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

docs: update transfer msg docs with ics20-2 fields #6504

Merged
merged 7 commits into from
Jun 5, 2024

Conversation

damiannolan
Copy link
Contributor

@damiannolan damiannolan commented Jun 5, 2024

Description

closes: #6389


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

  • Documentation
    • Deprecated the Token field in MsgTransfer and replaced it with Tokens, a slice of sdk.Coin. Updated validation rules and usage guidelines accordingly.
    • Updated attributes and values in various callbacks related to MsgTransfer events, affecting behavior and data associated with these events.

Copy link
Contributor

coderabbitai bot commented Jun 5, 2024

Walkthrough

The recent updates focus on modifying the MsgTransfer struct and associated event callbacks in the transfer module. The Token field is now deprecated and replaced with a Tokens slice, affecting validation rules and usage guidelines. Additionally, various attributes in the event callbacks have been updated, renamed, or removed to reflect these changes, enhancing the overall functionality and data handling associated with MsgTransfer events.

Changes

Files Change Summary
docs/docs/02-apps/01-transfer/04-messages.md Deprecated Token field in MsgTransfer struct and replaced with Tokens slice of sdk.Coin. Updated validation rules and usage guidelines.
docs/docs/02-apps/01-transfer/05-events.md Updated attributes in fungible_token_packet callbacks: renamed denom to voucherDenom, removed amount, changed success to ackSuccess, added error and acknowledgement attributes, and modified refund_receiver to refund_tokens.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant MsgTransfer
    participant EventCallbacks

    User->>MsgTransfer: Initiate Transfer with Tokens
    MsgTransfer->>EventCallbacks: Trigger OnRecvPacket
    EventCallbacks->>MsgTransfer: Process voucherDenom, ackSuccess, error
    MsgTransfer->>User: Acknowledge Transfer Completion
Loading
sequenceDiagram
    participant User
    participant MsgTransfer
    participant EventCallbacks

    User->>MsgTransfer: Initiate Transfer with Tokens
    MsgTransfer->>EventCallbacks: Trigger OnAcknowledgePacket
    EventCallbacks->>MsgTransfer: Process acknowledgement
    MsgTransfer->>User: Confirm Acknowledgement
Loading
sequenceDiagram
    participant User
    participant MsgTransfer
    participant EventCallbacks

    User->>MsgTransfer: Initiate Transfer with Tokens
    MsgTransfer->>EventCallbacks: Trigger OnTimeoutPacket
    EventCallbacks->>MsgTransfer: Process refund_tokens
    MsgTransfer->>User: Notify Timeout and Refund
Loading

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.

@damiannolan damiannolan marked this pull request as ready for review June 5, 2024 12:21
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: 2

Outside diff range and nitpick comments (2)
docs/docs/02-apps/01-transfer/04-messages.md (2)

18-18: Clarify the deprecation notice for better understanding.

Consider enhancing the deprecation notice for the Token field to explicitly state the version or date when it will be removed or become unsupported. This can help developers plan their transition to the new Tokens field more effectively.


Line range hint 48-48: Clarify the structure of the JSON object in the memo field.

It might be helpful to specify that the JSON object structure in the memo field can vary depending on the middleware used. This clarification can prevent confusion and ensure proper implementation:

- The memo field should be represented as a json object where different middlewares use different json keys.
+ The memo field should be represented as a JSON object. The structure of this object may vary depending on the middleware used, with different middlewares requiring different JSON keys.
Tools
LanguageTool

[style] ~33-~33: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym. (ENGLISH_WORD_REPEAT_BEGINNING_RULE)
Context: ...hs-identifiers-separators)). - Tokens is empty or a Coin contained within the ...


