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

onAbort #587

Merged
merged 3 commits into from
Mar 28, 2025
Merged

onAbort #587

merged 3 commits into from
Mar 28, 2025

Conversation

fadeev
Copy link
Member

@fadeev fadeev commented Mar 24, 2025

Summary by CodeRabbit

  • Documentation

    • Enhanced text consistency and clarity in the documentation.
    • Added a new section detailing the behavior of abort transactions, including how tokens are redirected when operations revert.
    • Clarified that withdrawing ZETA tokens is currently not supported.
    • Specified length restrictions for revert messages.
  • New Features

    • Introduced improved explanations for handling cross-chain call reversions, making the process more understandable for users.
    • Defined new structures and interfaces to support abort transaction handling.

@fadeev fadeev requested review from a team as code owners March 24, 2025 16:54
Copy link
Contributor

coderabbitai bot commented Mar 24, 2025

📝 Walkthrough

Walkthrough

This pull request updates the Zetachain documentation by correcting textual inconsistencies and clarifying the behavior of the abortAddress. It introduces a new "Abort Transactions" section that explains the process and conditions under which tokens are transferred upon transaction reversion. Additionally, the PR defines the AbortContext struct and the Abortable interface to standardize the handling of abort transactions during cross-chain calls.

Changes

File Summary of Changes
src/pages/developers/chains/zetachain.mdx • Corrected quotation mark consistency in multiple phrases.
• Revised abortAddress description to clarify token transfer behavior.
• Added "Abort Transactions" section explaining functionality for failed cross-chain calls, including new definitions for AbortContext and Abortable.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CrossChainModule
    participant AbortableContract

    User->>CrossChainModule: Initiate cross-chain transaction
    CrossChainModule->>AbortableContract: Execute transaction
    note right of AbortableContract: Transaction may revert
    AbortableContract-->>CrossChainModule: Return error (reversion)
    CrossChainModule->>AbortableContract: Call onAbort(AbortContext)
    AbortableContract-->>CrossChainModule: Process abort, transfer tokens to abortAddress
Loading

Suggested reviewers

  • GMaiolo
  • hernan-clich

🪧 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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

Copy link

vercel bot commented Mar 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview Mar 24, 2025 5:17pm

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

🧹 Nitpick comments (1)
src/pages/developers/chains/zetachain.mdx (1)

190-230: Well-Structured "Abort Transactions" Section with Minor Refinements
The newly added "Abort Transactions" section effectively details the scenarios triggering onAbort and clearly defines the AbortContext struct and Abortable interface. A few minor suggestions to further polish the text:

  • Punctuation: In line 192, consider adding a comma after "ZetaChain" for clarity, e.g., "The abortAddress field in the RevertOptions struct specifies the address on ZetaChain, which is called in two scenarios:".
  • Terminology: In line 200, if referring to countable tokens, consider using "number of tokens" instead of "amount of tokens" to enhance precision.
  • Verb Tense: In line 209, revising "which called onRevert" to "which triggers onRevert" helps maintain consistent verb tense.
    These adjustments are optional nitpicks aimed at further enhancing clarity and consistency.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~192-~192: Possible missing comma found.
Context: ...ptions` struct specifies the address on ZetaChain which is called in two scenarios: ``` ...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~200-~200: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...in (incoming call) is reverted, but the amount of tokens supplied with the call is not...

(AMOUNTOF_TO_NUMBEROF)


[uncategorized] ~209-~209: This verb may not be in the correct tense. Consider changing the tense to fit the context better.
Context: ...g call) is reverted, a cross-chain call was made from connected chain to ZetaChain,...

(AI_EN_LECTOR_REPLACEMENT_VERB_TENSE)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7a0c695 and 2a14ceb.

📒 Files selected for processing (1)
  • src/pages/developers/chains/zetachain.mdx (7 hunks)
🧰 Additional context used
🪛 LanguageTool
src/pages/developers/chains/zetachain.mdx

[formatting] ~164-~164: If the ‘because’ clause is essential to the meaning, do not use a comma before the clause.
Context: ...in to ZetaChain does not support reverts, because there are no assets to cover the revert...

