-
Notifications
You must be signed in to change notification settings - Fork 63
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
Conversation
📝 WalkthroughWalkthroughThis pull request updates the Zetachain documentation by correcting textual inconsistencies and clarifying the behavior of the Changes
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
Suggested reviewers
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this 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 triggeringonAbort
and clearly defines theAbortContext
struct andAbortable
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 theRevertOptions
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 triggersonRevert
" 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
📒 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 ofabortAddress
Updating the description to state that tokens are transferred if reverting fails removes ambiguity about non-implementation and better communicates its intended behavior.
There was a problem hiding this 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 theabortAddress
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
📒 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 withZETANotSupported()
. 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 therevertOptions.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 ofmessage
andrevertOptions.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 viaonCall
reverts, tokens are transferred to theabortAddress
. This helps standardize expectations. Please confirm that this description accurately reflects the contract’s behavior.
187-190
: Review Revertable Interface Addition
The inclusion of theRevertable
interface—detailing how theonRevert
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 theAbortContext
struct andAbortable
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ACK
Summary by CodeRabbit
Documentation
New Features