[uncategorized] ~40-~40: A comma may be missing after the conjunctive/linking adverb ‘Similarly’. (SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)
Context: ...nis used thenTokensmust be empty. Similarly ifTokensis used thenToken` should...

Markdownlint

34-34: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


35-35: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a5183be and 61c44bd.

Files selected for processing (1)
  • docs/docs/02-apps/01-transfer/04-messages.md (1 hunks)
Additional context used
Path-based instructions (1)
docs/docs/02-apps/01-transfer/04-messages.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

LanguageTool
docs/docs/02-apps/01-transfer/04-messages.md

[style] ~33-~33: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym. (ENGLISH_WORD_REPEAT_BEGINNING_RULE)
Context: ...hs-identifiers-separators)). - Tokens is empty or a Coin contained within the ...


[uncategorized] ~40-~40: A comma may be missing after the conjunctive/linking adverb ‘Similarly’. (SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)
Context: ...nis used thenTokensmust be empty. Similarly ifTokensis used thenToken` should...


[uncategorized] ~48-~48: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...o field should be represented as a json object where different middlewares use differe...

Markdownlint
docs/docs/02-apps/01-transfer/04-messages.md

34-34: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


35-35: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


8-8: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document

Additional comments not posted (1)
docs/docs/02-apps/01-transfer/04-messages.md (1)

25-25: Ensure the new Tokens field is correctly documented.

The addition of the Tokens field is well-documented. Make sure to update any related code examples or integration tests to reflect this change.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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)
docs/docs/02-apps/01-transfer/04-messages.md (1)

Line range hint 8-8: Address multiple top-level headings in the document.