(COMMA_BEFORE_BECAUSE)


[uncategorized] ~192-~192: Possible missing comma found.
Context: ...ptions` struct specifies the address on ZetaChain which is called in two scenarios: ``` ...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~200-~200: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...in (incoming call) is reverted, but the amount of tokens supplied with the call is not...

(AMOUNTOF_TO_NUMBEROF)


[uncategorized] ~209-~209: This verb may not be in the correct tense. Consider changing the tense to fit the context better.
Context: ...g call) is reverted, a cross-chain call was made from connected chain to ZetaChain,...

(AI_EN_LECTOR_REPLACEMENT_VERB_TENSE)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (3)
src/pages/developers/chains/zetachain.mdx (3)

34-34: Consistent Apostrophe Usage in Destination Chain Note
The updated text now uses a standard straight apostrophe (“You don't need to specify…”) which improves consistency and readability.


85-85: Improved Clarity in Swap Scenario Description
The change from “the caller’s identity is unnecessary” to “the caller's identity is unnecessary” ensures uniform punctuation throughout the document.


145-146: Clarified Functionality of abortAddress
Updating the description to state that tokens are transferred if reverting fails removes ambiguity about non-implementation and better communicates its intended behavior.

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

🧹 Nitpick comments (5)
src/pages/developers/chains/zetachain.mdx (5)

38-41: Enhance Clarity on Destination Chain Specification
The revised text clearly explains that specifying a destination chain is unnecessary because each ZRC-20 token is tied to its originating chain. This improves overall clarity. You might consider adding a brief note on how token conversion (e.g., swapping from USDC.ETH to USDC.BNB) is managed in practice.


88-92: Clarify Caller Identity Handling in Arbitrary Calls
The update explicitly mentions that in arbitrary calls (e.g., token swaps), retaining the caller's identity is unnecessary. This additional context enhances user understanding. Also, consider a minor punctuation review per static analysis suggestions to ensure optimal readability.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~89-~89: Loose punctuation mark.
Context: ...saction reverts. - isArbitraryCall: Determines whether the call is "arbitra...

(UNLIKELY_OPENING_PUNCTUATION)


107-108: Detail on ABI-Encoded Arguments
The explanation for ABI-encoded arguments now clearly states that the remaining bytes (after the function selector) follow Ethereum’s encoding rules. For added clarity, consider linking to the Ethereum ABI specification for users seeking further details.


151-152: Clarify Abort Behavior on Revert Failure
The updated text specifies that the abortAddress is used to transfer tokens if reverting fails. This addition improves the understanding of fallback mechanisms. It may be useful to provide an example scenario for further clarity.


202-222: Address Static Analysis Suggestions on Language and Punctuation
Static analysis tools have raised several minor suggestions:

  • Around line 202, consider inserting a comma after "ZetaChain" to improve readability in the phrase describing the scenarios for the abort address call.
  • At line 210, consider using “number of tokens” instead of “amount of tokens” when referring to token quantities.
  • At line 219, review the verb tense (e.g., consider "is made" instead of "was made") for consistency in the narrative.
  • At line 222, inserting a comma before "if this address is a contract" may enhance clarity.

These are minor nitpicks aimed at refining the documentation’s language for production-grade clarity.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~202-~202: Possible missing comma found.
Context: ...ptions` struct specifies the address on ZetaChain which is called in two scenarios: ``` ...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~210-~210: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...in (incoming call) is reverted, but the amount of tokens supplied with the call is not...

(AMOUNTOF_TO_NUMBEROF)


[uncategorized] ~219-~219: This verb may not be in the correct tense. Consider changing the tense to fit the context better.
Context: ...g call) is reverted, a cross-chain call was made from connected chain to ZetaChain,...

(AI_EN_LECTOR_REPLACEMENT_VERB_TENSE)


[uncategorized] ~222-~222: Possible missing comma found.
Context: ... on ZetaChain, and if this address is a contract it is called. Contracts implementing t...

(AI_HYDRA_LEO_MISSING_COMMA)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2a14ceb and e64d36e.

📒 Files selected for processing (1)
  • src/pages/developers/chains/zetachain.mdx (10 hunks)
