-
Notifications
You must be signed in to change notification settings - Fork 62
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
Detailed description of revert handling #527
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
📝 WalkthroughWalkthroughThe pull request introduces documentation updates for the ZetaChain gateway, focusing on clarifying the technical details of cross-chain interactions. The modifications provide more precise explanations of function parameters, struct fields, and interface behaviors related to withdrawal, contract calls, and error handling mechanisms. The changes aim to enhance the documentation's clarity by offering more explicit descriptions of how cross-chain transactions and revert processes work within the ZetaChain ecosystem. Changes
Sequence DiagramsequenceDiagram
participant Sender
participant ZetaChain Gateway
participant Target Chain
Sender->>ZetaChain Gateway: Initiate Cross-Chain Transaction
alt Arbitrary Call
Sender-->>ZetaChain Gateway: Encode Function Selector + Arguments
else Authenticated Call
Sender-->>ZetaChain Gateway: Encode Arguments Only
end
ZetaChain Gateway->>Target Chain: Execute Transaction
alt Transaction Fails
Target Chain-->>ZetaChain Gateway: Revert Triggered
ZetaChain Gateway->>Sender: Handle Revert Based on RevertOptions
end
The sequence diagram illustrates the high-level flow of a cross-chain transaction through the ZetaChain gateway, highlighting the different call types and potential revert scenarios described in the updated documentation. Finishing Touches
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? 🪧 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 (
|
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: 1
🧹 Nitpick comments (4)
src/pages/developers/chains/zetachain.mdx (4)
113-115
: Enhance authenticated calls documentation with an exampleThe explanation of authenticated calls would benefit from a concrete example showing the ABI-encoded arguments format, similar to the arbitrary calls section.
Consider adding an example like:
For authenticated calls the `message` is just ABI-encoded arguments (no function selector in the beginning, because authenticated calls are routed to a specific `onCall` function). + +For example, to encode two parameters (address and uint256): +``` +0000000000000000000000001234567890123456789012345678901234567890 +0000000000000000000000000000000000000000000000000000000000000064 +``` + +This represents: +- An address parameter: `0x1234567890123456789012345678901234567890` +- A uint256 parameter: `100` (hex: 64)🧰 Tools
🪛 LanguageTool
[uncategorized] ~113-~113: Possible missing comma found.
Context: ...imal (616c696365
). For authenticated calls themessage
is just ABI-encoded argum...(AI_HYDRA_LEO_MISSING_COMMA)
[formatting] ~114-~114: If the ‘because’ clause is essential to the meaning, do not use a comma before the clause.
Context: ...s (no function selector in the beginning, because authenticated calls are routed to a spe...(COMMA_BEFORE_BECAUSE)
153-161
: Add examples for gas fee calculationsThe explanation of gas fee handling would be clearer with concrete examples showing how the protocol calculates and deducts gas fees from the deposit amount.
Consider adding an example:
For CCTXS from a connected chain to ZetaChain, however, gas fees for revert execution are deducted from the deposit amount. If a CCTX reverts, the protocol will swap a fraction of the deposit amount into ZRC-20 gas tokens of the chain on which the revert is to be executed. If the deposit amount is insufficient, the CCTX will abort and `onRevert` will not be called. + +For example: +- Initial deposit: 100 USDC +- Gas required for revert: equivalent to 5 USDC +- Final revert amount: 95 USDC🧰 Tools
🪛 LanguageTool
[style] ~154-~154: Consider using just “returned”.
Context: ... amount that has been withdrawn will be returned back asrevertContext.amount
in ZRC-20 tok...(RETURN_BACK)
182-187
: Add cross-references to related sectionsThe explanation of the
asset
field would be more helpful with cross-references to related sections about deposits and withdrawals.Consider adding links:
On a connected chain `asset` is an address of an ERC-20 deposited using Gateway's `deposit` or `depositAndCall`. If a gas token was deposited, the `asset` is a zero address. +See the [Deposit Tokens](#deposit-tokens) section for more details. On ZetaChain `asset` is an address of a ZRC-20 withdrawn using Gateway's `withdraw` or `withdrawAndCall`. +See the [Withdraw ZRC-20 Tokens](#withdraw-zrc-20-tokens) section for more details.🧰 Tools
🪛 LanguageTool
[uncategorized] ~182-~182: Possible missing comma found.
Context: ...ontext) external; } ``` On a connected chainasset
is an address of an ERC-20 depo...(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~186-~186: Possible missing comma found.
Context: ...ted, theasset
is a zero address. On ZetaChainasset
is an address of a ZRC-20 withd...(AI_HYDRA_LEO_MISSING_COMMA)
134-134
: Fix grammatical issuesThere are a few grammatical issues to address:
- Line 134: Duplicate "the" in "transferred the the"
- Line 154: Redundant "back" in "returned back"
Apply these corrections:
-tokens will be transferred the the `msg.sender` +tokens will be transferred to the `msg.sender` -will be returned back as +will be returned asAlso applies to: 154-154
🧰 Tools
🪛 LanguageTool
[uncategorized] ~134-~134: “the” seems less likely than “to”.
Context: ...ecified, the tokens will be transferred the themsg.sender
that initiated the Gat...(AI_HYDRA_LEO_CP_THE_TO)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/pages/developers/chains/zetachain.mdx
(4 hunks)
🧰 Additional context used
🪛 LanguageTool
src/pages/developers/chains/zetachain.mdx
[uncategorized] ~113-~113: Possible missing comma found.
Context: ...imal (616c696365
). For authenticated calls the message
is just ABI-encoded argum...
(AI_HYDRA_LEO_MISSING_COMMA)
[formatting] ~114-~114: If the ‘because’ clause is essential to the meaning, do not use a comma before the clause.
Context: ...s (no function selector in the beginning, because authenticated calls are routed to a spe...
(COMMA_BEFORE_BECAUSE)
[uncategorized] ~134-~134: “the” seems less likely than “to”.
Context: ...ecified, the tokens will be transferred the the msg.sender
that initiated the Gat...
(AI_HYDRA_LEO_CP_THE_TO)
[style] ~154-~154: Consider using just “returned”.
Context: ... amount that has been withdrawn will be returned back as revertContext.amount
in ZRC-20 tok...
(RETURN_BACK)
[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] ~182-~182: Possible missing comma found.
Context: ...ontext) external; } ``` On a connected chain asset
is an address of an ERC-20 depo...
(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~186-~186: Possible missing comma found.
Context: ...ted, the asset
is a zero address. On ZetaChain asset
is an address of a ZRC-20 withd...
(AI_HYDRA_LEO_MISSING_COMMA)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
Summary by CodeRabbit
RevertOptions
,CallOptions
, andRevertable
interface