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

feat: revert options and revert context #305

Merged
merged 33 commits into from
Aug 12, 2024
Merged

feat: revert options and revert context #305

merged 33 commits into from
Aug 12, 2024

Conversation

skosito
Copy link
Contributor

@skosito skosito commented Aug 8, 2024

  • adds revertOption for every external function in both gateways

  • improve imports a bit

  • adapt tests and localnet scripts

  • add revertContext to methods where eventually onRevert is called in both evm and zevm

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced RevertContext for enhanced error handling during withdrawals and reverts across multiple contracts.
    • Updated functions to accept RevertContext, improving the clarity and structure of data during revert scenarios.
    • Expanded event definitions to include RevertContext, allowing better context and tracking for error handling.
  • Bug Fixes

    • Enhanced error management and logging for revert scenarios across contracts, improving reliability.
  • Documentation

    • Updated comments and documentation to reflect new function signatures and event structures involving RevertContext.

Copy link
Contributor

coderabbitai bot commented Aug 8, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The recent updates enhance error handling and control flow across various smart contracts by introducing structured RevertContext and RevertOptions. These additions enable more nuanced management of transaction failures, improving functionality and flexibility. The changes bolster transparency and control during revert scenarios, ensuring better operational resilience across multiple contract implementations.

Changes

Files Change Summary
v2/pkg/erc20custody.sol/... Updated ABI and binary representation of ERC20Custody with new RevertContext, enhancing withdrawal and revert functionalities.
v2/pkg/ierc20custody.sol/... Introduced RevertContext struct; modified withdrawAndRevert method to improve error handling with contextual details.
v2/pkg/senderzevm.sol/... Updated bytecode in SenderZEVMMetaData, reflecting changes in contract implementation while the ABI remains unchanged.
v2/pkg/zetaconnectornative.sol/... Added RevertContext to withdrawAndRevert, improving error handling capabilities in withdrawal scenarios.
v2/pkg/zetaconnectornonnative.sol/... Integrated RevertContext in withdrawAndRevert, enhancing flexibility in managing complex withdrawals.
v2/typechain-types/factories/... Updated factory files to include new revertOptions structures in ABI, enhancing type safety and clarity in function calls.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Contract
    participant RevertHandler

    User->>Contract: withdrawAndRevert(RevertContext)
    alt Success
        Contract-->>User: Withdrawal successful
    else Revert
        Contract->>RevertHandler: Handle revert using RevertContext
        RevertHandler-->>User: Provide revert details
    end
Loading

🐰 In the meadow, I hop with glee,
New options for reverts, oh what a spree!
With each little change, we dance and play,
Errors are managed in a clever way.
In this world of code, we take our chance,
Hooray for the updates, let’s do a happy dance! 🌟


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