🧰 Additional context used
🪛 LanguageTool
src/pages/developers/chains/zetachain.mdx

[formatting] ~174-~174: If the ‘because’ clause is essential to the meaning, do not use a comma before the clause.
Context: ...in to ZetaChain does not support reverts, because there are no assets to cover the revert...

(COMMA_BEFORE_BECAUSE)


[uncategorized] ~202-~202: Possible missing comma found.
Context: ...ptions` struct specifies the address on ZetaChain which is called in two scenarios: ``` ...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~210-~210: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...in (incoming call) is reverted, but the amount of tokens supplied with the call is not...

(AMOUNTOF_TO_NUMBEROF)


[uncategorized] ~219-~219: This verb may not be in the correct tense. Consider changing the tense to fit the context better.
Context: ...g call) is reverted, a cross-chain call was made from connected chain to ZetaChain,...

(AI_EN_LECTOR_REPLACEMENT_VERB_TENSE)


[uncategorized] ~222-~222: Possible missing comma found.
Context: ... on ZetaChain, and if this address is a contract it is called. Contracts implementing t...

(AI_HYDRA_LEO_MISSING_COMMA)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (6)
src/pages/developers/chains/zetachain.mdx (6)

10-11: Clarify ZETA Token Withdrawal Behavior
The added note now explicitly states that withdrawing ZETA tokens is not supported and will revert with ZETANotSupported(). This is clear and concise; please ensure that the actual contract behavior aligns with this documentation.


36-37: Document Message Length Constraint
The documentation now specifies that the revertOptions.revertMessage must not exceed 1024 bytes. This clear constraint helps users avoid issues when composing messages. Please verify that the contract enforces this limit consistently.


68-69: Enforce Combined Length Limitation
The documentation now notes that the combined length of message and revertOptions.revertMessage must not exceed 1024 bytes. This is important to prevent runtime issues. Please ensure that any corresponding validation logic in the contract reflects this limit.


175-176: Clarify Abort Address Functionality on onCall Reversion
The added description clearly delineates that if a call from a connected chain to ZetaChain via onCall reverts, tokens are transferred to the abortAddress. This helps standardize expectations. Please confirm that this description accurately reflects the contract’s behavior.


187-190: Review Revertable Interface Addition
The inclusion of the Revertable interface—detailing how the onRevert function should be implemented—provides a useful specification for developers. Ensure that related contracts consistently adhere to this interface.


200-240: Comprehensive Addition of Abort Transactions Section
The new "Abort Transactions" section thoroughly explains the scenarios triggering an abort, details the flow of token transfers, and introduces the AbortContext struct and Abortable interface. This is a valuable enhancement to the documentation. Verify that the terminology (e.g., "incoming call", "outgoing call") remains consistent across all documentation and that these definitions align with the underlying contract implementations.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~202-~202: Possible missing comma found.
Context: ...ptions` struct specifies the address on ZetaChain which is called in two scenarios: ``` ...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~210-~210: ‘Amount of’ should usually only be used with uncountable or mass nouns. Consider using “number” if this is not the case.
Context: ...in (incoming call) is reverted, but the amount of tokens supplied with the call is not...

(AMOUNTOF_TO_NUMBEROF)


[uncategorized] ~219-~219: This verb may not be in the correct tense. Consider changing the tense to fit the context better.
Context: ...g call) is reverted, a cross-chain call was made from connected chain to ZetaChain,...

(AI_EN_LECTOR_REPLACEMENT_VERB_TENSE)


[uncategorized] ~222-~222: Possible missing comma found.
Context: ... on ZetaChain, and if this address is a contract it is called. Contracts implementing t...

(AI_HYDRA_LEO_MISSING_COMMA)

@fadeev fadeev linked an issue Mar 24, 2025 that may be closed by this pull request
Copy link
Member

@hernan-clich hernan-clich left a comment

Choose a reason for hiding this comment

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

Tested ACK

@fadeev fadeev merged commit a157dbd into main Mar 28, 2025
6 checks passed
@fadeev fadeev deleted the on-abort branch March 28, 2025 07:39
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.

Docs for onAbort
2 participants