The document should not have multiple top-level headings (#). This can cause issues with document structure and navigation:

- # Messages
+ ## Messages
Tools
LanguageTool

[uncategorized] ~41-~41: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...now use Tokens instead. If Token is used then Tokens must be empty. Similarly,...


[uncategorized] ~41-~41: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...ust be empty. Similarly, if Tokens is used then Token should be left empty. This...


[uncategorized] ~42-~42: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...nd a fungible token to the counterparty chain represented by the counterparty Channel...

Markdownlint

35-35: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


36-36: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 61c44bd and 450c7ee.

Files selected for processing (1)
  • docs/docs/02-apps/01-transfer/04-messages.md (1 hunks)
Additional context used
Path-based instructions (1)
docs/docs/02-apps/01-transfer/04-messages.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

LanguageTool
docs/docs/02-apps/01-transfer/04-messages.md

[uncategorized] ~41-~41: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...now use Tokens instead. If Token is used then Tokens must be empty. Similarly,...


[uncategorized] ~41-~41: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...ust be empty. Similarly, if Tokens is used then Token should be left empty. This...


[uncategorized] ~42-~42: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...nd a fungible token to the counterparty chain represented by the counterparty Channel...


[uncategorized] ~48-~48: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...o field should be represented as a json object where different middlewares use differe...

Markdownlint
docs/docs/02-apps/01-transfer/04-messages.md

35-35: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


36-36: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


8-8: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document

Additional comments not posted (1)
docs/docs/02-apps/01-transfer/04-messages.md (1)

18-18: Update the MsgTransfer struct to reflect the deprecation of Token and addition of Tokens.

The changes correctly reflect the deprecation of the Token field and the addition of the Tokens field as per the PR objectives. This update aligns with the ICS20-2 specifications.

Also applies to: 25-25

Comment on lines +35 to +36
- `Amount` must be positive.
- `Denom` must be a valid IBC denomination, as defined in [ADR 001 - Coin Source Tracing](/architecture/adr-001-coin-source-tracing).
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct indentation in markdown list.

The indentation for the list items under Tokens validation rules is inconsistent with markdown standards. Here's a corrected version:

-    - `Amount` must be positive.
-    - `Denom` must be a valid IBC denomination, as defined in [ADR 001 - Coin Source Tracing](/architecture/adr-001-coin-source-tracing).
+  - `Amount` must be positive.
+  - `Denom` must be a valid IBC denomination, as defined in [ADR 001 - Coin Source Tracing](/architecture/adr-001-coin-source-tracing).
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
- `Amount` must be positive.
- `Denom` must be a valid IBC denomination, as defined in [ADR 001 - Coin Source Tracing](/architecture/adr-001-coin-source-tracing).
- `Amount` must be positive.
- `Denom` must be a valid IBC denomination, as defined in [ADR 001 - Coin Source Tracing](/architecture/adr-001-coin-source-tracing).
Tools
Markdownlint

35-35: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation


36-36: Expected: 2; Actual: 4 (MD007, ul-indent)
Unordered list indentation

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: 1

Outside diff range and nitpick comments (1)
docs/docs/02-apps/01-transfer/05-events.md (1)

8-8: Address the issue of multiple top-level headings in the document.

Consider restructuring the document to have a single top-level heading or adjust the heading levels appropriately.

Tools
Markdownlint

8-8: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 450c7ee and 4521083.

Files selected for processing (1)
  • docs/docs/02-apps/01-transfer/05-events.md (2 hunks)
Additional context used
Path-based instructions (1)
docs/docs/02-apps/01-transfer/05-events.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

Markdownlint
docs/docs/02-apps/01-transfer/05-events.md

24-24: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


25-25: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


29-29: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


8-8: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document

Additional comments not posted (4)
docs/docs/02-apps/01-transfer/05-events.md (4)

16-16: Ensure the new tokens attribute is correctly documented and matches the updated MsgTransfer struct.


22-32: Review the updated attributes for the OnRecvPacket callback.

Tools
Markdownlint

24-24: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


25-25: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


29-29: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


36-44: Review the updated attributes for the OnAcknowledgePacket callback.


48-53: Review the updated attributes for the OnTimeoutPacket callback.

| denomination | denom | \{denom\} |
| Type | Attribute Key | Attribute Value |
|-----------------------|---------------|------------------|
| fungible_token_packet | sender | \{sender\} |
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove trailing spaces to adhere to Markdown best practices.

- | fungible_token_packet | sender        | \{sender\}       | 
+ | fungible_token_packet | sender        | \{sender\}       |
- | fungible_token_packet | receiver      | \{receiver\}     | 
+ | fungible_token_packet | receiver      | \{receiver\}     |
- | fungible_token_packet | memo          | \{memo\}         | 
+ | fungible_token_packet | memo          | \{memo\}         |

Also applies to: 25-25, 29-29

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
| fungible_token_packet | sender | \{sender\} |
| fungible_token_packet | sender | \{sender\} |
| fungible_token_packet | receiver | \{receiver\} |
| fungible_token_packet | memo | \{memo\} |
Tools
Markdownlint

24-24: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces

@@ -14,42 +13,41 @@ slug: /apps/transfer/events
|--------------|---------------|-----------------|
| ibc_transfer | sender | \{sender\} |
| ibc_transfer | receiver | \{receiver\} |
| message | action | transfer |
Copy link
Contributor

Choose a reason for hiding this comment

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

I updated fields like this that were not change now, but were incorrect from before. Should we update them for older versions as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes that would be great 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Created a separate issue for this: #6512

Copy link
Contributor

Choose a reason for hiding this comment

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

it also doesn't seem we document Denom events?

Copy link
Contributor

Choose a reason for hiding this comment

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

They are documented under OnRecvPacket, which is the only place we emit them, I believe

Copy link
Contributor

@DimitrisJim DimitrisJim Jun 5, 2024

Choose a reason for hiding this comment

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

ah, missed! should probs be updated too then, we emit the Denom as a json too #6467 (comment)

@damiannolan damiannolan enabled auto-merge (squash) June 5, 2024 14:19
@damiannolan damiannolan merged commit cf2a3de into main Jun 5, 2024
25 of 26 checks passed
@damiannolan damiannolan deleted the damian/docs-update-transfer-v2 branch June 5, 2024 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update transfer docs with support for multidenom
4 participants