zeta-chain / node

ZetaChain’s blockchain node and an observer validator client
https://zetachain.com
MIT License
167 stars 109 forks source link

fix: out of gas on ZetaClient during `onRevert` #3144

Closed lumtis closed 1 week ago

lumtis commented 1 week ago

Description

Use 7M gas instead of 4M when processing a revert outbound.

To test the change, the onRevert hook on ZetaChain testDApp consume 300k more gas

To check the change is effective: Revert back this line: https://github.com/zeta-chain/node/pull/3144/files#diff-503de1565f57cda7a6a71c86db258cf0b5eb1a346eb009991b2f2ea1d30df70eR50 The v2EthWithdrawAndRevertTest will fail because of the current issue (outbound not observed)

Summary by CodeRabbit

coderabbitai[bot] commented 1 week ago
📝 Walkthrough ## Walkthrough The changes in this pull request primarily involve modifications to the deployment logic of the `TestDAppV2` contract across multiple files. Key updates include the addition of a boolean parameter to the `DeployTestDAppV2` function, which influences the deployment behavior regarding the ZetaChain context. New checks and constructors have been introduced to ascertain the contract's status on the ZetaChain. Additionally, the gas limit for outbound revert operations has been increased, reflecting the need for higher gas consumption during contract interactions. ## Changes | File Path | Change Summary | |---------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------| | e2e/e2etests/test_deploy_contract.go | Updated `deployZEVMTestDApp` and `deployEVMTestDApp` functions to include a boolean parameter in the call to `DeployTestDAppV2`. | | e2e/runner/v2_setup_evm.go | Modified `SetupEVMV2` function to add a boolean parameter for `DeployTestDAppV2` and implemented a check for ZetaChain status using `IsZetaChain`. | | e2e/runner/v2_setup_zeta.go | Updated `SetZEVMContractsV2` method to include a boolean parameter for `DeployTestDAppV2` and added a check for ZetaChain status. | | pkg/contracts/testdappv2/TestDAppV2.abi | Added a new constructor and function `isZetaChain` to the `TestDAppV2` contract's ABI. | | pkg/contracts/testdappv2/TestDAppV2.go | Updated `DeployTestDAppV2` method to include a boolean parameter and added methods for `isZetaChain` functionality. | | pkg/contracts/testdappv2/TestDAppV2.json | Updated ABI to include a new constructor and function `isZetaChain`. | | pkg/contracts/testdappv2/TestDAppV2.sol | Introduced a new state variable `isZetaChain`, modified the constructor, and added a `consumeGas` function to simulate gas usage. | | x/fungible/keeper/v2_deposits_test.go | Updated `deployTestDAppV2` function to include a boolean parameter affecting contract deployment in tests. | | zetaclient/zetacore/constant.go | Updated `PostVoteOutboundRevertGasLimit` constant from `4_000_000` to `7_000_000` to accommodate higher gas consumption needs. | ## Possibly related issues - **zeta-chain/node#3143**: The increase in the gas limit from `4M` to `7M` directly addresses the issue of handling outbound revert due to the new workflows in contract processing. ## Possibly related PRs - **#2795**: Modifications to deployment logic in `deployZEVMTestDApp` and `deployEVMTestDApp` are relevant to the changes in `SetupEVMV2`. - **#2802**: Changes in the `DeployTestDAppV2` function's signature are connected to the main PR's deployment logic updates. - **#2894**: Adjustments in gas limits for TSS voting relate to the main PR's focus on deployment logic. - **#2909**: The main PR's deployment logic changes may connect with legacy message handling improvements in the retrieved PR. - **#2952**: Enhancements in error handling and status updates in the retrieved PR relate to the main PR's updates to deployment functions. - **#3106**: The focus on gas limits in deployment tests aligns with changes addressing gas limits for omnichain calls. ## Suggested labels `breaking:cli`, `PERFORMANCE_TESTS`, `UPGRADE_TESTS` ## Suggested reviewers - fbac - kingpinXD - ws4charlie - brewmaster012 - swift1337 - skosito

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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , 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 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. ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 0% with 16 lines in your changes missing coverage. Please review.

Project coverage is 63.13%. Comparing base (edebb7a) to head (d09760f). Report is 6 commits behind head on develop.

Files with missing lines Patch % Lines
pkg/contracts/testdappv2/TestDAppV2.go 0.00% 16 Missing :warning:
Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/zeta-chain/node/pull/3144/graphs/tree.svg?width=650&height=150&src=pr&token=JABAIMO8MP&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zeta-chain)](https://app.codecov.io/gh/zeta-chain/node/pull/3144?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zeta-chain) ```diff @@ Coverage Diff @@ ## develop #3144 +/- ## =========================================== - Coverage 63.19% 63.13% -0.06% =========================================== Files 423 423 Lines 29887 29880 -7 =========================================== - Hits 18886 18865 -21 - Misses 10163 10177 +14 Partials 838 838 ``` | [Files with missing lines](https://app.codecov.io/gh/zeta-chain/node/pull/3144?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zeta-chain) | Coverage Δ | | |---|---|---| | [pkg/contracts/testdappv2/TestDAppV2.go](https://app.codecov.io/gh/zeta-chain/node/pull/3144?src=pr&el=tree&filepath=pkg%2Fcontracts%2Ftestdappv2%2FTestDAppV2.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zeta-chain#diff-cGtnL2NvbnRyYWN0cy90ZXN0ZGFwcHYyL1Rlc3REQXBwVjIuZ28=) | `0.00% <0.00%> (ø)` | | ... and [2 files with indirect coverage changes](https://app.codecov.io/gh/zeta-chain/node/pull/3144/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zeta-chain)