@skosito skosito linked an issue Aug 8, 2024 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Aug 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.33%. Comparing base (ff5eac1) to head (842f8e4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #305   +/-   ##
=======================================
  Coverage   83.33%   83.33%           
=======================================
  Files           7        7           
  Lines         288      288           
  Branches       96       96           
=======================================
  Hits          240      240           
  Misses         48       48           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

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

Yes this is the idea

Base automatically changed from improve-v2-coverage to main August 9, 2024 12:42
@skosito skosito marked this pull request as ready for review August 9, 2024 19:14
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: 15

Outside diff range, codebase verification and nitpick comments (3)
v2/src/zevm/interfaces/IGatewayZEVM.sol (1)

6-14: Correct the typo in the comment.

There is a typo in the comment for the RevertOptions struct. Change @pararm to @param.

-/// @pararm abortAddress Address to receive funds if aborted.
+/// @param abortAddress Address to receive funds if aborted.
v2/pkg/systemcontractmock.sol/systemcontractmock.go (1)

Line range hint 38-43:
Consider removing deprecated variables.

The variables SystemContractMockABI and SystemContractMockBin are marked as deprecated. If they are not used elsewhere, consider removing them to prevent potential issues and ensure the codebase remains clean.

-// Deprecated: Use SystemContractMockMetaData.ABI instead.
-var SystemContractMockABI = SystemContractMockMetaData.ABI

-// Deprecated: Use SystemContractMockMetaData.Bin instead.
-var SystemContractMockBin = SystemContractMockMetaData.Bin
v2/pkg/systemcontract.sol/systemcontract.go (1)

Lack of Validation for ZContext in DepositAndCall Function

The DepositAndCall function does not include explicit validation logic for the context parameter. Ensure that any necessary validations, such as checking for zero addresses or invalid input, are implemented elsewhere if required. This could be a potential oversight if validation is necessary for the correct functioning of the contract.

  • File: v2/pkg/systemcontract.sol/systemcontract.go
  • Functions: DepositAndCall in SystemContractTransactor, SystemContractSession, and SystemContractTransactorSession
Analysis chain

Line range hint 491-503:
Verify Logic and Validations for DepositAndCall.

The DepositAndCall function includes a structured context parameter. Ensure that the function logic correctly processes this parameter and that all necessary validations, such as checking for zero addresses or invalid input, are implemented.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the logic and validations for the `DepositAndCall` function.

# Test: Search for the `DepositAndCall` logic. Expect: Correct processing and validation of the `context` parameter.
rg --type go -A 10 $'DepositAndCall'

Length of output: 43439


Script:

#!/bin/bash
# Description: Search for the definition and usage of the `ZContext` type to check for any validation logic.

# Search for the definition of the `ZContext` type.
rg --type go 'type ZContext'

# Search for any functions or methods that might validate `ZContext`.
rg --type go 'func.*ZContext'

Length of output: 14023

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6486dd8 and 9136cc5.

Files selected for processing (56)
  • v2/pkg/erc20custody.sol/erc20custody.go (1 hunks)
  • v2/pkg/igatewayevm.sol/igatewayevm.go (8 hunks)
  • v2/pkg/igatewayevm.sol/igatewayevmevents.go (7 hunks)
  • v2/pkg/igatewayzevm.sol/igatewayzevm.go (11 hunks)
  • v2/pkg/igatewayzevm.sol/igatewayzevmevents.go (7 hunks)
  • v2/pkg/senderzevm.sol/senderzevm.go (1 hunks)
  • v2/pkg/systemcontract.sol/systemcontract.go (1 hunks)
  • v2/pkg/systemcontractmock.sol/systemcontractmock.go (1 hunks)
  • v2/pkg/testuniversalcontract.sol/testuniversalcontract.go (3 hunks)
  • v2/pkg/universalcontract.sol/universalcontract.go (3 hunks)
  • v2/pkg/zetaconnectornative.sol/zetaconnectornative.go (1 hunks)
  • v2/pkg/zetaconnectornonnative.sol/zetaconnectornonnative.go (1 hunks)
  • v2/scripts/localnet/EvmCall.s.sol (1 hunks)
  • v2/scripts/localnet/EvmDepositAndCall.s.sol (1 hunks)
  • v2/scripts/localnet/ZevmCall.s.sol (1 hunks)
  • v2/scripts/localnet/ZevmWithdrawAndCall.s.sol (1 hunks)
  • v2/src/evm/ERC20Custody.sol (1 hunks)
  • v2/src/evm/GatewayEVM.sol (3 hunks)
  • v2/src/evm/ZetaConnectorBase.sol (1 hunks)
  • v2/src/evm/interfaces/IGatewayEVM.sol (3 hunks)
  • v2/src/zevm/GatewayZEVM.sol (6 hunks)
  • v2/src/zevm/interfaces/IGatewayZEVM.sol (7 hunks)
  • v2/src/zevm/interfaces/UniversalContract.sol (2 hunks)
  • v2/test/GatewayEVM.t.sol (13 hunks)
  • v2/test/GatewayEVMZEVM.t.sol (7 hunks)
  • v2/test/GatewayZEVM.t.sol (29 hunks)
  • v2/test/ZetaConnectorNonNative.t.sol (1 hunks)
  • v2/test/utils/GatewayEVMUpgradeTest.sol (10 hunks)
  • v2/test/utils/SenderZEVM.sol (3 hunks)
  • v2/test/utils/TestUniversalContract.sol (1 hunks)
  • v2/typechain-types/GatewayEVM.ts (10 hunks)
  • v2/typechain-types/GatewayEVMEchidnaTest.ts (10 hunks)
  • v2/typechain-types/GatewayEVMUpgradeTest.ts (14 hunks)
  • v2/typechain-types/GatewayZEVM.ts (20 hunks)
  • v2/typechain-types/IGatewayEVM.sol/IGatewayEVM.ts (9 hunks)
  • v2/typechain-types/IGatewayEVM.sol/IGatewayEVMEvents.ts (5 hunks)
  • v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVM.ts (18 hunks)
  • v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVMEvents.ts (7 hunks)
  • v2/typechain-types/TestUniversalContract.ts (4 hunks)
  • v2/typechain-types/UniversalContract.sol/UniversalContract.ts (4 hunks)
  • v2/typechain-types/factories/ERC20Custody__factory.ts (1 hunks)
  • v2/typechain-types/factories/GatewayEVMEchidnaTest__factory.ts (8 hunks)
  • v2/typechain-types/factories/GatewayEVMUpgradeTest__factory.ts (11 hunks)
  • v2/typechain-types/factories/GatewayEVM__factory.ts (8 hunks)
  • v2/typechain-types/factories/GatewayZEVM__factory.ts (10 hunks)
  • v2/typechain-types/factories/IGatewayEVM.sol/IGatewayEVMEvents__factory.ts (2 hunks)
  • v2/typechain-types/factories/IGatewayEVM.sol/IGatewayEVM__factory.ts (7 hunks)
  • v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVMEvents__factory.ts (2 hunks)
  • v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVM__factory.ts (9 hunks)
  • v2/typechain-types/factories/SenderZEVM__factory.ts (1 hunks)
  • v2/typechain-types/factories/SystemContract.sol/SystemContract__factory.ts (1 hunks)
  • v2/typechain-types/factories/SystemContractMock.sol/SystemContractMock__factory.ts (1 hunks)
  • v2/typechain-types/factories/TestUniversalContract__factory.ts (2 hunks)
  • v2/typechain-types/factories/UniversalContract.sol/UniversalContract__factory.ts (1 hunks)
  • v2/typechain-types/factories/ZetaConnectorNative__factory.ts (1 hunks)
  • v2/typechain-types/factories/ZetaConnectorNonNative__factory.ts (1 hunks)
Files skipped from review due to trivial changes (3)
  • v2/src/evm/ERC20Custody.sol
  • v2/src/evm/ZetaConnectorBase.sol
  • v2/test/ZetaConnectorNonNative.t.sol
Additional context used
GitHub Check: Slither
v2/src/evm/GatewayEVM.sol

[warning] 207-224: Low-level calls
Low level call in GatewayEVM.deposit(address,RevertOptions) (src/evm/GatewayEVM.sol#207-224):
- (deposited,None) = tssAddress.call{value: msg.value}() (src/evm/GatewayEVM.sol#219)


[warning] 253-271: Low-level calls
Low level call in GatewayEVM.depositAndCall(address,bytes,RevertOptions) (src/evm/GatewayEVM.sol#253-271):
- (deposited,None) = tssAddress.call{value: msg.value}() (src/evm/GatewayEVM.sol#266)

Biome
v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVM.ts

[error] 356-356: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 367-367: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 379-379: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 491-491: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 503-503: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/typechain-types/IGatewayEVM.sol/IGatewayEVM.ts

[error] 328-328: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 334-334: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 345-345: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 355-355: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 417-417: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 424-424: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 436-436: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 447-447: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/typechain-types/GatewayZEVM.ts

[error] 650-650: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 661-661: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 673-673: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/typechain-types/GatewayEVM.ts

[error] 604-604: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 612-612: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 623-623: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 633-633: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 780-780: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 790-790: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 802-802: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/typechain-types/GatewayEVMUpgradeTest.ts

[error] 623-623: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 631-631: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 642-642: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 652-652: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 742-742: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 799-799: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 809-809: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 821-821: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/typechain-types/GatewayEVMEchidnaTest.ts

[error] 625-625: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 633-633: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 644-644: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 654-654: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 811-811: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 821-821: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

Additional comments not posted (247)
v2/src/zevm/interfaces/UniversalContract.sol (1)

31-31: Simplified context structure in onRevert.

The onRevert function now uses zContext instead of the removed revertContext. This change likely simplifies the context management for reverts, aligning with best practices for contract development.

v2/scripts/localnet/EvmCall.s.sol (2)

26-27: Introduction of RevertOptions structure.

The RevertOptions structure is introduced to manage revert scenarios more effectively. This addition provides enhanced control over transaction behavior in the event of a revert.


30-30: Enhanced gatewayEVM.call with RevertOptions.

The gatewayEVM.call now includes revertOptions, improving error handling and control flow during execution. This change aligns with the goal of robust contract interactions.

v2/scripts/localnet/ZevmCall.s.sol (2)

36-37: Introduction of RevertOptions structure.

The RevertOptions structure is introduced to manage revert scenarios more effectively. This addition provides enhanced control over transaction behavior in the event of a revert.


40-40: Enhanced gatewayZEVM.call with RevertOptions.

The gatewayZEVM.call now includes revertOptions, improving error handling and control flow during execution. This change aligns with the goal of robust contract interactions.

v2/scripts/localnet/ZevmWithdrawAndCall.s.sol (1)

39-40: LGTM! Verify the RevertOptions usage in the codebase.

The introduction of the RevertOptions parameter enhances error handling as intended.

Ensure that the RevertOptions struct and its usage are consistent across the codebase.

Verification successful

Consistent Usage of RevertOptions Across the Codebase

The RevertOptions struct is used consistently in various parts of the codebase, including test files and scripts. It is defined and utilized in both EVM and ZEVM contexts, ensuring that error handling is enhanced as intended.

  • Struct Definition: The RevertOptions struct is defined in the interfaces for both EVM and ZEVM gateways.
  • Test Files: The struct is used in multiple test files such as GatewayZEVM.t.sol, GatewayEVMZEVM.t.sol, and GatewayEVM.t.sol.
  • Scripts: It is also employed in scripts like ZevmWithdrawAndCall.s.sol, ZevmCall.s.sol, EvmDepositAndCall.s.sol, and EvmCall.s.sol.

These usages indicate that the RevertOptions parameter is consistently integrated across the codebase. No inconsistencies were found in its usage.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `RevertOptions` across the codebase.

# Test: Search for `RevertOptions` struct usage. Expect: Consistent usage across files.
rg --type solidity --context 5 'RevertOptions'

Length of output: 79


Script:

#!/bin/bash
# Description: Verify the usage of `RevertOptions` across the codebase.

# Define Solidity file type and search for `RevertOptions` struct usage.
rg --type-add 'solidity:*.sol' --type solidity --context 5 'RevertOptions'

Length of output: 34808

v2/scripts/localnet/EvmDepositAndCall.s.sol (1)

36-37: LGTM! Verify the RevertOptions usage in the codebase.

The introduction of the RevertOptions parameter enhances error handling as intended.

Ensure that the RevertOptions struct and its usage are consistent across the codebase.

Verification successful

RevertOptions Usage Verified

The RevertOptions struct is consistently used across the codebase in various contexts, such as events, function parameters, and memory allocations. The integration appears to be as intended.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `RevertOptions` across the codebase.

# Test: Search for `RevertOptions` struct usage. Expect: Consistent usage across files.
rg --type solidity --context 5 'RevertOptions'

Length of output: 79


Script:

#!/bin/bash
# Description: Verify the usage of `RevertOptions` across Solidity files in the codebase.

# Find all Solidity files and search for the `RevertOptions` struct usage within them.
fd --extension sol --exec rg 'RevertOptions' {}

Length of output: 280313

v2/typechain-types/factories/UniversalContract.sol/UniversalContract__factory.ts (1)

64-64: LGTM! Verify the zContext usage in the codebase.

The change from revertContext to zContext suggests a refactor for clarity or functionality.

Ensure that the zContext struct and its usage are consistent across the codebase.

Verification successful

Consistent Usage of zContext Verified

The zContext struct is used consistently across the codebase, indicating that the refactor from revertContext to zContext has been thoroughly applied. The instances found in various files confirm this consistency.

  • Files checked include multiple __factory.ts files across different directories.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `zContext` across the codebase.

# Test: Search for `zContext` struct usage. Expect: Consistent usage across files.
rg --type typescript --context 5 'zContext'

Length of output: 78


Script:

#!/bin/bash
# Description: Verify the usage of `zContext` across the codebase.

# Test: Search for `zContext` struct usage in TypeScript files.
rg --glob '*.ts' --context 5 'zContext'

Length of output: 22915

v2/test/utils/TestUniversalContract.sol (1)

Line range hint 56-62:
Verify the integration of zContext.

The parameter type change from revertContext to zContext seems correct, assuming zContext is the intended structure. Ensure that this change is consistent across the codebase and that the zContext type provides the necessary fields.

Verification successful

Integration of zContext is consistent and correct.

The zContext structure is used consistently across the codebase, including in the onRevert function. The change from revertContext to zContext is well-integrated and appears intentional. No issues found with this change.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `zContext` across the codebase.

# Test: Search for the definition and usage of `zContext`. Expect: Consistent usage across the codebase.
rg --type solidity 'zContext'

Length of output: 62


Script:

#!/bin/bash
# Description: Verify the usage of `zContext` across Solidity files.

# Find all Solidity files and search for `zContext` within them.
fd --extension sol --exec rg 'zContext' {}

Length of output: 53079

v2/test/utils/SenderZEVM.sol (3)

5-6: LGTM on import updates!

The destructuring import for IGatewayZEVM and RevertOptions is correct and improves clarity.


65-69: Verify RevertOptions instantiation.

The RevertOptions structure is instantiated with specific addresses. Ensure these addresses are correct and intended for the revert logic.


34-38: Verify RevertOptions instantiation.

The RevertOptions structure is instantiated with specific addresses. Ensure these addresses are correct and intended for the revert logic.

v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVMEvents__factory.ts (2)

40-62: LGTM on revertOptions structure!

The revertOptions structure is correctly defined and integrated into the Call event.


118-140: LGTM on revertOptions structure!

The revertOptions structure is correctly defined and integrated into the Withdrawal event.

v2/typechain-types/UniversalContract.sol/UniversalContract.ts (3)

Line range hint 142-147:
Verify getFunction logic for ZContextStruct.

Ensure that the getFunction logic for onRevert integrates ZContextStruct correctly and aligns with the overall contract functionality.


47-48: Verify compatibility of ZContextStruct.

Ensure that the ZContextStruct used in encodeFunctionData is compatible with the expected data format in the contract logic.

Verification successful

ZContextStruct is compatible with expected data formats.

The ZContextStruct is consistently defined and used across the codebase, with fields that align with typical Ethereum data types. This confirms its compatibility with the expected data format in the contract logic.

  • Definition includes fields: origin: BytesLike, sender: AddressLike, chainID: BigNumberish.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage and compatibility of `ZContextStruct` in the codebase.

# Test: Search for `ZContextStruct` usage. Expect: Consistent usage across the codebase.
rg --type ts 'ZContextStruct'

Length of output: 9712


Script:

#!/bin/bash
# Description: Extract the definition of `ZContextStruct` to verify its structure.

# Find the definition of `ZContextStruct` in the codebase.
ast-grep --lang typescript --pattern 'export type ZContextStruct = { $$$ }'

Length of output: 5080


Line range hint 113-118:
Verify onRevert method handling of ZContextStruct.

Ensure that the onRevert method correctly handles the ZContextStruct and integrates with the contract logic as expected.

v2/typechain-types/factories/IGatewayEVM.sol/IGatewayEVMEvents__factory.ts (2)

34-56: Verify integration of revertOptions in Call event.

Ensure that the revertOptions structure is correctly integrated into the Call event and aligns with the contract's logic.


94-116: Verify integration of revertOptions in Deposit event.

Ensure that the revertOptions structure is correctly integrated into the Deposit event and aligns with the contract's logic.

v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVMEvents.ts (4)

45-60: Verify integration of revertOptions in CallEvent.

Ensure that the revertOptions parameter is correctly integrated into the CallEvent input and output tuples and aligns with the event's logic.

Verification successful

Integration of revertOptions in CallEvent is consistent.

The revertOptions parameter is consistently integrated into the CallEvent input and output tuples across multiple files. This suggests that the integration is uniform throughout the codebase. Further checks on logic alignment should be conducted separately if needed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration of `revertOptions` in `CallEvent`.

# Test: Search for `CallEvent` usage. Expect: Consistent integration of `revertOptions`.
rg --type ts 'CallEvent' -A 5

Length of output: 32774


24-34: Verify definition and usage of RevertOptionsStruct.

Ensure that RevertOptionsStruct and RevertOptionsStructOutput are correctly defined and used consistently across the contract logic.

Verification successful

RevertOptionsStruct is correctly defined and consistently used across the codebase.

The RevertOptionsStruct and RevertOptionsStructOutput types are extensively utilized in various files, indicating their integral role in the contract logic. The definitions and usages are consistent with their intended purpose. No discrepancies were found in their application.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definition and usage of `RevertOptionsStruct`.

# Test: Search for `RevertOptionsStruct` usage. Expect: Consistent usage across the codebase.
rg --type ts 'RevertOptionsStruct'

Length of output: 13799


Line range hint 77-100:
Verify integration of revertOptions in WithdrawalEvent.

Ensure that the revertOptions parameter is correctly integrated into the WithdrawalEvent input and output tuples and aligns with the event's logic.


Line range hint 171-187:
Verify updated filters for Call and Withdrawal events.

Ensure that the updated filters for Call and Withdrawal events correctly include the revertOptions parameter and align with the contract's logic.

v2/typechain-types/TestUniversalContract.ts (3)

53-54: Change to ZContextStruct looks good, but verify its usage.

The switch from RevertContextStruct to ZContextStruct is consistent with the refactoring goals. Ensure that ZContextStruct is correctly defined and used across the codebase.

Verification successful

ZContextStruct is consistently defined and used across the codebase.

The search results show that ZContextStruct is defined and used in multiple files across different directories, indicating consistent usage. This confirms that the change from RevertContextStruct to ZContextStruct aligns with the refactoring goals and is correctly implemented throughout the codebase.

  • Files with ZContextStruct Definition and Usage:
    • v1/typechain-types/contracts/zevm/interfaces/ZContract.ts
    • v2/typechain-types/UniversalContract.sol/UniversalContract.ts
    • v2/typechain-types/SystemContract.sol/SystemContract.ts
    • v2/typechain-types/GatewayZEVM.ts
    • v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVM.ts
    • v2/typechain-types/zContract.sol/UniversalContract.ts
    • v2/typechain-types/TestUniversalContract.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `ZContextStruct` is correctly defined and used across the codebase.

# Test: Search for the definition and usage of `ZContextStruct`. Expect: Consistent usage and definition.
rg --type solidity 'ZContextStruct'

Length of output: 68


Script:

#!/bin/bash
# Description: Verify that `ZContextStruct` is correctly defined and used across the codebase.

# Test: Search for the definition and usage of `ZContextStruct` across all files.
rg 'ZContextStruct'

Length of output: 9702


175-177: Update to ZContextStruct in onRevert is correct, but verify related logic.

The change to use ZContextStruct is consistent with the refactoring. Ensure that all related logic and documentation are updated.


204-206: Refactoring to ZContextStruct in getFunction is appropriate, but verify related components.

The update to use ZContextStruct is consistent with the refactoring. Ensure that this change is reflected in all related components.

v2/src/evm/interfaces/IGatewayEVM.sol (6)

49-57: Addition of RevertOptions to Deposit event is correct, but verify event emission.

The inclusion of RevertOptions enhances the event's capability. Ensure that the event is emitted with the correct RevertOptions data.

Verification successful

Event Emissions with RevertOptions are Correct

The Deposit event is emitted with the RevertOptions parameter in various instances throughout the codebase, confirming its correct usage. Here are some examples:

  • emit Deposit(owner, destination, amount, address(token), payload, revertOptions);
  • emit Deposit(msg.sender, receiver, amount, asset, payload, revertOptions);

These emissions show that the RevertOptions parameter is being used as intended.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the `Deposit` event is emitted with correct `RevertOptions`.

# Test: Search for `Deposit` event emissions. Expect: Correct `RevertOptions` data.
rg --type solidity 'emit Deposit'

Length of output: 68


Script:

#!/bin/bash
# Description: Find all Solidity files and search for `Deposit` event emissions.

# Find all `.sol` files and search for `emit Deposit` within them.
fd --extension sol --exec rg 'emit Deposit' {}

Length of output: 1492


63-64: Inclusion of RevertOptions in Call event is appropriate, but verify event emission.

The addition of RevertOptions aligns with enhanced revert handling. Ensure that the event is emitted with the correct RevertOptions data.

Verification successful

Event Call is emitted with RevertOptions correctly.

The Call event is consistently emitted with the RevertOptions parameter across various instances in the codebase. This confirms that the integration of RevertOptions is appropriately handled during event emissions.

  • The event is emitted in multiple contexts, each including revertOptions.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the `Call` event is emitted with correct `RevertOptions`.

# Test: Search for `Call` event emissions. Expect: Correct `RevertOptions` data.
rg --type solidity 'emit Call'

Length of output: 65


Script:

#!/bin/bash
# Find all Solidity files and search for `emit Call` to verify the event emission.
fd -e sol -x rg 'emit Call' {}

Length of output: 488


142-147: Inclusion of RevertOptions in depositAndCall is appropriate, but verify function logic.

The addition of RevertOptions supports enhanced handling. Ensure that the function logic correctly uses the RevertOptions.


4-12: RevertOptions struct definition is well-structured, but verify its usage.

The RevertOptions struct provides necessary fields for handling revert scenarios. Ensure that these fields are used appropriately in the codebase.


129-130: Enhancement of deposit function with RevertOptions is valid, but verify function logic.

The addition of RevertOptions allows for enhanced handling. Ensure that the function logic appropriately utilizes the RevertOptions.


169-170: Addition of RevertOptions to call function is valid, but verify function logic.

The inclusion of RevertOptions aligns with enhanced handling. Ensure that the function logic makes proper use of the RevertOptions.

v2/typechain-types/factories/TestUniversalContract__factory.ts (2)

193-194: Bytecode update is noted, but verify intended changes.

The update in bytecode suggests changes in functionality or optimizations. Ensure that these changes are intended and documented.


78-80: Update to struct zContext is correct, but verify consistent application.

The change to struct zContext is consistent with the refactoring. Ensure that this change is consistently applied across the ABI.

Verification successful

Consistent Application of struct zContext Verified

The struct zContext is consistently applied across multiple files in the codebase, indicating that the refactoring has been applied uniformly.

  • v2/typechain-types/factories/TestUniversalContract__factory.ts
  • v2/typechain-types/factories/GatewayZEVM__factory.ts
  • v2/typechain-types/factories/zContract.sol/ZContract__factory.ts
  • v2/typechain-types/factories/UniversalContract.sol/UniversalContract__factory.ts
  • v2/typechain-types/factories/SystemContract.sol/SystemContract__factory.ts
  • v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVM__factory.ts
  • v1/typechain-types/factories/contracts/zevm/interfaces/ZContract__factory.ts
  • v1/typechain-types/factories/contracts/zevm/SystemContract.sol/SystemContract__factory.ts

This confirms that the update to struct zContext is consistently applied.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistent application of `struct zContext` across the ABI.

# Test: Search for `struct zContext` in ABI. Expect: Consistent application.
rg --type typescript 'struct zContext'

Length of output: 75


Script:

#!/bin/bash
# Description: Verify consistent application of `struct zContext` across the ABI.

# Test: Search for `struct zContext` in TypeScript files. Expect: Consistent application.
rg --type ts 'struct zContext'

Length of output: 2485

v2/typechain-types/factories/SenderZEVM__factory.ts (1)

123-123: Verify the updated bytecode.

The bytecode string has been updated. Ensure that this change reflects the intended modifications to the smart contract logic and that it has been thoroughly tested.

v2/src/zevm/interfaces/IGatewayZEVM.sol (4)

Line range hint 38-48:
Verify the addition of revertOptions in the Withdrawal event.

The Withdrawal event now includes a RevertOptions parameter. Ensure that this change is reflected in all related event emissions and handlers.


217-217: Verify the renaming of context to zContext.

The context parameter has been renamed to zContext in executeRevert and depositAndRevert functions. Ensure that all related logic and calls are updated accordingly.

Also applies to: 232-232


99-104: Verify the integration of RevertOptions in function signatures.

The RevertOptions struct has been added to multiple function signatures. Ensure that all function calls and related logic are updated to accommodate this change.

Also applies to: 111-116, 125-131, 140-146, 154-159


25-27: Verify the addition of revertOptions in the Call event.

The Call event now includes a RevertOptions parameter. Ensure that this change is reflected in all related event emissions and handlers.

Verification successful

Verification successful: revertOptions included in all Call event emissions.

The revertOptions parameter is consistently included in all instances of the Call event emissions across the codebase. No issues were found regarding its integration.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the `Call` event emissions include `RevertOptions`.

# Test: Search for the `Call` event to ensure `RevertOptions` is included in all emissions.
rg --type solidity "emit Call("

Length of output: 104


Script:

#!/bin/bash
# Corrected regex pattern to search for the `Call` event emissions in Solidity files.
rg --type solidity "emit Call\("

Length of output: 67


Script:

#!/bin/bash
# Find all Solidity files and search for the `emit Call(` statement to verify the inclusion of `RevertOptions`.
fd -e sol -x rg "emit Call\(" {}

Length of output: 490

v2/test/GatewayEVMZEVM.t.sol (3)

11-11: Improve import statement consistency.

The import statements have been updated to use destructuring. Ensure that this change is consistent across the codebase for readability and maintainability.

Also applies to: 18-24

Verification successful

Import statement consistency verified.

The use of destructured import statements is consistent across the codebase, as evidenced by the search results. This aligns with the goal of maintaining readability and maintainability. No further action is needed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistent use of destructured import statements across the codebase.

# Test: Search for import statements to ensure consistency in destructuring.
rg --type solidity "import {"

Length of output: 111


Script:

#!/bin/bash
# Description: Verify consistent use of destructured import statements across the codebase.

# Test: Search for import statements to ensure consistency in destructuring.
rg --type solidity "import \\{"

Length of output: 65


Script:

#!/bin/bash
# Description: Verify consistent use of destructured import statements across the codebase.

# Test: Search for import statements to ensure consistency in destructuring.
rg "import \\{" --glob "*.sol"

Length of output: 3950


134-135: Verify the integration of RevertOptions in test function calls.

The RevertOptions struct is integrated into several test function calls. Ensure that all related logic and assertions are updated to accommodate this change.

Also applies to: 154-160, 192-196, 222-227

Verification successful

Integration of RevertOptions Verified

The RevertOptions parameter is included in the calls to gatewayZEVM.call and gatewayZEVM.withdrawAndCall across the relevant test files. The presence of RevertOptions in these function calls suggests that the integration is implemented as expected. However, ensure that all related logic and assertions are updated to accommodate this change, as the search did not specifically verify assertion logic. You should manually verify that the test logic properly handles RevertOptions where necessary.

  • Files with RevertOptions integration:
    • v2/test/GatewayEVMZEVM.t.sol
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the test function calls include the `RevertOptions` parameter.

# Test: Search for test function calls to ensure `RevertOptions` is included.
rg --type solidity "gatewayZEVM\.call\(|gatewayZEVM\.withdrawAndCall\("

Length of output: 106


Script:

#!/bin/bash
# Description: Verify that the test function calls include the `RevertOptions` parameter.

# Find all Solidity files and search for the specific function calls.
fd --extension sol --exec rg 'gatewayZEVM\.call\(|gatewayZEVM\.withdrawAndCall\('

Length of output: 437


Script:

#!/bin/bash
# Description: Search for assertions or logic involving `RevertOptions` in Solidity test files.

# Find all Solidity test files and search for references to `RevertOptions`.
fd --extension sol --exec rg 'RevertOptions'

Length of output: 280308


64-64: Verify the initialization and use of RevertOptions.

The RevertOptions struct is initialized and used in various tests. Ensure that the tests adequately cover scenarios involving this struct.

Also applies to: 119-120

v2/typechain-types/IGatewayEVM.sol/IGatewayEVMEvents.ts (10)

24-28: New type declaration RevertOptionsStruct.

The RevertOptionsStruct type is well-defined and adds useful fields for handling reverts.


30-34: New type declaration RevertOptionsStructOutput.

The RevertOptionsStructOutput type mirrors the input structure, which is consistent and necessary for output handling.


52-54: Added revertOptions to CallEvent.InputTuple.

The addition of revertOptions enhances the event's ability to manage transaction reverts.


55-59: Added revertOptions to CallEvent.OutputTuple.

Including revertOptions in the output tuple is consistent with the input, ensuring symmetry.


65-65: Added revertOptions to CallEvent.OutputObject.

This addition ensures that the OutputObject remains consistent with the tuple definitions.


79-80: Added revertOptions to DepositEvent.InputTuple.

The inclusion of revertOptions provides additional context for handling reverts in deposit events.


87-88: Added revertOptions to DepositEvent.OutputTuple.

This ensures that the output tuple aligns with the input structure, maintaining consistency.


96-96: Added revertOptions to DepositEvent.OutputObject.

The OutputObject now reflects the updated tuple structure, which is consistent.


281-284: Updated Call event filter signature.

The signature change to include revertOptions as a tuple is correctly reflected in the event filter.


292-295: Updated Deposit event filter signature.

The signature now includes revertOptions, which aligns with the event's updated structure.

v2/typechain-types/factories/IGatewayEVM.sol/IGatewayEVM__factory.ts (7)

26-47: Added revertOptions to call function ABI.

The addition of revertOptions as a tuple is well-structured and enhances the function's revert handling capabilities.


61-82: Added revertOptions to deposit function ABI (payable).

Incorporating revertOptions into the ABI for the payable deposit function improves error management.


106-127: Added revertOptions to deposit function ABI (nonpayable).

The addition of revertOptions is consistent with the payable version, ensuring uniformity.


146-167: Added revertOptions to depositAndCall function ABI (payable).

The structured revertOptions tuple enhances the function's ability to handle reverts effectively.


196-217: Added revertOptions to depositAndCall function ABI (nonpayable).

This addition mirrors the payable version, maintaining consistency across function definitions.


342-364: Added revertOptions to Call event ABI.

The event ABI now includes revertOptions, which aligns with the updated event structure.


402-424: Added revertOptions to Deposit event ABI.

The inclusion of revertOptions in the event ABI is consistent with the event's new structure.

v2/pkg/universalcontract.sol/universalcontract.go (4)

41-41: Updated ABI metadata for UniversalContract.

The ABI now reflects the use of structzContext, ensuring consistency with the updated function signatures.


214-216: Updated OnRevert function signature in UniversalContractTransactor.

The replacement of RevertContext with ZContext is consistent with the new context handling approach.


221-223: Updated OnRevert function signature in UniversalContractSession.

This change aligns with the updated context management strategy using ZContext.


228-230: Updated OnRevert function signature in UniversalContractTransactorSession.

The use of ZContext ensures consistency across all session types for context handling.

v2/typechain-types/factories/SystemContractMock.sol/SystemContractMock__factory.ts (2)

345-345: Verify the updated bytecode.

The _bytecode constant has been updated, indicating a new contract deployment. Ensure that this change is intentional and correctly reflects the desired contract logic.


346-346: Verify constructor parameter handling.

The SystemContractMockConstructorParams type has been updated to include an optional signer. Ensure all constructor calls are compatible with this change.

v2/src/zevm/GatewayZEVM.sol (8)

Line range hint 190-206:
Ensure correct handling of RevertOptions in ZETA withdrawAndCall.

The ZETA withdrawAndCall function now includes RevertOptions. Verify that this parameter is correctly handled and integrated into the function logic.


319-319: Verify context type change in executeRevert.

The context parameter type has changed to zContext. Ensure this change is consistent with the broader context management strategy.


4-4: Verify import of RevertOptions.

The RevertOptions type is imported and used in several functions. Ensure that this type is correctly defined and used throughout the codebase.

Verification successful

Import and Usage of RevertOptions Verified

The RevertOptions struct is correctly defined in v2/src/zevm/interfaces/IGatewayZEVM.sol and is used consistently across the codebase, including in v2/src/zevm/GatewayZEVM.sol. The import and usage are valid and correctly implemented.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the import and usage of `RevertOptions`.

# Test: Search for `RevertOptions` definition and usage. Expect: Correct definition and consistent usage.
rg --type solidity 'RevertOptions'

Length of output: 67


Script:

#!/bin/bash
# Searching for the definition of `RevertOptions` in Solidity files
ast-grep --lang solidity --pattern 'contract RevertOptions { $$$ }'

# Searching for the usage of `RevertOptions` in Solidity files
rg 'RevertOptions' --glob '*.sol' -A 5

Length of output: 20175


342-342: Verify context type change in depositAndRevert.

The context parameter type has changed to zContext. Ensure this change is consistent with the broader context management strategy.

Verification successful

zContext Type Consistency Verified in depositAndRevert Function

The depositAndRevert function in both GatewayZEVM.sol and IGatewayZEVM.sol consistently uses zContext as the type for the context parameter. This change aligns with the broader context management strategy in these files.

  • Files and Lines:
    • v2/src/zevm/GatewayZEVM.sol: Lines 342-346
    • v2/src/zevm/interfaces/IGatewayZEVM.sol: Lines 342-346

The use of zContext is consistent across the implementation and interface, indicating a coherent application of the type change.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify context type change in `depositAndRevert`.

# Test: Search for `depositAndRevert` function implementation. Expect: Consistent use of `zContext`.
rg --type solidity $'function depositAndRevert\\(zContext calldata context, address zrc20, uint256 amount, address target, bytes calldata message\\)'

Length of output: 181


Script:

#!/bin/bash
# Description: Verify context type change in `depositAndRevert`.

# Test: Search for `depositAndRevert` function implementation in Solidity files. Expect: Consistent use of `zContext`.
rg 'function depositAndRevert\(zContext calldata context, address zrc20, uint256 amount, address target, bytes calldata message\)' --glob '*.sol' -A 5

Length of output: 152


Script:

#!/bin/bash
# Description: Search for any implementation of `depositAndRevert` in Solidity files.

# Test: Search for `depositAndRevert` function in Solidity files to check parameter types.
rg 'function depositAndRevert\(' --glob '*.sol' -A 5

Length of output: 801


Line range hint 143-161:
Ensure correct handling of RevertOptions in withdrawAndCall.

The withdrawAndCall function now includes RevertOptions. Verify that this parameter is correctly handled and integrated into the function logic.


212-225: Ensure correct handling of RevertOptions in call.

The call function now includes RevertOptions. Verify that this parameter is correctly handled and integrated into the function logic.


118-135: Ensure correct handling of RevertOptions in withdraw.

The withdraw function now includes RevertOptions. Verify that this parameter is correctly handled and integrated into the function logic.


167-182: Ensure correct handling of RevertOptions in ZETA withdraw.

The ZETA withdraw function now includes RevertOptions. Verify that this parameter is correctly handled and integrated into the function logic.

v2/src/evm/GatewayEVM.sol (4)

4-6: Verify import of RevertOptions.

The RevertOptions type is imported and used in several functions. Ensure that this type is correctly defined and used throughout the codebase.

Verification successful

Import and Usage of RevertOptions Verified

The RevertOptions type is correctly defined as a struct in both IGatewayEVM.sol and IGatewayZEVM.sol and is consistently used across the codebase, including in GatewayEVM.sol. Its fields are appropriately utilized in various functions and tests. No issues found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the import and usage of `RevertOptions`.

# Test: Search for `RevertOptions` definition and usage. Expect: Correct definition and consistent usage.
rg --type solidity 'RevertOptions'

Length of output: 67


Script:

#!/bin/bash
# Description: Verify the import and usage of `RevertOptions`.

# Search for `RevertOptions` definition and usage in Solidity files.
rg 'RevertOptions' --glob '*.sol' -A 5

Length of output: 19988


301-312: Ensure correct handling of RevertOptions in call.

The call function now includes RevertOptions. Verify that this parameter is correctly handled and integrated into the function logic.


Line range hint 278-295:
Ensure correct handling of RevertOptions in ERC20 depositAndCall.

The ERC20 depositAndCall function now includes RevertOptions. Verify that this parameter is correctly handled and integrated into the function logic.

Tools
GitHub Check: Slither

[warning] 207-224: Low-level calls
Low level call in GatewayEVM.deposit(address,RevertOptions) (src/evm/GatewayEVM.sol#207-224):
- (deposited,None) = tssAddress.call{value: msg.value}() (src/evm/GatewayEVM.sol#219)


[warning] 253-271: Low-level calls
Low level call in GatewayEVM.depositAndCall(address,bytes,RevertOptions) (src/evm/GatewayEVM.sol#253-271):
- (deposited,None) = tssAddress.call{value: msg.value}() (src/evm/GatewayEVM.sol#266)


230-246: Ensure correct handling of RevertOptions in ERC20 deposit.

The ERC20 deposit function now includes RevertOptions. Verify that this parameter is correctly handled and integrated into the function logic.

v2/test/utils/GatewayEVMUpgradeTest.sol (9)

57-71: Improved readability and maintainability.

The use of descriptive parameter names and zero address checks enhances the function's clarity and robustness.


103-114: Zero address check and event emission enhance robustness and transparency.

The addition of a zero address check and the emission of an event with revertOptions improve the function's reliability and transparency.


211-228: Enhanced error handling and input validation.

The addition of the RevertOptions parameter and zero address checks improve the function's robustness.


235-251: Improved error handling and input validation.

The inclusion of the RevertOptions parameter and zero address checks enhance the function's robustness.


257-275: Enhanced error handling and input validation.

The addition of the RevertOptions parameter and zero address checks improve the function's robustness.


283-300: Improved error handling and input validation.

The inclusion of the RevertOptions parameter and zero address checks enhance the function's robustness.


306-317: Enhanced error handling and input validation.

The addition of the RevertOptions parameter and zero address checks improve the function's robustness.


321-327: Improved readability and input validation.

The use of a descriptive parameter name and zero address checks enhance the function's clarity and robustness.


331-337: Improved readability and input validation.

The use of a descriptive parameter name and zero address checks enhance the function's clarity and robustness.

v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVM__factory.ts (5)

31-51: Well-defined RevertOptions structure.

The RevertOptions structure enhances error handling capabilities by providing detailed options for managing reverts.


182-182: Enhanced context management and error handling.

The updated function signature with zContext and RevertOptions improves the function's robustness and flexibility.


282-282: Enhanced context management and error handling.

The updated function signature with zContext and RevertOptions improves the function's robustness and flexibility.


340-364: Improved error handling with RevertOptions.

The inclusion of RevertOptions in the function signature enhances its ability to manage revert scenarios.


Line range hint 439-464: Improved error handling with RevertOptions.

The inclusion of RevertOptions in the function signature enhances its ability to manage revert scenarios.

v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVM.ts (5)

26-29: Well-defined RevertOptionsStruct.

The RevertOptionsStruct enhances error handling capabilities by providing detailed options for managing reverts.


60-63: Enhanced error handling in function signatures.

The inclusion of RevertOptionsStruct in the function signatures improves the interface's ability to manage revert scenarios.


167-168: Improved event logging with revertOptions.

The inclusion of revertOptions in event definitions enhances logging by providing more context about revert scenarios.


349-366: Improved error handling with RevertOptionsStruct.

The inclusion of RevertOptionsStruct in the method signature enhances its ability to manage revert scenarios.

Tools
Biome

[error] 356-356: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


371-389: Improved error handling with RevertOptionsStruct.

The inclusion of RevertOptionsStruct in the method signature enhances its ability to manage revert scenarios.

Tools
Biome

[error] 379-379: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/typechain-types/IGatewayEVM.sol/IGatewayEVM.ts (8)

26-30: Define RevertOptionsStruct Correctly.

The RevertOptionsStruct is defined correctly with fields revertAddress, callOnRevert, and abortAddress. This structure is crucial for handling revert options across various functions.


32-36: Ensure Consistency in RevertOptionsStructOutput.

The RevertOptionsStructOutput is defined to match the RevertOptionsStruct, ensuring consistency between input and output types. This is important for correct encoding and decoding of data.


141-154: Update Event Input and Output Tuples for CallEvent.

The CallEvent now includes revertOptions in its input and output tuples. This change ensures that events carry the necessary revert option data.


168-185: Update Event Input and Output Tuples for DepositEvent.

The DepositEvent now includes revertOptions in its input and output tuples. This update is crucial for tracking revert options in deposit-related events.


64-86: Correctly Encode Function Data with Revert Options.

The encodeFunctionData methods now include RevertOptionsStruct as a parameter. Verify that the encoding logic is correctly implemented in the codebase.


107-119: Decode Function Results with Updated Signatures.

The decodeFunctionResult methods are updated to handle the new function signatures. Ensure that decoding logic is correctly implemented.


Line range hint 546-557: Update Event Filters with Revert Options.

The event filters for Call and Deposit events now include revertOptions. Ensure that these filters are correctly used in the codebase.

Verification successful

Event Filters Updated with Revert Options Verified

The Call and Deposit event filters have been updated to include revertOptions in their definitions. These updates are consistent across multiple files in the codebase, confirming that the changes are correctly implemented.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of updated event filters with `revertOptions`.

# Test: Search for event filter usage. Expect: Proper handling of `revertOptions`.
rg --type typescript -A 5 $'filters: { "Call(address,address,bytes,tuple)"'
rg --type typescript -A 5 $'filters: { "Deposit(address,address,uint256,address,bytes,tuple)"'

Length of output: 471


Script:

#!/bin/bash
# Description: Search for the usage of `Call` and `Deposit` event filters and check for `revertOptions`.

# Corrected search for event filter usage.
rg --type typescript -A 10 'CallEvent' 
rg --type typescript -A 10 'DepositEvent'

Length of output: 150


Script:

#!/bin/bash
# Description: Search for the usage of `CallEvent` and `DepositEvent` in TypeScript files and check for `revertOptions`.

# Corrected search for event filter usage in .ts files.
rg --glob '*.ts' -A 10 'CallEvent'
rg --glob '*.ts' -A 10 'DepositEvent'

Length of output: 97607


42-45: Update Function Signatures for Revert Options.

The function signatures have been updated to include RevertOptionsStruct. Ensure that all calls to these functions are updated accordingly in the codebase.

v2/typechain-types/factories/SystemContract.sol/SystemContract__factory.ts (1)

442-442: Verify the Updated Bytecode.

The bytecode has been updated, indicating changes in the contract's compiled code. Ensure that the new bytecode reflects the intended updates and does not introduce regressions.

v2/pkg/senderzevm.sol/senderzevm.go (1)

35-35: Verify the Updated Bytecode in SenderZEVMMetaData.

The Bin field has been updated, indicating changes in the contract's bytecode. Ensure that the new bytecode reflects the intended updates and does not introduce regressions.

v2/test/GatewayEVM.t.sol (4)

37-37: Addition of RevertOptions in GatewayEVMTest.

The RevertOptions variable is introduced, which enhances the test setup by allowing for more detailed revert handling. Ensure that this variable is used consistently throughout the test cases.


Line range hint 290-324:
Addition of RevertOptions in GatewayEVMInboundTest.

The RevertOptions variable is added and initialized. This provides flexibility in testing different revert scenarios. Ensure that the revertOptions are correctly applied in all relevant test cases.


335-336: Inclusion of revertOptions in event emissions and function calls.

The revertOptions parameter is now included in various event emissions and function calls. This change ensures that revert conditions are consistently logged and handled across different operations.

Also applies to: 361-362, 388-389, 419-419, 432-433, 466-467, 493-494


353-353: Ensure proper handling of revertOptions in failure scenarios.

The revertOptions parameter is included in failure scenarios, which is crucial for testing how the system handles reverts. Verify that all edge cases are covered and that the revertOptions are correctly influencing the behavior.

Also applies to: 374-374, 380-380, 399-399, 406-406, 448-448, 457-457, 478-478, 486-486, 501-501

v2/pkg/igatewayzevm.sol/igatewayzevmevents.go (4)

32-37: Definition of RevertOptions struct.

The RevertOptions struct is defined with fields RevertAddress, CallOnRevert, and AbortAddress. This struct encapsulates revert handling details, enhancing the robustness of event handling.


41-41: Update of ABI to include revertOptions.

The ABI strings for Call and Withdrawal events now include the revertOptions parameter. This change ensures that the events carry detailed revert handling information.


259-264: Integration of RevertOptions into event structures.

The RevertOptions field is added to the IGatewayZEVMEventsCall and IGatewayZEVMEventsWithdrawal structs. This integration provides additional context for revert scenarios in event data.

Also applies to: 423-423


267-269: Modification of event handling functions to support RevertOptions.

The event handling functions (FilterCall, WatchCall, ParseCall, FilterWithdrawal, WatchWithdrawal, ParseWithdrawal) are updated to accommodate the RevertOptions parameter. Ensure that these functions correctly process the new field.

Also applies to: 288-290, 334-336, 427-429, 448-450, 494-496

v2/typechain-types/factories/ZetaConnectorNonNative__factory.ts (1)

620-620: Significant bytecode update.

The bytecode for the ZetaConnectorNonNative contract has been entirely replaced. This suggests major changes in the contract logic. Ensure that the changes are consistent with the intended functionality and that all dependent components are updated accordingly.

v2/typechain-types/factories/ZetaConnectorNative__factory.ts (1)

614-614: Verify the bytecode update.

The _bytecode constant has been updated. Ensure that this change reflects the intended updates to the smart contract logic and that it has been thoroughly tested.

v2/typechain-types/factories/ERC20Custody__factory.ts (1)

674-674: Verify the bytecode update.

The _bytecode constant has been updated. Ensure that this change reflects the intended updates to the smart contract logic and that it has been thoroughly tested.

v2/typechain-types/GatewayZEVM.ts (8)

26-29: Introduction of RevertOptionsStruct.

The new RevertOptionsStruct enhances the handling of revert options. Ensure that this struct is used consistently across the contract and that it aligns with the intended error handling improvements.


32-36: Introduction of RevertOptionsStructOutput.

The RevertOptionsStructOutput provides a clear output structure for the revert options. Verify that this output structure is correctly integrated into the contract's logic.


76-79: Update function signatures to include RevertOptionsStruct.

The function signatures now include RevertOptionsStruct, which enhances error handling. Ensure that all related functions are updated and tested for this change.


180-205: Update encoding for functions with RevertOptionsStruct.

The encoding functions have been updated to include RevertOptionsStruct. Verify that these changes are consistent with the intended functionality and that they are thoroughly tested.


272-284: Update decoding for functions with RevertOptionsStruct.

The decoding functions have been updated to include RevertOptionsStruct. Ensure these changes are consistent with the intended functionality and are thoroughly tested.


295-310: Update CallEvent to include RevertOptionsStruct.

The CallEvent now includes RevertOptionsStruct, providing additional context. Verify that this change is correctly integrated and tested.


Line range hint 433-456:
Update WithdrawalEvent to include RevertOptionsStruct.

The WithdrawalEvent now includes RevertOptionsStruct, enhancing event context. Ensure this change is correctly integrated and tested.


Line range hint 969-1057:
Update event filters to include RevertOptionsStruct.

The event filters now include RevertOptionsStruct, providing enhanced filtering capabilities. Verify that these changes are correctly integrated and tested.

v2/pkg/testuniversalcontract.sol/testuniversalcontract.go (3)

236-238: Update context parameter type in OnRevert.

The OnRevert function now uses ZContext instead of RevertContext. Ensure that all usages of this function across the codebase are updated to match the new parameter type.


243-245: Update context parameter type in OnRevert for session.

The OnRevert function in TestUniversalContractSession now uses ZContext. Verify that the session calls are updated accordingly.


250-252: Update context parameter type in OnRevert for transactor session.

The OnRevert function in TestUniversalContractTransactorSession now uses ZContext. Ensure consistency in function calls with the new parameter type.

v2/typechain-types/GatewayEVM.ts (9)

26-30: Introduce RevertOptionsStruct.

The RevertOptionsStruct is a new type that provides additional options for handling reverts. This enhances the flexibility and robustness of transaction management.


48-51: Update deposit method signatures to include RevertOptionsStruct.

The deposit methods now accept RevertOptionsStruct, allowing for more nuanced control over transaction behavior. Ensure that all calls to these methods are updated to include the new parameter.


111-134: Update encodeFunctionData for new signatures.

The encodeFunctionData method signatures are updated to handle the new RevertOptionsStruct. This ensures proper encoding of function calls with the new parameters.


301-314: Update CallEvent to include RevertOptionsStruct.

The CallEvent now includes RevertOptionsStruct, reflecting the additional options available for handling reverts. This change ensures that event logs capture the full context of transactions.


328-345: Update DepositEvent to include RevertOptionsStruct.

The DepositEvent now includes RevertOptionsStruct, enhancing the event's ability to convey transaction revert options.


Line range hint 1036-1047: Update event filters to include RevertOptionsStruct.

The event filters for Call and Deposit events now include RevertOptionsStruct, ensuring that the filters can handle the new parameters.


599-603: Avoid using void outside return types.

The use of void in parameter lists is confusing. Consider replacing void with undefined to align with TypeScript best practices.

- [void],
+ [undefined],

Likely invalid or redundant comment.


627-632: Avoid using void outside return types.

Replace void with undefined in parameter lists to adhere to best practices.

- [void],
+ [undefined],

Likely invalid or redundant comment.


616-622: Avoid using void outside return types.

Replace void with undefined in parameter lists to improve clarity.

- [void],
+ [undefined],

Likely invalid or redundant comment.

v2/typechain-types/GatewayEVMUpgradeTest.ts (9)

26-30: Introduce RevertOptionsStruct.

The RevertOptionsStruct is a new type that provides additional options for handling reverts, enhancing transaction management.


48-51: Update deposit method signatures to include RevertOptionsStruct.

The deposit methods now accept RevertOptionsStruct, allowing for more nuanced control over transaction behavior. Ensure that all calls to these methods are updated to include the new parameter.


112-135: Update encodeFunctionData for new signatures.

The encodeFunctionData method signatures are updated to handle the new RevertOptionsStruct. This ensures proper encoding of function calls with the new parameters.


302-315: Update CallEvent to include RevertOptionsStruct.

The CallEvent now includes RevertOptionsStruct, reflecting the additional options available for handling reverts. This change ensures that event logs capture the full context of transactions.


329-346: Update DepositEvent to include RevertOptionsStruct.

The DepositEvent now includes RevertOptionsStruct, enhancing the event's ability to convey transaction revert options.


Line range hint 1062-1073: Update event filters to include RevertOptionsStruct.

The event filters for Call and Deposit events now include RevertOptionsStruct, ensuring that the filters can handle the new parameters.


646-651: Avoid using void outside return types.

Replace void with undefined in parameter lists to adhere to best practices.

- [void],
+ [undefined],

Likely invalid or redundant comment.


618-622: Avoid using void outside return types.

The use of void in parameter lists is confusing. Consider replacing void with undefined to align with TypeScript best practices.

- [void],
+ [undefined],

Likely invalid or redundant comment.


635-641: Avoid using void outside return types.

Replace void with undefined in parameter lists to improve clarity.

- [void],
+ [undefined],

Likely invalid or redundant comment.

v2/typechain-types/GatewayEVMEchidnaTest.ts (9)

26-30: RevertOptionsStruct Definition Looks Good.

The structure of RevertOptionsStruct is well-defined and aligns with the intended functionality for handling revert options.


32-36: RevertOptionsStructOutput Definition Looks Good.

The structure of RevertOptionsStructOutput is well-defined and provides a clear mapping for output scenarios.


114-115: Function Signature Update for call Looks Good.

The inclusion of RevertOptionsStruct in the call function signature enhances error handling capabilities.


118-119: Function Signature Update for deposit Looks Good.

The inclusion of RevertOptionsStruct in the deposit function signature is consistent with enhanced revert management.


126-127: Function Signature Update for depositAndCall Looks Good.

The inclusion of RevertOptionsStruct in the depositAndCall function signature enhances the function's error handling capabilities.


322-323: Event Definition Update for CallEvent Looks Good.

The inclusion of revertOptions in the CallEvent definition improves the event's ability to track transaction states and manage errors.


349-350: Event Definition Update for DepositEvent Looks Good.

The inclusion of revertOptions in the DepositEvent definition improves the event's ability to track transaction states and manage errors.


1080-1081: Filter Update for Call Event Looks Good.

The inclusion of a tuple in the Call event filter aligns with the updated event definition and maintains consistency.


1091-1092: Filter Update for Deposit Event Looks Good.

The inclusion of a tuple in the Deposit event filter aligns with the updated event definition and maintains consistency.

v2/test/GatewayZEVM.t.sol (39)

29-29: Integration of revertOptions Looks Good.

The addition of revertOptions as a state variable enhances the contract's error handling capabilities.


67-68: Initialization of revertOptions Looks Good.

The revertOptions variable is initialized correctly, ensuring it has the necessary values for testing.


76-78: Inclusion of revertOptions in Withdrawal Emit Statement Looks Good.

The emit Withdrawal statement now includes revertOptions, which enhances the tracking of transaction states.


79-79: Inclusion of revertOptions in withdraw Function Call Looks Good.

The withdraw function call now includes revertOptions, ensuring enhanced error handling during execution.


94-94: Inclusion of revertOptions in withdraw Function Call Looks Good.

The withdraw function call now includes revertOptions, ensuring enhanced error handling during execution.


103-103: Inclusion of revertOptions in withdraw Function Call Looks Good.

The withdraw function call now includes revertOptions, ensuring enhanced error handling during execution.


108-108: Inclusion of revertOptions in withdraw Function Call Looks Good.

The withdraw function call now includes revertOptions, ensuring enhanced error handling during execution.


113-113: Inclusion of revertOptions in withdraw Function Call Looks Good.

The withdraw function call now includes revertOptions, ensuring enhanced error handling during execution.


125-125: Inclusion of revertOptions in withdraw Function Call Looks Good.

The withdraw function call now includes revertOptions, ensuring enhanced error handling during execution.


135-135: Inclusion of revertOptions in withdrawAndCall Function Call Looks Good.

The withdrawAndCall function call now includes revertOptions, ensuring enhanced error handling during execution.


141-141: Inclusion of revertOptions in withdrawAndCall Function Call Looks Good.

The withdrawAndCall function call now includes revertOptions, ensuring enhanced error handling during execution.


154-154: Inclusion of revertOptions in withdrawAndCall Function Call Looks Good.

The withdrawAndCall function call now includes revertOptions, ensuring enhanced error handling during execution.


178-178: Inclusion of revertOptions in withdrawAndCall Function Call Looks Good.

The withdrawAndCall function call now includes revertOptions, ensuring enhanced error handling during execution.


186-186: Inclusion of revertOptions in withdraw Function Call Looks Good.

The withdraw function call now includes revertOptions, ensuring enhanced error handling during execution.


191-191: Inclusion of revertOptions in withdraw Function Call Looks Good.

The withdraw function call now includes revertOptions, ensuring enhanced error handling during execution.


197-197: Inclusion of revertOptions in withdrawAndCall Function Call Looks Good.

The withdrawAndCall function call now includes revertOptions, ensuring enhanced error handling during execution.


203-203: Inclusion of revertOptions in withdrawAndCall Function Call Looks Good.

The withdrawAndCall function call now includes revertOptions, ensuring enhanced error handling during execution.


215-215: Inclusion of revertOptions in withdraw Function Call Looks Good.

The withdraw function call now includes revertOptions, ensuring enhanced error handling during execution.


239-239: Inclusion of revertOptions in withdraw Function Call Looks Good.

The withdraw function call now includes revertOptions, ensuring enhanced error handling during execution.


258-258: Inclusion of revertOptions in withdraw Function Call Looks Good.

The withdraw function call now includes revertOptions, ensuring enhanced error handling during execution.


273-273: Inclusion of revertOptions in withdrawAndCall Function Call Looks Good.

The withdrawAndCall function call now includes revertOptions, ensuring enhanced error handling during execution.


298-298: Inclusion of revertOptions in withdrawAndCall Function Call Looks Good.

The withdrawAndCall function call now includes revertOptions, ensuring enhanced error handling during execution.


313-313: Inclusion of revertOptions in call Function Call Looks Good.

The call function call now includes revertOptions, ensuring enhanced error handling during execution.


322-322: Inclusion of revertOptions in call Function Call Looks Good.

The call function call now includes revertOptions, ensuring enhanced error handling during execution.


336-336: Integration of revertOptions Looks Good.

The addition of revertOptions as a state variable enhances the contract's error handling capabilities.


534-535: Use of zContext in executeRevert Function Looks Good.

The executeRevert function now uses zContext, ensuring consistent handling of context data.


544-545: Use of zContext in executeRevert Function Looks Good.

The executeRevert function now uses zContext, ensuring consistent handling of context data.


554-555: Use of zContext in executeRevert Function Looks Good.

The executeRevert function now uses zContext, ensuring consistent handling of context data.


564-565: Use of zContext in executeRevert Function Looks Good.

The executeRevert function now uses zContext, ensuring consistent handling of context data.


574-575: Use of zContext in executeRevert Function Looks Good.

The executeRevert function now uses zContext, ensuring consistent handling of context data.


584-585: Use of zContext in executeRevert Function Looks Good.

The executeRevert function now uses zContext, ensuring consistent handling of context data.


595-596: Use of zContext in executeRevert Function Looks Good.

The executeRevert function now uses zContext, ensuring consistent handling of context data.


682-683: Use of zContext in depositAndRevert Function Looks Good.

The depositAndRevert function now uses zContext, ensuring consistent handling of context data.


692-693: Use of zContext in depositAndRevert Function Looks Good.

The depositAndRevert function now uses zContext, ensuring consistent handling of context data.


702-703: Use of zContext in depositAndRevert Function Looks Good.

The depositAndRevert function now uses zContext, ensuring consistent handling of context data.


715-716: Use of zContext in depositAndRevert Function Looks Good.

The depositAndRevert function now uses zContext, ensuring consistent handling of context data.


729-730: Use of zContext in depositAndRevert Function Looks Good.

The depositAndRevert function now uses zContext, ensuring consistent handling of context data.


739-740: Use of zContext in depositAndRevert Function Looks Good.

The depositAndRevert function now uses zContext, ensuring consistent handling of context data.


749-750: Use of zContext in depositAndRevert Function Looks Good.

The depositAndRevert function now uses zContext, ensuring consistent handling of context data.

v2/pkg/igatewayevm.sol/igatewayevmevents.go (9)

33-37: Struct RevertOptions is well-defined.

The RevertOptions struct encapsulates additional parameters for event handling, enhancing error handling capabilities. The field types are appropriate.


259-263: Struct IGatewayEVMEventsCall updated correctly.

The addition of RevertOptions aligns with the updated ABI and provides additional context for the Call event.


414-420: Struct IGatewayEVMEventsDeposit updated correctly.

The addition of RevertOptions aligns with the updated ABI and provides additional context for the Deposit event.


Line range hint 266-285: Function FilterCall updated correctly.

The function adapts to the new Call event structure, including RevertOptions, while maintaining existing filtering logic.


Line range hint 287-331: Function WatchCall updated correctly.

The function adapts to the new Call event structure, including RevertOptions, while maintaining existing subscription logic.


Line range hint 333-340: Function ParseCall updated correctly.

The function adapts to the new Call event structure, including RevertOptions, while maintaining existing parsing logic.


Line range hint 423-442: Function FilterDeposit updated correctly.

The function adapts to the new Deposit event structure, including RevertOptions, while maintaining existing filtering logic.


Line range hint 444-488: Function WatchDeposit updated correctly.

The function adapts to the new Deposit event structure, including RevertOptions, while maintaining existing subscription logic.


Line range hint 490-497: Function ParseDeposit updated correctly.

The function adapts to the new Deposit event structure, including RevertOptions, while maintaining existing parsing logic.

v2/pkg/igatewayzevm.sol/igatewayzevm.go (3)

32-36: LGTM! Struct RevertOptions is well-defined.

The new struct RevertOptions provides a clear and structured way to handle revert scenarios.


497-501: LGTM! Event structs include RevertOptions.

The addition of RevertOptions to IGatewayZEVMCall and IGatewayZEVMWithdrawal enhances event logging.

Also applies to: 661-661


200-201: LGTM! Verify consistent usage of RevertOptions.

The function signatures have been updated correctly to include RevertOptions.

Ensure that all function calls are updated to match the new signatures.

Also applies to: 207-208, 214-215, 347-348, 354-355, 361-362, 368-369, 375-376, 382-383, 389-390, 396-397, 403-404, 410-411, 417-418, 424-425

v2/typechain-types/factories/GatewayEVM__factory.ts (5)

99-119: Consistent use of revertOptions structure.

The addition of the revertOptions structure enhances error handling across multiple functions. Ensure that all functions using this structure are tested for the new functionality.

Also applies to: 147-167, 192-212, 232-252, 282-302


690-712: Inclusion of revertOptions in events.

Adding revertOptions to events improves transparency and aids in debugging. Ensure that these events are emitted correctly in the contract logic.

Also applies to: 750-772


1177-1177: Flexible constructor parameters.

The addition of [signer?: Signer] to GatewayEVMConstructorParams provides flexibility in factory construction. Ensure that both constructor scenarios are tested.


Line range hint 1181-1187: Correct constructor logic for parameter differentiation.

The constructor logic correctly handles different parameter types using isSuperArgs. Ensure that tests cover both constructor paths.


Line range hint 1195-1212: Consistency in static properties and methods.

The updates to static properties and methods ensure consistency with the new ABI and bytecode. Ensure related documentation and tests are updated accordingly.

v2/typechain-types/factories/GatewayEVMUpgradeTest__factory.ts (8)

102-123: Addition of revertOptions parameter in call function is well-defined.

The revertOptions tuple is appropriately structured for handling revert scenarios. Ensure consistency across all functions using this parameter.


150-171: Addition of revertOptions parameter in deposit function is consistent.

The revertOptions tuple maintains consistency with other function definitions.


195-216: Addition of revertOptions parameter in overloaded deposit function is consistent.

The revertOptions tuple maintains consistency with other function definitions.


235-256: Addition of revertOptions parameter in depositAndCall function is consistent.

The revertOptions tuple maintains consistency with other function definitions.


285-306: Addition of revertOptions parameter in overloaded depositAndCall function is consistent.

The revertOptions tuple maintains consistency with other function definitions.


693-715: Addition of revertOptions parameter in Call event is consistent.

The revertOptions tuple maintains consistency with other event definitions.


753-775: Addition of revertOptions parameter in Deposit event is consistent.

The revertOptions tuple maintains consistency with other event definitions.


1207-1207: Constructor parameter changes are valid.

The inclusion of an optional signer parameter enhances flexibility in contract deployment.

v2/typechain-types/factories/GatewayZEVM__factory.ts (7)

95-115: Addition of revertOptions to call function looks good.

The inclusion of revertOptions enhances error handling by providing structured options for reverts. This aligns well with the PR's objective of improving functionality.


246-246: Change of context to zContext is appropriate.

The update to zContext suggests an enhancement of the structure, aligning with the PR's goal of improving context management.


601-620: Addition of revertOptions to withdraw function is consistent and beneficial.

This change aligns with the overall enhancement strategy for error handling.


696-715: Inclusion of revertOptions in withdrawAndCall function aligns well with error handling improvements.

The structured approach to managing reverts is consistent with the PR's objectives.


813-834: Inclusion of revertOptions in Call event enhances transparency.

Adding revertOptions to events supports better debugging and aligns with the PR's enhancements.


1018-1039: Addition of revertOptions to Withdrawal event is consistent and useful.

This change aligns with the enhancement of error handling and transparency.


641-644: Replacement of chainId with zrc20 is appropriate.

This change suggests a shift in focus towards specific token standards, aligning with the PR's goals.

v2/pkg/systemcontractmock.sol/systemcontractmock.go (1)

35-35: Verify ABI and Bin consistency.

The updated ABI and Bin values indicate changes to the contract's interface and logic. Ensure that these changes align with the intended functionality and that all related components are updated accordingly.

v2/pkg/igatewayevm.sol/igatewayevm.go (8)

32-37: RevertOptions struct looks good.

The RevertOptions struct is well-defined and aligns with the intended functionality of managing revert scenarios.


448-452: IGatewayEVMCall struct update looks good.

The addition of the RevertOptions field to IGatewayEVMCall is consistent with the changes made to the function signatures.


603-609: IGatewayEVMDeposit struct update looks good.

The addition of the RevertOptions field to IGatewayEVMDeposit is consistent with the changes made to the function signatures.


193-194: Verify function signature updates for Call method.

The Call method signatures have been updated to include the RevertOptions parameter. Ensure that all function calls to Call are updated accordingly.

Also applies to: 200-201, 207-208

Verification successful

Function Signature Update Verified

The Call method signatures have been successfully updated to include the RevertOptions parameter across the codebase. All instances reflect the new signature, ensuring consistency and correctness.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `Call` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'Call(receiver common.Address, payload []byte, revertOptions RevertOptions)'

Length of output: 271


Script:

#!/bin/bash
# Description: Verify all function calls to `Call` match the new signature.

# Corrected Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 'Call\(receiver common\.Address, payload \[\]byte, revertOptions RevertOptions\)'

Length of output: 10562


256-257: Verify function signature updates for DepositAndCall method.

The DepositAndCall method signatures have been updated to include the RevertOptions parameter. Ensure that all function calls to DepositAndCall are updated accordingly.

Also applies to: 263-264, 270-271

Verification successful

Function signature updates for DepositAndCall verified successfully.

All instances of the DepositAndCall method in the codebase have been updated to include the RevertOptions parameter. No further changes are needed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `DepositAndCall` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'DepositAndCall(receiver common.Address, payload []byte, revertOptions RevertOptions)'

Length of output: 301


Script:

#!/bin/bash
# Description: Verify all function calls to `DepositAndCall` include the new `revertOptions` parameter.

# Test: Search for the function usage and check for the presence of `revertOptions` in the context.
rg --type go -A 5 'DepositAndCall' | rg 'revertOptions'

Length of output: 14375


277-278: Verify function signature updates for DepositAndCall0 method.

The DepositAndCall0 method signatures have been updated to include the RevertOptions parameter. Ensure that all function calls to DepositAndCall0 are updated accordingly.

Also applies to: 284-285, 291-292

Verification successful

Function Signature Updates Verified for DepositAndCall0 Method

The DepositAndCall0 method's signature, including the RevertOptions parameter, has been consistently updated across the codebase. All relevant function calls now correctly include this parameter.

  • Verified in files such as v2/pkg/igatewayevm.sol/igatewayevm.go and others.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `DepositAndCall0` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'DepositAndCall0(receiver common.Address, amount *big.Int, asset common.Address, payload []byte, revertOptions RevertOptions)'

Length of output: 421


Script:

#!/bin/bash
# Description: Verify all function calls to `DepositAndCall0` match the new signature.

# Corrected Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 'DepositAndCall0\('

Length of output: 14610


214-215: Verify function signature updates for Deposit method.

The Deposit method signatures have been updated to include the RevertOptions parameter. Ensure that all function calls to Deposit are updated accordingly.

Also applies to: 221-222, 228-229


235-236: Verify function signature updates for Deposit0 method.

The Deposit0 method signatures have been updated to include the RevertOptions parameter. Ensure that all function calls to Deposit0 are updated accordingly.

Also applies to: 242-243, 249-250

Verification successful

Function signature updates for Deposit0 verified successfully.

All occurrences of the Deposit0 function in the codebase include the revertOptions parameter, confirming that the updates have been applied consistently. No further changes are required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `Deposit0` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'Deposit0(receiver common.Address, amount *big.Int, asset common.Address, revertOptions RevertOptions)'

Length of output: 123


Script:

#!/bin/bash
# Description: Search for all function calls to `Deposit0` in the codebase to verify their signatures.

# Search for all occurrences of `Deposit0` function calls and include context lines to check the parameters.
rg --type go -A 5 'Deposit0('

Length of output: 100


Script:

#!/bin/bash
# Description: Search for all function calls to `Deposit0` in the codebase to verify their signatures.

# Correct the regex pattern by escaping the parentheses.
rg --type go -A 5 'Deposit0\('

Length of output: 9614

v2/pkg/systemcontract.sol/systemcontract.go (2)

Line range hint 77-91:
Verify Deployment Logic with Updated ABI.

Ensure that the DeploySystemContract function correctly handles the updated ABI and bytecode. Verify that the deployment parameters align with the new contract structure.

Verification successful

Deployment Logic Correctly Handles ABI and Bytecode

The DeploySystemContract function properly retrieves and checks the ABI, uses the bytecode, and deploys the contract using bind.DeployContract. The deployment logic aligns with the updated contract structure.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the `DeploySystemContract` function aligns with the updated ABI and bytecode.

# Test: Search for the deployment logic and parameters. Expect: Correct alignment with the updated ABI.
rg --type go -A 5 $'DeploySystemContract'

Length of output: 3567


Script:

#!/bin/bash
# Extract the full implementation of the `DeploySystemContract` function to verify ABI and bytecode handling.
ast-grep --lang go --pattern 'func DeploySystemContract($_, $_, $_, $_, $_) ($_, $_, $_, $_) { $$$ }'

Length of output: 3550


Line range hint 36-42:
Ensure ABI Consistency and Completeness.

The updated ABI includes a structured context parameter in the depositAndCall function. Verify that all components of the context (origin, sender, chainID) are correctly utilized in the contract logic and that the ABI accurately reflects the contract's functionality.

v2/typechain-types/factories/GatewayEVMEchidnaTest__factory.ts (5)

150-171: Enhancement: Added revertOptions to deposit function.

The revertOptions tuple is added to improve error handling by allowing specific actions on revert scenarios. Verify that this addition is consistently used across all relevant functions and that the handling logic is correctly implemented.


195-216: Enhancement: Added revertOptions to deposit function variant.

The inclusion of the revertOptions tuple supports improved error handling. Ensure consistent implementation across all relevant functions.


235-256: Enhancement: Added revertOptions to depositAndCall function.

The revertOptions tuple enhances error handling by providing structured parameters for revert scenarios. Ensure consistent usage across all relevant functions.


285-306: Enhancement: Added revertOptions to depositAndCall function variant.

The inclusion of the revertOptions tuple supports improved error handling. Ensure consistent implementation across all relevant functions.


102-123: Enhancement: Added revertOptions to call function.

The addition of the revertOptions tuple enhances error handling by providing structured parameters for revert scenarios. Ensure that this addition is consistently used across all relevant functions and that the handling logic is correctly implemented.

Verification successful

Verification Complete: Consistent Usage of revertOptions

The revertOptions parameter is consistently used across multiple relevant functions and structures in the codebase. Ensure that the logic handling these options is correctly implemented in all instances.

  • Files with consistent usage include:
    • v2/typechain-types/GatewayZEVM.ts
    • v2/typechain-types/GatewayEVMEchidnaTest.ts
    • v2/typechain-types/GatewayEVM.ts
    • v2/typechain-types/GatewayEVMUpgradeTest.ts
    • Various factory files
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistent usage of `revertOptions` across the codebase.

# Test: Search for the usage of `revertOptions` in function signatures. Expect: Consistent usage across all relevant functions.
rg --type ts -A 5 $'revertOptions'

Length of output: 69502

v2/pkg/zetaconnectornative.sol/zetaconnectornative.go (1)

35-35: Ensure ABI changes are documented and tested.

The ABI has been updated with new functions like withdrawAndCall and withdrawAndRevert, as well as new error types. Ensure these changes are reflected in the documentation and adequately tested.

v2/pkg/zetaconnectornonnative.sol/zetaconnectornonnative.go (2)

35-35: Verify ABI changes for consistency and security.

The ABI has been expanded to include new functions and events. Ensure that these changes are consistent with the intended functionality and do not introduce security vulnerabilities.

Verification successful

ABI changes are consistent and secure.

The ABI changes, including new functions and events related to roles and token management, are consistent with the intended functionality. There are no indications of security vulnerabilities or inconsistent usage in the codebase.

  • The ZetaConnectorNonNativeMetaData variable is used consistently within the same file.
  • The new functions and events align with the contract's expanded capabilities.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of ABI changes with the intended functionality.

# Test: Search for the ABI usage in the codebase. Expect: Consistent usage of new functions and events.
rg --type go -A 5 $'ZetaConnectorNonNativeMetaData'

Length of output: 22231


Line range hint 38-41:
Ensure deprecated variables are not used elsewhere.

The variables ZetaConnectorNonNativeABI and ZetaConnectorNonNativeBin are deprecated. Verify that they are not used elsewhere in the codebase, and ensure the transition to ZetaConnectorNonNativeMetaData is complete.

Verification successful

Ensure Internal Transition to ZetaConnectorNonNativeMetaData is Complete

The deprecated variables ZetaConnectorNonNativeABI and ZetaConnectorNonNativeBin are not used elsewhere in the codebase. However, ZetaConnectorNonNativeBin is still used internally within its declaration file. Consider updating this internal usage to ensure full transition to ZetaConnectorNonNativeMetaData.

  • Update usage within v2/pkg/zetaconnectornonnative.sol/zetaconnectornonnative.go to use ZetaConnectorNonNativeMetaData.Bin.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that deprecated variables are not used elsewhere in the codebase.

# Test: Search for the usage of deprecated variables. Expect: No usage of `ZetaConnectorNonNativeABI` and `ZetaConnectorNonNativeBin`.
rg --type go $'ZetaConnectorNonNativeABI|ZetaConnectorNonNativeBin'

Length of output: 832


Script:

#!/bin/bash
# Description: Verify if deprecated variables are used outside their declaration file.

# Test: Search for the usage of deprecated variables in the entire codebase, excluding their declaration file.
rg --type go --glob '!v2/pkg/zetaconnectornonnative.sol/zetaconnectornonnative.go' $'ZetaConnectorNonNativeABI|ZetaConnectorNonNativeBin'

Length of output: 138

v2/pkg/erc20custody.sol/erc20custody.go (2)

35-35: LGTM! ABI and binary updates enhance functionality.

The ABI and binary updates are well-structured and enhance the contract's functionality by adding new methods and events for improved withdrawal capabilities.


35-35: Verify ABI consistency with Solidity contract.

Ensure that the updated ABI accurately reflects the Solidity contract's functions and events, especially the new withdrawAndCall and withdrawAndRevert methods.

Verification successful

ABI Consistency Verified

The ABI in the Go file accurately reflects the Solidity contract's functions and events, including withdrawAndCall and withdrawAndRevert. The changes are consistent with the contract's implementation.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify ABI consistency with the Solidity contract.

# Test: Check if the ABI matches the Solidity contract.
# Expect: The ABI in the Go file should match the functions and events in the Solidity contract.
rg --type solidity 'function withdrawAndCall|function withdrawAndRevert|event WithdrawAndCall|event WithdrawAndRevert'

Length of output: 153


Script:

#!/bin/bash
# Description: Locate Solidity files and verify ABI consistency with the Solidity contract.

# Step 1: Find all Solidity files in the repository.
sol_files=$(fd --extension sol)

# Step 2: Search for the functions and events in the located Solidity files.
for file in $sol_files; do
  echo "Searching in $file"
  rg 'function withdrawAndCall|function withdrawAndRevert|event WithdrawAndCall|event WithdrawAndRevert' "$file"
done

Length of output: 159364

@@ -32,7 +32,7 @@ var (
// ZetaConnectorNonNativeMetaData contains all meta data concerning the ZetaConnectorNonNative contract.
var ZetaConnectorNonNativeMetaData = &bind.MetaData{
ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"gateway_\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"zetaToken_\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"tssAddress_\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"admin_\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"DEFAULT_ADMIN_ROLE\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"PAUSER_ROLE\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"TSS_ROLE\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"WITHDRAWER_ROLE\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"gateway\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"contractIGatewayEVM\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getRoleAdmin\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"grantRole\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"hasRole\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"maxSupply\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"paused\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"receiveTokens\",\"inputs\":[{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"renounceRole\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"callerConfirmation\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"revokeRole\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setMaxSupply\",\"inputs\":[{\"name\":\"maxSupply_\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"supportsInterface\",\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\",\"internalType\":\"bytes4\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"unpause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdraw\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"internalSendHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdrawAndCall\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"internalSendHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdrawAndRevert\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"internalSendHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"zetaToken\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"event\",\"name\":\"MaxSupplyUpdated\",\"inputs\":[{\"name\":\"maxSupply\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Paused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"RoleAdminChanged\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"previousAdminRole\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"newAdminRole\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"RoleGranted\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"account\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"sender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"RoleRevoked\",\"inputs\":[{\"name\":\"role\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"account\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"sender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Unpaused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Withdraw\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"WithdrawAndCall\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"WithdrawAndRevert\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"AccessControlBadConfirmation\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"AccessControlUnauthorizedAccount\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"neededRole\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"EnforcedPause\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ExceedsMaxSupply\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ExpectedPause\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ReentrancyGuardReentrantCall\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ZeroAddress\",\"inputs\":[]}]",
Bin: "0x60c060405260001960035534801561001657600080fd5b5060405161155a38038061155a83398101604081905261003591610220565b60016000819055805460ff19169055838383836001600160a01b038416158061006557506001600160a01b038316155b8061007757506001600160a01b038216155b8061008957506001600160a01b038116155b156100a75760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03808516608052831660a0526100c5600082610154565b506100f07f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e483610154565b5061011b7f0da06bffcb63442de88b7f8385468eaf51e47079d4fa96875938e2c27c451deb83610154565b506101467f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a82610154565b505050505050505050610274565b60008281526002602090815260408083206001600160a01b038516845290915281205460ff166101fa5760008381526002602090815260408083206001600160a01b03861684529091529020805460ff191660011790556101b23390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016101fe565b5060005b92915050565b80516001600160a01b038116811461021b57600080fd5b919050565b6000806000806080858703121561023657600080fd5b61023f85610204565b935061024d60208601610204565b925061025b60408601610204565b915061026960608601610204565b905092959194509250565b60805160a0516112826102d86000396000818161021d01528181610531015281816108240152818161097b01528181610ad00152610bf20152600081816101d1015281816104a1015281816105040152818161079401526107f701526112826000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c80635e3e9fef116100d857806391d148541161008c578063d547741f11610066578063d547741f14610386578063d5abeb0114610399578063e63ab1e9146103a257600080fd5b806391d1485414610311578063a217fddf14610357578063a783c7891461035f57600080fd5b8063743e0c9b116100bd578063743e0c9b146102cf5780638456cb59146102e257806385f438c1146102ea57600080fd5b80635e3e9fef146102a95780636f8b44b0146102bc57600080fd5b8063248a9ca31161012f57806336568abe1161011457806336568abe146102835780633f4ba83a146102965780635c975abb1461029e57600080fd5b8063248a9ca31461023f5780632f2ff15d1461027057600080fd5b8063106e629011610160578063106e6290146101b9578063116191b6146101cc57806321e093b11461021857600080fd5b806301ffc9a71461017c57806302d5c899146101a4575b600080fd5b61018f61018a366004610fb4565b6103c9565b60405190151581526020015b60405180910390f35b6101b76101b2366004611026565b610462565b005b6101b76101c73660046110b8565b6105f7565b6101f37f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b6101f37f000000000000000000000000000000000000000000000000000000000000000081565b61026261024d3660046110eb565b60009081526002602052604090206001015490565b60405190815260200161019b565b6101b761027e366004611104565b61069c565b6101b7610291366004611104565b6106c7565b6101b7610720565b60015460ff1661018f565b6101b76102b7366004611026565b610755565b6101b76102ca3660046110eb565b6108d0565b6101b76102dd3660046110eb565b61093e565b6101b76109e8565b6102627f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e481565b61018f61031f366004611104565b600091825260026020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b610262600081565b6102627f0da06bffcb63442de88b7f8385468eaf51e47079d4fa96875938e2c27c451deb81565b6101b7610394366004611104565b610a1a565b61026260035481565b6102627f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061045c57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b61046a610a3f565b7f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e461049481610a82565b61049c610a8c565b6104c77f00000000000000000000000000000000000000000000000000000000000000008684610acb565b6040517fb8969bd400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063b8969bd490610561907f0000000000000000000000000000000000000000000000000000000000000000908a908a908a908a90600401611179565b600060405180830381600087803b15801561057b57600080fd5b505af115801561058f573d6000803e3d6000fd5b505050508573ffffffffffffffffffffffffffffffffffffffff167fba96f26bdda53eb8c8ba39045dfb4ff39753fbc7a6edcf250a88e75e78d102fe8686866040516105dd939291906111d6565b60405180910390a2506105f06001600055565b5050505050565b6105ff610a3f565b7f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e461062981610a82565b610631610a8c565b61063c848484610acb565b8373ffffffffffffffffffffffffffffffffffffffff167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243648460405161068491815260200190565b60405180910390a2506106976001600055565b505050565b6000828152600260205260409020600101546106b781610a82565b6106c18383610c53565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610716576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6106978282610d53565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a61074a81610a82565b610752610e12565b50565b61075d610a3f565b7f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e461078781610a82565b61078f610a8c565b6107ba7f00000000000000000000000000000000000000000000000000000000000000008684610acb565b6040517f5131ab5900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690635131ab5990610854907f0000000000000000000000000000000000000000000000000000000000000000908a908a908a908a90600401611179565b600060405180830381600087803b15801561086e57600080fd5b505af1158015610882573d6000803e3d6000fd5b505050508573ffffffffffffffffffffffffffffffffffffffff167f7772f56296d3a5202974a45c61c9188d844ab4d6eeb18c851e4b8d5384ca6ced8686866040516105dd939291906111d6565b7f0da06bffcb63442de88b7f8385468eaf51e47079d4fa96875938e2c27c451deb6108fa81610a82565b610902610a8c565b60038290556040518281527f7810bd47de260c3e9ee10061cf438099dd12256c79485f12f94dbccc981e806c9060200160405180910390a15050565b610946610a8c565b6040517f79cc6790000000000000000000000000000000000000000000000000000000008152336004820152602481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906379cc679090604401600060405180830381600087803b1580156109d457600080fd5b505af11580156105f0573d6000803e3d6000fd5b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a610a1281610a82565b610752610e8f565b600082815260026020526040902060010154610a3581610a82565b6106c18383610d53565b600260005403610a7b576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600055565b6107528133610ee8565b60015460ff1615610ac9576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b6003547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5d91906111f9565b610b679084611212565b1115610b9f576040517fc30436e900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f1e458bee00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015260248201849052604482018390527f00000000000000000000000000000000000000000000000000000000000000001690631e458bee90606401600060405180830381600087803b158015610c3657600080fd5b505af1158015610c4a573d6000803e3d6000fd5b50505050505050565b600082815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610d4b57600083815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610ce93390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161045c565b50600061045c565b600082815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610d4b57600083815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161045c565b610e1a610f78565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b610e97610a8c565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833610e65565b600082815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610f74576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024810183905260440160405180910390fd5b5050565b60015460ff16610ac9576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060208284031215610fc657600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610ff657600080fd5b9392505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461102157600080fd5b919050565b60008060008060006080868803121561103e57600080fd5b61104786610ffd565b945060208601359350604086013567ffffffffffffffff81111561106a57600080fd5b8601601f8101881361107b57600080fd5b803567ffffffffffffffff81111561109257600080fd5b8860208284010111156110a457600080fd5b959894975060200195606001359392505050565b6000806000606084860312156110cd57600080fd5b6110d684610ffd565b95602085013595506040909401359392505050565b6000602082840312156110fd57600080fd5b5035919050565b6000806040838503121561111757600080fd5b8235915061112760208401610ffd565b90509250929050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8616815273ffffffffffffffffffffffffffffffffffffffff851660208201528360408201526080606082015260006111cb608083018486611130565b979650505050505050565b8381526040602082015260006111f0604083018486611130565b95945050505050565b60006020828403121561120b57600080fd5b5051919050565b8082018082111561045c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220de5fa55e0ca79ea2f08903481d01ea00bbbf346b9cfba44e12a2dd6f3a6f2e8a64736f6c634300081a0033",
Bin: "0x60c060405260001960035534801561001657600080fd5b5060405161155a38038061155a83398101604081905261003591610220565b60016000819055805460ff19169055838383836001600160a01b038416158061006557506001600160a01b038316155b8061007757506001600160a01b038216155b8061008957506001600160a01b038116155b156100a75760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03808516608052831660a0526100c5600082610154565b506100f07f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e483610154565b5061011b7f0da06bffcb63442de88b7f8385468eaf51e47079d4fa96875938e2c27c451deb83610154565b506101467f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a82610154565b505050505050505050610274565b60008281526002602090815260408083206001600160a01b038516845290915281205460ff166101fa5760008381526002602090815260408083206001600160a01b03861684529091529020805460ff191660011790556101b23390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016101fe565b5060005b92915050565b80516001600160a01b038116811461021b57600080fd5b919050565b6000806000806080858703121561023657600080fd5b61023f85610204565b935061024d60208601610204565b925061025b60408601610204565b915061026960608601610204565b905092959194509250565b60805160a0516112826102d86000396000818161021d01528181610531015281816108240152818161097b01528181610ad00152610bf20152600081816101d1015281816104a1015281816105040152818161079401526107f701526112826000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c80635e3e9fef116100d857806391d148541161008c578063d547741f11610066578063d547741f14610386578063d5abeb0114610399578063e63ab1e9146103a257600080fd5b806391d1485414610311578063a217fddf14610357578063a783c7891461035f57600080fd5b8063743e0c9b116100bd578063743e0c9b146102cf5780638456cb59146102e257806385f438c1146102ea57600080fd5b80635e3e9fef146102a95780636f8b44b0146102bc57600080fd5b8063248a9ca31161012f57806336568abe1161011457806336568abe146102835780633f4ba83a146102965780635c975abb1461029e57600080fd5b8063248a9ca31461023f5780632f2ff15d1461027057600080fd5b8063106e629011610160578063106e6290146101b9578063116191b6146101cc57806321e093b11461021857600080fd5b806301ffc9a71461017c57806302d5c899146101a4575b600080fd5b61018f61018a366004610fb4565b6103c9565b60405190151581526020015b60405180910390f35b6101b76101b2366004611026565b610462565b005b6101b76101c73660046110b8565b6105f7565b6101f37f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b6101f37f000000000000000000000000000000000000000000000000000000000000000081565b61026261024d3660046110eb565b60009081526002602052604090206001015490565b60405190815260200161019b565b6101b761027e366004611104565b61069c565b6101b7610291366004611104565b6106c7565b6101b7610720565b60015460ff1661018f565b6101b76102b7366004611026565b610755565b6101b76102ca3660046110eb565b6108d0565b6101b76102dd3660046110eb565b61093e565b6101b76109e8565b6102627f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e481565b61018f61031f366004611104565b600091825260026020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b610262600081565b6102627f0da06bffcb63442de88b7f8385468eaf51e47079d4fa96875938e2c27c451deb81565b6101b7610394366004611104565b610a1a565b61026260035481565b6102627f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061045c57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b61046a610a3f565b7f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e461049481610a82565b61049c610a8c565b6104c77f00000000000000000000000000000000000000000000000000000000000000008684610acb565b6040517fb8969bd400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063b8969bd490610561907f0000000000000000000000000000000000000000000000000000000000000000908a908a908a908a90600401611179565b600060405180830381600087803b15801561057b57600080fd5b505af115801561058f573d6000803e3d6000fd5b505050508573ffffffffffffffffffffffffffffffffffffffff167fba96f26bdda53eb8c8ba39045dfb4ff39753fbc7a6edcf250a88e75e78d102fe8686866040516105dd939291906111d6565b60405180910390a2506105f06001600055565b5050505050565b6105ff610a3f565b7f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e461062981610a82565b610631610a8c565b61063c848484610acb565b8373ffffffffffffffffffffffffffffffffffffffff167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243648460405161068491815260200190565b60405180910390a2506106976001600055565b505050565b6000828152600260205260409020600101546106b781610a82565b6106c18383610c53565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610716576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6106978282610d53565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a61074a81610a82565b610752610e12565b50565b61075d610a3f565b7f10dac8c06a04bec0b551627dad28bc00d6516b0caacd1c7b345fcdb5211334e461078781610a82565b61078f610a8c565b6107ba7f00000000000000000000000000000000000000000000000000000000000000008684610acb565b6040517f5131ab5900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690635131ab5990610854907f0000000000000000000000000000000000000000000000000000000000000000908a908a908a908a90600401611179565b600060405180830381600087803b15801561086e57600080fd5b505af1158015610882573d6000803e3d6000fd5b505050508573ffffffffffffffffffffffffffffffffffffffff167f7772f56296d3a5202974a45c61c9188d844ab4d6eeb18c851e4b8d5384ca6ced8686866040516105dd939291906111d6565b7f0da06bffcb63442de88b7f8385468eaf51e47079d4fa96875938e2c27c451deb6108fa81610a82565b610902610a8c565b60038290556040518281527f7810bd47de260c3e9ee10061cf438099dd12256c79485f12f94dbccc981e806c9060200160405180910390a15050565b610946610a8c565b6040517f79cc6790000000000000000000000000000000000000000000000000000000008152336004820152602481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906379cc679090604401600060405180830381600087803b1580156109d457600080fd5b505af11580156105f0573d6000803e3d6000fd5b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a610a1281610a82565b610752610e8f565b600082815260026020526040902060010154610a3581610a82565b6106c18383610d53565b600260005403610a7b576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600055565b6107528133610ee8565b60015460ff1615610ac9576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b6003547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5d91906111f9565b610b679084611212565b1115610b9f576040517fc30436e900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f1e458bee00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015260248201849052604482018390527f00000000000000000000000000000000000000000000000000000000000000001690631e458bee90606401600060405180830381600087803b158015610c3657600080fd5b505af1158015610c4a573d6000803e3d6000fd5b50505050505050565b600082815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610d4b57600083815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610ce93390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161045c565b50600061045c565b600082815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610d4b57600083815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161045c565b610e1a610f78565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b610e97610a8c565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833610e65565b600082815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610f74576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff821660048201526024810183905260440160405180910390fd5b5050565b60015460ff16610ac9576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060208284031215610fc657600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610ff657600080fd5b9392505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461102157600080fd5b919050565b60008060008060006080868803121561103e57600080fd5b61104786610ffd565b945060208601359350604086013567ffffffffffffffff81111561106a57600080fd5b8601601f8101881361107b57600080fd5b803567ffffffffffffffff81111561109257600080fd5b8860208284010111156110a457600080fd5b959894975060200195606001359392505050565b6000806000606084860312156110cd57600080fd5b6110d684610ffd565b95602085013595506040909401359392505050565b6000602082840312156110fd57600080fd5b5035919050565b6000806040838503121561111757600080fd5b8235915061112760208401610ffd565b90509250929050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8616815273ffffffffffffffffffffffffffffffffffffffff851660208201528360408201526080606082015260006111cb608083018486611130565b979650505050505050565b8381526040602082015260006111f0604083018486611130565b95945050505050565b60006020828403121561120b57600080fd5b5051919050565b8082018082111561045c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220133feb959a4994813f6fed174503c9362a55a5eb16796c13ecec764f91a7467b64736f6c634300081a0033",
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure documentation and testing for new functions and events.

The new functions and events added to the ABI should be well-documented and adequately tested to ensure correct behavior and security.

Would you like assistance in generating documentation or tests for the new functions and events?

Comment on lines 332 to 333
"deposit(address,(address,bool,address))": TypedContractMethod<
[receiver: AddressLike, revertOptions: RevertOptionsStruct],
Copy link
Contributor

Choose a reason for hiding this comment

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

Address Confusing Use of void in Function Return Types.

The use of void in function return types is flagged as confusing. Consider replacing void with undefined for clarity.

-    [void],
+    [undefined],

Also applies to: 338-344, 349-353, 359-365

Comment on lines +412 to +416
[
receiver: AddressLike,
payload: BytesLike,
revertOptions: RevertOptionsStruct
],
Copy link
Contributor

Choose a reason for hiding this comment

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

Address Confusing Use of void in getFunction Return Types.

The use of void in getFunction return types is flagged as confusing. Consider replacing void with undefined for clarity.

-    [void],
+    [undefined],

Also applies to: 421-425, 430-435, 442-446, 451-458

Comment on lines 610 to 612
"deposit(address,(address,bool,address))": TypedContractMethod<
[receiver: AddressLike, revertOptions: RevertOptionsStruct],
[void],
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid using void outside return types.

Replace void with undefined in parameter lists to prevent confusion.

- [void],
+ [undefined],
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"deposit(address,(address,bool,address))": TypedContractMethod<
[receiver: AddressLike, revertOptions: RevertOptionsStruct],
[void],
"deposit(address,(address,bool,address))": TypedContractMethod<
[receiver: AddressLike, revertOptions: RevertOptionsStruct],
[undefined],
Tools
Biome

[error] 612-612: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

Comment on lines 629 to 631
"deposit(address,(address,bool,address))": TypedContractMethod<
[receiver: AddressLike, revertOptions: RevertOptionsStruct],
[void],
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid using void outside return types.

Replace void with undefined in parameter lists to prevent confusion.

- [void],
+ [undefined],
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"deposit(address,(address,bool,address))": TypedContractMethod<
[receiver: AddressLike, revertOptions: RevertOptionsStruct],
[void],
"deposit(address,(address,bool,address))": TypedContractMethod<
[receiver: AddressLike, revertOptions: RevertOptionsStruct],
[undefined],
Tools
Biome

[error] 631-631: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

"deposit(address)": TypedContractMethod<
[receiver: AddressLike],
"deposit(address,(address,bool,address))": TypedContractMethod<
[receiver: AddressLike, revertOptions: RevertOptionsStruct],
[void],
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace void with undefined.

Using void outside of a return type or type parameter can be confusing. Consider replacing it with undefined.

-    [void],
+    [undefined],
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[void],
[undefined],
Tools
Biome

[error] 633-633: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

amount: BigNumberish,
asset: AddressLike,
revertOptions: RevertOptionsStruct
],
[void],
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace void with undefined.

Using void outside of a return type or type parameter can be confusing. Consider replacing it with undefined.

-    [void],
+    [undefined],
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[void],
[undefined],
Tools
Biome

[error] 644-644: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

receiver: AddressLike,
payload: BytesLike,
revertOptions: RevertOptionsStruct
],
[void],
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace void with undefined.

Using void outside of a return type or type parameter can be confusing. Consider replacing it with undefined.

-    [void],
+    [undefined],
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[void],
[undefined],
Tools
Biome

[error] 811-811: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

Comment on lines 252 to 270
/// @param revertOptions Revert options.
function depositAndCall(
address receiver,
bytes calldata payload,
RevertOptions calldata revertOptions
)
external
payable
whenNotPaused
nonReentrant
{
if (msg.value == 0) revert InsufficientETHAmount();
if (receiver == address(0)) revert ZeroAddress();

(bool deposited,) = tssAddress.call{ value: msg.value }("");

if (!deposited) revert DepositFailed();

emit Deposit(msg.sender, receiver, msg.value, address(0), payload);
emit Deposit(msg.sender, receiver, msg.value, address(0), payload, revertOptions);
Copy link
Contributor

Choose a reason for hiding this comment

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

Review low-level call in depositAndCall.

The function uses a low-level call to tssAddress. Ensure that this call is safe and consider using a higher-level abstraction if possible.

Consider using Address.sendValue from OpenZeppelin's Address library for safer ETH transfers.

- (bool deposited,) = tssAddress.call{ value: msg.value }("");
+ Address.sendValue(payable(tssAddress), msg.value);

Committable suggestion was skipped due to low confidence.

receiver: AddressLike,
payload: BytesLike,
revertOptions: RevertOptionsStruct
],
[void],
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace void with undefined.

Using void outside of a return type or type parameter can be confusing. Consider replacing it with undefined.

-    [void],
+    [undefined],
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[void],
[undefined],
Tools
Biome

[error] 625-625: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

/// @param revertAddress Address to receive revert.
/// @param callOnRevert Flag if onRevert hook should be called.
/// @pararm abortAddress Address to receive funds if aborted.
struct RevertOptions {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can define the type in a single file used by evm and zevm?
I don't think we need to maintain 2 version of it. Same whether depositing or withdrawing

Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

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

As per #310

We can add a revertMessage in the options that represents arbitrary data sent back in onRevert allowing custom handling and keeping context of initial inbound

@skosito skosito requested a review from lumtis August 12, 2024 10:34
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, codebase verification and nitpick comments (1)
v2/src/RevertOptions.sol (1)

7-7: Fix typo in comment.

There is a typo in the comment for abortAddress. It should be @param instead of @pararm.

-/// @pararm abortAddress Address to receive funds if aborted.
+/// @param abortAddress Address to receive funds if aborted.
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9136cc5 and d10dd45.

Files selected for processing (40)
  • v2/pkg/erc20custody.sol/erc20custody.go (1 hunks)
  • v2/pkg/igatewayevm.sol/igatewayevm.go (8 hunks)
  • v2/pkg/igatewayevm.sol/igatewayevmevents.go (7 hunks)
  • v2/pkg/igatewayzevm.sol/igatewayzevm.go (11 hunks)
  • v2/pkg/igatewayzevm.sol/igatewayzevmevents.go (7 hunks)
  • v2/pkg/revertoptions.sol/revertoptions.go (1 hunks)
  • v2/pkg/senderzevm.sol/senderzevm.go (1 hunks)
  • v2/pkg/zetaconnectornative.sol/zetaconnectornative.go (1 hunks)
  • v2/pkg/zetaconnectornonnative.sol/zetaconnectornonnative.go (1 hunks)
  • v2/scripts/localnet/EvmCall.s.sol (1 hunks)
  • v2/scripts/localnet/EvmDepositAndCall.s.sol (1 hunks)
  • v2/scripts/localnet/ZevmCall.s.sol (1 hunks)
  • v2/scripts/localnet/ZevmWithdrawAndCall.s.sol (1 hunks)
  • v2/src/RevertOptions.sol (1 hunks)
  • v2/src/evm/interfaces/IGatewayEVM.sol (3 hunks)
  • v2/src/zevm/interfaces/IGatewayZEVM.sol (7 hunks)
  • v2/test/GatewayEVM.t.sol (13 hunks)
  • v2/test/GatewayEVMZEVM.t.sol (7 hunks)
  • v2/test/GatewayZEVM.t.sol (29 hunks)
  • v2/test/utils/SenderZEVM.sol (3 hunks)
  • v2/typechain-types/GatewayEVM.ts (10 hunks)
  • v2/typechain-types/GatewayEVMEchidnaTest.ts (10 hunks)
  • v2/typechain-types/GatewayEVMUpgradeTest.ts (14 hunks)
  • v2/typechain-types/GatewayZEVM.ts (20 hunks)
  • v2/typechain-types/IGatewayEVM.sol/IGatewayEVM.ts (9 hunks)
  • v2/typechain-types/IGatewayEVM.sol/IGatewayEVMEvents.ts (5 hunks)
  • v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVM.ts (18 hunks)
  • v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVMEvents.ts (7 hunks)
  • v2/typechain-types/factories/ERC20Custody__factory.ts (1 hunks)
  • v2/typechain-types/factories/GatewayEVMEchidnaTest__factory.ts (7 hunks)
  • v2/typechain-types/factories/GatewayEVMUpgradeTest__factory.ts (10 hunks)
  • v2/typechain-types/factories/GatewayEVM__factory.ts (7 hunks)
  • v2/typechain-types/factories/GatewayZEVM__factory.ts (10 hunks)
  • v2/typechain-types/factories/IGatewayEVM.sol/IGatewayEVMEvents__factory.ts (2 hunks)
  • v2/typechain-types/factories/IGatewayEVM.sol/IGatewayEVM__factory.ts (5 hunks)
  • v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVMEvents__factory.ts (2 hunks)
  • v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVM__factory.ts (9 hunks)
  • v2/typechain-types/factories/SenderZEVM__factory.ts (1 hunks)
  • v2/typechain-types/factories/ZetaConnectorNative__factory.ts (1 hunks)
  • v2/typechain-types/factories/ZetaConnectorNonNative__factory.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • v2/pkg/revertoptions.sol/revertoptions.go
Files skipped from review as they are similar to previous changes (16)
  • v2/pkg/erc20custody.sol/erc20custody.go
  • v2/pkg/igatewayzevm.sol/igatewayzevmevents.go
  • v2/pkg/zetaconnectornative.sol/zetaconnectornative.go
  • v2/scripts/localnet/EvmCall.s.sol
  • v2/scripts/localnet/EvmDepositAndCall.s.sol
  • v2/scripts/localnet/ZevmCall.s.sol
  • v2/scripts/localnet/ZevmWithdrawAndCall.s.sol
  • v2/src/evm/interfaces/IGatewayEVM.sol
  • v2/src/zevm/interfaces/IGatewayZEVM.sol
  • v2/test/GatewayEVM.t.sol
  • v2/test/GatewayEVMZEVM.t.sol
  • v2/test/GatewayZEVM.t.sol
  • v2/test/utils/SenderZEVM.sol
  • v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVM__factory.ts
  • v2/typechain-types/factories/SenderZEVM__factory.ts
  • v2/typechain-types/factories/ZetaConnectorNative__factory.ts
Additional context used
Biome
v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVM.ts

[error] 363-363: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 374-374: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 386-386: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 498-498: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 510-510: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/typechain-types/IGatewayEVM.sol/IGatewayEVM.ts

[error] 335-335: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 346-346: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 352-352: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 364-364: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 374-374: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 424-424: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 436-436: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 443-443: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 456-456: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 467-467: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/typechain-types/GatewayZEVM.ts

[error] 657-657: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 668-668: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 680-680: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/typechain-types/GatewayEVM.ts

[error] 611-611: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 624-624: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 630-630: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 642-642: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 652-652: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 787-787: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 802-802: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 809-809: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/typechain-types/GatewayEVMUpgradeTest.ts

[error] 630-630: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 643-643: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 649-649: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 661-661: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 671-671: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 749-749: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 806-806: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 821-821: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 828-828: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/typechain-types/GatewayEVMEchidnaTest.ts

[error] 632-632: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 645-645: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 651-651: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 663-663: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 673-673: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 818-818: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 833-833: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

Additional comments not posted (118)
v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVMEvents__factory.ts (1)

40-67: LGTM!

The changes correctly introduce the revertOptions tuple in the ABI for the Call and Withdrawal events. This aligns with the new RevertOptions struct.

Also applies to: 123-150

v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVMEvents.ts (1)

24-41: LGTM!

The introduction of RevertOptionsStruct and RevertOptionsStructOutput and their integration into CallEvent and WithdrawalEvent are well-implemented. The filter signatures are correctly updated.

Also applies to: 52-53, 59-60, 67-67, 84-85, 95-96, 107-107, 178-178, 189-189

v2/typechain-types/factories/IGatewayEVM.sol/IGatewayEVMEvents__factory.ts (2)

34-61: Addition of revertOptions Structure in ABI.

The introduction of the revertOptions tuple structure in the Call event enhances the error handling capabilities by allowing more detailed revert scenarios. This change is well-structured, with clear naming and types for each component.


99-126: Addition of revertOptions Structure in Deposit Event.

The revertOptions structure is also added to the Deposit event, providing consistency across events for handling revert scenarios. Ensure that these changes are reflected in the contract logic and that appropriate tests are in place.

v2/typechain-types/IGatewayEVM.sol/IGatewayEVMEvents.ts (5)

24-29: Introduction of RevertOptionsStruct.

The new RevertOptionsStruct type is well-defined, providing a clear structure for handling revert scenarios. This addition enhances the flexibility and control over transaction reverts.


31-41: Introduction of RevertOptionsStructOutput.

The RevertOptionsStructOutput type complements the input structure, ensuring consistent handling of revert options in event outputs. This is a good practice to maintain type safety.


59-61: Update to CallEvent with revertOptions.

The CallEvent namespace now includes revertOptions, which aligns with the new error handling strategy. Ensure that event listeners are updated to handle this additional data.

Also applies to: 63-66, 72-72


86-87: Update to DepositEvent with revertOptions.

The DepositEvent namespace is updated similarly, ensuring consistent error handling across different events. Verify that these changes are tested thoroughly.

Also applies to: 94-95, 103-103


Line range hint 288-299:
Modification of Event Filters with revertOptions.

The event filter signatures for Call and Deposit now include the revertOptions tuple. This change is crucial for capturing the new revert data in event listeners.

v2/typechain-types/factories/IGatewayEVM.sol/IGatewayEVM__factory.ts (7)

27-51: Integration of revertOptions in call Function.

The addition of revertOptions to the call function enhances its ability to handle reverts. Ensure that the contract logic properly utilizes these options for error handling.


76-101: Integration of revertOptions in deposit Function.

The deposit function now includes revertOptions, providing better control over revert scenarios. Verify that this change is reflected in the contract's operational logic.


117-141: Integration of revertOptions in Payable deposit Function.

The payable version of the deposit function also includes revertOptions, ensuring consistency across function variants. Ensure that these options are correctly implemented in the contract.


171-197: Integration of revertOptions in depositAndCall Function.

The depositAndCall function now supports revertOptions, enhancing its error management capabilities. This addition should be tested to ensure proper functionality.


217-242: Integration of revertOptions in Payable depositAndCall Function.

The payable depositAndCall function includes revertOptions, maintaining consistency in error handling features. Ensure that these changes are well-tested.


367-394: Addition of revertOptions in Call Event.

The Call event now includes revertOptions, aligning with the new error handling strategy. This addition should be reflected in event processing logic.


432-459: Addition of revertOptions in Deposit Event.

The Deposit event's inclusion of revertOptions ensures comprehensive error handling. Verify that event listeners are updated to process this data.

v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVM.ts (4)

26-30: Introduce RevertOptionsStruct.

The new RevertOptionsStruct provides a structured way to handle revert options, enhancing error handling capabilities.


33-43: Introduce RevertOptionsStructOutput.

The RevertOptionsStructOutput mirrors the RevertOptionsStruct for output purposes, maintaining consistency in data handling.


174-189: Update event definitions to include revertOptions.

The Call and Withdrawal events now include revertOptions, allowing for more detailed logging of revert scenarios.

Also applies to: 206-229


67-70: Update function signatures to include RevertOptionsStruct.

The function signatures have been updated to include RevertOptionsStruct, providing enhanced control over revert scenarios. Ensure that all calls to these functions are updated accordingly.

Also applies to: 104-129, 152-164, 356-396, 490-534

Verification successful

All function calls match the updated signatures with RevertOptionsStruct.

The search results confirm that all instances of withdraw and withdrawAndCall in the v2/typechain-types directory are using the updated signatures that include RevertOptionsStruct. There are no mismatched function calls in the specified directory.

  • The function signatures in both GatewayZEVM.ts and IGatewayZEVM.ts are correctly updated.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all function calls match the updated signatures including `RevertOptionsStruct`.

# Test: Search for function usage. Expect: Occurrences of the updated signatures.
rg --type ts -A 5 $'withdraw\\(bytes,uint256,address,\\(address,bool,address,bytes\\)\\)'
rg --type ts -A 5 $'withdrawAndCall\\(bytes,uint256,address,bytes,\\(address,bool,address,bytes\\)\\)'

Length of output: 10083


Script:

#!/bin/bash
# Description: Verify that all function calls to `withdraw` and `withdrawAndCall` use the updated signatures with `RevertOptionsStruct`.

# Search for calls to the `withdraw` function and check if they match the updated signature.
rg --type ts -A 2 'withdraw\('

# Search for calls to the `withdrawAndCall` function and check if they match the updated signature.
rg --type ts -A 2 'withdrawAndCall\('

Length of output: 38799


Script:

#!/bin/bash
# Description: Verify that all function calls to `withdraw` and `withdrawAndCall` in the `v2/typechain-types` directory use the updated signatures with `RevertOptionsStruct`.

# Search for calls to the `withdraw` function in the `v2/typechain-types` directory.
rg --type ts -A 2 'withdraw\(' v2/typechain-types/

# Search for calls to the `withdrawAndCall` function in the `v2/typechain-types` directory.
rg --type ts -A 2 'withdrawAndCall\(' v2/typechain-types/

Length of output: 10255

v2/typechain-types/IGatewayEVM.sol/IGatewayEVM.ts (4)

26-31: Introduce RevertOptionsStruct.

The new RevertOptionsStruct enhances the interface by providing structured revert handling options.


33-43: Introduce RevertOptionsStructOutput.

The RevertOptionsStructOutput is consistent with the input structure, ensuring coherent data handling.


148-161: Update event definitions to include revertOptions.

The CallEvent and DepositEvent now include revertOptions, providing more detailed event logging.

Also applies to: 175-192


49-52: Update function signatures to include RevertOptionsStruct.

Function signatures now incorporate RevertOptionsStruct, enhancing the ability to manage revert scenarios. Verify all function calls to ensure they match the updated signatures.

Also applies to: 71-93, 114-126, 330-373, 419-468

Verification successful

Function signatures updated successfully.

The function signatures have been updated to include RevertOptionsStruct across the relevant files. The changes are consistent with the updated signatures as requested.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all function calls match the updated signatures including `RevertOptionsStruct`.

# Test: Search for function usage. Expect: Occurrences of the updated signatures.
rg --type ts -A 5 $'deposit\\(address,uint256,address,\\(address,bool,address,bytes\\)\\)'
rg --type ts -A 5 $'depositAndCall\\(address,bytes,\\(address,bool,address,bytes\\)\\)'

Length of output: 20014

v2/pkg/senderzevm.sol/senderzevm.go (1)

35-35: Update in SenderZEVM contract bytecode.

The bytecode for the SenderZEVM contract has been updated. Ensure that this change aligns with the intended contract functionality and does not introduce unexpected behavior.

v2/typechain-types/factories/ZetaConnectorNonNative__factory.ts (1)

620-620: Verify the impact of bytecode changes.

The bytecode has been entirely replaced, indicating a substantial change in the contract logic. Ensure that these changes are thoroughly tested and documented, as they may affect contract behavior.

v2/typechain-types/factories/ERC20Custody__factory.ts (1)

674-674: Verify the impact of bytecode changes.

The bytecode has been entirely replaced, indicating a substantial change in the contract logic. Ensure that these changes are thoroughly tested and documented, as they may affect contract behavior.

v2/typechain-types/GatewayZEVM.ts (2)

523-528: Address void type usage issue.

The use of void in these method signatures is flagged as confusing. Consider replacing void with undefined to clarify the return type.

- [void],
+ [undefined],

Also applies to: 650-656, 661-667, 672-678, 684-690


26-30: Ensure comprehensive testing of RevertOptionsStruct integration.

The introduction of RevertOptionsStruct enhances error handling. Verify that all affected methods and events are adequately tested to ensure correct functionality and error management.

Also applies to: 33-43, 83-86, 121-121, 137-137, 145-145, 187-212, 279-291, 302-303, 309-310, 317-317, 440-441, 451-452, 463-463

v2/typechain-types/GatewayEVM.ts (8)

26-31: Introduction of RevertOptionsStruct.

The addition of RevertOptionsStruct is a positive enhancement for handling revert scenarios more effectively. Ensure that this new structure is consistently used across the codebase where applicable.


33-43: Definition of RevertOptionsStructOutput.

The RevertOptionsStructOutput provides a clear mapping for the output of revert options. This is well-structured for handling outputs consistently.


55-58: Update method signatures to include RevertOptionsStruct.

The method signatures in GatewayEVMInterface now include RevertOptionsStruct, enhancing the functionality for handling revert scenarios. This is a significant improvement in terms of error handling.


118-141: Update encodeFunctionData method signatures.

The encodeFunctionData methods have been updated to include RevertOptionsStruct, which aligns with the new approach for handling reverts. Ensure that encoding logic is correctly implemented and tested.


236-249: Update decodeFunctionResult method signatures.

The decodeFunctionResult methods now handle RevertOptionsStruct, ensuring that the decoding process accommodates the new structure. This change supports the enhanced error handling mechanism.


308-321: Update CallEvent to include RevertOptionsStruct.

The CallEvent now carries additional information about revert options, which is beneficial for event handling and logging.


335-352: Update DepositEvent to include RevertOptionsStruct.

The DepositEvent has been updated to include revert options, aligning with the new error handling strategy. This ensures comprehensive event logging.


Line range hint 1043-1054:
Update event filters to include RevertOptionsStruct.

The event filters for Call and Deposit now include revert options, ensuring that these events capture the full context of transaction handling.

v2/typechain-types/GatewayEVMUpgradeTest.ts (8)

26-31: Introduction of RevertOptionsStruct.

The addition of RevertOptionsStruct enhances the handling of revert scenarios, providing a structured approach to error management.


33-43: Definition of RevertOptionsStructOutput.

The RevertOptionsStructOutput provides a structured format for handling output related to revert options, ensuring consistency in data handling.


55-58: Update method signatures to include RevertOptionsStruct.

The method signatures in GatewayEVMUpgradeTestInterface now incorporate RevertOptionsStruct, enhancing error handling capabilities.


119-142: Update encodeFunctionData method signatures.

The encodeFunctionData methods now include RevertOptionsStruct, aligning with the new error handling strategy. Ensure proper testing of encoding logic.


237-249: Update decodeFunctionResult method signatures.

The decodeFunctionResult methods have been updated to handle RevertOptionsStruct, supporting the enhanced error handling mechanism.


309-322: Update CallEvent to include RevertOptionsStruct.

The CallEvent now includes revert options, providing additional context for event handling and logging.


336-353: Update DepositEvent to include RevertOptionsStruct.

The DepositEvent has been updated to include revert options, ensuring comprehensive event logging and error handling.


Line range hint 1069-1080:
Update event filters to include RevertOptionsStruct.

The event filters for Call and Deposit now include revert options, capturing the full context of transaction handling.

v2/typechain-types/GatewayEVMEchidnaTest.ts (16)

26-31: RevertOptionsStruct definition looks good.

The RevertOptionsStruct type is well-defined and aligns with the intended functionality of enhancing error handling.


33-43: RevertOptionsStructOutput definition looks good.

The RevertOptionsStructOutput type is correctly defined and consistent with TypeScript's tuple syntax.


55-58: Function signature updates look good.

The updated function signatures in GatewayEVMEchidnaTestInterface correctly incorporate RevertOptionsStruct for enhanced error handling.


121-144: encodeFunctionData updates look good.

The updates to encodeFunctionData correctly reflect the changes in function signatures to include RevertOptionsStruct.


248-260: decodeFunctionResult updates look good.

The updates to decodeFunctionResult correctly reflect the changes in function signatures to include RevertOptionsStruct.


Line range hint 329-357: Event updates look good.

The updates to CallEvent and DepositEvent correctly incorporate RevertOptionsStruct, enhancing error handling in events.


627-674: TypedContractMethod updates look good.

The updated TypedContractMethod definitions correctly incorporate RevertOptionsStruct for enhanced error handling.

Tools
Biome

[error] 632-632: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 645-645: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 651-651: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 663-663: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 673-673: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


813-865: getFunction updates look good.

The updates to getFunction correctly reflect the changes in function signatures to include RevertOptionsStruct.

Tools
Biome

[error] 818-818: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 833-833: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


Line range hint 1087-1098: Event filter updates look good.

The updates to event filters correctly incorporate tuple, enhancing the filtering capabilities for Call and Deposit events.


632-632: Replace void with undefined.

Using void outside of a return type or type parameter can be confusing. Consider replacing it with undefined.

Tools
Biome

[error] 632-632: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


645-645: Replace void with undefined.

Using void outside of a return type or type parameter can be confusing. Consider replacing it with undefined.

Tools
Biome

[error] 645-645: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


651-651: Replace void with undefined.

Using void outside of a return type or type parameter can be confusing. Consider replacing it with undefined.

Tools
Biome

[error] 651-651: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


663-663: Replace void with undefined.

Using void outside of a return type or type parameter can be confusing. Consider replacing it with undefined.

Tools
Biome

[error] 663-663: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


673-673: Replace void with undefined.

Using void outside of a return type or type parameter can be confusing. Consider replacing it with undefined.

Tools
Biome

[error] 673-673: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


818-818: Replace void with undefined.

Using void outside of a return type or type parameter can be confusing. Consider replacing it with undefined.

Tools
Biome

[error] 818-818: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


833-833: Replace void with undefined.

Using void outside of a return type or type parameter can be confusing. Consider replacing it with undefined.

Tools
Biome

[error] 833-833: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/pkg/igatewayevm.sol/igatewayevmevents.go (9)

32-38: RevertOptions struct addition is well-defined.

The new RevertOptions struct encapsulates parameters for revert handling, aligning with the PR's goal to improve error handling.


260-264: RevertOptions field addition to IGatewayEVMEventsCall is appropriate.

Including RevertOptions in the IGatewayEVMEventsCall struct provides additional context for revert scenarios, enhancing event handling.


Line range hint 267-286: FilterCall function update is consistent with ABI changes.

The function has been updated to reflect the new ABI for the Call event, ensuring consistency with the contract's event structure.


Line range hint 288-332: WatchCall function update is consistent with ABI changes.

The function has been updated to reflect the new ABI for the Call event, ensuring consistency with the contract's event structure.


Line range hint 334-341: ParseCall function update is consistent with ABI changes.

The function has been updated to reflect the new ABI for the Call event, ensuring consistency with the contract's event structure.


415-421: RevertOptions field addition to IGatewayEVMEventsDeposit is appropriate.

Including RevertOptions in the IGatewayEVMEventsDeposit struct provides additional context for revert scenarios, enhancing event handling.


Line range hint 424-443: FilterDeposit function update is consistent with ABI changes.

The function has been updated to reflect the new ABI for the Deposit event, ensuring consistency with the contract's event structure.


Line range hint 445-489: WatchDeposit function update is consistent with ABI changes.

The function has been updated to reflect the new ABI for the Deposit event, ensuring consistency with the contract's event structure.


Line range hint 491-498: ParseDeposit function update is consistent with ABI changes.

The function has been updated to reflect the new ABI for the Deposit event, ensuring consistency with the contract's event structure.

v2/pkg/igatewayzevm.sol/igatewayzevm.go (11)

32-37: RevertOptions struct addition is well-defined.

The new RevertOptions struct encapsulates parameters for revert handling, aligning with the PR's goal to improve error handling.


198-202: Call function update with RevertOptions is appropriate.

Including RevertOptions in the Call function enhances its ability to manage revert scenarios, aligning with the PR's objectives.


345-349: Withdraw function update with RevertOptions is appropriate.

Including RevertOptions in the Withdraw function enhances its ability to manage revert scenarios, aligning with the PR's objectives.


498-503: RevertOptions field addition to IGatewayZEVMCall is appropriate.

Including RevertOptions in the IGatewayZEVMCall struct provides additional context for revert scenarios, enhancing event handling.


Line range hint 506-525: FilterCall function update is consistent with ABI changes.

The function has been updated to reflect the new ABI for the Call event, ensuring consistency with the contract's event structure.


Line range hint 527-571: WatchCall function update is consistent with ABI changes.

The function has been updated to reflect the new ABI for the Call event, ensuring consistency with the contract's event structure.


Line range hint 573-580: ParseCall function update is consistent with ABI changes.

The function has been updated to reflect the new ABI for the Call event, ensuring consistency with the contract's event structure.


662-663: RevertOptions field addition to IGatewayZEVMWithdrawal is appropriate.

Including RevertOptions in the IGatewayZEVMWithdrawal struct provides additional context for revert scenarios, enhancing event handling.


Line range hint 666-685: FilterWithdrawal function update is consistent with ABI changes.

The function has been updated to reflect the new ABI for the Withdrawal event, ensuring consistency with the contract's event structure.


Line range hint 687-731: WatchWithdrawal function update is consistent with ABI changes.

The function has been updated to reflect the new ABI for the Withdrawal event, ensuring consistency with the contract's event structure.


Line range hint 733-740: ParseWithdrawal function update is consistent with ABI changes.

The function has been updated to reflect the new ABI for the Withdrawal event, ensuring consistency with the contract's event structure.

v2/typechain-types/factories/GatewayEVM__factory.ts (7)

99-125: Inclusion of revertOptions in call function is well-structured.

The addition of the revertOptions parameter enhances the function's flexibility for error handling.


162-188: Inclusion of revertOptions in deposit function is consistent and appropriate.

The revertOptions parameter is added correctly, aligning with the intended improvements in error handling.


195-227: Consistent addition of revertOptions in the second deposit function.

The revertOptions parameter is included appropriately, providing enhanced error handling.


257-283: Addition of revertOptions in depositAndCall function is well-implemented.

The revertOptions parameter is correctly integrated, supporting improved error handling.


715-742: Inclusion of revertOptions in Call event is consistent.

The revertOptions parameter is added correctly, aligning with the enhanced error handling strategy.


780-807: Consistent addition of revertOptions in Deposit event.

The revertOptions parameter is correctly integrated, enhancing error handling capabilities.


1211-1212: Flexibility in GatewayEVMConstructorParams is well-implemented.

The inclusion of an optional signer provides greater flexibility in constructor parameters.

v2/typechain-types/factories/GatewayEVMUpgradeTest__factory.ts (6)

102-128: Enhancement with revertOptions parameter.

The addition of the revertOptions parameter in the call function enhances error handling and control flow. The structure appears correct and consistent.


165-191: Enhancement with revertOptions parameter.

The addition of the revertOptions parameter in the deposit function is consistent with the enhancements for error handling. The structure is correct.


198-230: Enhancement with revertOptions parameter.

The addition of the revertOptions parameter in the second deposit function aligns with the error handling enhancements. The structure is consistent.


260-286: Enhancement with revertOptions parameter.

The addition of the revertOptions parameter in the depositAndCall function enhances error handling. The structure is consistent and correct.


291-331: Enhancement with revertOptions parameter.

The addition of the revertOptions parameter in the second depositAndCall function aligns with the enhancements for error handling. The structure is consistent.


472-482: Parameter renaming for consistency.

The renaming of parameters in the initialize, setConnector, and setCustody functions enhances readability and consistency. The changes are appropriate.

Also applies to: 592-605

v2/typechain-types/factories/GatewayZEVM__factory.ts (5)

605-631: Consistent enhancement with revertOptions in withdraw.

The withdraw function now includes a revertOptions tuple, aligning with similar enhancements in the call function. This consistency is beneficial for error handling.

Verify the consistent implementation of revertOptions throughout the codebase.


701-736: revertOptions added to withdrawAndCall.

The inclusion of revertOptions in the withdrawAndCall function is consistent with previous changes, enhancing error handling capabilities.

Verify the consistent implementation of revertOptions throughout the codebase.


837-864: revertOptions added to Call event.

Including revertOptions in the Call event provides more detailed logging of revert scenarios, which aids in debugging and monitoring.

Verify the consistent implementation of revertOptions throughout the codebase.


1047-1074: revertOptions added to Withdrawal event.

The addition of revertOptions to the Withdrawal event enhances logging and monitoring capabilities for revert scenarios, aiding in debugging.

Verify the consistent implementation of revertOptions throughout the codebase.


95-121: Enhance error handling with revertOptions.

The addition of the revertOptions tuple in the call function enhances error handling by allowing more control over revert scenarios. This is a positive change.

Ensure that the implementation of revertOptions is consistent across the codebase.

Verification successful

Consistent usage of revertOptions verified.

The revertOptions tuple is consistently used across the codebase, aligning with its intended structure and purpose. This ensures enhanced error handling capabilities are uniformly applied. No issues found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistent usage of `revertOptions` across the codebase.

# Test: Search for the usage of `revertOptions`. Expect: Consistent structure and usage.
rg --type ts 'revertOptions'

Length of output: 13883

v2/pkg/igatewayevm.sol/igatewayevm.go (13)

32-38: Addition of RevertOptions struct is well-structured.

The RevertOptions struct provides a clear and organized way to handle transaction reverts. Its fields cover various aspects needed for revert scenarios.


194-195: Inclusion of revertOptions in Call function is appropriate.

The updated function signature allows for improved error handling during transactions.


201-202: Inclusion of revertOptions in Call function is appropriate.

The updated function signature allows for improved error handling during transactions.


208-209: Inclusion of revertOptions in Call function is appropriate.

The updated function signature allows for improved error handling during transactions.


215-216: Inclusion of revertOptions in Deposit function is appropriate.

The updated function signature allows for improved error handling during transactions.


222-223: Inclusion of revertOptions in Deposit function is appropriate.

The updated function signature allows for improved error handling during transactions.


229-230: Inclusion of revertOptions in Deposit function is appropriate.

The updated function signature allows for improved error handling during transactions.


236-237: Inclusion of revertOptions in Deposit0 function is appropriate.

The updated function signature allows for improved error handling during transactions.


243-244: Inclusion of revertOptions in Deposit0 function is appropriate.

The updated function signature allows for improved error handling during transactions.


250-251: Inclusion of revertOptions in Deposit0 function is appropriate.

The updated function signature allows for improved error handling during transactions.


257-258: Inclusion of revertOptions in DepositAndCall function is appropriate.

The updated function signature allows for improved error handling during transactions.


449-452: Inclusion of RevertOptions in IGatewayEVMCall struct is beneficial.

The addition enhances the event's ability to log revert scenarios.


604-609: Inclusion of RevertOptions in IGatewayEVMDeposit struct is beneficial.

The addition enhances the event's ability to log revert scenarios.

v2/typechain-types/factories/GatewayEVMEchidnaTest__factory.ts (5)

102-128: revertOptions addition in call function looks good.

The addition of the revertOptions tuple enhances error handling by allowing more granular control over reverts.


165-191: revertOptions addition in deposit function looks good.

The revertOptions tuple is consistently integrated, enhancing the function's error handling capabilities.


198-230: revertOptions addition in overloaded deposit function looks good.

The integration of revertOptions is consistent and enhances error handling.


260-286: revertOptions addition in depositAndCall function looks good.

Consistent integration of revertOptions enhances the function's error handling.


767-794: revertOptions addition in Call event looks good.

The inclusion of revertOptions in the event enhances tracking and handling of revert scenarios.

v2/pkg/zetaconnectornonnative.sol/zetaconnectornonnative.go (1)

Line range hint 14-35:
Ensure documentation and testing for new functions and events.

The ABI changes introduce new functions and events, such as withdrawAndRevert and AccessControlUnauthorizedAccount. Ensure these are well-documented and adequately tested to maintain correct behavior and security.

amount: BigNumberish,
zrc20: AddressLike,
revertOptions: RevertOptionsStruct
],
[void],
Copy link
Contributor

Choose a reason for hiding this comment

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

Address confusing use of void in function return types.

The use of void is flagged as confusing. Consider replacing void with undefined for clarity.

-    [void],
+    [undefined],

Also applies to: 374-374, 386-386, 498-498, 510-510

Tools
Biome

[error] 363-363: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

Comment on lines +606 to +610
[
receiver: AddressLike,
payload: BytesLike,
revertOptions: RevertOptionsStruct
],
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace void with undefined in parameter lists.

The use of void in parameter lists is confusing outside of return types. Replace it with undefined to prevent confusion and align with TypeScript best practices.

- [void],
+ [undefined],

Also applies to: 617-623, 628-629, 634-640, 646-651

Comment on lines +625 to +629
[
receiver: AddressLike,
payload: BytesLike,
revertOptions: RevertOptionsStruct
],
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace void with undefined in parameter lists.

The use of void in parameter lists is confusing outside of return types. Replace it with undefined to align with TypeScript best practices and prevent confusion.

- [void],
+ [undefined],

Also applies to: 636-642, 647-648, 653-659, 665-670

@skosito skosito marked this pull request as draft August 12, 2024 11:10
@skosito skosito changed the title feat: revert options feat: revert options and revert context Aug 12, 2024
@skosito skosito linked an issue Aug 12, 2024 that may be closed by this pull request
@skosito skosito marked this pull request as ready for review August 12, 2024 11:22
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: 10

Outside diff range, codebase verification and nitpick comments (6)
v2/typechain-types/factories/TestUniversalContract__factory.ts (1)

76-78: Ensure Consistency in Type Naming Across the Codebase

The type name RevertContext should be used consistently throughout the codebase. The following files contain instances of revertContext that should be updated to RevertContext for consistency:

  • v2/typechain-types/factories/ZetaConnectorNonNative__factory.ts
  • v2/typechain-types/factories/ZetaConnectorNative__factory.ts
  • v2/typechain-types/factories/ZetaConnectorBase__factory.ts
  • v2/typechain-types/factories/TestUniversalContract__factory.ts
  • v2/typechain-types/factories/Revert.sol/Revertable__factory.ts
  • v2/typechain-types/factories/GatewayZEVM__factory.ts
  • v2/typechain-types/factories/GatewayEVMUpgradeTest__factory.ts
  • v2/typechain-types/factories/GatewayEVM__factory.ts
  • v2/typechain-types/factories/ERC20Custody__factory.ts
  • v2/typechain-types/factories/GatewayEVMEchidnaTest__factory.ts
  • v2/typechain-types/factories/ERC20CustodyEchidnaTest__factory.ts
  • v2/typechain-types/factories/zContract.sol/UniversalContract__factory.ts

Please update these instances to ensure consistent naming conventions.

Analysis chain

Ensure Consistency in Type Naming.

The change from struct revertContext to struct RevertContext should be consistent across the codebase to prevent mismatches.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the type name `RevertContext` across the codebase.

# Test: Search for occurrences of `revertContext` and `RevertContext`.
rg --type ts 'revertContext|RevertContext'

Length of output: 22773

v2/src/zevm/interfaces/IGatewayZEVM.sol (3)

5-5: Consider Centralizing Type Definitions.

The import of Revert.sol suggests that types are defined in multiple locations. Consider centralizing type definitions to avoid duplication and potential inconsistencies.


Update Required for Withdrawal Event Emissions

Not all Withdrawal event emissions and definitions have been updated to include the revertOptions parameter. Please ensure consistency across the codebase by updating the following locations:

  • v2/src/zevm/ZRC20.sol: Update the Withdrawal event to include revertOptions.
  • v2/src/zevm/interfaces/IWZETA.sol: Update the Withdrawal event to include revertOptions.
  • v2/src/zevm/interfaces/IZRC20.sol: Update the Withdrawal event to include revertOptions.
Analysis chain

Line range hint 29-39:
Update to Withdrawal Event.

The addition of revertOptions to the Withdrawal event improves its functionality. Ensure that all event emissions and listeners reflect this change.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all `Withdrawal` event emissions and listeners include the new `revertOptions`.

# Test: Search for `Withdrawal` event emissions and listeners.
rg --type sol 'Withdrawal'

Length of output: 54


Script:

#!/bin/bash
# Description: Search for `Withdrawal` event emissions and listeners across all files, focusing on Solidity files.

# Test: Search for `Withdrawal` event emissions and listeners.
rg 'Withdrawal' --glob '*.sol' -A 5

Length of output: 10116


207-214: Update executeRevert Function Calls in Tests

The executeRevert function in v2/test/GatewayZEVM.t.sol still uses revertContext instead of zContext. Please update these calls to ensure consistency with the updated function signature.

  • File: v2/test/GatewayZEVM.t.sol
  • Lines: Multiple instances where executeRevert is called with revertContext.
Analysis chain

Update to executeRevert Function Signature.

The executeRevert function now uses zContext instead of revertContext. Ensure that all function calls reflect this change.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all `executeRevert` function calls use `zContext`.

# Test: Search for `executeRevert` function calls and check for `zContext`.
rg --type sol 'executeRevert'

Length of output: 57


Script:

#!/bin/bash
# Description: Verify that all `executeRevert` function calls use `zContext`.

# Test: Search for `executeRevert` function calls and check for `zContext`.
rg 'executeRevert'

Length of output: 100333


Script:

#!/bin/bash
# Description: Check for `executeRevert` function calls in test files to verify parameter usage.

# Search for `executeRevert` calls in test files and check for parameter usage.
rg 'executeRevert\(' -A 2 v2/test/*.sol

Length of output: 1643

v2/pkg/revert.sol/revertable.go (1)

4-4: Update References to Package Name

The package name igatewayevm is still present in several files. Please update these references to the new package name revert to ensure consistency across the codebase.

  • v2/pkg/igatewayevm.sol/igatewayevmevents.go
  • v2/pkg/igatewayevm.sol/igatewayevmerrors.go
  • v2/pkg/igatewayevm.sol/igatewayevm.go
Analysis chain

Package name change.

The package name has been changed from igatewayevm to revert, indicating a shift in focus or functionality. Ensure that all references to this package are updated accordingly in the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all references to the old package name are updated.

# Test: Search for the old package name. Expect: No occurrences.
rg --type go 'package igatewayevm'

Length of output: 222

v2/src/zevm/GatewayZEVM.sol (1)

Update withdrawAndCall function calls to include RevertOptions.

The withdrawAndCall function signature has been updated to include a RevertOptions parameter. However, some calls to this function have not been updated to match the new signature. Please update the following occurrences:

  • v2/test/ZetaConnectorNative.t.sol
  • v2/test/ERC20Custody.t.sol

These calls should include the RevertOptions parameter to ensure consistency and correct functionality.

Analysis chain

Line range hint 145-163:
Verify the usage of RevertOptions.

The addition of RevertOptions to the withdrawAndCall function enhances error handling. Ensure that all calls to this function are updated to include the new parameter.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `withdrawAndCall` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type solidity -A 5 $'withdrawAndCall'

Length of output: 74


Script:

#!/bin/bash
# Corrected: Verify all function calls to `withdrawAndCall` match the new signature.

# Test: Search for the function usage in Solidity files.
rg --glob '*.sol' -A 5 $'withdrawAndCall'

Length of output: 19531

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d10dd45 and 82d4d98.

Files selected for processing (86)
  • v2/pkg/erc20custody.sol/erc20custody.go (5 hunks)
  • v2/pkg/ierc20custody.sol/ierc20custody.go (5 hunks)
  • v2/pkg/ierc20custody.sol/ierc20custodyevents.go (4 hunks)
  • v2/pkg/igatewayevm.sol/igatewayevm.go (13 hunks)
  • v2/pkg/igatewayevm.sol/igatewayevmevents.go (10 hunks)
  • v2/pkg/igatewayzevm.sol/igatewayzevm.go (11 hunks)
  • v2/pkg/ireceiverevm.sol/ireceiverevmevents.go (4 hunks)
  • v2/pkg/izetaconnector.sol/izetaconnectorevents.go (4 hunks)
  • v2/pkg/receiverevm.sol/receiverevm.go (5 hunks)
  • v2/pkg/revert.sol/revertable.go (3 hunks)
  • v2/pkg/senderzevm.sol/senderzevm.go (1 hunks)
  • v2/pkg/systemcontract.sol/systemcontract.go (1 hunks)
  • v2/pkg/systemcontractmock.sol/systemcontractmock.go (1 hunks)
  • v2/pkg/testuniversalcontract.sol/testuniversalcontract.go (6 hunks)
  • v2/pkg/universalcontract.sol/universalcontract.go (3 hunks)
  • v2/pkg/zetaconnectorbase.sol/zetaconnectorbase.go (5 hunks)
  • v2/pkg/zetaconnectornative.sol/zetaconnectornative.go (5 hunks)
  • v2/pkg/zetaconnectornonnative.sol/zetaconnectornonnative.go (5 hunks)
  • v2/src/Revert.sol (1 hunks)
  • v2/src/evm/ERC20Custody.sol (3 hunks)
  • v2/src/evm/GatewayEVM.sol (6 hunks)
  • v2/src/evm/ZetaConnectorBase.sol (2 hunks)
  • v2/src/evm/ZetaConnectorNative.sol (2 hunks)
  • v2/src/evm/ZetaConnectorNonNative.sol (2 hunks)
  • v2/src/evm/interfaces/IERC20Custody.sol (3 hunks)
  • v2/src/evm/interfaces/IGatewayEVM.sol (5 hunks)
  • v2/src/evm/interfaces/IZetaConnector.sol (2 hunks)
  • v2/src/zevm/GatewayZEVM.sol (8 hunks)
  • v2/src/zevm/interfaces/IGatewayZEVM.sol (7 hunks)
  • v2/src/zevm/interfaces/UniversalContract.sol (2 hunks)
  • v2/test/ERC20Custody.t.sol (7 hunks)
  • v2/test/GatewayEVM.t.sol (18 hunks)
  • v2/test/GatewayZEVM.t.sol (18 hunks)
  • v2/test/ZetaConnectorNative.t.sol (4 hunks)
  • v2/test/ZetaConnectorNonNative.t.sol (6 hunks)
  • v2/test/utils/GatewayEVMUpgradeTest.sol (9 hunks)
  • v2/test/utils/IReceiverEVM.sol (2 hunks)
  • v2/test/utils/ReceiverEVM.sol (2 hunks)
  • v2/test/utils/TestUniversalContract.sol (3 hunks)
  • v2/typechain-types/ERC20Custody.ts (6 hunks)
  • v2/typechain-types/ERC20CustodyEchidnaTest.ts (6 hunks)
  • v2/typechain-types/GatewayEVM.ts (19 hunks)
  • v2/typechain-types/GatewayEVMEchidnaTest.ts (21 hunks)
  • v2/typechain-types/GatewayEVMUpgradeTest.ts (23 hunks)
  • v2/typechain-types/GatewayZEVM.ts (22 hunks)
  • v2/typechain-types/IERC20Custody.sol/IERC20Custody.ts (6 hunks)
  • v2/typechain-types/IERC20Custody.sol/IERC20CustodyEvents.ts (3 hunks)
  • v2/typechain-types/IGatewayEVM.sol/IGatewayEVM.ts (14 hunks)
  • v2/typechain-types/IGatewayEVM.sol/IGatewayEVMEvents.ts (8 hunks)
  • v2/typechain-types/IGatewayEVM.sol/index.ts (1 hunks)
  • v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVM.ts (18 hunks)
  • v2/typechain-types/IReceiverEVM.sol/IReceiverEVMEvents.ts (3 hunks)
  • v2/typechain-types/IZetaConnector.sol/IZetaConnectorEvents.ts (3 hunks)
  • v2/typechain-types/ReceiverEVM.ts (6 hunks)
  • v2/typechain-types/Revert.sol/Revertable.ts (1 hunks)
  • v2/typechain-types/Revert.sol/index.ts (1 hunks)
  • v2/typechain-types/TestUniversalContract.ts (6 hunks)
  • v2/typechain-types/UniversalContract.sol/UniversalContract.ts (4 hunks)
  • v2/typechain-types/ZetaConnectorBase.ts (6 hunks)
  • v2/typechain-types/ZetaConnectorNative.ts (6 hunks)
  • v2/typechain-types/ZetaConnectorNonNative.ts (6 hunks)
  • v2/typechain-types/factories/ERC20Custody__factory.ts (3 hunks)
  • v2/typechain-types/factories/GatewayEVMUpgradeTest__factory.ts (14 hunks)
  • v2/typechain-types/factories/GatewayEVM__factory.ts (11 hunks)
  • v2/typechain-types/factories/GatewayZEVM__factory.ts (12 hunks)
  • v2/typechain-types/factories/IERC20Custody.sol/IERC20CustodyEvents__factory.ts (1 hunks)
  • v2/typechain-types/factories/IERC20Custody.sol/IERC20Custody__factory.ts (2 hunks)
  • v2/typechain-types/factories/IGatewayEVM.sol/IGatewayEVMEvents__factory.ts (4 hunks)
  • v2/typechain-types/factories/IGatewayEVM.sol/IGatewayEVM__factory.ts (9 hunks)
  • v2/typechain-types/factories/IGatewayEVM.sol/index.ts (1 hunks)
  • v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVM__factory.ts (11 hunks)
  • v2/typechain-types/factories/IReceiverEVM.sol/IReceiverEVMEvents__factory.ts (1 hunks)
  • v2/typechain-types/factories/IZetaConnector.sol/IZetaConnectorEvents__factory.ts (1 hunks)
  • v2/typechain-types/factories/ReceiverEVM__factory.ts (3 hunks)
  • v2/typechain-types/factories/Revert.sol/Revertable__factory.ts (1 hunks)
  • v2/typechain-types/factories/Revert.sol/index.ts (1 hunks)
  • v2/typechain-types/factories/SenderZEVM__factory.ts (1 hunks)
  • v2/typechain-types/factories/SystemContract.sol/SystemContract__factory.ts (1 hunks)
  • v2/typechain-types/factories/SystemContractMock.sol/SystemContractMock__factory.ts (1 hunks)
  • v2/typechain-types/factories/TestUniversalContract__factory.ts (2 hunks)
  • v2/typechain-types/factories/UniversalContract.sol/UniversalContract__factory.ts (1 hunks)
  • v2/typechain-types/factories/ZetaConnectorBase__factory.ts (2 hunks)
  • v2/typechain-types/factories/ZetaConnectorNative__factory.ts (3 hunks)
  • v2/typechain-types/factories/ZetaConnectorNonNative__factory.ts (3 hunks)
  • v2/typechain-types/factories/index.ts (1 hunks)
  • v2/typechain-types/index.ts (3 hunks)
Files skipped from review due to trivial changes (3)
  • v2/typechain-types/Revert.sol/index.ts
  • v2/typechain-types/factories/IGatewayEVM.sol/index.ts
  • v2/typechain-types/factories/Revert.sol/index.ts
Files skipped from review as they are similar to previous changes (17)
  • v2/pkg/igatewayevm.sol/igatewayevmevents.go
  • v2/pkg/senderzevm.sol/senderzevm.go
  • v2/pkg/systemcontractmock.sol/systemcontractmock.go
  • v2/src/evm/ERC20Custody.sol
  • v2/src/evm/ZetaConnectorBase.sol
  • v2/src/evm/interfaces/IGatewayEVM.sol
  • v2/src/zevm/interfaces/UniversalContract.sol
  • v2/test/ZetaConnectorNonNative.t.sol
  • v2/test/utils/TestUniversalContract.sol
  • v2/typechain-types/factories/GatewayEVMUpgradeTest__factory.ts
  • v2/typechain-types/factories/GatewayEVM__factory.ts
  • v2/typechain-types/factories/GatewayZEVM__factory.ts
  • v2/typechain-types/factories/IGatewayEVM.sol/IGatewayEVMEvents__factory.ts
  • v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVM__factory.ts
  • v2/typechain-types/factories/SenderZEVM__factory.ts
  • v2/typechain-types/factories/SystemContract.sol/SystemContract__factory.ts
  • v2/typechain-types/factories/SystemContractMock.sol/SystemContractMock__factory.ts
Additional context used
Biome
v2/typechain-types/factories/Revert.sol/Revertable__factory.ts

[error] 44-52: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)

v2/typechain-types/Revert.sol/Revertable.ts

[error] 92-92: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 104-104: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 108-108: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

v2/typechain-types/ReceiverEVM.ts

[error] 260-260: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 298-298: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/typechain-types/IGatewayEVM.sol/IGatewayEVM.ts

[error] 337-337: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 348-348: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 354-354: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 366-366: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 376-376: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 431-431: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 443-443: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 450-450: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 463-463: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 474-474: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVM.ts

[error] 380-380: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 391-391: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 402-402: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 414-414: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 516-516: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 528-528: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 540-540: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/typechain-types/GatewayZEVM.ts

[error] 685-685: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 696-696: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 708-708: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/typechain-types/GatewayEVM.ts

[error] 613-613: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 626-626: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 632-632: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 644-644: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 654-654: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 794-794: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 809-809: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 816-816: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/typechain-types/GatewayEVMUpgradeTest.ts

[error] 632-632: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 645-645: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 651-651: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 663-663: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 673-673: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 756-756: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 813-813: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 828-828: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 835-835: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/typechain-types/GatewayEVMEchidnaTest.ts

[error] 634-634: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 647-647: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 653-653: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 665-665: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 675-675: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 825-825: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 840-840: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

GitHub Check: Slither
v2/src/evm/GatewayEVM.sol

[warning] 211-228: Low-level calls
Low level call in GatewayEVM.deposit(address,RevertOptions) (src/evm/GatewayEVM.sol#211-228):
- (deposited,None) = tssAddress.call{value: msg.value}() (src/evm/GatewayEVM.sol#223)


[warning] 257-275: Low-level calls
Low level call in GatewayEVM.depositAndCall(address,bytes,RevertOptions) (src/evm/GatewayEVM.sol#257-275):
- (deposited,None) = tssAddress.call{value: msg.value}() (src/evm/GatewayEVM.sol#270)

Additional comments not posted (320)
v2/typechain-types/IGatewayEVM.sol/index.ts (1)

Line range hint 1-6:
Verify the impact of removing Revertable.

The Revertable type has been removed from exports. Ensure that this change does not affect any dependent modules or components that relied on this type.

v2/src/Revert.sol (1)

1-32: LGTM! The new structures and interface enhance error handling.

The introduction of RevertOptions, RevertContext, and the Revertable interface provides a structured approach to managing reverts, improving error handling and control flow.

v2/src/evm/interfaces/IZetaConnector.sol (1)

Line range hint 4-25:
LGTM! The addition of RevertContext enhances event functionality.

Including RevertContext in the WithdrawAndRevert event provides more detailed information for handling revert scenarios, improving debugging and management.

v2/test/utils/IReceiverEVM.sol (1)

4-5: LGTM! Enhanced event structure with RevertContext.

The use of RevertContext in the ReceivedRevert event improves the structure and clarity of the event parameters.

Also applies to: 37-38

v2/typechain-types/factories/UniversalContract.sol/UniversalContract__factory.ts (1)

62-79: LGTM! Improved ABI structure with RevertContext.

The changes to the onRevert function's ABI enhance the clarity and structure of the parameters, using a structured RevertContext.

v2/typechain-types/factories/IZetaConnector.sol/IZetaConnectorEvents__factory.ts (1)

78-99: Enhancement: Detailed revert context added.

The addition of the revertContext structure to the WithdrawAndRevert event provides more comprehensive information about reverts, enhancing error handling and debugging capabilities.

v2/test/utils/ReceiverEVM.sol (1)

69-72: Improvement: Enhanced revert handling.

The onRevert function now uses RevertContext, improving the handling and emission of detailed revert information. This change enhances the contract's error handling capabilities.

v2/typechain-types/factories/IERC20Custody.sol/IERC20CustodyEvents__factory.ts (1)

122-144: LGTM! Verify the integration of the new event structure.

The addition of the revertContext event structure enhances debugging capabilities by providing detailed revert information. Ensure that this new structure is correctly integrated and used in the contract logic.

Verification successful

Integration of revertContext Verified

The revertContext structure is well-integrated across various parts of the codebase. It is used in multiple Solidity contracts and TypeScript files, indicating its integration into the contract logic and related interfaces. This confirms that the new event structure is being utilized effectively for debugging and revert information handling.

  • Occurrences in Solidity Contracts: Found in IGatewayZEVM.sol, GatewayEVM.sol, ZetaConnectorNative.sol, ZetaConnectorBase.sol, IERC20Custody.sol, and more.
  • Occurrences in TypeScript Files: Found in IGatewayEVM.ts, IZetaConnectorEvents.ts, IERC20Custody.ts, and others.

The integration appears comprehensive and consistent with the intended functionality.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage and integration of the new `revertContext` structure.

# Test: Search for the usage of `revertContext`. Expect: Occurrences in related contract logic.
rg --type solidity --type ts 'revertContext'

Length of output: 77


Script:

#!/bin/bash
# Description: Verify the usage and integration of the new `revertContext` structure.

# Find all Solidity and TypeScript files and search for the usage of `revertContext`.
fd -e sol -e ts | xargs rg 'revertContext'

Length of output: 386963

v2/typechain-types/factories/IReceiverEVM.sol/IReceiverEVMEvents__factory.ts (1)

135-155: LGTM! Verify the integration of the new event parameter.

The replacement of the data parameter with the revertContext structure provides more detailed information about revert scenarios. Ensure that this new parameter is correctly integrated and used in the contract logic.

Verification successful

Integration of revertContext Parameter Verified

The revertContext parameter is extensively integrated across the codebase, appearing in both Solidity and TypeScript files. It is used in event emissions, function parameters, and struct definitions, and is also present in test files, indicating that its functionality is being tested. This suggests a thorough integration into the contract logic.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage and integration of the new `revertContext` parameter.

# Test: Search for the usage of `revertContext`. Expect: Occurrences in related contract logic.
rg --type solidity --type ts 'revertContext'

Length of output: 77


Script:

#!/bin/bash
# Description: Verify the usage and integration of the new `revertContext` parameter.

# Test: Search for the usage of `revertContext`. Expect: Occurrences in related contract logic.
rg 'revertContext' --glob '*.sol' --glob '*.ts'

Length of output: 24340

v2/src/evm/ZetaConnectorNative.sol (1)

Line range hint 76-96: LGTM! Verify the integration of the new parameter in function logic.

The addition of the revertContext parameter to the withdrawAndRevert function enhances error handling by providing context during revert operations. Ensure that this new parameter is correctly integrated and used in the function logic.

Verification successful

Integration of revertContext Parameter Verified: The revertContext parameter is correctly integrated into the withdrawAndRevert function. It is used in the function's logic and passed to the gateway.revertWithERC20 method, and its integration is supported by related test cases.

  • The parameter is part of the function signature and used in the function body.
  • Test cases involving withdrawAndRevert confirm its usage and integration.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage and integration of the `revertContext` parameter in the `withdrawAndRevert` function.

# Test: Search for the usage of `withdrawAndRevert` and `revertContext`. Expect: Occurrences in related contract logic.
rg --type solidity 'withdrawAndRevert|revertContext'

Length of output: 87


Script:

#!/bin/bash
# Description: Verify the usage and integration of the `revertContext` parameter in the `withdrawAndRevert` function.

# Test: Search for the usage of `withdrawAndRevert` and `revertContext` in Solidity files.
rg 'withdrawAndRevert|revertContext' --glob '*.sol' -A 5

Length of output: 37964

v2/typechain-types/UniversalContract.sol/UniversalContract.ts (3)

37-39: LGTM: Enhanced RevertContextStruct.

The updated RevertContextStruct now includes asset, amount, and revertMessage, which enhances error handling by providing more context.


59-59: LGTM: Updated encodeFunctionData for onRevert.

The encodeFunctionData method now correctly uses the updated RevertContextStruct, aligning with the new structure.


124-124: LGTM: Updated onRevert method signature.

The onRevert method now uses the updated RevertContextStruct, improving the handling of revert scenarios.

Also applies to: 148-148

v2/src/evm/interfaces/IERC20Custody.sol (2)

27-30: LGTM: Enhanced WithdrawAndRevert event.

The WithdrawAndRevert event now includes a RevertContext parameter, providing more context for revert scenarios.


76-84: LGTM: Updated withdrawAndRevert function signature.

The withdrawAndRevert function now includes a RevertContext parameter, enhancing error handling and context management.

v2/src/evm/ZetaConnectorNonNative.sol (1)

90-96: LGTM: Enhanced withdrawAndRevert function.

The withdrawAndRevert function now includes a RevertContext parameter and uses it in the gateway.revertWithERC20 method, improving error handling.

Also applies to: 108-110

v2/typechain-types/factories/index.ts (1)

13-13: Addition of Revert.sol export is consistent.

The new export statement for Revert.sol follows the existing pattern and enhances module accessibility. This change is appropriate and aligns with the file's purpose.

v2/typechain-types/IZetaConnector.sol/IZetaConnectorEvents.ts (3)

24-28: Introduction of RevertContextStruct enhances event detail.

The new RevertContextStruct provides a structured way to include detailed revert information, which is a valuable addition for error handling.


77-90: Update to WithdrawAndRevertEvent includes revert context.

The addition of revertContext to the WithdrawAndRevertEvent namespace enriches the event with more detailed revert information, aligning with the enhanced error handling goals.


Line range hint 190-195: Update event signature for WithdrawAndRevert.

The change in the event signature to include revertContext is consistent with the new structure and provides more comprehensive event data.

Ensure that all event listeners and handlers are updated to accommodate this new signature.

v2/typechain-types/factories/IERC20Custody.sol/IERC20Custody__factory.ts (2)

106-127: Addition of RevertContext to withdrawAndRevert function.

The inclusion of RevertContext in the withdrawAndRevert function inputs enhances error handling by providing detailed context about reverts.


242-264: Addition of RevertContext to WithdrawAndRevert event.

The RevertContext addition to the WithdrawAndRevert event enriches the event data with detailed revert information, aligning with enhanced error management.

Ensure that all relevant functions and event handlers are updated to handle the new context structure.

Verification successful

RevertContext Structure is Properly Integrated

The RevertContext structure has been integrated into the WithdrawAndRevert event across the codebase, as evidenced by the multiple instances found in various files. This confirms that the relevant functions and event handlers have been updated to handle the new context structure.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the updated `withdrawAndRevert` function and `WithdrawAndRevert` event.

# Test: Search for the `withdrawAndRevert` function and `WithdrawAndRevert` event usage. Expect: Updated context structure usage.
rg --type typescript -A 5 $'withdrawAndRevert'
rg --type typescript -A 5 $'WithdrawAndRevert'

Length of output: 161


Script:

#!/bin/bash
# Description: Verify the usage of the updated `withdrawAndRevert` function and `WithdrawAndRevert` event.

# Test: Search for the `withdrawAndRevert` function and `WithdrawAndRevert` event usage in .ts files. Expect: Updated context structure usage.
rg --glob '*.ts' -A 5 $'withdrawAndRevert'
rg --glob '*.ts' -A 5 $'WithdrawAndRevert'

Length of output: 40391

v2/typechain-types/TestUniversalContract.ts (3)

39-48: Structured Revert Context Approved.

The addition of asset, amount, and revertMessage fields in RevertContextStruct and RevertContextStructOutput enhances the clarity and utility of revert data handling.


104-107: Event Structure Update Approved.

The inclusion of revertContext in ContextDataRevertEvent aligns with the structured handling of revert data.


65-65: Simplified Method Signatures Approved.

The updated method signatures using RevertContextStruct streamline the handling of revert contexts.

Ensure that all usages of encodeFunctionData and onRevert are updated to match the new signatures.

Also applies to: 170-170, 194-194

v2/typechain-types/IERC20Custody.sol/IERC20CustodyEvents.ts (3)

24-35: New Revert Context Structure Approved.

The introduction of RevertContextStruct and RevertContextStructOutput provides a clear and structured way to handle revert contexts.


119-120: Enhanced Event Structure Approved.

The update to include revertContext in WithdrawAndRevertEvent enhances the event's data handling capabilities.

Also applies to: 126-127, 134-134


270-270: Updated Event Signature Approved.

The signature update for WithdrawAndRevert reflects the inclusion of structured revert context data.

Ensure that all emissions of WithdrawAndRevert are updated to match the new signature.

Verification successful

Event Signature Update Verified.

The WithdrawAndRevert event signature has been consistently updated across the relevant files in the codebase:

  • v2/typechain-types/ERC20CustodyEchidnaTest.ts
  • v2/typechain-types/ERC20Custody.ts
  • v2/typechain-types/IERC20Custody.sol/IERC20Custody.ts
  • v2/typechain-types/IERC20Custody.sol/IERC20CustodyEvents.ts

These updates confirm that the new signature is correctly implemented.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all emissions of `WithdrawAndRevert` match the new signature.

# Test: Search for the event emission. Expect: Only occurrences of the new signature.
rg --type typescript -A 5 $'WithdrawAndRevert\\(address,address,uint256,bytes,tuple\\)'

Length of output: 121


Script:

#!/bin/bash
# Description: Verify all emissions of `WithdrawAndRevert` match the new signature.

# Test: Search for the event emission. Expect: Only occurrences of the new signature.
rg --type ts -A 5 $'WithdrawAndRevert\\(address,address,uint256,bytes,tuple\\)'

Length of output: 2285

v2/typechain-types/IReceiverEVM.sol/IReceiverEVMEvents.ts (3)

24-35: New Revert Context Structure Approved.

The introduction of RevertContextStruct and RevertContextStructOutput provides a clear and structured way to handle revert contexts.


138-141: Enhanced Event Structure Approved.

The update to include revertContext in ReceivedRevertEvent enhances the event's data handling capabilities.

Also applies to: 143-145, 148-148


284-284: Updated Event Signature Approved.

The signature update for ReceivedRevert reflects the inclusion of structured revert context data.

Ensure that all emissions of ReceivedRevert are updated to match the new signature.

Verification successful

Event Signature Update Verified

The ReceivedRevert event signature has been correctly updated to include a tuple in the relevant files:

  • v2/typechain-types/ReceiverEVM.ts
  • v2/typechain-types/IReceiverEVM.sol/IReceiverEVMEvents.ts

The changes reflect the new event structure as intended.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all emissions of `ReceivedRevert` match the new signature.

# Test: Search for the event emission. Expect: Only occurrences of the new signature.
rg --type typescript -A 5 $'ReceivedRevert\\(address,tuple\\)'

Length of output: 96


Script:

#!/bin/bash
# Description: Verify all emissions of `ReceivedRevert` match the new signature.

# Test: Search for the event emission. Expect: Only occurrences of the new signature.
rg --type ts -A 5 $'ReceivedRevert\\(address,tuple\\)'

Length of output: 1048

v2/typechain-types/factories/TestUniversalContract__factory.ts (1)

171-171: Verify Bytecode Changes.

The bytecode has been updated, which may affect contract deployment and execution. Ensure that the new bytecode aligns with the intended functionality and has been tested.

v2/typechain-types/IGatewayEVM.sol/IGatewayEVMEvents.ts (5)

24-29: New Type Definition: RevertOptionsStruct.

The introduction of RevertOptionsStruct enhances error handling. Ensure that this new type is utilized consistently across the codebase.


43-47: New Type Definition: RevertContextStruct.

The addition of RevertContextStruct provides context for reverts. Verify its integration with existing logic.


Line range hint 277-288:
Update Event Filter Signatures.

The event filter signatures for Call and Deposit now include revertOptions. Ensure that all event listeners are updated to handle this change.


70-72: Update to CallEvent InputTuple.

The addition of revertOptions to the CallEvent input tuple enhances event handling. Ensure that all event emissions are updated accordingly.

Verification successful

Verification Successful: CallEvent emissions include revertOptions.

The revertOptions parameter has been successfully integrated into the CallEvent emissions across the relevant files. No further action is required.

  • Files verified include:
    • v2/typechain-types/GatewayEVMUpgradeTest.ts
    • v2/typechain-types/GatewayEVMEchidnaTest.ts
    • v2/typechain-types/GatewayEVM.ts
    • v2/typechain-types/IGatewayEVM.sol/IGatewayEVMEvents.ts
    • v2/typechain-types/IGatewayEVM.sol/IGatewayEVM.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all `CallEvent` emissions include the new `revertOptions`.

# Test: Search for `CallEvent` emissions and check for `revertOptions`.
rg --type ts 'CallEvent'

Length of output: 12950


Script:

#!/bin/bash
# Description: Search for `CallEvent` emissions and check if they include `revertOptions`.

# Search for `CallEvent` emissions and include a few lines of context to check for `revertOptions`.
rg --type ts 'CallEvent' -A 5 | grep -i 'revertOptions'

Length of output: 475


97-98: Update to DepositEvent InputTuple.

The inclusion of revertOptions in the DepositEvent input tuple improves event handling. Ensure that all event emissions reflect this change.

v2/src/zevm/interfaces/IGatewayZEVM.sol (5)

15-18: Update to Call Event.

The inclusion of revertOptions in the Call event enhances its utility. Ensure that all event emissions and listeners are updated accordingly.


88-94: Update to withdraw Function Signature.

The withdraw function now includes revertOptions. Verify that all function calls are updated to pass this new parameter.

Verification successful

Verification Successful: withdraw Function Calls Updated

The withdraw function calls have been updated to include the revertOptions parameter, as seen in the test files. This confirms that the necessary updates have been made to accommodate the new function signature.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all `withdraw` function calls include the new `revertOptions`.

# Test: Search for `withdraw` function calls and check for `revertOptions`.
rg --type sol 'withdraw'

Length of output: 52


Script:

#!/bin/bash
# Description: Verify that all `withdraw` function calls include the new `revertOptions`.

# Test: Search for `withdraw` function calls in Solidity files and check for `revertOptions`.
rg 'withdraw' --glob '*.sol' -A 2

Length of output: 42243


143-149: Update to call Function Signature.

The call function now includes revertOptions. Verify that all function calls are updated to pass this new parameter.


114-121: Update to withdrawAndCall Function Signature.

The withdrawAndCall function now requires revertOptions. Ensure that all calls to this function are updated accordingly.

Verification successful

All withdrawAndCall Calls Updated with revertOptions.

The withdrawAndCall function calls within the IGatewayZEVM contract have been updated to include the revertOptions parameter as required. No further action is needed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all `withdrawAndCall` function calls include the new `revertOptions`.

# Test: Search for `withdrawAndCall` function calls and check for `revertOptions`.
rg --type sol 'withdrawAndCall'

Length of output: 59


Script:

#!/bin/bash
# Find all Solidity files and search for `withdrawAndCall` calls.
fd -e sol -x rg 'withdrawAndCall' {}

Length of output: 92706


Script:

#!/bin/bash
# Find all Solidity files and search for `withdrawAndCall` calls specifically within the IGatewayZEVM contract.
fd -e sol -x rg 'IGatewayZEVM.*withdrawAndCall' {}

Length of output: 465


224-231: Update to depositAndRevert Function Signature.

The depositAndRevert function now uses zContext. Verify that all function calls are updated to reflect this change.

Verification successful

depositAndRevert Function Calls Updated with zContext.

The depositAndRevert function calls across the codebase have been updated to include zContext as a parameter. The search results confirm that zContext is consistently used in all relevant function calls.

  • Instances of depositAndRevert in TypeScript and Go files include zContext in their parameters.

No further action is required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all `depositAndRevert` function calls use `zContext`.

# Test: Search for `depositAndRevert` function calls and check for `zContext`.
rg --type sol 'depositAndRevert'

Length of output: 60


Script:

#!/bin/bash
# Find all Solidity files and search for `depositAndRevert` function calls.
fd -e sol -x rg 'depositAndRevert' {}

Length of output: 32058


Script:

#!/bin/bash
# Extract lines around `depositAndRevert` calls to check for `zContext` usage.
fd -e sol -e ts -e go -x rg -A 3 -B 3 'depositAndRevert' {}

Length of output: 133664

v2/pkg/revert.sol/revertable.go (5)

32-37: Introduction of RevertContext struct.

The RevertContext struct provides a clear and structured way to handle revert-related data, enhancing type safety and readability. This is a positive change that improves the code's maintainability.


200-201: Update OnRevert function signature in RevertableSession.

This change mirrors the update in RevertableTransactor, ensuring consistency across sessions. Verify that session usage aligns with this change.


207-208: Update OnRevert function signature in RevertableTransactorSession.

This change ensures consistency across transactor sessions. Verify that transactor session usage aligns with this change.


41-41: ABI update for onRevert.

The ABI string has been updated to reflect the new RevertContext struct. Ensure that all external systems interacting with this contract are aware of the ABI change.


193-194: Update OnRevert function signature in RevertableTransactor.

The function now takes a RevertContext instead of a byte array, improving type safety and clarity. Ensure that all calls to this function are updated to use the new parameter type.

Verification successful

Verification Successful: All OnRevert function calls updated

All instances of the OnRevert function in the codebase have been updated to use the RevertContext parameter, as expected. No further action is needed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all calls to `OnRevert` use the new parameter type.

# Test: Search for `OnRevert` function calls. Expect: Only occurrences with `RevertContext`.
rg --type go 'OnRevert'

Length of output: 268691

v2/typechain-types/IERC20Custody.sol/IERC20Custody.ts (6)

26-30: Introduction of RevertContextStruct.

The RevertContextStruct provides a clear and structured way to handle revert-related data in TypeScript, enhancing type safety and readability.


32-36: Definition of RevertContextStructOutput.

This output type provides a tuple representation of the RevertContextStruct, ensuring consistency in how revert context data is handled in outputs.


256-257: Update withdrawAndRevert method signature.

The method now requires a RevertContextStruct, aligning with the updated function signature. Ensure that all calls to this method are updated with the new parameter.

Also applies to: 297-297


384-384: Update event signature for WithdrawAndRevert.

The event now includes revertContext, enhancing the information available during event emissions. Ensure that event filters are updated to accommodate this change.


70-76: Update encodeFunctionData for withdrawAndRevert.

The function now requires a RevertContextStruct, reflecting changes to handle additional context. Ensure that all calls to this method are updated with the new parameter.


166-181: Update WithdrawAndRevertEvent structure.

The event now includes revertContext, enhancing the information available during event emissions. Ensure that event listeners are updated to handle this new structure.

v2/typechain-types/factories/ZetaConnectorBase__factory.ts (2)

308-329: Addition of revertContext in withdrawAndRevert function inputs.

The revertContext provides detailed context for revert scenarios, improving error handling. Ensure that all calls to this function are updated with the new parameter.


514-536: Addition of revertContext in WithdrawAndRevert event inputs.

The event now includes revertContext, enhancing the information available during event emissions. Ensure that event listeners are updated to handle this new structure.

v2/typechain-types/ReceiverEVM.ts (4)

26-30: Introduce RevertContextStruct for structured error handling.

The new RevertContextStruct type provides a structured way to pass information about reverts, which enhances error handling and debugging capabilities.


32-36: Define RevertContextStructOutput for output handling.

The RevertContextStructOutput type mirrors RevertContextStruct for output scenarios, ensuring consistency in handling revert context data.


58-61: Update encodeFunctionData for onRevert with RevertContextStruct.

The encodeFunctionData method now accepts RevertContextStruct, aligning with the new structured error handling approach.


197-207: Enhance ReceivedRevertEvent with RevertContextStruct.

The ReceivedRevertEvent now includes RevertContextStruct, providing more detailed information during revert scenarios.

v2/pkg/universalcontract.sol/universalcontract.go (5)

34-36: Redefine RevertContext struct for clarity.

The RevertContext struct now includes Asset, Amount, and RevertMessage, simplifying the representation of revert contexts.


48-48: Update ABI metadata for onRevert.

The ABI metadata reflects the changes in the RevertContext structure, ensuring compatibility with the contract's interface.


218-222: Simplify OnRevert function signature in UniversalContractTransactor.

The OnRevert function now takes a single RevertContext parameter, streamlining the function's interface and improving maintainability.


225-229: Simplify OnRevert function signature in UniversalContractSession.

The function signature change mirrors the transactor, ensuring consistency across different contract sessions.


232-236: Simplify OnRevert function signature in UniversalContractTransactorSession.

This change aligns with the overall refactoring effort, maintaining uniformity in how revert contexts are handled.

v2/test/ZetaConnectorNative.t.sol (4)

42-42: Add revertContext state variable for structured revert handling.

The revertContext variable is initialized in setUp, providing a consistent structure for handling reverts in tests.


76-76: Initialize revertContext in setUp.

The initialization of revertContext ensures that revert scenarios are handled with detailed context, improving test reliability.


267-273: Update event emissions to include revertContext.

The use of revertContext in event emissions enhances the clarity and consistency of revert-related events, aiding in debugging and error tracking.


299-299: Include revertContext in withdrawAndRevert function call.

The function signature now includes revertContext, aligning with the updated error handling strategy.

v2/src/zevm/GatewayZEVM.sol (6)

170-184: Verify the usage of RevertOptions.

The addition of RevertOptions to the withdraw function for ZETA tokens enhances error handling. Ensure that all calls to this function are updated to include the new parameter.

Verification successful

Verify the usage of RevertOptions in function calls.

The search results indicate that the withdraw function with the RevertOptions parameter is being called correctly in multiple places within the codebase. These calls are consistent with the updated function signature, ensuring that the RevertOptions parameter is utilized as intended.

  • Files with updated withdraw calls:
    • v2/test/GatewayZEVM.t.sol
    • v2/test/utils/SenderZEVM.sol
    • v2/scripts/localnet/ZevmWithdrawAndCall.s.sol

Please verify manually if necessary to ensure all calls are updated and functioning as expected.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `withdraw` for ZETA tokens match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type solidity -A 5 $'withdraw'

Length of output: 67


Script:

#!/bin/bash
# Description: Verify all function calls to `withdraw` for ZETA tokens match the new signature.

# Test: Search for the function usage in Solidity files. Expect: Only occurrences of the new signature.
rg 'withdraw' --glob '*.sol' -A 5

Length of output: 70098


Line range hint 320-336:
Verify the usage of the new context type.

The context parameter type in executeRevert has been changed. Ensure that all calls to this function are updated to use the new context type.

Verification successful

New context type usage verified successfully.

The executeRevert function calls in the test files correctly use the zContext type for the context parameter, indicating that the change has been properly integrated. No further action is required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `executeRevert` match the new context type.

# Test: Search for the function usage. Expect: Only occurrences of the new context type.
rg --type solidity -A 5 $'executeRevert'

Length of output: 72


Script:

#!/bin/bash
# Description: Verify all function calls to `executeRevert` match the new context type.

# Test: Search for the function usage. Expect: Only occurrences of the new context type.
rg --glob '*.sol' -A 5 'executeRevert'

Length of output: 6167


215-227: Verify the usage of RevertOptions.

The addition of RevertOptions to the call function enhances error handling. Ensure that all calls to this function are updated to include the new parameter.


Line range hint 345-363:
Verify the usage of the new context type.

The context parameter type in depositAndRevert has been changed. Ensure that all calls to this function are updated to use the new context type.

Verification successful

Verification Successful: New Context Type Usage is Consistent

The depositAndRevert function has been updated to use the new context type zContext or ZContextStruct across the codebase. All instances reflect this change, ensuring consistency. No outdated usage of the old context type was found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `depositAndRevert` match the new context type.

# Test: Search for the function usage. Expect: Only occurrences of the new context type.
rg --type solidity -A 5 $'depositAndRevert'

Length of output: 75


Script:

#!/bin/bash
# Description: Verify all function calls to `depositAndRevert` in the Solidity codebase.

# Test: Search for the function usage across all files. Expect: Only occurrences of the new context type.
rg 'depositAndRevert' -A 5

Length of output: 72644


121-137: Verify the usage of RevertOptions.

The addition of RevertOptions to the withdraw function enhances error handling. Ensure that all calls to this function are updated to include the new parameter.


Line range hint 192-208:
Verify the usage of RevertOptions.

The addition of RevertOptions to the withdrawAndCall function for ZETA tokens enhances error handling. Ensure that all calls to this function are updated to include the new parameter.

Verification successful

All calls to withdrawAndCall include RevertOptions.

The search results confirm that the withdrawAndCall function is consistently called with the RevertOptions parameter across the codebase. This suggests that the function's new signature has been correctly adopted in all relevant places.

  • Calls to withdrawAndCall with RevertOptions were found in various Solidity files, confirming the update.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `withdrawAndCall` for ZETA tokens match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type solidity -A 5 $'withdrawAndCall'

Length of output: 74


Script:

#!/bin/bash
# Description: Find Solidity files and search for calls to `withdrawAndCall`.

# Find all Solidity files and search for the function usage.
fd --extension sol --exec rg 'withdrawAndCall' {}

Length of output: 92719


Script:

#!/bin/bash
# Description: Refine search to focus on Solidity files and verify the usage of `withdrawAndCall` with `RevertOptions`.

# Find all Solidity files and search for the specific function signature usage.
fd --extension sol --exec rg 'withdrawAndCall\(.*revertOptions' {}

Length of output: 3419

v2/typechain-types/factories/IGatewayEVM.sol/IGatewayEVM__factory.ts (6)

27-55: Verify the usage of revertOptions.

The addition of revertOptions to the call function enhances error handling. Ensure that all calls to this function are updated to include the new parameter.

Verification successful

Verify the usage of revertOptions.

The call function is consistently used with the revertOptions parameter across the codebase. Ensure that all instances are correctly updated to include this parameter, as seen in the following files:

  • v2/test/GatewayZEVM.t.sol
  • v2/test/GatewayEVMZEVM.t.sol
  • v2/test/GatewayEVM.t.sol
  • v2/test/utils/SenderZEVM.sol
  • v2/scripts/localnet/ZevmCall.s.sol
  • v2/scripts/localnet/EvmCall.s.sol

These instances confirm that the new parameter is being utilized correctly. However, further manual verification might be necessary to ensure all edge cases are covered.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `call` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type typescript -A 5 $'call'

Length of output: 67


Script:

#!/bin/bash
# Description: Search for the `call` function usage across the codebase.

# Search for the `call` function usage and include surrounding lines for context.
rg 'call\(' -A 5

Length of output: 19918


285-306: Verify the usage of revertContext.

The addition of revertContext to the executeRevert function enhances error handling. Ensure that all calls to this function are updated to include the new parameter.

Verification successful

The revertContext parameter is correctly integrated.

The executeRevert function is consistently defined and used with the revertContext parameter across the codebase, including in files such as GatewayEVM.ts, GatewayEVMUpgradeTest.ts, and GatewayEVMEchidnaTest.ts. This confirms that all calls to this function have been updated to include the new parameter.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `executeRevert` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type typescript -A 5 $'executeRevert'

Length of output: 76


Script:

#!/bin/bash
# Description: Verify all function calls to `executeRevert` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type ts -A 5 $'executeRevert'

Length of output: 15959


117-141: Verify the usage of revertOptions.

The addition of revertOptions to the payable deposit function enhances error handling. Ensure that all calls to this function are updated to include the new parameter.


76-102: Verify the usage of revertOptions.

The addition of revertOptions to the deposit function enhances error handling. Ensure that all calls to this function are updated to include the new parameter.

Verification successful

Verification Successful: revertOptions Parameter Usage in deposit Function

The updated deposit function signature with the revertOptions parameter is present in the codebase, indicating that the integration has been made. Ensure that all relevant function calls are updated to use this new signature where applicable.

  • Confirmed occurrences in v2/typechain-types/GatewayEVM.ts and related files.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `deposit` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type typescript -A 5 $'deposit'

Length of output: 70


Script:

#!/bin/bash
# Description: Verify all function calls to `deposit` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type ts -A 5 $'deposit'

Length of output: 163777


363-384: Verify the usage of revertContext.

The addition of revertContext to the revertWithERC20 function enhances error handling. Ensure that all calls to this function are updated to include the new parameter.


171-197: Verify the usage of revertOptions.

The addition of revertOptions to the depositAndCall function enhances error handling. Ensure that all calls to this function are updated to include the new parameter.

v2/src/evm/GatewayEVM.sol (5)

305-316: Verify the usage of RevertOptions.

The addition of RevertOptions to the call function enhances error handling. Ensure that all calls to this function are updated to include the new parameter.

Verification successful

RevertOptions usage in call function is correctly implemented.

The call function with the RevertOptions parameter is used correctly across the codebase, including in test files, ensuring the new signature is properly integrated and tested.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `call` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type solidity -A 5 $'call'

Length of output: 63


Script:

#!/bin/bash
# Description: Verify all function calls to `call` match the new signature.

# Test: Search for the function usage within Solidity files. Expect: Only occurrences of the new signature.
rg 'call\(' --glob '*.sol' -A 5

Length of output: 5243


Line range hint 186-205:
Verify the usage of revertContext.

The addition of revertContext to the revertWithERC20 function enhances error handling. Ensure that all calls to this function are updated to include the new parameter.

Verification successful

All calls to revertWithERC20 are correctly updated with revertContext. The function is consistently used with the new parameter across the codebase, ensuring enhanced error handling as intended.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `revertWithERC20` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type solidity -A 5 $'revertWithERC20'

Length of output: 74


Script:

#!/bin/bash
# Description: Search for all occurrences of `revertWithERC20` in Solidity files to verify the new function signature.

# Find all `.sol` files and search for `revertWithERC20` within them.
fd --extension sol --exec rg 'revertWithERC20' {}

Length of output: 66551


256-274: Review low-level call in depositAndCall.

The function uses a low-level call to tssAddress. Ensure that this call is safe and consider using a higher-level abstraction if possible.

Consider using Address.sendValue from OpenZeppelin's Address library for safer ETH transfers.

- (bool deposited,) = tssAddress.call{ value: msg.value }("");
+ Address.sendValue(payable(tssAddress), msg.value);

Verify the usage of RevertOptions.

The addition of RevertOptions to the depositAndCall function enhances error handling. Ensure that all calls to this function are updated to include the new parameter.

Verification successful

Function calls to depositAndCall have been updated.

The depositAndCall function is used with the new RevertOptions parameter in the test files, confirming that the codebase has been updated to match the new signature.

  • Instances in v2/test/GatewayEVM.t.sol demonstrate the usage of the new signature.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `depositAndCall` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type solidity -A 5 $'depositAndCall'

Length of output: 73


Script:

#!/bin/bash
# Description: Verify all function calls to `depositAndCall` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --glob '*.sol' -A 5 'depositAndCall'

Length of output: 14743


210-227: Review low-level call in deposit.

The function uses a low-level call to tssAddress. Ensure that this call is safe and consider using a higher-level abstraction if possible.

Consider using Address.sendValue from OpenZeppelin's Address library for safer ETH transfers.

- (bool deposited,) = tssAddress.call{ value: msg.value }("");
+ Address.sendValue(payable(tssAddress), msg.value);

Verify the usage of RevertOptions.

The addition of RevertOptions to the deposit function enhances error handling. Ensure that all calls to this function are updated to include the new parameter.

Verification successful

All deposit function calls include RevertOptions.

The deposit function in GatewayEVM.sol is correctly using the RevertOptions parameter in all relevant instances, including interfaces and test files. This indicates that the function's signature has been consistently updated across the codebase.

  • v2/src/evm/interfaces/IGatewayEVM.sol: Function signatures include RevertOptions.
  • v2/src/evm/GatewayEVM.sol: Function implementation includes RevertOptions.
  • v2/test/utils/GatewayEVMUpgradeTest.sol: Test cases include RevertOptions.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `deposit` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type solidity -A 5 $'deposit'

Length of output: 66


Script:

#!/bin/bash
# Description: Verify all function calls to `deposit` match the new signature.

# Test: Search for the function usage in Solidity files. Expect: Only occurrences of the new signature.
rg --glob '*.sol' -A 5 $'deposit'

Length of output: 50927


Script:

#!/bin/bash
# Description: Verify if all calls to `deposit` in GatewayEVM.sol use the new signature with `RevertOptions`.

# Test: Search for the specific signature of the `deposit` function with `RevertOptions`.
rg --glob '*.sol' -A 3 'deposit(' | grep 'RevertOptions'

Length of output: 123


Script:

#!/bin/bash
# Description: Verify if all calls to `deposit` in GatewayEVM.sol use the new signature with `RevertOptions`.

# Test: Search for the specific signature of the `deposit` function with `RevertOptions`.
rg --glob '*.sol' -A 3 'deposit\(' | grep 'RevertOptions'

Length of output: 502


Line range hint 101-115:
Verify the usage of revertContext.

The addition of revertContext to the executeRevert function enhances error handling. Ensure that all calls to this function are updated to include the new parameter.

Verification successful

All executeRevert calls are correctly updated with revertContext.

The search results confirm that all instances of the executeRevert function in the codebase have been updated to include the revertContext parameter. This ensures that the function's new signature is consistently used throughout the codebase.

  • Files and Locations:
    • v2/src/evm/GatewayEVM.sol
    • v2/src/evm/interfaces/IGatewayEVM.sol
    • Various test files and typechain-generated files also reflect the updated signature.

No further manual verification is required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `executeRevert` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type solidity -A 5 $'executeRevert'

Length of output: 72


Script:

#!/bin/bash
# Description: Verify all function calls to `executeRevert` match the new signature.

# Test: Search for the function usage without specifying file type.
rg -A 5 'executeRevert'

Length of output: 266519

v2/typechain-types/factories/ReceiverEVM__factory.ts (2)

28-47: Enhance error handling with RevertContext.

The introduction of the RevertContext tuple in the onRevert function's ABI enhances error handling by providing detailed context during reverts. This change improves the granularity of information available, aiding in debugging and state management.


275-295: Update event structure for ReceivedRevert.

The ReceivedRevert event now includes the RevertContext tuple, providing more comprehensive information when a revert occurs. This change aligns with the improved error handling strategy and enhances transparency in transaction logging.

v2/test/utils/GatewayEVMUpgradeTest.sol (10)

4-4: Import RevertContext and RevertOptions for enhanced error handling.

The addition of these imports from Revert.sol indicates a shift towards more structured error handling within the contract, allowing for better management of transaction failures.


57-71: Improve initialization with descriptive parameter names.

The initialize function now uses more descriptive parameter names, enhancing code readability. The addition of zero address checks strengthens the contract's robustness against invalid inputs.


103-119: Enhance executeRevert function with RevertContext.

The executeRevert function now includes a RevertContext parameter, allowing for more nuanced handling of revert scenarios. This change improves the function's ability to manage errors effectively.


214-231: Add RevertOptions to deposit function for improved error handling.

The deposit function now includes RevertOptions, allowing for more flexible management of potential errors during deposits. This change enhances the function's robustness and transparency.


238-254: Integrate RevertOptions into ERC20 deposit function.

The ERC20 deposit function now incorporates RevertOptions, aligning with the enhanced error handling strategy across the contract. This addition improves the function's ability to manage transaction failures.


260-278: Include RevertOptions in depositAndCall for better error management.

The depositAndCall function now accepts RevertOptions, providing more control over error handling during complex transactions. This change supports the contract's improved error management capabilities.


286-303: Enhance ERC20 depositAndCall with RevertOptions.

The ERC20 version of depositAndCall now includes RevertOptions, enhancing error handling and aligning with the contract's overall improvements in managing transaction failures.


309-320: Add RevertOptions to call function for improved control.

The call function now includes RevertOptions, allowing for more detailed management of potential errors during contract calls. This change enhances the function's robustness and flexibility.


324-330: Refactor setCustody with improved parameter naming.

The setCustody function now uses a more descriptive parameter name, custody_, improving code readability. The additional check for zero addresses strengthens the function's robustness.


334-340: Refactor setConnector with improved parameter naming.

The setConnector function now uses a more descriptive parameter name, zetaConnector_, enhancing code clarity. The added zero address check improves the function's robustness.

v2/typechain-types/index.ts (2)

22-23: Add revertSol import for expanded type definitions.

The addition of the revertSol import integrates types from Revert.sol, expanding the available type definitions and improving modularity.


196-197: Shift Revertable type source to Revert.sol.

The Revertable type and its factory are now sourced from Revert.sol, reflecting a reorganization that enhances modularity and clarity in type management.

v2/typechain-types/IGatewayEVM.sol/IGatewayEVM.ts (12)

26-31: Introduce RevertOptionsStruct for enhanced error handling.

The RevertOptionsStruct type is a well-structured addition that enhances the contract's ability to handle revert scenarios more explicitly. This change improves the robustness of the contract's operations.


33-43: Define RevertOptionsStructOutput for consistent output handling.

The RevertOptionsStructOutput type ensures that the output of functions using RevertOptionsStruct is consistently structured, aiding in clarity and maintainability.


45-49: Introduce RevertContextStruct for contextual revert information.

The RevertContextStruct provides additional context for revert scenarios, which can be useful for debugging and handling complex transactions.


61-64: Update function signatures to include RevertOptionsStruct.

The inclusion of RevertOptionsStruct in function signatures like deposit and depositAndCall enhances the flexibility and control over transaction reverts.


82-104: Modify encodeFunctionData to support RevertOptionsStruct.

The encodeFunctionData method updates reflect the changes in function signatures, ensuring that the encoding process accommodates the new RevertOptionsStruct.


112-126: Update encodeFunctionData for executeRevert with RevertContextStruct.

The executeRevert function now includes RevertContextStruct, providing additional context during reverts.


165-178: Enhance CallEvent with RevertOptionsStruct.

The CallEvent now includes RevertOptionsStruct, allowing emitted events to carry revert-related information, which aids in tracking and handling errors.


192-209: Enhance DepositEvent with RevertOptionsStruct.

The DepositEvent now includes RevertOptionsStruct, improving the ability to log and manage revert scenarios during deposit operations.


263-280: Enhance RevertedEvent with RevertContextStruct.

The RevertedEvent now includes RevertContextStruct, providing detailed information about the context of a revert, which is beneficial for debugging and auditing.


387-391: Replace void with undefined in return types.

The use of void in return types is flagged as confusing. Consider replacing void with undefined for clarity and to align with TypeScript best practices.

Also applies to: 412-413


426-430: Replace void with undefined in return types.

The use of void in return types is flagged as confusing. Consider replacing void with undefined for clarity and to align with TypeScript best practices.

Also applies to: 435-442, 447-448, 454-461, 466-473


Line range hint 558-569: Update event filters to include RevertOptionsStruct.

The event filters for Call and Deposit now include RevertOptionsStruct, ensuring that the filtering process accounts for the new revert-related data.

Also applies to: 602-603

v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVM.ts (11)

26-31: Introduce RevertOptionsStruct for enhanced error handling.

The RevertOptionsStruct type is a well-structured addition that enhances the contract's ability to handle revert scenarios more explicitly. This change improves the robustness of the contract's operations.


33-43: Define RevertOptionsStructOutput for consistent output handling.

The RevertOptionsStructOutput type ensures that the output of functions using RevertOptionsStruct is consistently structured, aiding in clarity and maintainability.


58-60: Introduce RevertContextStruct for contextual revert information.

The RevertContextStruct provides additional context for revert scenarios, which can be useful for debugging and handling complex transactions.


79-82: Update function signatures to include RevertOptionsStruct.

The inclusion of RevertOptionsStruct in function signatures like withdraw and withdrawAndCall enhances the flexibility and control over transaction reverts.


Line range hint 89-155: Modify encodeFunctionData to support RevertOptionsStruct.

The encodeFunctionData method updates reflect the changes in function signatures, ensuring that the encoding process accommodates the new RevertOptionsStruct.


178-190: Update decodeFunctionResult for consistency with new signatures.

The decodeFunctionResult methods have been updated to reflect the new function signatures, ensuring consistency in decoding function results.


200-215: Enhance CallEvent with RevertOptionsStruct.

The CallEvent now includes RevertOptionsStruct, allowing emitted events to carry revert-related information, which aids in tracking and handling errors.


Line range hint 232-255: Enhance WithdrawalEvent with RevertOptionsStruct.

The WithdrawalEvent now includes RevertOptionsStruct, improving the ability to log and manage revert scenarios during withdrawal operations.


373-378: Replace void with undefined in return types.

The use of void in return types is flagged as confusing. Consider replacing void with undefined for clarity and to align with TypeScript best practices.

Also applies to: 509-514


437-442: Replace void with undefined in return types.

The use of void in return types is flagged as confusing. Consider replacing void with undefined for clarity and to align with TypeScript best practices.

Also applies to: 482-487, 520-527, 532-539, 544-551, 557-564


Line range hint 586-597: Update event filters to include RevertOptionsStruct.

The event filters for Call and Withdrawal now include RevertOptionsStruct, ensuring that the filtering process accounts for the new revert-related data.

v2/test/GatewayEVM.t.sol (12)

37-38: Introduce RevertOptions and RevertContext for enhanced testing.

The addition of RevertOptions and RevertContext variables in the test contract allows for testing scenarios involving revert options, enhancing the robustness of the test suite.


79-79: Initialize RevertContext for testing revert scenarios.

The RevertContext is initialized with mock data, providing a basis for testing revert-related functionality.


240-240: Test revertWithERC20 with RevertContext.

The test for revertWithERC20 now includes revertContext, ensuring that the function's behavior is correctly validated under revert conditions.


251-255: Test executeRevert with RevertContext.

The test for executeRevert now includes revertContext, validating that the function correctly handles revert scenarios.


268-268: Test executeRevert failure scenarios.

The tests for executeRevert now include scenarios where the sender is not authorized or the receiver is a zero address, ensuring comprehensive coverage of potential errors.

Also applies to: 277-277


293-293: Introduce RevertOptions for enhanced testing in GatewayEVMInboundTest.

The addition of RevertOptions allows for testing scenarios involving revert options, enhancing the robustness of the test suite.


326-331: Initialize RevertOptions with mock data.

The RevertOptions are initialized with mock data, providing a basis for testing revert-related functionality.


342-343: Emit Deposit event with RevertOptions.

The Deposit event now includes revertOptions, ensuring that the event accurately reflects the transaction's revert conditions.

Also applies to: 368-369, 395-396, 473-474


426-426: Emit Deposit event with payload and RevertOptions.

The Deposit event now includes a payload and revertOptions, ensuring that the event accurately reflects the transaction's conditions.

Also applies to: 439-440


455-455: Test failure scenarios for depositAndCall.

The tests for depositAndCall now include scenarios where the amount is zero or the receiver is a zero address, ensuring comprehensive coverage of potential errors.

Also applies to: 464-464, 485-485, 493-493


500-501: Emit Call event with RevertOptions.

The Call event now includes revertOptions, ensuring that the event accurately reflects the transaction's revert conditions.


508-508: Test failure scenario for call.

The test for call now includes a scenario where the destination is a zero address, ensuring comprehensive coverage of potential errors.

v2/typechain-types/ZetaConnectorBase.ts (5)

26-30: New Type Definition: RevertContextStruct.

The introduction of RevertContextStruct is a positive addition for handling revert scenarios, encapsulating asset, amount, and revertMessage. Ensure consistency in how these fields are used across the codebase.


32-36: New Type Definition: RevertContextStructOutput.

The corresponding output type RevertContextStructOutput correctly mirrors the structure of RevertContextStruct for output purposes. This ensures type safety and clarity in handling revert contexts.


304-317: Update Event Tuples: WithdrawAndRevertEvent.

Including revertContext in the InputTuple and OutputTuple of WithdrawAndRevertEvent improves event logging and debugging capabilities. Ensure that event emissions are updated accordingly in the implementation.


444-445: Update Method Signature: withdrawAndRevert.

The method signature now includes revertContext, aligning with the enhanced error handling strategy. Check that all invocations of this method are updated to include the new parameter.

Verification successful

No Invocations Found for withdrawAndRevert Method

The search did not find any invocations of the withdrawAndRevert method in the codebase. This suggests that the method is not currently used, or it might be a new addition awaiting integration. Ensure that any future uses of this method include the revertContext parameter as per the updated method signature.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify method invocations of `withdrawAndRevert` with the new parameter.
rg --type typescript -A 5 $'withdrawAndRevert'

Length of output: 80


Script:

#!/bin/bash
# Re-run the search for method invocations of `withdrawAndRevert` using the correct file type for TypeScript.
rg --type ts -A 5 $'withdrawAndRevert'

Length of output: 15129


Script:

#!/bin/bash
# Search for actual function calls to `withdrawAndRevert` to verify if the `revertContext` parameter is included.
rg --type ts 'withdrawAndRevert\(' -A 3

Length of output: 41


Script:

#!/bin/bash
# Broaden the search for function calls to `withdrawAndRevert` to ensure no invocations are missed.
rg --type ts 'withdrawAndRevert\(' -A 10

Length of output: 42


129-135: Update Function Signature: encodeFunctionData for withdrawAndRevert.

The addition of RevertContextStruct to the withdrawAndRevert function signature enhances error handling by providing detailed context. Verify that all calls to this function are updated to match the new signature.

v2/typechain-types/ZetaConnectorNative.ts (5)

26-30: New Type Definition: RevertContextStruct.

The introduction of RevertContextStruct is consistent with the previous file, providing a structured way to handle revert scenarios. Ensure its usage is consistent across the codebase.


32-36: New Type Definition: RevertContextStructOutput.

The output type RevertContextStructOutput mirrors the input structure, ensuring consistency and type safety in handling revert contexts.


304-317: Update Event Tuples: WithdrawAndRevertEvent.

Including revertContext in the InputTuple and OutputTuple of WithdrawAndRevertEvent enhances event logging. Ensure that event emissions are updated accordingly in the implementation.


444-445: Update Method Signature: withdrawAndRevert.

The method signature now includes revertContext, aligning with the enhanced error handling strategy. Check that all invocations of this method are updated to include the new parameter.


129-135: Update Function Signature: encodeFunctionData for withdrawAndRevert.

Adding RevertContextStruct to the withdrawAndRevert function signature enhances error handling. Verify that all calls to this function are updated to match the new signature.

v2/test/ERC20Custody.t.sol (5)

36-36: New State Variable: revertContext.

The addition of revertContext as a state variable allows for better error handling and context management during tests. Ensure this variable is correctly initialized and used in all relevant test cases.


78-78: Initialization of revertContext.

The revertContext is initialized with default values. Ensure these values are appropriate for the test scenarios and adjust if necessary.


374-374: Update Function Call: withdrawAndRevert.

The withdrawAndRevert function call now includes revertContext, aligning with the enhanced error handling. Ensure all test cases using this function are updated accordingly.


423-429: Update Event Emissions:

The events ReceivedRevert, Reverted, and WithdrawAndRevert now include revertContext. This provides better traceability and context in test scenarios. Verify that the emitted values are correctly asserted in the tests.


Line range hint 454-472: Test Cases for withdrawAndRevert.

The test cases for withdrawAndRevert are updated to include revertContext. Ensure that these tests cover all edge cases and scenarios relevant to the new context handling.

v2/typechain-types/ZetaConnectorNonNative.ts (5)

26-30: Define RevertContextStruct Type.

The RevertContextStruct type is well-defined with properties asset, amount, and revertMessage. This structure is crucial for passing detailed context in case of transaction reverts.


32-36: Define RevertContextStructOutput Type.

The RevertContextStructOutput type mirrors the input structure but specifies output types, ensuring consistency in handling revert contexts.


137-143: Update withdrawAndRevert Function Signature.

The addition of RevertContextStruct to the withdrawAndRevert function signature enhances error handling by providing detailed context in case of reverts.


329-342: Modify WithdrawAndRevertEvent Structure.

The inclusion of revertContext in both input and output tuples of the WithdrawAndRevertEvent allows for more comprehensive event data, facilitating better debugging and state tracking.


Line range hint 746-751: Update Event Declaration for WithdrawAndRevert.

The event signature now includes a tuple for revertContext, aligning with the updated function and event structures. This change ensures consistency across the contract's interface.

v2/typechain-types/ERC20Custody.ts (5)

26-30: Define RevertContextStruct Type.

The RevertContextStruct is correctly defined with asset, amount, and revertMessage properties, providing detailed context for transaction reverts.


32-36: Define RevertContextStructOutput Type.

The RevertContextStructOutput type ensures the output format is consistent with the input structure, aiding in uniform handling of revert contexts.


143-149: Update withdrawAndRevert Function Signature.

Including RevertContextStruct in the withdrawAndRevert function signature enhances error handling capabilities by providing additional context.


361-376: Modify WithdrawAndRevertEvent Structure.

The addition of revertContext to both input and output tuples of the WithdrawAndRevertEvent allows for detailed event data, improving debugging and state management.


Line range hint 785-790: Update Event Declaration for WithdrawAndRevert.

The event signature now includes revertContext as a tuple, ensuring consistency with updated function and event structures.

v2/typechain-types/ERC20CustodyEchidnaTest.ts (5)

26-30: Define RevertContextStruct Type.

The RevertContextStruct is well-defined with asset, amount, and revertMessage properties, providing essential context for transaction reverts.


32-36: Define RevertContextStructOutput Type.

The RevertContextStructOutput type mirrors the input structure, ensuring consistency in handling revert contexts.


155-161: Update withdrawAndRevert Function Signature.

The addition of RevertContextStruct to the withdrawAndRevert function signature enhances the function's ability to handle errors with detailed context.


382-397: Modify WithdrawAndRevertEvent Structure.

The inclusion of revertContext in both input and output tuples of the WithdrawAndRevertEvent provides comprehensive event data, aiding in debugging and state management.


Line range hint 829-834: Update Event Declaration for WithdrawAndRevert.

The event signature now includes revertContext as a tuple, aligning with the updated function and event structures for consistency.

v2/pkg/izetaconnector.sol/izetaconnectorevents.go (4)

32-37: New Struct: RevertContext

The RevertContext struct is well-defined with appropriate fields to capture the asset, amount, and revert message. Ensure this struct is correctly utilized in all relevant parts of the codebase.


550-554: Updated Struct: IZetaConnectorEventsWithdrawAndRevert

The RevertContext field is correctly added to the IZetaConnectorEventsWithdrawAndRevert struct, enhancing the event's data. Confirm that all event consumers handle this additional context.


Line range hint 557-572: Event Handling Updates

The functions FilterWithdrawAndRevert, WatchWithdrawAndRevert, and ParseWithdrawAndRevert are updated to accommodate the new revertContext parameter. Ensure that these functions are tested and that their usage aligns with the updated event signature.

Also applies to: 574-612, 616-629


41-41: Updated ABI String

The ABI string now includes the revertContext as a tuple in the WithdrawAndRevert event. Verify that all consumers of this ABI are updated to handle the new structure.

Verification successful

No External Consumers Found for Updated ABI

The IZetaConnectorEventsMetaData is only referenced within its defining file and does not appear to have external consumers in the codebase. Therefore, no updates are necessary for handling the new revertContext structure in external consumers.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all usages of the updated ABI string.

# Test: Search for the usage of `IZetaConnectorEventsMetaData` to ensure consumers are updated.
rg --type go 'IZetaConnectorEventsMetaData'

Length of output: 623


Script:

#!/bin/bash
# Description: Search for all references to `IZetaConnectorEventsMetaData` in the codebase to check for consumer updates.

rg 'IZetaConnectorEventsMetaData'

Length of output: 613

v2/typechain-types/factories/ZetaConnectorNonNative__factory.ts (2)

371-392: Updated Function and Event: withdrawAndRevert

The withdrawAndRevert function and corresponding event now include the revertContext parameter. Ensure that all interactions with this function and event are updated to handle the new parameter.

Also applies to: 590-612


665-665: Significant Bytecode Update

The _bytecode constant has been completely replaced, indicating a substantial change in the contract's logic. Verify that all dependent systems are aware of and compatible with these changes.

v2/typechain-types/factories/ZetaConnectorNative__factory.ts (2)

345-366: Updated Function and Event: withdrawAndRevert

The withdrawAndRevert function and corresponding event now include the revertContext parameter. Ensure that all interactions with this function and event are updated to handle the new parameter.

Also applies to: 551-573


659-659: Significant Bytecode Update

The _bytecode constant has been completely replaced, indicating a substantial change in the contract's logic. Verify that all dependent systems are aware of and compatible with these changes.

v2/typechain-types/factories/ERC20Custody__factory.ts (2)

369-390: Enhancement: Addition of revertContext structure is approved.

The revertContext structure provides additional context during reverts, enhancing error handling capabilities.

Also applies to: 606-628


719-719: Verify the impact of the bytecode update.

The complete replacement of the _bytecode constant suggests a major update to the contract. Ensure that the new bytecode reflects the intended functionality and security enhancements.

v2/typechain-types/GatewayZEVM.ts (2)

26-31: Enhancement: Addition of RevertOptionsStruct is approved.

The RevertOptionsStruct provides a structured way to handle revert options, improving error handling.

Also applies to: 33-43


95-98: Enhancement: Method signature updates to include RevertOptionsStruct are approved.

The inclusion of RevertOptionsStruct in method signatures ensures consistent handling of revert options.

Also applies to: 213-238, 305-317, 678-718

v2/pkg/testuniversalcontract.sol/testuniversalcontract.go (2)

34-36: Enhancement: RevertContext struct changes are approved.

The updated RevertContext struct consolidates relevant fields, enhancing clarity and usability.


240-244: Enhancement: OnRevert function signature updates are approved.

The updated OnRevert function signatures streamline context management by using the new RevertContext structure.

Also applies to: 247-251, 254-258

v2/typechain-types/GatewayEVM.ts (9)

26-31: RevertOptionsStruct definition is appropriate.

The structure is well-defined and aligns with the intended functionality for handling transaction reverts.


45-49: RevertContextStruct definition is appropriate.

This structure is well-defined for providing context during a transaction revert.


325-338: Event updates are consistent with method signature changes.

The inclusion of RevertOptionsStruct in events aligns with the updated method signatures and enhances functionality.


447-464: Event updates are consistent with method signature changes.

The inclusion of RevertContextStruct in events aligns with the updated method signatures and enhances functionality.


194-200: Replace void with undefined in parameter lists.

The use of void in parameter lists is confusing outside of return types. Replace it with undefined to align with TypeScript best practices.

- [void],
+ [undefined],

Likely invalid or redundant comment.


151-152: Replace void with undefined in parameter lists.

The use of void in parameter lists is confusing outside of return types. Replace it with undefined to align with TypeScript best practices.

- [void],
+ [undefined],

Likely invalid or redundant comment.


160-161: Replace void with undefined in parameter lists.

The use of void in parameter lists is confusing outside of return types. Replace it with undefined to align with TypeScript best practices.

- [void],
+ [undefined],

Likely invalid or redundant comment.


137-138: Replace void with undefined in parameter lists.

The use of void in parameter lists is confusing outside of return types. Replace it with undefined to align with TypeScript best practices.

- [void],
+ [undefined],

Likely invalid or redundant comment.


141-148: Replace void with undefined in parameter lists.

The use of void in parameter lists is confusing outside of return types. Replace it with undefined to align with TypeScript best practices.

- [void],
+ [undefined],

Likely invalid or redundant comment.

v2/typechain-types/GatewayEVMUpgradeTest.ts (9)

26-31: RevertOptionsStruct definition is appropriate.

The structure is well-defined and aligns with the intended functionality for handling transaction reverts.


45-49: RevertContextStruct definition is appropriate.

This structure is well-defined for providing context during a transaction revert.


326-339: Event updates are consistent with method signature changes.

The inclusion of RevertOptionsStruct in events aligns with the updated method signatures and enhances functionality.


466-483: Event updates are consistent with method signature changes.

The inclusion of RevertContextStruct in events aligns with the updated method signatures and enhances functionality.


152-153: Replace void with undefined in parameter lists.

The use of void in parameter lists is confusing outside of return types. Replace it with undefined to align with TypeScript best practices.

- [void],
+ [undefined],

Likely invalid or redundant comment.


138-139: Replace void with undefined in parameter lists.

The use of void in parameter lists is confusing outside of return types. Replace it with undefined to align with TypeScript best practices.

- [void],
+ [undefined],

Likely invalid or redundant comment.


195-201: Replace void with undefined in parameter lists.

The use of void in parameter lists is confusing outside of return types. Replace it with undefined to align with TypeScript best practices.

- [void],
+ [undefined],

Likely invalid or redundant comment.


161-161: Replace void with undefined in parameter lists.

The use of void in parameter lists is confusing outside of return types. Replace it with undefined to align with TypeScript best practices.

- [void],
+ [undefined],

Likely invalid or redundant comment.


142-149: Replace void with undefined in parameter lists.

The use of void in parameter lists is confusing outside of return types. Replace it with undefined to align with TypeScript best practices.

- [void],
+ [undefined],

Likely invalid or redundant comment.

v2/typechain-types/GatewayEVMEchidnaTest.ts (6)

26-43: RevertOptionsStruct and RevertOptionsStructOutput look good!

The introduction of these types enhances error handling and state management. The structure is clear and well-defined.


45-55: RevertContextStruct and RevertContextStructOutput look good!

These types provide valuable context for handling reverts, and their structure is clear and appropriate.


132-155: Function signature updates in GatewayEVMEchidnaTestInterface look good!

The inclusion of RevertOptionsStruct in function signatures enhances error handling. The changes are consistent and well-integrated.


Line range hint 346-374: Event definition updates in GatewayEVMEchidnaTestInterface look good!

Including revertOptions in event definitions enhances the information available for event handling. The changes are well-structured.


Line range hint 629-692: TypedContractMethod updates look good, but address void usage.

The updates to include RevertOptionsStruct and RevertContextStruct enhance error handling. However, consider replacing void with undefined for clarity.

-    [void],
+    [undefined],
Tools
Biome

[error] 634-634: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 647-647: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 653-653: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 665-665: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 675-675: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


Line range hint 1092-1158: TypedContractEvent updates look good!

The inclusion of revertOptions in event definitions provides more detailed information for event handling. The changes are well-structured and beneficial.

v2/pkg/ireceiverevm.sol/ireceiverevmevents.go (5)

32-37: RevertContext struct definition is well-designed.

The RevertContext struct encapsulates relevant information for revert scenarios effectively.


805-807: ReceivedRevert event modification enhances semantic richness.

Replacing raw bytes with RevertContext provides more detailed information about reverts.


810-815: FilterReceivedRevert function correctly updated.

The function now handles the new ReceivedRevert event structure.


822-827: WatchReceivedRevert function correctly updated.

The function now watches logs for the new ReceivedRevert event structure.


859-864: ParseReceivedRevert function correctly updated.

The function now parses logs for the new ReceivedRevert event structure.

v2/test/GatewayZEVM.t.sol (11)

67-72: revertOptions initialization is appropriate.

The revertOptions variable is initialized with suitable values for testing.


80-83: testWithdrawZRC20 function correctly integrates revertOptions.

The test verifies the expected behavior with revertOptions.


98-98: testWithdrawZRC20FailsIfNoBalanceForGasFee function correctly integrates revertOptions.

The test verifies the expected failure scenario with revertOptions.


107-107: testWithdrawZRC20FailsIfNoBalanceForTransfer function correctly integrates revertOptions.

The test verifies the expected failure scenario with revertOptions.


112-112: testWithdrawZRC20FailsIsAmountIs0 function correctly integrates revertOptions.

The test verifies the expected failure scenario with revertOptions.


117-117: testWithdrawZRC20FailsIfReceiverIsZeroAddress function correctly integrates revertOptions.

The test verifies the expected failure scenario with revertOptions.


129-129: testWithdrawZRC20FailsIfNoAllowance function correctly integrates revertOptions.

The test verifies the expected failure scenario with revertOptions.


139-139: testWithdrawAndCallZRC20FailsIfReceiverIsZeroAddress function correctly integrates revertOptions.

The test verifies the expected failure scenario with revertOptions.


145-145: testWithdrawAndCallZRC20FailsIfAmountIsZero function correctly integrates revertOptions.

The test verifies the expected failure scenario with revertOptions.


158-158: testWithdrawZRC20WithMessageFailsIfNoAllowance function correctly integrates revertOptions.

The test verifies the expected failure scenario with revertOptions.


172-182: testWithdrawZRC20WithMessage function correctly integrates revertOptions.

The test verifies the expected behavior with revertOptions.

v2/pkg/ierc20custody.sol/ierc20custodyevents.go (5)

32-37: RevertContext struct definition is well-structured.

The RevertContext struct encapsulates relevant information for revert scenarios effectively.


856-861: WithdrawAndRevert event modification is appropriate.

Including RevertContext in the WithdrawAndRevert event provides valuable context for debugging and error handling.


Line range hint 864-878: FilterWithdrawAndRevert function update is correct.

The function appropriately handles the updated WithdrawAndRevert event structure with the revertContext parameter.


Line range hint 885-899: WatchWithdrawAndRevert function update is correct.

The function correctly adapts to the new WithdrawAndRevert event structure, including the revertContext parameter.


931-935: ParseWithdrawAndRevert function update is correct.

The function appropriately handles the parsing of the updated WithdrawAndRevert event with the revertContext parameter.

v2/pkg/ierc20custody.sol/ierc20custody.go (8)

32-37: New Struct: RevertContext

The RevertContext struct has been introduced to encapsulate additional information for revert scenarios. This is a beneficial addition for providing context during transaction reverts, improving debuggability and error handling.


273-274: Update Function Signature: Session WithdrawAndRevert

The session variant of WithdrawAndRevert also includes the revertContext parameter. Ensure that session-based calls are updated accordingly.


280-281: Update Function Signature: Transactor Session WithdrawAndRevert

The transactor session variant of WithdrawAndRevert includes the revertContext parameter. Ensure that transactor session-based calls are updated accordingly.


950-955: Update Event Struct: IERC20CustodyWithdrawAndRevert

The IERC20CustodyWithdrawAndRevert struct now includes the RevertContext. This change ensures that events related to this struct capture the full context of a revert scenario, which is crucial for logging and debugging.


958-960: Update Event Filter: FilterWithdrawAndRevert

The FilterWithdrawAndRevert function now filters logs with the updated event signature, including the RevertContext. Ensure that any log processing logic accommodates this change.


979-981: Update Event Watcher: WatchWithdrawAndRevert

The WatchWithdrawAndRevert function now watches logs with the updated event signature, including the RevertContext. Ensure that any event handling logic accommodates this change.


1025-1027: Update Event Parser: ParseWithdrawAndRevert

The ParseWithdrawAndRevert function now parses logs with the updated event signature, including the RevertContext. Ensure that any parsing logic accommodates this change.


266-267: Update Function Signature: WithdrawAndRevert

The WithdrawAndRevert function now includes a revertContext parameter. This change enhances the function's capability to handle more detailed revert scenarios. Ensure that all calls to this function are updated to include the new parameter.

v2/pkg/igatewayzevm.sol/igatewayzevm.go (30)

39-44: New Struct: RevertOptions

The RevertOptions struct replaces the previous RevertContext and provides a more detailed configuration for handling reverts. This addition allows for more granular control over revert scenarios, enhancing the contract's robustness.


215-216: Update Function Signature: Session Call

The session variant of Call includes the revertOptions parameter. Ensure that session-based calls are updated accordingly.


222-223: Update Function Signature: Transactor Session Call

The transactor session variant of Call includes the revertOptions parameter. Ensure that transactor session-based calls are updated accordingly.


299-300: Update Function Signature: Session DepositAndRevert

The session variant of DepositAndRevert includes the revertContext parameter. Ensure that session-based calls are updated accordingly.


306-307: Update Function Signature: Transactor Session DepositAndRevert

The transactor session variant of DepositAndRevert includes the revertContext parameter. Ensure that transactor session-based calls are updated accordingly.


341-342: Update Function Signature: Session ExecuteRevert

The session variant of ExecuteRevert includes the revertContext parameter. Ensure that session-based calls are updated accordingly.


348-349: Update Function Signature: Transactor Session ExecuteRevert

The transactor session variant of ExecuteRevert includes the revertContext parameter. Ensure that transactor session-based calls are updated accordingly.


362-363: Update Function Signature: Session Withdraw

The session variant of Withdraw includes the revertOptions parameter. Ensure that session-based calls are updated accordingly.


369-370: Update Function Signature: Transactor Session Withdraw

The transactor session variant of Withdraw includes the revertOptions parameter. Ensure that transactor session-based calls are updated accordingly.


383-384: Update Function Signature: Session Withdraw0

The session variant of Withdraw0 includes the revertOptions parameter. Ensure that session-based calls are updated accordingly.


390-391: Update Function Signature: Transactor Session Withdraw0

The transactor session variant of Withdraw0 includes the revertOptions parameter. Ensure that transactor session-based calls are updated accordingly.


404-405: Update Function Signature: Session WithdrawAndCall

The session variant of WithdrawAndCall includes the revertOptions parameter. Ensure that session-based calls are updated accordingly.


411-412: Update Function Signature: Transactor Session WithdrawAndCall

The transactor session variant of WithdrawAndCall includes the revertOptions parameter. Ensure that transactor session-based calls are updated accordingly.


425-426: Update Function Signature: Session WithdrawAndCall0

The session variant of WithdrawAndCall0 includes the revertOptions parameter. Ensure that session-based calls are updated accordingly.


432-433: Update Function Signature: Transactor Session WithdrawAndCall0

The transactor session variant of WithdrawAndCall0 includes the revertOptions parameter. Ensure that transactor session-based calls are updated accordingly.


509-510: Update Event Struct: IGatewayZEVMCall

The IGatewayZEVMCall struct now includes the RevertOptions. This change ensures that events related to this struct capture the full context of a revert scenario, which is crucial for logging and debugging.


513-515: Update Event Filter: FilterCall

The FilterCall function now filters logs with the updated event signature, including the RevertOptions. Ensure that any log processing logic accommodates this change.


534-536: Update Event Watcher: WatchCall

The WatchCall function now watches logs with the updated event signature, including the RevertOptions. Ensure that any event handling logic accommodates this change.


580-582: Update Event Parser: ParseCall

The ParseCall function now parses logs with the updated event signature, including the RevertOptions. Ensure that any parsing logic accommodates this change.


669-670: Update Event Struct: IGatewayZEVMWithdrawal

The IGatewayZEVMWithdrawal struct now includes the RevertOptions. This change ensures that events related to this struct capture the full context of a revert scenario, which is crucial for logging and debugging.


673-675: Update Event Filter: FilterWithdrawal

The FilterWithdrawal function now filters logs with the updated event signature, including the RevertOptions. Ensure that any log processing logic accommodates this change.


694-696: Update Event Watcher: WatchWithdrawal

The WatchWithdrawal function now watches logs with the updated event signature, including the RevertOptions. Ensure that any event handling logic accommodates this change.


740-742: Update Event Parser: ParseWithdrawal

The ParseWithdrawal function now parses logs with the updated event signature, including the RevertOptions. Ensure that any parsing logic accommodates this change.


208-209: Update Function Signature: Call

The Call function now includes a revertOptions parameter. This change provides more control over revert scenarios during contract calls. Ensure that all calls to this function are updated to include the new parameter.


334-335: Update Function Signature: ExecuteRevert

The ExecuteRevert function now includes a revertContext parameter. This change enhances the function's capability to handle more detailed revert scenarios. Ensure that all calls to this function are updated to include the new parameter.


355-356: Update Function Signature: Withdraw

The Withdraw function now includes a revertOptions parameter. This change provides more control over revert scenarios during withdrawals. Ensure that all calls to this function are updated to include the new parameter.


397-398: Update Function Signature: WithdrawAndCall

The WithdrawAndCall function now includes a revertOptions parameter. This change provides more control over revert scenarios during withdrawals. Ensure that all calls to this function are updated to include the new parameter.


418-419: Update Function Signature: WithdrawAndCall0

The WithdrawAndCall0 function now includes a revertOptions parameter. This change provides more control over revert scenarios during withdrawals. Ensure that all calls to this function are updated to include the new parameter.

Verification successful

Verification Successful: Function Calls Updated

All calls to the WithdrawAndCall0 function have been updated to include the new revertOptions parameter, as required by the updated function signature. No further action is needed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `WithdrawAndCall0` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'WithdrawAndCall0'

Length of output: 5761


292-293: Update Function Signature: DepositAndRevert

The DepositAndRevert function now includes a revertContext parameter. This change enhances the function's capability to handle more detailed revert scenarios. Ensure that all calls to this function are updated to include the new parameter.

Verification successful

Function Signature Update Verified: DepositAndRevert

The DepositAndRevert function calls across the codebase have been successfully updated to include the new revertContext parameter. No further action is required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `DepositAndRevert` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'DepositAndRevert'

Length of output: 178816


376-377: Update Function Signature: Withdraw0

The Withdraw0 function now includes a revertOptions parameter. This change provides more control over revert scenarios during withdrawals. Ensure that all calls to this function are updated to include the new parameter.

Verification successful

No Calls to Update for Withdraw0 Function

The search did not find any calls to the Withdraw0 function in the codebase, indicating that there are no existing calls that need to be updated with the new revertOptions parameter.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `Withdraw0` match the new signature.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type go -A 5 $'Withdraw0'

Length of output: 5431


Script:

#!/bin/bash
# Description: Search for all calls to the `Withdraw0` function to verify they include the new `revertOptions` parameter.

# Test: Find all calls to `Withdraw0` and check their usage.
rg --type go 'Withdraw0\(' -A 2

Length of output: 2615


Script:

#!/bin/bash
# Description: Perform a comprehensive search for calls to the `Withdraw0` function.

# Test: Search the entire codebase for any calls to `Withdraw0`.
rg 'Withdraw0\(' -A 2

Length of output: 2605

v2/pkg/receiverevm.sol/receiverevm.go (8)

33-37: RevertContext struct definition looks good.

The RevertContext struct is well-defined with appropriate field types for its purpose.


215-216: OnRevert function signature change is appropriate.

The function now accepts a RevertContext struct, aligning with the improved error handling strategy.


222-223: OnRevert function signature change in ReceiverEVMSession is consistent.

The update to use RevertContext ensures consistency and improved error handling across session types.


229-230: OnRevert function signature change in ReceiverEVMTransactorSession is consistent.

The update to use RevertContext ensures consistency and improved error handling across session types.


995-997: ReceiverEVMReceivedRevert struct update is well-defined.

Replacing the Data field with RevertContext provides a more structured approach to handling revert events.


1002-1003: FilterReceivedRevert function update is consistent.

The function correctly reflects the changes in the ReceivedRevert event structure.


1014-1015: WatchReceivedRevert function update is consistent.

The function correctly reflects the changes in the ReceivedRevert event structure.


1051-1052: ParseReceivedRevert function update is consistent.

The function correctly reflects the changes in the ReceivedRevert event structure.

v2/pkg/igatewayevm.sol/igatewayevm.go (26)

32-37: RevertContext struct looks good.

The RevertContext struct is well-defined with appropriate fields for handling context in revert scenarios.


39-44: RevertOptions struct looks good.

The RevertOptions struct is well-defined with appropriate fields for handling options in revert scenarios.


201-202: Function signature updated correctly for Call in IGatewayEVMTransactor.

The addition of RevertOptions to the Call function enhances error handling capabilities.


208-209: Function signature updated correctly for Call in IGatewayEVMSession.

The addition of RevertOptions to the Call function enhances error handling capabilities.


215-216: Function signature updated correctly for Call in IGatewayEVMTransactorSession.

The addition of RevertOptions to the Call function enhances error handling capabilities.


222-223: Function signature updated correctly for Deposit in IGatewayEVMTransactor.

The addition of RevertOptions to the Deposit function enhances error handling capabilities.


229-230: Function signature updated correctly for Deposit in IGatewayEVMSession.

The addition of RevertOptions to the Deposit function enhances error handling capabilities.


236-237: Function signature updated correctly for Deposit in IGatewayEVMTransactorSession.

The addition of RevertOptions to the Deposit function enhances error handling capabilities.


243-244: Function signature updated correctly for Deposit0 in IGatewayEVMTransactor.

The addition of RevertOptions to the Deposit0 function enhances error handling capabilities.


250-251: Function signature updated correctly for Deposit0 in IGatewayEVMSession.

The addition of RevertOptions to the Deposit0 function enhances error handling capabilities.


257-258: Function signature updated correctly for Deposit0 in IGatewayEVMTransactorSession.

The addition of RevertOptions to the Deposit0 function enhances error handling capabilities.


264-265: Function signature updated correctly for DepositAndCall in IGatewayEVMTransactor.

The addition of RevertOptions to the DepositAndCall function enhances error handling capabilities.


271-272: Function signature updated correctly for DepositAndCall in IGatewayEVMSession.

The addition of RevertOptions to the DepositAndCall function enhances error handling capabilities.


278-279: Function signature updated correctly for DepositAndCall in IGatewayEVMTransactorSession.

The addition of RevertOptions to the DepositAndCall function enhances error handling capabilities.


285-286: Function signature updated correctly for DepositAndCall0 in IGatewayEVMTransactor.

The addition of RevertOptions to the DepositAndCall0 function enhances error handling capabilities.


292-293: Function signature updated correctly for DepositAndCall0 in IGatewayEVMSession.

The addition of RevertOptions to the DepositAndCall0 function enhances error handling capabilities.


299-300: Function signature updated correctly for DepositAndCall0 in IGatewayEVMTransactorSession.

The addition of RevertOptions to the DepositAndCall0 function enhances error handling capabilities.


327-328: Function signature updated correctly for ExecuteRevert in IGatewayEVMTransactor.

The addition of RevertContext to the ExecuteRevert function enhances error handling capabilities.


334-335: Function signature updated correctly for ExecuteRevert in IGatewayEVMSession.

The addition of RevertContext to the ExecuteRevert function enhances error handling capabilities.


341-342: Function signature updated correctly for ExecuteRevert in IGatewayEVMTransactorSession.

The addition of RevertContext to the ExecuteRevert function enhances error handling capabilities.


369-370: Function signature updated correctly for RevertWithERC20 in IGatewayEVMTransactor.

The addition of RevertContext to the RevertWithERC20 function enhances error handling capabilities.


376-377: Function signature updated correctly for RevertWithERC20 in IGatewayEVMSession.

The addition of RevertContext to the RevertWithERC20 function enhances error handling capabilities.


383-384: Function signature updated correctly for RevertWithERC20 in IGatewayEVMTransactorSession.

The addition of RevertContext to the RevertWithERC20 function enhances error handling capabilities.


456-460: IGatewayEVMCall struct updated correctly.

The addition of RevertOptions to the IGatewayEVMCall struct aligns with the event updates and enhances data handling.


611-617: IGatewayEVMDeposit struct updated correctly.

The addition of RevertOptions to the IGatewayEVMDeposit struct aligns with the event updates and enhances data handling.


1069-1074: IGatewayEVMReverted struct updated correctly.

The addition of RevertContext to the IGatewayEVMReverted struct aligns with the event updates and enhances data handling.

v2/pkg/systemcontract.sol/systemcontract.go (4)

Line range hint 32-36: Structured input approach with ZContext looks good!

The ZContext struct provides a clear and structured way to handle context-related data, improving the readability and maintainability of the code.


39-45: Updated ABI structure and deprecation of SystemContractABI are appropriate.

The updated ABI in SystemContractMetaData enhances the contract's capabilities. Deprecating SystemContractABI in favor of SystemContractMetaData.ABI aligns with best practices for maintaining a single source of truth.


Line range hint 51-67: Deployment function correctly utilizes updated metadata.

The DeploySystemContract function appropriately uses SystemContractMetaData for ABI retrieval and deployment, ensuring alignment with the updated metadata structure.


Line range hint 431-437: Structured input in DepositAndCall enhances clarity.

The addition of the context parameter using the ZContext struct improves the function's clarity and maintainability. Ensure consistent usage throughout the codebase.

Verification successful

Structured input in DepositAndCall is consistently used.

The DepositAndCall function consistently uses the ZContext parameter across all instances in the codebase, confirming the structured input's integration. No further action is required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `DepositAndCall` use the new `ZContext` parameter.

# Test: Search for the function usage. Expect: Only occurrences with the new `ZContext` parameter.
rg --type go -A 5 $'DepositAndCall'

Length of output: 39039

v2/pkg/zetaconnectorbase.sol/zetaconnectorbase.go (5)

32-37: LGTM: Struct RevertContext is well-defined.

The RevertContext struct is appropriately defined to encapsulate revert-related information.


1803-1807: LGTM: Updated event WithdrawAndRevert with RevertContext.

The inclusion of RevertContext in the event enhances the capability to handle revert scenarios.

Ensure that event parsing and handling are updated with the new signature.


685-686: LGTM: Updated function signature for WithdrawAndRevert.

The inclusion of revertContext enhances the function's capability to handle revert scenarios.

Ensure that all calls to this function are updated with the new signature.


678-679: LGTM: Updated function signature for WithdrawAndRevert.

The inclusion of revertContext enhances the function's capability to handle revert scenarios.

Ensure that all calls to this function are updated with the new signature.


671-672: LGTM: Updated function signature for WithdrawAndRevert.

The inclusion of revertContext enhances the function's capability to handle revert scenarios.

Ensure that all calls to this function are updated with the new signature.

v2/pkg/zetaconnectornative.sol/zetaconnectornative.go (8)

32-37: Struct RevertContext looks good.

The RevertContext struct is well-defined with relevant fields to provide context during reverts.


700-701: Function WithdrawAndRevert signature update looks good.

The inclusion of the revertContext parameter is consistent with the transactor's update.


707-708: Function WithdrawAndRevert signature update looks good.

The inclusion of the revertContext parameter is consistent with other session updates.


1825-1829: Struct ZetaConnectorNativeWithdrawAndRevert update looks good.

The addition of RevertContext to this event struct enhances logging capabilities.


Line range hint 1834-1844:
Function FilterWithdrawAndRevert update looks good.

The update aligns with the new event signature and improves event handling.


Line range hint 1851-1861:
Function WatchWithdrawAndRevert update looks good.

The update aligns with the new event signature and enhances real-time event processing.


Line range hint 1893-1899:
Function ParseWithdrawAndRevert update looks good.

The update aligns with the new event signature and enhances parsing capabilities.


693-694: Function WithdrawAndRevert signature update looks good.

The inclusion of the revertContext parameter enhances error handling capabilities.

Ensure that all function calls to WithdrawAndRevert are updated to match the new signature.

v2/pkg/zetaconnectornonnative.sol/zetaconnectornonnative.go (5)

32-37: Well-defined RevertContext struct.

The RevertContext struct is a clear and appropriate addition for handling revert scenarios, encapsulating necessary parameters like asset, amount, and revert message.


745-746: Enhanced WithdrawAndRevert function signature.

The inclusion of the revertContext parameter improves the function's capability to handle detailed revert scenarios.


752-753: Consistent WithdrawAndRevert function signature in session.

The updated function signature maintains consistency with the Transactor version, enhancing session handling with detailed revert information.


759-760: Updated WithdrawAndRevert function signature in transactor session.

The inclusion of the revertContext parameter ensures comprehensive handling of revert scenarios, consistent with other function versions.


2011-2015: Enhanced WithdrawAndRevert event structure.

The addition of RevertContext to the event data structure improves the granularity of event logging and tracking.

v2/pkg/erc20custody.sol/erc20custody.go (3)

32-37: Introduction of RevertContext struct looks good.

The RevertContext struct is well-defined and appropriately uses types suitable for Ethereum smart contract interactions.


713-715: Changes to WithdrawAndRevert function signature are appropriate.

The addition of the revertContext parameter enhances error handling and interaction capabilities.

Ensure that all usages of WithdrawAndRevert across the codebase are updated to match the new signature.

Also applies to: 720-722, 727-729


2152-2157: Updates to WithdrawAndRevert event are well-implemented.

Including RevertContext in the event parameters provides comprehensive logging and handling of reverts.

Ensure that all event handling and parsing logic is updated to accommodate the new event structure.

Also applies to: 2160-2162, 2181-2183


onRevert: TypedContractMethod<
[revertContext: RevertContextStruct],
[void],
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid using void outside return types.

The use of void in the onRevert method signature is confusing. Consider using undefined instead for clarity.

-    [void],
+    [undefined],

Also applies to: 104-104

Tools
Biome

[error] 92-92: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

"nonpayable"
>;

filters: {};
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid using {} as a type.

Using {} as a type can be misleading. Consider defining an explicit object shape or using Record<string, unknown> if the shape is not known.

-  filters: {};
+  filters: Record<string, unknown>;
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
filters: {};
filters: Record<string, unknown>;
Tools
Biome

[error] 108-108: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

Comment on lines +44 to +52
export class Revertable__factory {
static readonly abi = _abi;
static createInterface(): RevertableInterface {
return new Interface(_abi) as RevertableInterface;
}
static connect(address: string, runner?: ContractRunner | null): Revertable {
return new Contract(address, _abi, runner) as unknown as Revertable;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor static-only class into standalone functions.

The Revertable__factory class contains only static members, which can be refactored into standalone functions to reduce complexity and improve readability.

export const Revertable__factory = {
  abi: _abi,
  createInterface(): RevertableInterface {
    return new Interface(_abi) as RevertableInterface;
  },
  connect(address: string, runner?: ContractRunner | null): Revertable {
    return new Contract(address, _abi, runner) as unknown as Revertable;
  },
};
Tools
Biome

[error] 44-52: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)

Comment on lines +258 to +261
onRevert: TypedContractMethod<
[revertContext: RevertContextStruct],
[void],
"nonpayable"
Copy link
Contributor

Choose a reason for hiding this comment

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

Address void usage in onRevert.

The use of void here is flagged by the static analysis tool as potentially confusing. Consider using undefined instead to align with TypeScript conventions.

- [void],
+ [undefined],
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
onRevert: TypedContractMethod<
[revertContext: RevertContextStruct],
[void],
"nonpayable"
onRevert: TypedContractMethod<
[revertContext: RevertContextStruct],
[undefined],
"nonpayable"
Tools
Biome

[error] 260-260: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

Comment on lines +296 to +299
): TypedContractMethod<
[revertContext: RevertContextStruct],
[void],
"nonpayable"
Copy link
Contributor

Choose a reason for hiding this comment

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

Address void usage in getFunction for onRevert.

Similar to the previous comment, replace void with undefined for clarity and consistency with TypeScript practices.

- [void],
+ [undefined],
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
): TypedContractMethod<
[revertContext: RevertContextStruct],
[void],
"nonpayable"
): TypedContractMethod<
[revertContext: RevertContextStruct],
[undefined],
"nonpayable"
Tools
Biome

[error] 298-298: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

Comment on lines +332 to +336
[
receiver: AddressLike,
payload: BytesLike,
revertOptions: RevertOptionsStruct
],
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace void with undefined in return types.

The use of void in return types is flagged as confusing. Consider replacing void with undefined for clarity and to align with TypeScript best practices.

-    [void],
+    [undefined],

Also applies to: 341-347, 352-353, 358-364, 370-375

Comment on lines +307 to +312
[
receiver: BytesLike,
chainId: BigNumberish,
message: BytesLike,
revertOptions: RevertOptionsStruct
],
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace void with undefined in return types.

The use of void in return types is flagged as confusing. Consider replacing void with undefined for clarity and to align with TypeScript best practices.

-    [void],
+    [undefined],

Also applies to: 384-390, 395-401, 406-412, 418-424

Comment on lines +549 to +554
[
receiver: BytesLike,
chainId: BigNumberish,
message: BytesLike,
revertOptions: RevertOptionsStruct
],
Copy link
Contributor

Choose a reason for hiding this comment

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

Address void type usage issue.

The use of void in these method signatures is flagged as confusing. Consider replacing void with undefined to clarify the return type.

- [void],
+ [undefined],

Also applies to: 685-695, 700-718

Comment on lines +129 to +134
values: [AddressLike, BytesLike, RevertOptionsStruct]
): string;
encodeFunctionData(functionFragment: "custody", values?: undefined): string;
encodeFunctionData(
functionFragment: "deposit(address)",
values: [AddressLike]
functionFragment: "deposit(address,uint256,address,(address,bool,address,bytes))",
values: [AddressLike, BigNumberish, AddressLike, RevertOptionsStruct]
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace void with undefined in parameter lists.

The use of void in parameter lists is confusing outside of return types. Replace it with undefined to align with TypeScript best practices.

- [void],
+ [undefined],
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
values: [AddressLike, BytesLike, RevertOptionsStruct]
): string;
encodeFunctionData(functionFragment: "custody", values?: undefined): string;
encodeFunctionData(
functionFragment: "deposit(address)",
values: [AddressLike]
functionFragment: "deposit(address,uint256,address,(address,bool,address,bytes))",
values: [AddressLike, BigNumberish, AddressLike, RevertOptionsStruct]
values: [AddressLike, BytesLike, RevertOptionsStruct]
): string;
encodeFunctionData(functionFragment: "custody", values?: undefined): string;
encodeFunctionData(
functionFragment: "deposit(address,uint256,address,(address,bool,address,bytes))",
values: [AddressLike, BigNumberish, AddressLike, RevertOptionsStruct]

Comment on lines +130 to +135
values: [AddressLike, BytesLike, RevertOptionsStruct]
): string;
encodeFunctionData(functionFragment: "custody", values?: undefined): string;
encodeFunctionData(
functionFragment: "deposit(address)",
values: [AddressLike]
functionFragment: "deposit(address,uint256,address,(address,bool,address,bytes))",
values: [AddressLike, BigNumberish, AddressLike, RevertOptionsStruct]
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace void with undefined in parameter lists.

The use of void in parameter lists is confusing outside of return types. Replace it with undefined to align with TypeScript best practices.

- [void],
+ [undefined],
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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
values: [AddressLike, BytesLike, RevertOptionsStruct]
): string;
encodeFunctionData(functionFragment: "custody", values?: undefined): string;
encodeFunctionData(
functionFragment: "deposit(address)",
values: [AddressLike]
functionFragment: "deposit(address,uint256,address,(address,bool,address,bytes))",
values: [AddressLike, BigNumberish, AddressLike, RevertOptionsStruct]
values: [AddressLike, BytesLike, RevertOptionsStruct]
): string;
encodeFunctionData(functionFragment: "custody", values?: undefined): string;
encodeFunctionData(
functionFragment: "deposit(address,uint256,address,(address,bool,address,bytes))",
values: [AddressLike, BigNumberish, AddressLike, RevertOptionsStruct]

Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

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

LGTM
Minor comment

@@ -109,9 +110,9 @@ contract GatewayEVM is
if (destination == address(0)) revert ZeroAddress();
(bool success,) = destination.call{ value: msg.value }("");
if (!success) revert ExecutionFailed();
Revertable(destination).onRevert(data);
Revertable(destination).onRevert(revertContext);
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't we directly have destination as Revertable in the argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we are always casting like this (eg. UniversalContract, ERC20 and so on), i suggest we open new issue to make it consistent across codebase if we prefer this approach, not sure what is better, but would be nice to be consistent

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 82d4d98 and 0565180.

Files selected for processing (19)
  • v2/pkg/erc20custody.sol/erc20custody.go (5 hunks)
  • v2/pkg/receiverevm.sol/receiverevm.go (5 hunks)
  • v2/pkg/senderzevm.sol/senderzevm.go (1 hunks)
  • v2/pkg/systemcontract.sol/systemcontract.go (1 hunks)
  • v2/pkg/systemcontractmock.sol/systemcontractmock.go (1 hunks)
  • v2/pkg/testuniversalcontract.sol/testuniversalcontract.go (6 hunks)
  • v2/pkg/zetaconnectornative.sol/zetaconnectornative.go (5 hunks)
  • v2/pkg/zetaconnectornonnative.sol/zetaconnectornonnative.go (5 hunks)
  • v2/typechain-types/factories/ERC20Custody__factory.ts (3 hunks)
  • v2/typechain-types/factories/GatewayEVMUpgradeTest__factory.ts (14 hunks)
  • v2/typechain-types/factories/GatewayEVM__factory.ts (11 hunks)
  • v2/typechain-types/factories/GatewayZEVM__factory.ts (12 hunks)
  • v2/typechain-types/factories/ReceiverEVM__factory.ts (3 hunks)
  • v2/typechain-types/factories/SenderZEVM__factory.ts (1 hunks)
  • v2/typechain-types/factories/SystemContract.sol/SystemContract__factory.ts (1 hunks)
  • v2/typechain-types/factories/SystemContractMock.sol/SystemContractMock__factory.ts (1 hunks)
  • v2/typechain-types/factories/TestUniversalContract__factory.ts (2 hunks)
  • v2/typechain-types/factories/ZetaConnectorNative__factory.ts (3 hunks)
  • v2/typechain-types/factories/ZetaConnectorNonNative__factory.ts (3 hunks)
Files skipped from review as they are similar to previous changes (10)
  • v2/pkg/erc20custody.sol/erc20custody.go
  • v2/pkg/receiverevm.sol/receiverevm.go
  • v2/pkg/testuniversalcontract.sol/testuniversalcontract.go
  • v2/typechain-types/factories/GatewayEVMUpgradeTest__factory.ts
  • v2/typechain-types/factories/GatewayEVM__factory.ts
  • v2/typechain-types/factories/GatewayZEVM__factory.ts
  • v2/typechain-types/factories/ReceiverEVM__factory.ts
  • v2/typechain-types/factories/SenderZEVM__factory.ts
  • v2/typechain-types/factories/SystemContract.sol/SystemContract__factory.ts
  • v2/typechain-types/factories/SystemContractMock.sol/SystemContractMock__factory.ts
Additional comments not posted (28)
v2/typechain-types/factories/TestUniversalContract__factory.ts (2)

76-78: Ensure Consistency in Type Naming.

The internal type has been updated from struct revertContext to struct RevertContext. Ensure that this change is consistently applied across the codebase to avoid potential mismatches.

Verification successful

Consistency in Type Naming Verified.

The change from struct revertContext to struct RevertContext has been consistently applied across the codebase. No instances of the old naming were found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify consistency of the `RevertContext` struct usage across the codebase.
rg --type ts 'struct RevertContext'

Length of output: 4214


171-171: Verify Bytecode Changes.

The bytecode has been updated. Ensure that the changes are intentional and that all dependent components are aware of the new bytecode.

v2/pkg/senderzevm.sol/senderzevm.go (1)

35-35: Verify Updated Bytecode.

The bytecode for SenderZEVM has been updated. Ensure that this change is consistent with the intended contract logic and that all relevant documentation reflects this update.

v2/typechain-types/factories/ZetaConnectorNonNative__factory.ts (1)

665-665: Verify Complete Bytecode Replacement.

The bytecode has been entirely replaced. Ensure that the new bytecode reflects the intended changes and that all dependent systems are updated accordingly.

v2/typechain-types/factories/ZetaConnectorNative__factory.ts (2)

345-366: Enhanced error handling with revertContext.

The addition of the revertContext structure to the withdrawAndRevert function and event provides valuable context for handling reverts, aligning well with the PR objectives.

Also applies to: 551-573


659-659: Significant bytecode update.

The complete replacement of the bytecode indicates a major update to the contract's implementation, likely enhancing functionality or performance.

v2/typechain-types/factories/ERC20Custody__factory.ts (2)

369-390: Enhanced error handling with revertContext.

The addition of the revertContext structure to the withdrawAndRevert function and event provides valuable context for handling reverts, aligning well with the PR objectives.

Also applies to: 606-628


719-719: Significant bytecode update.

The complete replacement of the bytecode indicates a major update to the contract's implementation, likely enhancing functionality or performance.

v2/pkg/systemcontractmock.sol/systemcontractmock.go (2)

35-35: Verify binary data changes reflect intended logic updates.

The binary data updates should correspond to the ABI changes and reflect the intended logic updates. Ensure consistency with the ABI and PR objectives.


34-34: Verify ABI changes align with PR objectives.

The ABI updates suggest changes in the contract's interface. Ensure these changes are consistent with the introduction of RevertContext and RevertOptions as described in the PR objectives.

v2/pkg/systemcontract.sol/systemcontract.go (3)

Line range hint 600-605:
Verify Event Handling and Log Filtering Functions.

The event handling and log filtering functions should be checked for consistency with the updated ABI. Ensure that event names and parameters match the contract definitions.

Verification successful

Event Handling and Log Filtering Verified

The event handling and log filtering functions for SetConnectorZEVM are implemented correctly in the SystemContractFilterer struct, matching the expected ABI. The functions FilterSetConnectorZEVM, WatchSetConnectorZEVM, and ParseSetConnectorZEVM ensure proper event handling.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify event handling and log filtering functions align with the updated ABI.

# Test: Search for event `SetConnectorZEVM` in the Go code. Expect: The function signature matches the ABI.
rg --type go -A 5 $'func (_SystemContract *SystemContractFilterer) FilterSetConnectorZEVM'

Length of output: 91


Script:

#!/bin/bash
# Description: Search for event handling functions in the SystemContractFilterer struct.

# Test: List all functions in SystemContractFilterer to find any event handling implementations.
rg --type go -A 5 'func \(_SystemContract \*SystemContractFilterer\)'

Length of output: 21224


Line range hint 145-150:
Ensure Function Signatures Align with Updated ABI.

The function signatures in SystemContract should be verified against the updated ABI to ensure consistency. This includes checking the deployment and interaction functions for any potential issues.


41-42: Verify ABI Changes and Structured Input.

The ABI changes, particularly the structured input for the context parameter in depositAndCall, should be verified for correctness. Ensure that these changes align with the intended contract functionality and that any dependent systems or contracts are updated accordingly.

Verification successful

ABI Changes Verified: Structured Input Confirmed

The depositAndCall function with a structured context parameter is correctly implemented in the Solidity code, matching the ABI changes. This confirms the correctness and consistency of the ABI with the contract's intended functionality. No further issues were found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the ABI changes and the structured input for the `context` parameter.

# Test: Search for function `depositAndCall` in the contract code. Expect: The function signature matches the ABI.
rg --type solidity -A 5 $'function depositAndCall'

Length of output: 84


Script:

#!/bin/bash
# Description: Locate Solidity files and search for the `depositAndCall` function.

# Find all Solidity files and search for the `depositAndCall` function.
fd --extension sol --exec rg 'function depositAndCall' {}

Length of output: 8420

v2/pkg/zetaconnectornative.sol/zetaconnectornative.go (8)

32-37: RevertContext struct looks good.

The RevertContext struct is well-defined and enhances error handling by providing detailed context during asset withdrawal failures.


690-694: WithdrawAndRevert function update is appropriate.

The inclusion of the RevertContext parameter enhances error handling by providing additional context for transaction failures.


697-701: WithdrawAndRevert function update in session is consistent.

The addition of RevertContext ensures consistent error handling improvements across session types.


704-708: WithdrawAndRevert function update in transactor session is consistent.

The inclusion of RevertContext maintains consistency and enhances error handling across transactor sessions.


1825-1829: ZetaConnectorNativeWithdrawAndRevert struct update is logical.

The inclusion of the RevertContext field enhances the event logging capabilities, aligning with the function changes.


Line range hint 1832-1847: FilterWithdrawAndRevert function update is appropriate.

The function now captures logs with the enhanced WithdrawAndRevert event, including the RevertContext.


Line range hint 1849-1889: WatchWithdrawAndRevert function update is consistent.

The function now watches logs with the enhanced WithdrawAndRevert event, including the RevertContext, improving error tracking.


1891-1896: ParseWithdrawAndRevert function update is appropriate.

The function now parses logs with the enhanced WithdrawAndRevert event, including the RevertContext, aiding in detailed error analysis.

v2/pkg/zetaconnectornonnative.sol/zetaconnectornonnative.go (7)

749-753: Verify usage and testing of revertContext in WithdrawAndRevert.

Ensure that the revertContext parameter is properly utilized and that the function is adequately tested.


756-760: Verify usage and testing of revertContext in WithdrawAndRevert.

Ensure that the revertContext parameter is properly utilized and that the function is adequately tested.


2011-2015: Ensure documentation and testing for ZetaConnectorNonNativeWithdrawAndRevert.

The updated struct should be well-documented and adequately tested to ensure correct behavior and security.


2035-2037: Verify implementation and testing of WatchWithdrawAndRevert.

Ensure that the function correctly handles the WithdrawAndRevert event and is adequately tested.


2077-2079: Verify implementation and testing of ParseWithdrawAndRevert.

Ensure that the function correctly parses the WithdrawAndRevert event and is adequately tested.


742-746: Verify usage and testing of revertContext in WithdrawAndRevert.

Ensure that the revertContext parameter is properly utilized and that the function is adequately tested.


2018-2020: Verify implementation and testing of FilterWithdrawAndRevert.

Ensure that the function correctly handles the WithdrawAndRevert event and is adequately tested.

Comment on lines +32 to +37
// RevertContext is an auto generated low-level Go binding around an user-defined struct.
type RevertContext struct {
Asset common.Address
Amount uint64
RevertMessage []byte
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure documentation and testing for RevertContext.

The new RevertContext struct should be well-documented and adequately tested to ensure correct behavior and security.

Would you like assistance in generating documentation or tests for RevertContext?

@skosito skosito merged commit fa44616 into main Aug 12, 2024
9 checks passed
@skosito skosito deleted the revert-options branch August 12, 2024 16:12
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.

Create a RevertContext to pass to onRevert Add RevertOptions as part of the gateway entrypoint functions
4 participants