Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use typed Trace #6432

Merged
merged 12 commits into from
May 30, 2024
Merged

refactor: use typed Trace #6432

merged 12 commits into from
May 30, 2024

Conversation

colin-axner
Copy link
Contributor

@colin-axner colin-axner commented May 30, 2024

Description

closes: #6362


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against the correct branch (see CONTRIBUTING.md).
  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/).
  • Added relevant godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

Summary by CodeRabbit

  • Bug Fixes

    • Improved error messages for trace validation to provide clearer guidance.
  • Refactor

    • Updated internal data structures for denomination tracing to enhance consistency and reliability.
  • New Features

    • Added new test cases to cover a wider range of scenarios for token and packet validation.
  • Documentation

    • Adjusted deprecated options formatting in the Query service for better readability.

@@ -27,9 +27,18 @@ func TestFungibleTokenPacketDataValidateBasic(t *testing.T) {
expPass bool
}{
{"valid packet", types.NewFungibleTokenPacketData(denom, amount, sender, receiver, ""), true},
{"valid packet, base denom with leading slash", types.NewFungibleTokenPacketData("transfer/channel-1/uatom/", amount, sender, receiver, ""), true},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pulled from TestValidatePrefixedDenom

Copy link
Contributor

coderabbitai bot commented May 30, 2024

Warning

Rate limit exceeded

@colin-axner has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 28 minutes and 44 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between ac1d484 and 361b352.

Walkthrough

The changes across multiple files in the IBC transfer module involve replacing string slices with typed Trace structs for representing denomination trace information. This refactor aims to simplify the code by reducing string parsing and enhancing type safety. The updates include modifications to test cases, struct initializations, validation methods, and function implementations to accommodate the new Trace type.

Changes

Files Change Summary
.../ibc_middleware_test.go, .../ibc_module_test.go, .../convert_test.go, .../genesis_test.go, .../grpc_query_test.go, .../mbt_relay_test.go, .../relay_test.go, .../transfer_test.go Updated the Denom struct initialization to use types.Trace instead of string slices for the Trace field.
.../relay.go Modified telemetry labels and the creation of trace in the OnRecvPacket function to use token.Denom.FullPath() and types.NewTrace(packet.DestinationPort, packet.DestinationChannel).
.../denom.go, .../denom_test.go Refactored Validate method in Denom struct to iterate over d.Trace elements and validate each. Updated tests to use types.Trace for denomination tracing.
.../packet.go, .../packet_test.go Updated ValidateBasic method in FungibleTokenPacketData to extract denom from full path before validation. Added new test cases for various scenarios related to base denominations and trace identifiers.
.../token.go, .../token_test.go Updated Validate function in Token struct to validate token amount instead of denomination. Modified tests to use Trace struct for tracing denominations.
.../trace.go Added NewTrace, Validate, and String methods for the Trace type. Modified ParseDenomTrace and ExtractDenomFromFullPath to handle Trace slices. Removed ValidatePrefixedDenom function.
proto/ibc/applications/transfer/v1/query.proto Updated the formatting of the deprecated option in the Query service for DenomTraces and DenomTrace RPCs.
proto/ibc/applications/transfer/v2/token.proto Changed Denom message to use a Trace message with modifications to fields and options related to Trace.

Assessment against linked issues

Objective (Issue #) Addressed Explanation
Use typed Trace in ics20 v2 Token type (#6362)
Migrate internal storage of trace string to array (#6221)

Possibly related issues


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Comment on lines +61 to +65
path := ""
if !denom.IsNative() {
path = denom.FullPath()
path = strings.TrimSuffix(path, "/"+denom.Base)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick hack, function will be removed in next pr

@colin-axner colin-axner marked this pull request as ready for review May 30, 2024 10:33
@colin-axner colin-axner added the priority PRs that need prompt reviews label May 30, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Outside diff range and nitpick comments (1)
modules/apps/transfer/types/token_test.go (1)

Line range hint 19-19: The variables sender and receiver are declared but not used in any test cases. Consider removing these if they are not planned to be used, to clean up the code.

- var sender = sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()).String()
- var receiver = sdk.AccAddress("testaddr2").String()

Also applies to: 20-20

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2a555af and ac1d484.

Files ignored due to path filters (2)
  • modules/apps/transfer/types/query.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • modules/apps/transfer/types/token.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
Files selected for processing (19)
  • modules/apps/callbacks/ibc_middleware_test.go (4 hunks)
  • modules/apps/transfer/ibc_module_test.go (3 hunks)
  • modules/apps/transfer/internal/convert/convert_test.go (6 hunks)
  • modules/apps/transfer/keeper/genesis_test.go (1 hunks)
  • modules/apps/transfer/keeper/grpc_query_test.go (7 hunks)
  • modules/apps/transfer/keeper/mbt_relay_test.go (1 hunks)
  • modules/apps/transfer/keeper/relay.go (2 hunks)
  • modules/apps/transfer/keeper/relay_test.go (5 hunks)
  • modules/apps/transfer/transfer_test.go (3 hunks)
  • modules/apps/transfer/types/denom.go (3 hunks)
  • modules/apps/transfer/types/denom_test.go (2 hunks)
  • modules/apps/transfer/types/packet.go (1 hunks)
  • modules/apps/transfer/types/packet_test.go (22 hunks)
  • modules/apps/transfer/types/token.go (2 hunks)
  • modules/apps/transfer/types/token_test.go (11 hunks)
  • modules/apps/transfer/types/trace.go (5 hunks)
  • modules/apps/transfer/types/trace_test.go (1 hunks)
  • proto/ibc/applications/transfer/v1/query.proto (1 hunks)
  • proto/ibc/applications/transfer/v2/token.proto (1 hunks)
Files skipped from review due to trivial changes (2)
  • modules/apps/transfer/types/trace_test.go
  • proto/ibc/applications/transfer/v1/query.proto
Additional context used
Path-based instructions (16)
modules/apps/transfer/types/token.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

modules/apps/transfer/keeper/genesis_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

modules/apps/transfer/types/denom_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

modules/apps/transfer/types/denom.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

modules/apps/transfer/internal/convert/convert_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

modules/apps/transfer/types/token_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

modules/apps/transfer/types/packet.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

modules/apps/transfer/transfer_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

modules/apps/transfer/types/trace.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

modules/apps/transfer/keeper/grpc_query_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

modules/apps/transfer/keeper/mbt_relay_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

modules/apps/transfer/keeper/relay.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

modules/apps/transfer/types/packet_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

modules/apps/transfer/ibc_module_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

modules/apps/callbacks/ibc_middleware_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

modules/apps/transfer/keeper/relay_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

GitHub Check: lint
modules/apps/transfer/types/token_test.go

[failure] 19-19:
var sender is unused (unused)


[failure] 20-20:
var receiver is unused (unused)

Additional comments not posted (31)
proto/ibc/applications/transfer/v2/token.proto (2)

22-22: The use of gogoproto.nullable = false ensures that the trace field in the Denom message will not be nullable, which is a good practice for ensuring data integrity and avoiding null checks in the code.


29-31: The option (gogoproto.goproto_stringer) = false; disables the automatic generation of the String() method for the Trace message. Ensure that this is intentional and that a custom String() method is implemented if needed.

Verification successful

The custom String() method for the Trace struct is indeed implemented in the modules/apps/transfer/types/trace.go file.

  • modules/apps/transfer/types/trace.go: func (t Trace) String() string {
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify if a custom String() method is implemented for the Trace struct.

# Test: Search for the String method implementation for Trace. Expect: At least one occurrence.
rg --type go 'func \(t Trace\) String\(\) string' modules/apps/transfer/types

Length of output: 149

modules/apps/transfer/types/token.go (2)

10-10: The Validate method now includes validation for both the token denomination and amount. This is a good practice as it ensures that both aspects of a token are correct before proceeding with operations that involve the token.


12-12: The error wrapping provides more context on the failure, which is helpful for debugging. However, ensure that the error messages are clear and provide enough information to understand the issue without ambiguity.

Also applies to: 13-13

Verification successful

The error messages in the modules/apps/transfer directory are consistently clear and provide sufficient context about the issues. They include specific details that help in understanding the nature of the errors, such as invalid addresses, invalid coins, and other specific conditions.

  • modules/apps/transfer/types/msgs.go: Error messages specify issues like invalid addresses, invalid coins, and other specific conditions.
  • modules/apps/transfer/types/trace.go: Error messages include details about invalid port IDs, channel IDs, and denomination formats.
  • modules/apps/transfer/types/token.go: Error messages specify issues with token denominations and transfer amounts.
  • modules/apps/transfer/types/packet.go: Error messages detail issues with addresses, amounts, and memo lengths.
  • modules/apps/transfer/types/denom.go: Error messages specify issues with base denominations and trace validations.
  • modules/apps/transfer/types/transfer_authorization.go: Error messages include details about type mismatches, insufficient funds, and invalid authorizations.
  • modules/apps/transfer/ibc_module.go: Error messages specify issues with channel sequences, port IDs, and version mismatches.
  • modules/apps/transfer/keeper/relay.go: Error messages detail issues with channel capabilities, receiver addresses, and token amounts.
  • modules/apps/transfer/keeper/msg_server.go: Error messages specify issues with application versions, multiple coin transfers, and unauthorized actions.
  • modules/apps/transfer/internal/convert/convert.go: Error messages include details about invalid packet data.

The error messages are clear and provide enough information to understand the issues without ambiguity.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Check for consistency in error message clarity throughout the project.

# Test: Search for error wrapping patterns and review their clarity. Expect: Consistently clear error messages.
rg --type go 'errorsmod.Wrap' modules/apps/transfer

Length of output: 12506

modules/apps/transfer/keeper/genesis_test.go (2)

14-15: The getTrace function is a good utility for generating trace objects in tests. It uses dynamic data for the channel, which can help in testing various scenarios effectively.


22-29: The test setup using a slice of types.Trace is comprehensive and covers multiple scenarios. This is crucial for ensuring that the system behaves correctly under different conditions.

modules/apps/transfer/types/denom_test.go (2)

23-23: The tests for Denoms.Validate are well-structured and cover various scenarios including valid traces, duplicated denominations, and empty base denominations. This thorough testing is essential for maintaining robustness in the validation logic.

Also applies to: 30-31, 37-37


84-84: The FullPath method tests are comprehensive, covering scenarios from no hops to multiple hops with complex base denominations. This ensures that the method behaves correctly across a wide range of inputs.

Also applies to: 92-92, 100-100, 108-108

modules/apps/transfer/types/denom.go (3)

19-19: The Validate method in the Denom struct now includes trace validation, which is a critical addition for ensuring the integrity of the trace data. The use of error wrapping here adds clarity to the error messages, which is beneficial for troubleshooting.

Also applies to: 22-24


59-60: The FullPath method concatenates trace elements and the base denomination to form the full path. This method is crucial for generating the correct denomination string in a multi-chain environment.


74-74: The logic in SenderChainIsSource and ReceiverChainIsSource methods is crucial for determining the origin of the token in IBC transfers. This logic is sensitive and must be thoroughly tested to prevent issues in token tracking across chains.

Also applies to: 81-88

modules/apps/transfer/internal/convert/convert_test.go (1)

32-35: The conversion tests from FungibleTokenPacketData V1 to V2 are comprehensive, covering various scenarios including different trace lengths and base denominations with special characters. This ensures that the conversion logic handles all edge cases correctly.

Also applies to: 64-67, 81-84, 98-102, 116-121, 135-140

modules/apps/transfer/types/token_test.go (3)

33-37: The use of NewTrace in test cases is consistent with the PR's objective to use typed Trace instead of strings. This should enhance type safety and reduce errors related to string manipulation.

Also applies to: 47-50, 60-65, 83-87, 97-101, 111-115, 125-129, 140-140


133-133: The error messages in the test cases are well-formed and descriptive, providing clear feedback on the nature of the error, which is good for debugging and maintenance.

Also applies to: 144-144


Line range hint 178-198: The TestTokens_String method correctly tests the string representation of tokens with and without trace information. This ensures that the serialization of token data is consistent with expectations, which is crucial for interoperability and debugging.

Also applies to: 205-253

modules/apps/transfer/types/packet.go (1)

52-53: The refactoring to use ExtractDenomFromFullPath and validate the Denom in ValidateBasic aligns with the PR's goal to minimize string parsing by using typed Trace. This should improve the efficiency and maintainability of the code.

modules/apps/transfer/transfer_test.go (1)

73-76: The tests correctly use the new Trace type for creating Denom instances, which is consistent with the changes made in the PR. This ensures that the new functionality is covered by tests, which is crucial for maintaining robustness.

Also applies to: 101-101

modules/apps/transfer/types/trace.go (3)

20-47: The implementation of NewTrace, Validate, and String methods for the Trace type is well-done. These methods provide clear and concise functionality that enhances the readability and maintainability of the code.


61-67: The ParseDenomTrace function has been modified to work with the new Trace type instead of strings. This change is in line with the PR's objectives and should help in reducing the complexity and potential errors associated with string parsing.


Line range hint 116-132: The ExtractDenomFromFullPath function's logic to handle the extraction of Denom from a full path is sound. It correctly handles various cases and appends new Trace instances as needed, which is crucial for maintaining the integrity of token tracing.

modules/apps/transfer/keeper/grpc_query_test.go (1)

30-34: The test cases in grpc_query_test.go effectively cover the functionality related to querying denoms with the new Trace type. This ensures that the query handlers are correctly interpreting and handling the new data structure.

Also applies to: 47-51, 74-78, 131-132, 179-183

modules/apps/transfer/keeper/relay.go (2)

144-144: LGTM! The telemetry label now correctly uses the FullPath method from the Denom struct, which is consistent with the new Trace implementation.


242-242: The addition of Trace to the token's denomination when the sender chain is the source is correctly implemented. This aligns with the PR's objectives to use typed Trace for better clarity and less error-prone code.

modules/apps/transfer/types/packet_test.go (2)

30-41: The updated test cases correctly reflect the new Trace type usage in FungibleTokenPacketData. These tests ensure that the packet data validation logic handles the new structure properly.


Line range hint 188-378: The test cases for FungibleTokenPacketDataV2 are well-formed and cover a wide range of scenarios, including valid and invalid traces, amounts, and memo fields. This thorough testing is crucial for ensuring the robustness of the IBC token transfer functionality.

modules/apps/transfer/ibc_module_test.go (1)

559-562: Refactor to use typed Trace in token denomination.

The change from a string slice to a typed Trace slice for the Trace field in the Denom struct aligns with the PR's objective to minimize string parsing and improve maintainability. This is a positive change that enhances type safety and clarity in the codebase.

modules/apps/callbacks/ibc_middleware_test.go (4)

172-172: Update to use typed Trace instead of string slice for better type safety and reduced string parsing.


316-316: Conversion to typed Trace in token denomination enhances clarity and type safety.


651-651: The use of typed Trace in packet data aligns with the PR's goal to minimize string parsing.


785-785: Continued use of typed Trace in the WriteAcknowledgement function supports the overall refactor goal.

modules/apps/transfer/keeper/relay_test.go (1)

59-62: Refactor to use typed Trace in test cases.

The changes correctly implement the use of the typed Trace struct instead of strings for trace information in the Denom struct across various test cases. This aligns with the PR's objective to minimize string parsing and improve maintainability.

Also applies to: 73-76, 109-112, 122-125, 385-385

@@ -341,8 +341,7 @@ func (suite *KeeperTestSuite) TestModelBasedRelay() {
panic(errors.New("MBT failed to convert sender address"))
}
registerDenomFn()
denomTrace := types.ParseDenomTrace(tc.packet.Data.Tokens[0].GetFullDenomPath())
denom := denomTrace.IBCDenom()
denom := tc.packet.Data.Tokens[0].Denom.IBCDenom()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor to use the new Trace type in the Denom field.

The change at line 344 where denom := tc.packet.Data.Tokens[0].Denom.IBCDenom() is used, correctly reflects the transition from using strings to using the Trace type for denomination tracing. This is in line with the PR's objective to minimize string parsing by using a typed Trace. Ensure that all related functions and methods that interact with this line are updated to handle the Trace type effectively.

modules/apps/transfer/ibc_module_test.go Outdated Show resolved Hide resolved
modules/apps/transfer/ibc_module_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@chatton chatton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending the linter fixes, had one suggestions but nothing major, nice clean refactor!

Comment on lines 41 to 47
func (t Trace) String() string {
var sb strings.Builder
sb.WriteString(t.PortId) // nolint:revive // no error returned by WriteString
sb.WriteByte('/') //nolint:revive // no error returned by WriteByte
sb.WriteString(t.ChannelId) // nolint:revive
return sb.String()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when there's no logic involved, should we just do a direct return fmt.Sprintf("%s/%s", t.PortId, t.ChannelId)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that sounds good to me 👍

@@ -605,7 +605,7 @@ func (suite *TransferTestSuite) TestPacketDataUnmarshalerInterface() {
{
Denom: types.Denom{
Base: ibctesting.TestCoin.Denom,
Trace: []types.Trace{types.Trace{}},
Trace: []types.Trace{{}},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this to be an odd linting standard

Copy link
Contributor

@DimitrisJim DimitrisJim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link

sonarcloud bot commented May 30, 2024

Quality Gate Passed Quality Gate passed for 'ibc-go'

Issues
11 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@colin-axner colin-axner merged commit 0beaba6 into main May 30, 2024
75 of 76 checks passed
@colin-axner colin-axner deleted the colin/6362-typed-trace branch May 30, 2024 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority PRs that need prompt reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use typed Trace in ics20 v2 Token type
4 participants