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

fix: various fixes #316

Merged
merged 11 commits into from
Aug 14, 2024
Merged

fix: various fixes #316

merged 11 commits into from
Aug 14, 2024

Conversation

skosito
Copy link
Contributor

@skosito skosito commented Aug 13, 2024

closes: #315

Summary by CodeRabbit

  • New Features

    • Enhanced GatewayZEVM contract with new functions for asset withdrawals and deposits.
    • Introduction of structured RevertOptionsStruct and RevertContextStruct for improved error handling and transaction management.
    • Added new events (Called, Withdrawn) to enhance monitoring of contract interactions.
    • Expanded ABI for the IGatewayZEVM interface, reflecting changes to improve usability and functionality.
  • Bug Fixes

    • Removed checks for zero amounts in withdrawal and deposit functions, adjusting control flow for improved transaction handling.
  • Documentation

    • Updated event and function names for clarity, enhancing understanding of contract interactions.
  • Chores

    • Refactor and clean up of existing code structures to support new functionalities and improve modularity.

Copy link
Contributor

coderabbitai bot commented Aug 13, 2024

Walkthrough

The recent updates significantly enhance the GatewayZEVM and related contracts by removing checks for zero amounts in execution functions, enabling simpler calls. Additionally, new functions have been introduced, error handling has been improved, and various contract interfaces have been refined. These modifications aim to boost functionality, clarity, and error reporting, ultimately optimizing transaction handling within the system.

Changes

Files Change Summary
v2/pkg/gatewayzevm.sol
v2/src/zevm/GatewayZEVM.sol
Removed checks for amount being zero in execution functions, allowing zero amounts. Introduced new functions and error types, enhancing transaction handling.
v2/types/* Added new data structures and updated interfaces with RevertOptionsStruct and RevertContextStruct. Improved event naming for clarity.
v2/test/GatewayZEVM.t.sol Removed tests related to zero amount checks, indicating a new testing approach.
v2/types/factories/* Updated ABI definitions to reflect new parameters and structures, improving function signatures.

Assessment against linked issues

Objective Addressed Explanation
Remove check amount == 0 in GatewayZEVM (315)

🐇 In the meadow, bright and free,
The code now flows with glee!
No more checks for amounts of naught,
Simplified calls, oh what a thought!
In contracts new, we hop and play,
A joyful leap into a brighter day! 🌼✨


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.

@codecov-commenter
Copy link

codecov-commenter commented Aug 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.81%. Comparing base (2054b10) to head (a152e7e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #316      +/-   ##
==========================================
- Coverage   81.93%   81.81%   -0.13%     
==========================================
  Files           7        7              
  Lines         299      297       -2     
  Branches       99       97       -2     
==========================================
- Hits          245      243       -2     
  Misses         54       54              

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

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 (2)
v2/types/ERC20Custody.ts (1)

Line range hint 475-585: Consider replacing void with undefined.

The use of void outside a return type or a type parameter can be confusing. Consider using undefined instead for clarity.

- unwhitelist: TypedContractMethod<[token: AddressLike], [void], "nonpayable">;
+ unwhitelist: TypedContractMethod<[token: AddressLike], [undefined], "nonpayable">;

- whitelist: TypedContractMethod<[token: AddressLike], [void], "nonpayable">;
+ whitelist: TypedContractMethod<[token: AddressLike], [undefined], "nonpayable">;

- withdraw: TypedContractMethod<[to: AddressLike, token: AddressLike, amount: BigNumberish], [void], "nonpayable">;
+ withdraw: TypedContractMethod<[to: AddressLike, token: AddressLike, amount: BigNumberish], [undefined], "nonpayable">;
Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/types/ERC20CustodyEchidnaTest.ts (1)

Line range hint 506-629: Consider replacing void with undefined.

The use of void outside a return type or a type parameter can be confusing. Consider using undefined instead for clarity.

- unwhitelist: TypedContractMethod<[token: AddressLike], [void], "nonpayable">;
+ unwhitelist: TypedContractMethod<[token: AddressLike], [undefined], "nonpayable">;

- whitelist: TypedContractMethod<[token: AddressLike], [void], "nonpayable">;
+ whitelist: TypedContractMethod<[token: AddressLike], [undefined], "nonpayable">;

- withdraw: TypedContractMethod<[to: AddressLike, token: AddressLike, amount: BigNumberish], [void], "nonpayable">;
+ withdraw: TypedContractMethod<[to: AddressLike, token: AddressLike, amount: BigNumberish], [undefined], "nonpayable">;
Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2054b10 and 5b759b5.

Files selected for processing (68)
  • v2/pkg/gatewayzevm.sol/gatewayzevm.go (1 hunks)
  • v2/src/zevm/GatewayZEVM.sol (2 hunks)
  • v2/test/GatewayZEVM.t.sol (2 hunks)
  • v2/types/ERC20Custody.ts (19 hunks)
  • v2/types/ERC20CustodyEchidnaTest.ts (19 hunks)
  • v2/types/GatewayEVM.ts (18 hunks)
  • v2/types/GatewayEVMEchidnaTest.ts (20 hunks)
  • v2/types/GatewayEVMUpgradeTest.ts (22 hunks)
  • v2/types/GatewayZEVM.ts (23 hunks)
  • v2/types/IERC20Custody.sol/IERC20Custody.ts (1 hunks)
  • v2/types/IERC20Custody.sol/IERC20CustodyEvents.ts (4 hunks)
  • v2/types/IERC20Custody.sol/index.ts (1 hunks)
  • v2/types/IGatewayEVM.sol/IGatewayEVM.ts (8 hunks)
  • v2/types/IGatewayEVM.sol/IGatewayEVMEvents.ts (6 hunks)
  • v2/types/IGatewayEVM.sol/index.ts (1 hunks)
  • v2/types/IGatewayZEVM.sol/IGatewayZEVM.ts (13 hunks)
  • v2/types/IGatewayZEVM.sol/IGatewayZEVMEvents.ts (5 hunks)
  • v2/types/IReceiverEVM.sol/IReceiverEVMEvents.ts (3 hunks)
  • v2/types/IZRC20.sol/IZRC20.ts (7 hunks)
  • v2/types/IZRC20.sol/IZRC20Metadata.ts (7 hunks)
  • v2/types/IZetaConnector.sol/IZetaConnectorEvents.ts (4 hunks)
  • v2/types/ReceiverEVM.ts (6 hunks)
  • v2/types/Revert.sol/Revertable.ts (1 hunks)
  • v2/types/Revert.sol/index.ts (1 hunks)
  • v2/types/SenderZEVM.ts (3 hunks)
  • v2/types/TestUniversalContract.ts (1 hunks)
  • v2/types/UniversalContract.sol/UniversalContract.ts (1 hunks)
  • v2/types/UniversalContract.sol/ZContract.ts (1 hunks)
  • v2/types/UniversalContract.sol/index.ts (1 hunks)
  • v2/types/ZRC20.sol/ZRC20.ts (5 hunks)
  • v2/types/ZetaConnectorBase.ts (14 hunks)
  • v2/types/ZetaConnectorNative.ts (14 hunks)
  • v2/types/ZetaConnectorNonNative.ts (14 hunks)
  • v2/types/factories/ERC20Custody__factory.ts (11 hunks)
  • v2/types/factories/GatewayEVMUpgradeTest__factory.ts (17 hunks)
  • v2/types/factories/GatewayEVM__factory.ts (14 hunks)
  • v2/types/factories/GatewayZEVM__factory.ts (18 hunks)
  • v2/types/factories/IERC20Custody.sol/IERC20CustodyErrors__factory.ts (1 hunks)
  • v2/types/factories/IERC20Custody.sol/IERC20CustodyEvents__factory.ts (4 hunks)
  • v2/types/factories/IERC20Custody.sol/IERC20Custody__factory.ts (1 hunks)
  • v2/types/factories/IERC20Custody.sol/index.ts (1 hunks)
  • v2/types/factories/IGatewayEVM.sol/IGatewayEVMErrors__factory.ts (2 hunks)
  • v2/types/factories/IGatewayEVM.sol/IGatewayEVMEvents__factory.ts (5 hunks)
  • v2/types/factories/IGatewayEVM.sol/IGatewayEVM__factory.ts (5 hunks)
  • v2/types/factories/IGatewayEVM.sol/index.ts (1 hunks)
  • v2/types/factories/IGatewayZEVM.sol/IGatewayZEVMErrors__factory.ts (2 hunks)
  • v2/types/factories/IGatewayZEVM.sol/IGatewayZEVMEvents__factory.ts (4 hunks)
  • v2/types/factories/IGatewayZEVM.sol/IGatewayZEVM__factory.ts (10 hunks)
  • v2/types/factories/IReceiverEVM.sol/IReceiverEVMEvents__factory.ts (1 hunks)
  • v2/types/factories/IZRC20.sol/IZRC20Metadata__factory.ts (2 hunks)
  • v2/types/factories/IZRC20.sol/IZRC20__factory.ts (2 hunks)
  • v2/types/factories/IZetaConnector.sol/IZetaConnectorEvents__factory.ts (4 hunks)
  • v2/types/factories/ReceiverEVM__factory.ts (3 hunks)
  • v2/types/factories/Revert.sol/Revertable__factory.ts (1 hunks)
  • v2/types/factories/Revert.sol/index.ts (1 hunks)
  • v2/types/factories/SenderZEVM__factory.ts (4 hunks)
  • v2/types/factories/SystemContract.sol/SystemContract__factory.ts (1 hunks)
  • v2/types/factories/SystemContractMock.sol/SystemContractMock__factory.ts (1 hunks)
  • v2/types/factories/TestUniversalContract__factory.ts (1 hunks)
  • v2/types/factories/UniversalContract.sol/UniversalContract__factory.ts (1 hunks)
  • v2/types/factories/UniversalContract.sol/ZContract__factory.ts (1 hunks)
  • v2/types/factories/UniversalContract.sol/index.ts (1 hunks)
  • v2/types/factories/ZRC20.sol/ZRC20__factory.ts (2 hunks)
  • v2/types/factories/ZetaConnectorBase__factory.ts (6 hunks)
  • v2/types/factories/ZetaConnectorNative__factory.ts (7 hunks)
  • v2/types/factories/ZetaConnectorNonNative__factory.ts (7 hunks)
  • v2/types/factories/index.ts (3 hunks)
  • v2/types/index.ts (9 hunks)
Files skipped from review due to trivial changes (8)
  • v2/test/GatewayZEVM.t.sol
  • v2/types/Revert.sol/index.ts
  • v2/types/UniversalContract.sol/index.ts
  • v2/types/factories/IERC20Custody.sol/index.ts
  • v2/types/factories/IGatewayEVM.sol/index.ts
  • v2/types/factories/Revert.sol/index.ts
  • v2/types/factories/TestUniversalContract__factory.ts
  • v2/types/factories/UniversalContract.sol/index.ts
Additional context used
Biome
v2/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/types/factories/UniversalContract.sol/ZContract__factory.ts

[error] 59-67: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)

v2/types/factories/UniversalContract.sol/UniversalContract__factory.ts

[error] 89-100: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)

v2/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/types/UniversalContract.sol/ZContract.ts

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 121-121: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

v2/types/UniversalContract.sol/UniversalContract.ts

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 153-153: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

v2/types/factories/IERC20Custody.sol/IERC20Custody__factory.ts

[error] 280-291: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)

v2/types/TestUniversalContract.ts

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/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/types/IERC20Custody.sol/IERC20Custody.ts

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/types/IGatewayZEVM.sol/IGatewayZEVM.ts

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/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)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/types/ERC20Custody.ts

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/types/ERC20CustodyEchidnaTest.ts

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/types/GatewayZEVM.ts

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/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/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/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)

Gitleaks
v2/types/IGatewayEVM.sol/IGatewayEVM.ts

543-543: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

Additional comments not posted (265)
v2/types/IGatewayEVM.sol/index.ts (1)

Line range hint 1-7:
Verify the impact of removing Revertable.

The removal of the Revertable type from the exports might affect other parts of the codebase that rely on it. Ensure that no external code depends on this type.

v2/types/IERC20Custody.sol/index.ts (1)

4-4: Verify the addition of IERC20Custody.

The addition of the IERC20Custody export expands the module's interface. Ensure that this change does not introduce any conflicts or issues in the codebase.

Verification successful

Addition of IERC20Custody Verified Successfully

The IERC20Custody type is consistently used across multiple files, including type exports and factories, indicating proper integration into the codebase. No conflicts or issues were found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `IERC20Custody` in the codebase.

# Test: Search for the usage of `IERC20Custody`. Expect: No conflicts or issues.
rg --type typescript 'IERC20Custody'

Length of output: 71


Script:

#!/bin/bash
# Description: Verify the usage of `IERC20Custody` in the codebase.

# Test: Search for the usage of `IERC20Custody`. Expect: No conflicts or issues.
rg --type ts 'IERC20Custody'

Length of output: 11256

v2/types/factories/IERC20Custody.sol/IERC20CustodyErrors__factory.ts (1)

12-16: Verify handling of NotWhitelisted error.

The addition of the NotWhitelisted error type enhances error handling. Ensure that this new error is appropriately handled in the codebase.

Verification successful

The NotWhitelisted error is appropriately handled in the codebase.

The NotWhitelisted error is referenced in several factory files and is specifically tested in v1/test/ERC20Custody.spec.ts, ensuring that transactions revert as expected when this error occurs. This confirms that the error handling is correctly implemented and verified through tests.

  • v1/test/ERC20Custody.spec.ts: Tests expect transactions to revert with "NotWhitelisted".
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the handling of the `NotWhitelisted` error in the codebase.

# Test: Search for the handling of `NotWhitelisted`. Expect: Proper error handling.
rg --type typescript 'NotWhitelisted'

Length of output: 72


Script:

#!/bin/bash
# Description: Verify the handling of the `NotWhitelisted` error in the codebase.

# Test: Search for the handling of `NotWhitelisted`. Expect: Proper error handling.
rg --type ts 'NotWhitelisted'

Length of output: 1995

v2/types/factories/IGatewayEVM.sol/IGatewayEVMErrors__factory.ts (2)

17-21: New error type ConnectorInitialized added.

This addition enhances error handling by providing a specific error message for connector initialization issues. The change looks good.


47-51: New error type NotWhitelistedInCustody added.

This addition improves error handling by providing a specific error message for custody whitelist issues. The change looks good.

v2/types/factories/IGatewayZEVM.sol/IGatewayZEVMErrors__factory.ts (2)

17-21: New error type EmptyMessage added.

This addition enhances error handling by providing a specific error message for empty message scenarios. The change looks good.


37-41: New error type InsufficientZetaAmount added.

This addition improves error handling by providing a specific error message for insufficient Zeta amount scenarios. The change looks good.

v2/types/factories/IZetaConnector.sol/IZetaConnectorEvents__factory.ts (1)

Line range hint 14-99:
Event renaming and additions enhance clarity and functionality.

The renaming of events to past tense and the addition of revertContext to the WithdrawnAndReverted event improve semantic understanding and provide more detailed context for error handling. These changes are well-aligned with best practices.

v2/types/factories/IERC20Custody.sol/IERC20CustodyEvents__factory.ts (1)

Line range hint 14-144:
LGTM! Events and parameters updated correctly.

The changes to the event names and the addition of the revertContext parameter are consistent with the PR objectives and enhance the contract's functionality.

v2/types/factories/IReceiverEVM.sol/IReceiverEVMEvents__factory.ts (1)

135-155: Improvement in event structure with revertContext.

The replacement of the data parameter with the revertContext tuple provides more detailed context for error handling. This change enhances the semantic richness of the event, allowing for better debugging and error tracing.

Ensure that all consumers of this event are updated to handle the new revertContext structure.

Verification successful

Consumers of the ReceivedRevert event have been updated.

The search results indicate that the ReceivedRevert event is now using the revertContext structure in its definitions and usages across various files. This suggests that consumers have been updated to handle the new structure.

  • v2/types/ReceiverEVM.ts
  • v2/types/IReceiverEVM.sol/IReceiverEVMEvents.ts
  • v2/types/factories/ReceiverEVM__factory.ts
  • v2/types/factories/IReceiverEVM.sol/IReceiverEVMEvents__factory.ts
  • v2/typechain-types/ReceiverEVM.ts
  • v2/typechain-types/IReceiverEVM.sol/IReceiverEVMEvents.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all consumers of the `ReceivedRevert` event are updated to handle the new `revertContext` structure.

# Test: Search for event listeners or handlers for `ReceivedRevert`. Expect: Updated handling for `revertContext`.
rg --type typescript -A 5 'ReceivedRevert'

Length of output: 77


Script:

#!/bin/bash
# Description: Verify all consumers of the `ReceivedRevert` event are updated to handle the new `revertContext` structure.

# Corrected Test: Search for event listeners or handlers for `ReceivedRevert`. Expect: Updated handling for `revertContext`.
rg 'ReceivedRevert' --glob '**/*.ts' -A 5

Length of output: 11340

v2/types/factories/IGatewayZEVM.sol/IGatewayZEVMEvents__factory.ts (5)

14-14: Event name change from Call to Called.

The event name change improves clarity by using a past-tense verb, indicating a completed action.

Ensure that all references to this event are updated to use the new name.

Verification successful

Event Name Change Verified: No References to Call Found

The search did not reveal any direct references to an event named Call. The occurrences found were part of function or method names unrelated to the event name change. Therefore, it appears that all necessary updates to the event name have been made.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all references to the `Call` event are updated to `Called`.

# Test: Search for references to the `Called` event. Expect: No occurrences of `Call` event.
rg --type typescript 'Call\('

Length of output: 66


Script:

#!/bin/bash
# Description: Verify all references to the `Call` event are updated to `Called`.

# Test: Search for references to the `Call` event in TypeScript files.
rg 'Call\(' --glob '*.ts'

Length of output: 32064


73-73: Event name change from Withdrawal to Withdrawn.

The event name change improves clarity by using a past-tense verb, indicating a completed action.

Ensure that all references to this event are updated to use the new name.


23-26: Parameter change from chainId to zrc20.

The parameter change reflects a shift in the data being captured, likely enhancing the event's relevance to address-based operations.

Ensure all consumers of this event are updated to handle the new zrc20 parameter.


123-150: Addition of revertOptions in Withdrawn event.

The addition of revertOptions enhances the event's capability to handle revert scenarios, providing more detailed context for error handling.

Ensure that all consumers of this event are updated to handle the new revertOptions structure.


40-67: Addition of revertOptions in Called event.

The addition of revertOptions enhances the event's capability to handle revert scenarios, providing more detailed context for error handling.

Ensure that all consumers of this event are updated to handle the new revertOptions structure.

v2/types/SenderZEVM.ts (3)

136-136: Parameter type change to AddressLike in getFunction.

The change from BigNumberish to AddressLike for the chainId parameter, now zrc20, reflects a redesign to accommodate address-based identifiers.

Ensure that all calls to getFunction are updated to pass an AddressLike type for this parameter.


31-31: Parameter type change to AddressLike in encodeFunctionData.

The change from BigNumberish to AddressLike for the chainId parameter, now zrc20, reflects a redesign to accommodate address-based identifiers.

Ensure that all calls to encodeFunctionData are updated to pass an AddressLike type for this parameter.


103-103: Parameter type change to AddressLike in callReceiver.

The change from BigNumberish to AddressLike for the chainId parameter, now zrc20, reflects a redesign to accommodate address-based identifiers.

Ensure that all calls to callReceiver are updated to pass an AddressLike type for this parameter.

v2/types/UniversalContract.sol/UniversalContract.ts (5)

24-28: Type definition ZContextStruct is well-defined.

The structure and types of the fields are appropriate.


30-34: Tuple type ZContextStructOutput is well-defined.

The tuple elements correctly match the ZContextStruct.


36-40: Type definition RevertContextStruct is well-defined.

The structure and types of the fields are appropriate.


42-46: Tuple type RevertContextStructOutput is well-defined.

The tuple elements correctly match the RevertContextStruct.


48-67: Interface UniversalContractInterface is well-defined, but consider using undefined instead of void.

The interface methods are correctly defined, but using undefined instead of void outside a return type or type parameter is recommended.

- [void],
+ [undefined],

Likely invalid or redundant comment.

v2/types/factories/index.ts (3)

13-13: Export statement for revertSol is well-defined.

The export is correctly structured and follows conventions.


19-19: Export statement for universalContractSol is well-defined.

The export is correctly structured and follows conventions.


76-76: Export statement for TestUniversalContract__factory is well-defined.

The export is correctly structured and indicates a shift towards universal contract functionalities.

v2/types/factories/IZRC20.sol/IZRC20__factory.ts (2)

9-21: Function definition GAS_LIMIT is well-defined.

The function is correctly structured and follows conventions for ABI definitions.


253-276: Function definition withdrawGasFeeWithGasLimit is well-defined.

The function is correctly structured and follows conventions for ABI definitions.

v2/types/IGatewayZEVM.sol/IGatewayZEVMEvents.ts (5)

24-41: Review new type declarations for correctness.

The RevertOptionsStruct and RevertOptionsStructOutput types are well-defined and provide a structured approach to handling revert scenarios. Ensure that these types are used consistently across the codebase where revert handling is required.


44-44: Update event names in the interface.

The event names have been updated from "Call" and "Withdrawal" to "Called" and "Withdrawn," respectively. This change aligns with a past-tense naming convention, which can improve clarity in event handling.


47-73: Enhance event structures with revert options.

The CalledEvent namespace now includes the revertOptions parameter, which adds valuable context for handling revert scenarios. This enhancement improves the utility of the event data.


Line range hint 75-111:
Enhance event structures with revert options.

Similarly, the WithdrawnEvent namespace includes the revertOptions parameter, enhancing the event's informational capacity for handling revert scenarios.


163-197: Ensure correct event filtering with updated names and structures.

The getEvent method and event filters have been updated to match the new event names and structures. This ensures that event listeners can correctly interpret the updated data formats.

v2/types/factories/IGatewayEVM.sol/IGatewayEVMEvents__factory.ts (3)

Line range hint 14-61:
Review event renaming and new parameters for correctness.

The event "Call" has been renamed to "Called," and new revertOptions parameters have been added. These changes improve semantic clarity and provide additional context for revert scenarios.


Line range hint 67-126:
Review event renaming and new parameters for correctness.

The event "Deposit" has been renamed to "Deposited," and new revertOptions parameters have been added. This enhances the event's expressiveness and utility.


Line range hint 191-236:
Review simplification and new parameters in the "Reverted" event.

The "Reverted" event now includes a revertContext parameter, which provides valuable context for revert scenarios. The removal of value and data parameters simplifies the event structure.

v2/types/factories/IZRC20.sol/IZRC20Metadata__factory.ts (2)

12-24: Review new function GAS_LIMIT for correctness.

The GAS_LIMIT function is a view function that returns the current gas limit. Ensure that this function is utilized where gas limit information is required.


295-318: Review new function withdrawGasFeeWithGasLimit for correctness and utility.

The withdrawGasFeeWithGasLimit function allows specifying a gas limit for withdrawing gas fees, providing more control over gas consumption. Ensure that this function is used appropriately in scenarios where gas limits need to be managed.

v2/types/IZetaConnector.sol/IZetaConnectorEvents.ts (6)

24-28: Addition of RevertContextStruct type.

The new RevertContextStruct type is well-defined, encapsulating details about an asset, amount, and revert message. This addition enhances error handling capabilities by providing a structured way to manage revert contexts.


30-34: Addition of RevertContextStructOutput type.

The RevertContextStructOutput type mirrors the input structure, ensuring consistency in handling revert contexts across different stages of processing.


38-41: Updated event names in getEvent method.

The renaming of events to "Withdrawn", "WithdrawnAndCalled", and "WithdrawnAndReverted" aligns with the intended outcomes, improving clarity in event handling.


Line range hint 45-99:
Namespace updates for event structures.

The updates to event namespaces and the inclusion of RevertContextStruct in WithdrawnAndRevertedEvent enhance the robustness of event data handling, particularly in error recovery scenarios.


149-201: Updated getEvent method signatures.

The updated method signatures reflect the new event names and structures, maintaining consistency with the interface changes.


171-201: Updated event filters.

The filters have been updated to match the new event names, ensuring that event references are consistent throughout the codebase.

v2/types/factories/IERC20Custody.sol/IERC20Custody__factory.ts (1)

11-278: Review of ABI structure.

The ABI structure for the IERC20Custody contract is well-defined, covering functions and events with appropriate inputs and outputs. This structure is crucial for interacting with the contract programmatically.

v2/types/TestUniversalContract.ts (5)

26-36: Addition of ZContextStruct and ZContextStructOutput types.

These types are well-defined, providing a structured representation of cross-chain call contexts, which is essential for handling such operations.


38-48: Addition of RevertContextStruct and RevertContextStructOutput types.

These types are consistent with similar structures elsewhere, enhancing error handling and revert context management.


50-57: Interface method definitions.

The getFunction and getEvent methods are correctly defined, allowing for interaction with the contract's functions and events.


179-197: Method definitions for getFunction.

These methods are well-defined, enabling retrieval of contract methods by name or signature.

Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


199-235: Event definitions and filters.

The event definitions and filters are correctly set up, ensuring accurate event handling and filtering.

v2/types/IZRC20.sol/IZRC20.ts (4)

39-39: Addition of withdrawGasFeeWithGasLimit to getFunction.

The inclusion of withdrawGasFeeWithGasLimit in the getFunction method is consistent with the existing structure and enhances the interface's functionality.


84-87: Addition of withdrawGasFeeWithGasLimit to encodeFunctionData.

The addition of withdrawGasFeeWithGasLimit to the encodeFunctionData method follows the established pattern for encoding function data and is correctly implemented.


113-116: Addition of withdrawGasFeeWithGasLimit to decodeFunctionResult.

The inclusion of withdrawGasFeeWithGasLimit in the decodeFunctionResult method is consistent with the existing structure for decoding function results.


210-214: Addition of withdrawGasFeeWithGasLimit as a TypedContractMethod.

The addition of withdrawGasFeeWithGasLimit as a TypedContractMethod is consistent with the existing method definitions and enhances the interface's functionality.

v2/types/IReceiverEVM.sol/IReceiverEVMEvents.ts (3)

24-28: Addition of RevertContextStruct.

The RevertContextStruct is well-defined and enhances the clarity and organization of revert-related data.


138-148: Update to ReceivedRevertEvent with RevertContextStruct.

The integration of RevertContextStruct into the ReceivedRevertEvent input and output tuples is correctly implemented and enhances data handling.


284-284: Update to ReceivedRevert event signature.

The change to use a tuple in the ReceivedRevert event signature reflects the new structured data approach and is correctly implemented.

v2/types/IERC20Custody.sol/IERC20CustodyEvents.ts (4)

24-28: Addition of RevertContextStruct.

The RevertContextStruct is well-defined and enhances the clarity and organization of revert-related data.


114-134: Update to WithdrawnAndRevertedEvent with RevertContextStruct.

The integration of RevertContextStruct into the WithdrawnAndRevertedEvent input and output tuples is correctly implemented and enhances data handling.


38-43: Renaming of event names for clarity.

The event names have been updated to better reflect their functionality, enhancing the clarity and readability of the interface.


190-275: Update to getEvent method and filters with new event names.

The updates to the getEvent method and filters reflect the new event names and are correctly implemented, enhancing interface consistency.

v2/types/factories/SenderZEVM__factory.ts (4)

24-24: Consistent naming convention applied.

The parameter name change from _gateway to gateway_ follows a consistent naming convention, which improves code readability and clarity.


143-146: Parameter renaming in getDeployTransaction.

The parameter renaming in the getDeployTransaction method is consistent with the constructor changes, maintaining clarity in the method signature.


149-152: Parameter renaming in deploy.

The parameter renaming in the deploy method is consistent with the constructor changes, maintaining clarity in the method signature.


41-43: Semantic change in ABI input structure.

The change from chainId to zrc20 in the ABI input structure suggests a shift in the contract's focus, possibly towards token interactions. Ensure that the rest of the contract logic aligns with this new input parameter.

v2/types/IZRC20.sol/IZRC20Metadata.ts (7)

Line range hint 27-42:
Addition of new functions for gas management.

The inclusion of GAS_LIMIT and withdrawGasFeeWithGasLimit in the getFunction method enhances the interface's ability to manage gas fees effectively. This is a valuable addition for handling transaction costs.


90-93: Support for encoding withdrawGasFeeWithGasLimit.

The encodeFunctionData method now includes support for withdrawGasFeeWithGasLimit, allowing for encoding with a gasLimit parameter. This enhances the contract's flexibility in fee management.


122-125: Support for decoding withdrawGasFeeWithGasLimit.

The decodeFunctionResult method now includes support for withdrawGasFeeWithGasLimit, allowing for decoding results related to this function. This ensures consistency in handling function results.


171-172: New method for gas limit retrieval.

The GAS_LIMIT method provides a straightforward way to retrieve the gas limit, which is crucial for managing transaction costs.


225-229: New method for withdrawing gas fees with limits.

The withdrawGasFeeWithGasLimit method allows for more flexible fee withdrawal strategies, accommodating different gas limit scenarios. This addition enhances the contract's operational capabilities.


235-237: Addition of GAS_LIMIT to getFunction.

The getFunction method now includes GAS_LIMIT, ensuring that this function can be accessed in a type-safe manner.


304-306: Addition of withdrawGasFeeWithGasLimit to getFunction.

The getFunction method now includes withdrawGasFeeWithGasLimit, ensuring that this function can be accessed in a type-safe manner.

v2/types/IGatewayEVM.sol/IGatewayEVMEvents.ts (13)

24-29: New RevertOptionsStruct added.

The introduction of RevertOptionsStruct provides a structured way to handle transaction reverts, enhancing the contract's error handling capabilities.


31-41: New RevertOptionsStructOutput added.

The RevertOptionsStructOutput mirrors the input structure, ensuring that revert options are consistently handled in both input and output scenarios.


43-47: New RevertContextStruct added.

The RevertContextStruct encapsulates additional contextual information for reverts, which can be useful for debugging and error analysis.


49-53: New RevertContextStructOutput added.

The RevertContextStructOutput mirrors the input structure, ensuring consistency in handling revert context information.


58-59: Event name changes for consistency.

The renaming of events from "Call" to "Called" and "Deposit" to "Deposited" improves consistency and clarity across the interface.


66-83: Updated CalledEvent with revert options.

The CalledEvent now includes revertOptions, providing more detailed information during event handling, which enhances the functionality of the event system.


91-114: Updated DepositedEvent with revert options.

The DepositedEvent now includes revertOptions, providing more detailed information during event handling, which enhances the functionality of the event system.


168-185: Updated RevertedEvent with revert context.

The RevertedEvent now includes revertContext, which aligns with the new RevertContextStruct, providing additional contextual information for reverts.


241-245: Updated getEvent for Called.

The getEvent method now reflects the renamed Called event, ensuring type-safe access to this event.


248-252: Updated getEvent for Deposited.

The getEvent method now reflects the renamed Deposited event, ensuring type-safe access to this event.


277-285: Updated filters for Called.

The filters now include the renamed Called event, ensuring that event filtering is consistent with the updated event naming.


288-296: Updated filters for Deposited.

The filters now include the renamed Deposited event, ensuring that event filtering is consistent with the updated event naming.


321-324: Updated filters for Reverted.

The filters now include the updated Reverted event with revertContext, ensuring that event filtering captures the additional contextual information.

v2/types/factories/ZetaConnectorBase__factory.ts (3)

38-50: Addition of TSS_ROLE function is appropriate.

The new function TSS_ROLE is consistent with other role functions in the ABI. It provides a mechanism to retrieve a specific role identifier.


308-329: Expanded outputs enhance error handling.

The addition of the revertContext tuple provides more detailed context for reverts, improving error handling and state reporting.


Line range hint 450-536:
Event renaming improves clarity.

Renaming the events to Withdrawn, WithdrawnAndCalled, and WithdrawnAndReverted clarifies that these events indicate completed actions, enhancing the semantic understanding of the contract's event emissions.

v2/types/ReceiverEVM.ts (5)

26-36: Structured types for revert contexts enhance clarity.

The introduction of RevertContextStruct and RevertContextStructOutput provides a clear and type-safe way to handle revert contexts, aligning with best practices for structured data handling.


58-61: Interface modification enhances type safety.

The change in encodeFunctionData to accept RevertContextStruct aligns with the structured approach for handling revert data, enhancing clarity and type safety.


197-207: Event structure update improves detail.

Including revertContext in the ReceivedRevertEvent input and output tuples allows for more detailed and organized event handling, aligning with the structured approach.


258-262: Method update aligns with structured approach.

The onRevert method now accepts a RevertContextStruct, aligning it with the updated event structure and enhancing type safety.

Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


296-300: Method update ensures consistency.

The getFunction method update for onRevert ensures consistency with the updated parameter type, maintaining alignment with the structured approach.

Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/types/IERC20Custody.sol/IERC20Custody.ts (4)

26-36: Structured types for revert contexts enhance clarity.

The introduction of RevertContextStruct and RevertContextStructOutput provides a clear and type-safe way to handle revert contexts, aligning with best practices for structured data handling.


38-92: Interface definition is clear and functional.

The IERC20CustodyInterface is well-defined, with methods for withdrawal and whitelisting, using structured types for revert contexts to enhance clarity and functionality.


94-187: Event namespaces are well-structured.

The event namespaces for Unwhitelisted, Whitelisted, Withdrawn, WithdrawnAndCalled, and WithdrawnAndReverted are clearly defined, providing structured input and output tuples for effective event handling.


232-301: Method definitions align with intended functionality.

The methods for whitelisted, withdraw, withdrawAndCall, and withdrawAndRevert are well-defined, using structured types for revert contexts, aligning with the intended functionality for ERC20 custody.

Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/types/factories/SystemContractMock.sol/SystemContractMock__factory.ts (1)

345-345: Bytecode Update: Verify Consistency and Intent.

The bytecode has been significantly updated. Ensure that this change aligns with the intended contract logic and deployment parameters. Verify that any dependent systems or documentation are updated accordingly.

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

Line range hint 148-149:
Verify the Removal of Zero Amount Checks.

The checks for zero amounts have been removed from the withdraw and withdrawAndCall functions. Ensure that this change is intentional and that there are no unintended vulnerabilities introduced. Confirm that the contract logic elsewhere can safely handle zero amounts.

Also applies to: 194-195

Verification successful

Zero Amount Checks Removed: Ensure Adequate Testing and Handling

The removal of zero amount checks from the withdraw and withdrawAndCall functions seems intentional, and there are test cases in GatewayZEVM.t.sol that verify the handling of zero amounts. Ensure these tests are comprehensive enough to cover potential edge cases and that the contract logic safely handles zero amounts.

  • Consider reviewing the test cases in v2/test/GatewayZEVM.t.sol for completeness.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the removal of zero amount checks in `withdraw` and `withdrawAndCall`.

# Test: Search for any references to these functions to ensure the change aligns with the intended logic.
rg --type solidity 'withdraw\(.*amount' -A 5

Length of output: 79


Script:

#!/bin/bash
# Description: Re-run the search for references to `withdraw` and `withdrawAndCall` functions in Solidity files.

# Corrected Test: Search for any references to these functions to ensure the change aligns with the intended logic.
rg 'withdraw\(.*amount' --glob '*.sol' -A 5

Length of output: 13257

v2/types/factories/ReceiverEVM__factory.ts (1)

28-47: Ensure Consistency with New revertContext Structure.

The revertContext parameter has been introduced, enhancing error handling. Ensure that this change is consistent across the contract's interface and that all related logic is updated to accommodate this new structure.

Also applies to: 275-295

Verification successful

The revertContext structure is consistently integrated across the codebase.

The search results indicate that the revertContext structure is referenced in multiple files, including test files, type definitions, and factory files. This suggests that the structure is consistently used and integrated into various components. However, ensure that the RevertContextStruct is correctly defined and used in the relevant interfaces to align with the intended design. If there are specific areas of concern, further manual verification might be necessary.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistency with the new `revertContext` structure.

# Test: Search for references to `revertContext` to ensure consistent usage across the codebase.
rg --type ts 'revertContext'

Length of output: 22618

v2/types/factories/IGatewayEVM.sol/IGatewayEVM__factory.ts (8)

27-51: Enhancement: Added revertOptions parameter to call function.

The inclusion of revertOptions improves the function's capability to handle revert scenarios effectively.


76-101: Enhancement: Added revertOptions parameter to deposit function.

This addition aligns with the strategy to improve revert handling across functions.


109-141: New Function: deposit with revertOptions and payable state.

The new variant supports Ether transactions, enhancing the contract's flexibility.


171-197: Enhancement: Added revertOptions parameter to depositAndCall function.

This change improves the function's ability to manage revert scenarios.


202-245: New Function: depositAndCall with revertOptions and payable state.

The new variant supports Ether transactions, enhancing the contract's flexibility.


285-306: Enhancement: Added revertContext parameter to executeRevert function.

This addition provides detailed revert handling capabilities.


363-384: Enhancement: Added revertContext parameter to revertWithERC20 function.

This change improves the function's ability to manage revert scenarios.


389-661: Enhancement: Added new events and error types.

These additions enhance the contract's event-driven architecture and error handling capabilities.

v2/types/index.ts (5)

22-23: New Type: Added revertSol to exports.

This addition supports functionality related to revert operations.


34-35: New Type: Added universalContractSol to exports.

This addition facilitates interactions with a broader set of contracts.


100-100: Refactor: Renamed TestZContract to TestUniversalContract.

This renaming reflects a refactoring towards a more unified contract structure.


138-139: New Type: Added IERC20Custody and its factory to exports.

This addition supports expanded functionality for ERC20 custody operations.


Line range hint 196-222: New Types: Added Revertable, UniversalContract, and ZContract to exports.

These additions enhance the module's functionality for revert operations and universal contracts.

v2/types/IGatewayZEVM.sol/IGatewayZEVM.ts (9)

26-43: New Types: Added RevertOptionsStruct and RevertOptionsStructOutput.

These types enhance the handling of revert scenarios within the contract's operations.


58-67: Updated Types: Modified RevertContextStruct and RevertContextStructOutput.

These changes reflect a shift towards asset management during reversion.


79-82: Updated Function Signatures: Added RevertOptionsStruct to functions.

These updates enhance the interaction model by incorporating revert handling.


85-85: Updated Event Signature: Added RevertOptionsStruct to Called event.

This update enhances the event-driven architecture by incorporating revert handling.


136-162: Updated Function Signatures: Added RevertOptionsStruct to withdraw and withdrawAndCall.

These updates enhance the functions' ability to handle revert scenarios.


202-228: New Namespace: Added CalledEvent for event handling.

This namespace enhances the contract's event-driven architecture.


230-268: New Namespace: Added WithdrawnEvent for event handling.

This namespace enhances the contract's event-driven architecture.


392-434: Updated Method Definitions: Added RevertOptionsStruct to withdraw and withdrawAndCall.

These updates enhance the methods' ability to handle revert scenarios.

Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


581-618: Updated Event Filters: Added RevertOptionsStruct to Called and Withdrawn.

These updates enhance the event handling capabilities by incorporating revert scenarios.

v2/types/IGatewayEVM.sol/IGatewayEVM.ts (15)

26-31: New Struct: RevertOptionsStruct

The RevertOptionsStruct is a well-defined structure for handling revert scenarios, adding flexibility to contract interactions.


33-43: New Struct Output: RevertOptionsStructOutput

The output structure mirrors the input struct, ensuring consistent data handling for revert options.


45-49: New Struct: RevertContextStruct

This struct provides context for reverts, which is useful for detailed error handling.


51-55: New Struct Output: RevertContextStructOutput

The output structure aligns with the input, maintaining consistency in revert context handling.


71-78: New Event Definitions

The addition of new events like Called, Deposited, Executed, ExecutedWithERC20, and Reverted enhances the contract's ability to communicate state changes.


161-184: Event: CalledEvent

The CalledEvent is structured to capture essential transaction details, including sender, receiver, and payload.


186-215: Event: DepositedEvent

This event captures deposit activity, including sender, receiver, and amount, which is crucial for transaction tracking.


217-233: Event: ExecutedEvent

The ExecutedEvent provides details on transaction execution, which is valuable for auditing and debugging.


235-258: Event: ExecutedWithERC20Event

This event tracks transactions involving ERC20 tokens, adding transparency to token operations.


260-286: Event: RevertedEvent

The RevertedEvent is essential for understanding failed transactions and their contexts.


543-543: Security Concern: Potential API Key Exposure

Detected a generic API key. Ensure this is not sensitive information.

Tools
Gitleaks

543-543: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


358-364: Static Analysis: Avoid void Type

Using void outside of return types can be confusing. Consider using undefined instead.

- [void],
+ [undefined],

Likely invalid or redundant comment.


352-353: Static Analysis: Avoid void Type

Using void outside of return types can be confusing. Consider using undefined instead.

- [void],
+ [undefined],

Likely invalid or redundant comment.


341-347: Static Analysis: Avoid void Type

Using void outside of return types can be confusing. Consider using undefined instead.

- [void],
+ [undefined],

Likely invalid or redundant comment.


332-336: Static Analysis: Avoid void Type

Using void outside of return types can be confusing. Consider using undefined instead.

- [void],
+ [undefined],

Likely invalid or redundant comment.

v2/types/ZetaConnectorBase.ts (12)

26-30: New Type Declaration: RevertContextStruct.

The introduction of RevertContextStruct encapsulates asset transaction details that may revert. This is a useful addition for handling complex transaction scenarios.


32-36: New Type Declaration: RevertContextStructOutput.

This output type complements RevertContextStruct and ensures that the data structure is correctly formatted for output operations.


43-43: Addition of TSS_ROLE.

The TSS_ROLE enhances role management capabilities within the interface, which is crucial for permission control.


69-71: Event Renaming for Consistency.

The renaming of events to Withdrawn, WithdrawnAndCalled, and WithdrawnAndReverted aligns with the function signatures and improves clarity.


129-135: Updated encodeFunctionData for withdrawAndRevert.

The addition of RevertContextStruct as a parameter enhances the function's ability to handle revert scenarios with more context.


147-147: Decoding Function Result for TSS_ROLE.

This addition ensures that results related to TSS_ROLE can be decoded correctly, which is important for role-based operations.


Line range hint 269-317: Event Namespace Renaming and Structure Update.

The renaming and structural update of event namespaces to include revertContext ensures consistency and provides additional context for transaction events.


372-372: Addition of TSS_ROLE Method.

The inclusion of TSS_ROLE as a method further supports role management and enhances contract security.


444-445: Updated withdrawAndRevert Method Signature.

Incorporating RevertContextStruct into the method signature allows for more detailed handling of revert scenarios.


463-465: Addition of TSS_ROLE to getFunction.

This ensures that TSS_ROLE can be retrieved using the getFunction method, supporting dynamic role management.


590-608: Event Retrieval Update.

The updates to getEvent for renamed events ensure that the correct events are retrieved, maintaining consistency across the contract.


667-697: Filter Updates for Renamed Events.

These changes ensure that event filters are correctly aligned with the new event names, supporting accurate event handling.

v2/types/ZetaConnectorNative.ts (12)

26-30: New Type Declaration: RevertContextStruct.

This type encapsulates details for transactions that may revert, enhancing the management of such scenarios.


32-36: New Type Declaration: RevertContextStructOutput.

This output type complements the RevertContextStruct, ensuring proper formatting for output operations.


43-43: Addition of TSS_ROLE.

The TSS_ROLE enhances role management within the interface, crucial for permission control.


69-71: Event Renaming for Consistency.

Renaming events to Withdrawn, WithdrawnAndCalled, and WithdrawnAndReverted aligns with function signatures and improves clarity.


129-135: Updated encodeFunctionData for withdrawAndRevert.

Adding RevertContextStruct as a parameter enhances the function's ability to handle revert scenarios with more context.


147-147: Decoding Function Result for TSS_ROLE.

This addition ensures results related to TSS_ROLE can be decoded correctly, important for role-based operations.


Line range hint 269-317: Event Namespace Renaming and Structure Update.

Renaming and updating event namespaces to include revertContext ensures consistency and provides additional context for transaction events.


372-372: Addition of TSS_ROLE Method.

Including TSS_ROLE as a method supports role management and enhances contract security.


444-445: Updated withdrawAndRevert Method Signature.

Incorporating RevertContextStruct allows for more detailed handling of revert scenarios.


463-465: Addition of TSS_ROLE to getFunction.

Ensures TSS_ROLE can be retrieved using getFunction, supporting dynamic role management.


590-608: Event Retrieval Update.

Updates to getEvent for renamed events ensure correct retrieval, maintaining consistency across the contract.


667-697: Filter Updates for Renamed Events.

These changes ensure event filters align with new event names, supporting accurate event handling.

v2/types/ZRC20.sol/ZRC20.ts (5)

53-53: New Function: withdrawGasFeeWithGasLimit.

This function allows specifying a gas limit when withdrawing gas fees, enhancing flexibility in gas fee management.


143-146: Encoding Function Data for withdrawGasFeeWithGasLimit.

This implementation ensures the new function can be correctly encoded for transaction data.


205-208: Decoding Function Result for withdrawGasFeeWithGasLimit.

This implementation ensures the new function's results can be correctly decoded, supporting accurate data handling.


472-476: New Method: withdrawGasFeeWithGasLimit.

The addition of this method to the ZRC20 contract allows users to manage gas fees with a specified gas limit, enhancing control and flexibility.


582-584: Addition of withdrawGasFeeWithGasLimit to getFunction.

This ensures the new function can be retrieved dynamically, supporting flexible contract interactions.

v2/types/ZetaConnectorNonNative.ts (8)

26-30: Addition of RevertContextStruct is well-structured.

The RevertContextStruct type enhances error handling by encapsulating asset, amount, and revert message details.


32-36: Addition of RevertContextStructOutput is consistent.

The RevertContextStructOutput type provides a clear output format for the RevertContextStruct, maintaining consistency.


Line range hint 43-74: Interface updates improve role management and event clarity.

The addition of TSS_ROLE and renaming of events enhance the interface's functionality and readability.


137-143: encodeFunctionData update supports enhanced error handling.

The inclusion of RevertContextStruct in withdrawAndRevert improves the method's capability to handle complex scenarios.


155-155: decodeFunctionResult update aligns with interface changes.

The method now supports the updated role and event names, ensuring consistency in decoding results.


Line range hint 294-299: WithdrawnEvent namespace update improves clarity.

The updated namespace better reflects the event's functionality, enhancing semantic understanding.


Line range hint 307-322: WithdrawnAndCalledEvent namespace update improves clarity.

The updated namespace better reflects the event's functionality, enhancing semantic understanding.


325-342: WithdrawnAndRevertedEvent update enhances error context.

Including RevertContextStruct in the event namespace provides detailed context, improving error handling.

v2/types/ERC20Custody.ts (8)

26-30: Addition of RevertContextStruct is well-structured.

The RevertContextStruct type enhances error handling by encapsulating asset, amount, and revert message details.


32-36: Addition of RevertContextStructOutput is consistent.

The RevertContextStructOutput type provides a clear output format for the RevertContextStruct, maintaining consistency.


Line range hint 43-57: Interface updates enhance whitelisting functionality.

The addition of WHITELISTER_ROLE and related methods improves the contract's capability to manage token whitelisting.


143-149: encodeFunctionData update supports enhanced error handling.

The inclusion of RevertContextStruct in withdrawAndRevert improves the method's capability to handle complex scenarios.


Line range hint 160-195: decodeFunctionResult update aligns with interface changes.

The method now supports the updated role and event names, ensuring consistency in decoding results.


289-311: New whitelisting event namespaces improve tracking.

The addition of UnwhitelistedEvent and WhitelistedEvent enhances the contract's ability to track whitelisting changes.


Line range hint 313-329: WithdrawnEvent namespace update improves clarity.

The updated namespace better reflects the event's functionality, enhancing semantic understanding.


356-376: WithdrawnAndRevertedEvent update enhances error context.

Including RevertContextStruct in the event namespace provides detailed context, improving error handling.

v2/types/ERC20CustodyEchidnaTest.ts (8)

26-30: Addition of RevertContextStruct is well-structured.

The RevertContextStruct type enhances error handling by encapsulating asset, amount, and revert message details.


32-36: Addition of RevertContextStructOutput is consistent.

The RevertContextStructOutput type provides a clear output format for the RevertContextStruct, maintaining consistency.


Line range hint 43-60: Interface updates enhance whitelisting functionality.

The addition of WHITELISTER_ROLE and related methods improves the contract's capability to manage token whitelisting.


155-161: encodeFunctionData update supports enhanced error handling.

The inclusion of RevertContextStruct in withdrawAndRevert improves the method's capability to handle complex scenarios.


Line range hint 172-216: decodeFunctionResult update aligns with interface changes.

The method now supports the updated role and event names, ensuring consistency in decoding results.


310-332: New whitelisting event namespaces improve tracking.

The addition of UnwhitelistedEvent and WhitelistedEvent enhances the contract's ability to track whitelisting changes.


Line range hint 334-349: WithdrawnEvent namespace update improves clarity.

The updated namespace better reflects the event's functionality, enhancing semantic understanding.


377-397: WithdrawnAndRevertedEvent update enhances error context.

Including RevertContextStruct in the event namespace provides detailed context, improving error handling.

v2/types/factories/ZetaConnectorNonNative__factory.ts (3)

75-87: Addition of TSS_ROLE function.

The new TSS_ROLE function is a view function returning a bytes32 type. This addition is consistent with role management practices in smart contracts.


371-392: Inclusion of revertContext in withdrawAndRevert function.

The addition of revertContext provides detailed context for reverts, enhancing error handling and debugging capabilities.


Line range hint 526-612: Event renaming and context enhancement.

The events Withdraw, WithdrawAndCall, and WithdrawAndRevert have been renamed to Withdrawn, WithdrawnAndCalled, and WithdrawnAndReverted, respectively. The inclusion of revertContext in events improves clarity and context.

v2/types/factories/ZetaConnectorNative__factory.ts (3)

75-87: Addition of TSS_ROLE function.

The TSS_ROLE function is added to facilitate role management, returning a bytes32 type. This aligns with standard practices for role-based access control.


345-366: Inclusion of revertContext in withdrawAndRevert function.

The revertContext tuple provides comprehensive details on reverts, aiding in better error handling and diagnostics.


Line range hint 487-573: Event renaming and context enhancement.

Events have been renamed to Withdrawn, WithdrawnAndCalled, and WithdrawnAndReverted, with revertContext providing additional context. These changes improve event clarity and usability.

v2/types/factories/ERC20Custody__factory.ts (8)

67-79: Addition of WHITELISTER_ROLE function.

The WHITELISTER_ROLE function, returning a bytes32 type, supports role management for whitelisting operations. This addition is well-aligned with access control practices.


251-261: Introduction of unwhitelist function.

The unwhitelist function allows for the removal of tokens from the whitelist, providing more control over token management.


264-274: Introduction of whitelist function.

The whitelist function enables adding tokens to a whitelist, enhancing the contract's token management capabilities.


277-293: Introduction of whitelisted function.

The whitelisted function checks if a token is whitelisted, returning a boolean. This is useful for verifying token status.


296-310: Modification of withdraw function.

The withdraw function now includes parameters for to and token, allowing for more granular control over withdrawals.


498-521: Event renaming and new events.

The Withdraw event is renamed to Unwhitelisted, and a new Whitelisted event is added. These changes improve clarity and track whitelisting actions.


Line range hint 580-628: Inclusion of revertContext in WithdrawnAndReverted event.

The revertContext provides detailed context on reverts, enhancing error tracking and diagnostics.


690-694: Introduction of NotWhitelisted error.

The NotWhitelisted error improves error handling by clearly indicating actions attempted on non-whitelisted tokens.

v2/types/factories/ZRC20.sol/ZRC20__factory.ts (2)

469-490: New Function: withdrawGasFeeWithGasLimit.

The addition of the withdrawGasFeeWithGasLimit function enhances the contract's functionality by allowing gas fees to be withdrawn with a specified gas limit. This provides better control over gas usage during transactions. Ensure that this function is thoroughly tested to verify its behavior and integration.


698-698: Bytecode Update: Verify Contract Logic Changes.

The modification in the _bytecode variable indicates an update to the underlying contract logic or optimizations. Ensure that these changes are consistent with the intended functionality and do not introduce any unintended side effects.

v2/types/GatewayZEVM.ts (6)

26-31: New Type: RevertOptionsStruct.

The introduction of RevertOptionsStruct allows for more nuanced handling of revert scenarios, enhancing the contract's flexibility in managing transaction failures. Ensure that all functions using this struct are updated accordingly.


33-43: New Type: RevertOptionsStructOutput.

This output type complements the RevertOptionsStruct by providing a structured format for handling revert-related data. Verify that the serialization and deserialization processes are correctly implemented.


58-60: Modified Type: RevertContextStruct.

The RevertContextStruct now focuses on asset management during reverts, reflecting a shift in handling revert scenarios. Ensure that this change aligns with the contract's overall logic and objectives.


64-67: Modified Type: RevertContextStructOutput.

The output format for RevertContextStruct has been updated to match the new structure. Verify that all related functions handle this output correctly.


95-98: Function Signature Update: Include RevertOptionsStruct.

The inclusion of RevertOptionsStruct in function signatures like withdraw and withdrawAndCall enhances error handling and transaction management. Ensure that these functions are tested for the new parameters.


104-112: Event Name Changes: Improve Clarity.

Renaming events from Call to Called and Withdrawal to Withdrawn improves clarity regarding their purpose. Ensure that all event listeners are updated to reflect these changes.

v2/types/GatewayEVM.ts (5)

26-31: New Type: RevertOptionsStruct.

The introduction of RevertOptionsStruct enhances the contract's flexibility in handling transaction failures by providing detailed revert options. Ensure that all functions using this struct are updated accordingly.


33-43: New Type: RevertOptionsStructOutput.

This output type complements the RevertOptionsStruct by providing a structured format for handling revert-related data. Verify that the serialization and deserialization processes are correctly implemented.


45-49: New Type: RevertContextStruct.

The RevertContextStruct provides a structured approach to managing asset-related information during reverts, enhancing transaction handling capabilities. Ensure that this change aligns with the contract's overall logic and objectives.


51-55: New Type: RevertContextStructOutput.

The output format for RevertContextStruct has been introduced to match the new structure. Verify that all related functions handle this output correctly.


67-70: Function Signature and Event Name Updates: Enhance Clarity and Functionality.

The updates to function signatures to include RevertOptionsStruct and event renaming improve clarity and functionality. Ensure that these changes are reflected throughout the codebase.

Also applies to: 96-97

v2/types/GatewayEVMUpgradeTest.ts (4)

26-43: Well-defined Revert Options Structures.

The RevertOptionsStruct and RevertOptionsStructOutput types are well-defined, capturing necessary details for handling revert scenarios, such as addresses and revert messages.


45-55: Well-defined Revert Context Structures.

The RevertContextStruct and RevertContextStructOutput types are well-defined, capturing necessary details for handling revert scenarios, such as asset, amount, and revert message.


67-70: Enhanced Function Signatures.

The updated function signatures in GatewayEVMUpgradeTestInterface incorporate new structs for enhanced error handling, improving the contract's robustness.

Also applies to: 96-97


134-153: Correct Encoding and Decoding Updates.

The encoding and decoding functions have been updated to accommodate new parameters, ensuring correct processing of additional data during transactions.

Also applies to: 161-201

v2/types/GatewayEVMEchidnaTest.ts (4)

26-43: Well-defined Revert Options Structures.

The RevertOptionsStruct and RevertOptionsStructOutput types are well-defined, capturing necessary details for handling revert scenarios, such as addresses and revert messages.


45-55: Well-defined Revert Context Structures.

The RevertContextStruct and RevertContextStructOutput types are well-defined, capturing necessary details for handling revert scenarios, such as asset, amount, and revert message.


67-70: Enhanced Function Signatures.

The updated function signatures in GatewayEVMEchidnaTestInterface incorporate new structs for enhanced error handling, improving the contract's robustness.

Also applies to: 99-100


136-155: Correct Encoding and Decoding Updates.

The encoding and decoding functions have been updated to accommodate new parameters, ensuring correct processing of additional data during transactions.

Also applies to: 167-207

v2/types/factories/GatewayEVM__factory.ts (10)

99-124: Struct RevertOptions definition looks good.

The struct provides a clear and detailed way to handle revert conditions. The field names are descriptive and consistent.


162-188: Function signature change for deposit looks good.

The addition of the revertOptions parameter allows for enhanced handling of revert scenarios.


257-283: Function signature change for depositAndCall looks good.

The addition of the revertOptions parameter is consistent with other modifications and enhances functionality.


371-391: Struct RevertContext definition looks good.

The struct provides a clear way to encapsulate asset management information during a revert.


Line range hint 739-786:
Event Called modification looks good.

The renaming and inclusion of the revertOptions parameter provide clarity and comprehensive event data.


Line range hint 792-851:
Event Deposited modification looks good.

The renaming and inclusion of the revertOptions parameter enhance the event's clarity and informativeness.


371-392: Function signature change for executeRevert looks good.

The addition of the revertContext parameter aligns with the struct definition and enhances revert handling.


584-605: Function signature change for revertWithERC20 looks good.

The addition of the revertContext parameter is consistent with other changes and enhances functionality.


1141-1144: Error ConnectorInitialized addition looks good.

This error provides clarity for scenarios where a connector is already initialized.


1212-1215: Error NotWhitelistedInCustody addition looks good.

This error provides clarity for scenarios where whitelisting is required for custody operations.

v2/types/factories/GatewayEVMUpgradeTest__factory.ts (5)

102-128: Enhancement in error handling with revertOptions.

The addition of the revertOptions tuple in the call function improves error handling by providing more context.


165-191: Improved error handling in deposit function.

The inclusion of the revertOptions tuple enhances the function's error handling capabilities.


260-286: Consistent error handling in depositAndCall function.

The addition of the revertOptions tuple enhances error handling consistency across the contract.


374-395: Enhanced revert handling in executeRevert function.

The revertContext tuple provides detailed context for handling reverts, improving error management.


587-608: Improved error context in revertWithERC20 function.

The addition of the revertContext tuple enhances the function's error handling capabilities.

v2/types/factories/GatewayZEVM__factory.ts (10)

1220-1224: Addition of InsufficientZetaAmount error type.

This error type improves error handling for scenarios with insufficient Zeta amounts. Ensure it is correctly implemented and used in the codebase.


1185-1189: Addition of EmptyMessage error type.

This error type enhances error management capabilities. Ensure it is correctly implemented and used in the codebase.


Line range hint 1051-1128:
Event name change from Withdrawal to Withdrawn.

This change improves clarity and consistency. Verify that the event's usage has been updated accordingly in the codebase.

Verification successful

Event name change from Withdrawal to Withdrawn verified.

The Withdrawn event is used consistently throughout the codebase, replacing the previous Withdrawal event name. This change has been reflected in various files, ensuring consistency and clarity in the code.

  • Usage of Withdrawn event is found in:
    • v1/typechain-types/contracts/evm/ERC20Custody.ts
    • v1/test/ERC20Custody.spec.ts
    • v2/types/GatewayZEVM.ts
    • v2/scripts/localnet/worker.ts
    • And several other related TypeScript files in the v2 directory.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify usage of `Withdrawn` event.

# Test: Search for the event usage. Expect: Updated usage of `Withdrawn` event.
rg --type typescript -A 5 $'Withdrawn'

Length of output: 72


Script:

#!/bin/bash
# Description: Verify usage of `Withdrawn` event.

# Test: Search for the event usage. Expect: Updated usage of `Withdrawn` event.
rg --type ts -A 5 $'Withdrawn'

Length of output: 143719


Line range hint 865-918:
Event name change from Call to Called.

This change improves clarity and consistency. Verify that the event's usage has been updated accordingly in the codebase.

Verification successful

Event name change from Call to Called is correctly propagated.

The event name change has been successfully integrated across the codebase, as evidenced by its presence in multiple relevant files. No further action is needed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify usage of `Called` event.

# Test: Search for the event usage. Expect: Updated usage of `Called` event.
rg --type typescript -A 5 $'Called'

Length of output: 69


Script:

#!/bin/bash
# Description: Verify usage of `Called` event.

# Test: Search for the event usage. Expect: Updated usage of `Called` event.
rg --type ts -A 5 $'Called'

Length of output: 99312


295-316: Addition of revertContext struct in depositAndRevert.

The revertContext struct enhances robustness in handling transaction reverts. Ensure this struct is correctly implemented and used in the codebase.


760-785: Addition of revertOptions parameter in withdrawAndCall.

The revertOptions parameter enhances control over transaction reverts. Ensure this parameter is correctly utilized in the codebase.


86-126: Enhancements in call function parameters.

The additions of zrc20, gasLimit, and revertOptions enhance transaction control and error handling. Ensure these parameters are correctly utilized across the codebase.

Verification successful

Enhancements in call function parameters are correctly utilized.

The parameters zrc20, gasLimit, and revertOptions have been successfully integrated into the call function and are utilized across the codebase. This confirms the enhancements are correctly implemented.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify usage of `call` function with new parameters.

# Test: Search for the function usage. Expect: Correct usage of new parameters.
rg --type typescript -A 5 $'call'

Length of output: 67


Script:

#!/bin/bash
# Description: Verify usage of `call` function with new parameters.

# Corrected Test: Search for the function usage with the correct file type. Expect: Correct usage of new parameters.
rg --type ts -A 5 $'call'

Length of output: 361045


794-818: Addition of zrc20 and gasLimit parameters in withdrawAndCall.

The zrc20 and gasLimit parameters provide enhanced control over token interactions and transaction execution. Ensure these parameters are correctly utilized in the codebase.


1294-1295: Flexibility in constructor parameters.

The inclusion of [signer?: Signer] in GatewayZEVMConstructorParams allows for more flexible contract instantiation. Ensure this flexibility is correctly utilized in the codebase.


654-680: Addition of revertOptions parameter in withdraw.

The revertOptions parameter enhances control over transaction reverts. Ensure this parameter is correctly utilized in the codebase.

v2/pkg/gatewayzevm.sol/gatewayzevm.go (5)

57-57: ABI Metadata Update: Enhancements Approved

The ABI metadata has been updated to include new functions and error types, enhancing the contract's capabilities for handling asset withdrawals and deposits. The introduction of error types like AccessControlUnauthorizedAccount and WithdrawalFailed improves error reporting and transparency.


57-57: Verify Function Signature Changes

The function signatures for depositAndCall, withdraw, and withdrawAndCall have been modified, replacing zrc20 with chainId in some cases. Ensure that these changes are reflected and correctly handled throughout the codebase.


57-57: Event Handling and Logging: Enhancements Approved

New events such as Called, Initialized, and Withdrawn have been added to enhance transparency and traceability, improving the ability to monitor contract interactions.

Ensure that these new events are correctly emitted and handled within the contract.


57-57: New Error Types: Enhancements Approved

The introduction of new error types such as AccessControlUnauthorizedAccount and WithdrawalFailed provides more granular error handling, improving the contract's robustness.

Ensure that these new error types are correctly integrated and handled throughout the contract.


57-57: Struct and Function Updates: Enhancements Approved

The GatewayZEVM struct and its related functions have been updated with new state variables and structures, indicating a shift towards more complex transaction handling.

Verify that the new structures are correctly utilized and integrated within the contract logic.

v2/types/factories/SystemContract.sol/SystemContract__factory.ts (3)

442-442: Enhancement: Flexible Constructor Parameters.

The introduction of the SystemContractConstructorParams type with an optional Signer enhances flexibility in contract instantiation.


Line range hint 447-453: Constructor Logic: Backward Compatibility Maintained.

The constructor logic effectively handles both the new and existing parameter types, maintaining backward compatibility while introducing new functionality.


442-442: Verify Bytecode Changes.

The _bytecode constant has been updated. Ensure that this change aligns with the intended updates or optimizations to the smart contract logic.

Verification successful

Bytecode Changes Verified.

The bytecode changes in SystemContract__factory.ts align with the newly added SystemContract.sol, confirming the intended updates to the smart contract logic. The changes include new mappings and functions for managing gas prices and ZRC20 addresses.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the changes in the bytecode against the intended smart contract logic.

# Test: Compare the bytecode with the expected changes.
# Note: This requires access to the original contract source to confirm the changes.
echo "Ensure that the bytecode changes reflect the intended updates or optimizations."

Length of output: 168


Script:

#!/bin/bash
# Find the Solidity source files that might relate to the bytecode in question.
fd --extension sol

# Check the git commit history for changes related to the bytecode update.
git log -p -S '0x60c060405234801561001057600080fd5b5060405161106f38038061106f83398101604081905261002f916100db565b3373735b14bb79463307aacbed86daf3322b1e6226ab1461006357604051632b2add3d60e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0385811691909117909155828116608052811660a0526040517f80699e81136d69cb8367ad52a994e25c722a86da654b561d0c14b61a777e7ac590600090a150505061011e565b80516001600160a01b03811681146100d657600080fd5b919050565b6000806000606084860312156100f057600080fd5b6100f9846100bf565b9250610107602085016100bf565b9150610115604085016100bf565b90509250925092565b60805160a051610f2561014a60003960006101e50152600081816102b9015261045b0152610f256000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c806397770dff11610097578063c63585cc11610066578063c63585cc14610273578063d7fd7afb14610286578063d936a012146102b4578063ee2815ba146102db57600080fd5b806397770dff1461021a578063a7cb05071461022d578063c39aca3714610240578063c62178ac1461025357600080fd5b8063513a9c05116100d3578063513a9c051461018a578063569541b9146101c0578063842da36d146101e057806391dd645f1461020757600080fd5b80630be15547146100fa5780631f0e251b1461015a5780633ce4a5bc1461016f575b600080fd5b610130610108366004610bd1565b60016020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b61016d610168366004610c13565b6102ee565b005b61013073735b14bb79463307aacbed86daf3322b1e6226ab81565b610130610198366004610bd1565b60026020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b6003546101309073ffffffffffffffffffffffffffffffffffffffff1681565b6101307f000000000000000000000000000000000000000000000000000000000000000081565b61016d610215366004610c35565b610402565b61016d610228366004610c13565b610526565b61016d61023b366004610c61565b610633565b61016d61024e366004610c83565b6106ce565b6004546101309073ffffffffffffffffffffffffffffffffffffffff1681565b610130610281366004610d53565b6108cd565b6102a6610294366004610bd1565b60006020819052908152604090205481565b604051908152602001610151565b6101307f000000000000000000000000000000000000000000000000000000000000000081565b61016d6102e9366004610c35565b610a02565b3373735b14bb79463307aacbed86daf3322b1e6226ab1461033b576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116610388576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f3ade88e3922d64780e1bf4460d364c2970b69da813f9c0c07a1c187b5647636c906020015b60405180910390a150565b3373735b14bb79463307aacbed86daf3322b1e6226ab1461044f576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600354600090610497907f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff16846108cd565b60008481526002602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85169081179091558251878152918201529192507f0ecec485166da6139b13bb7e033e9446e2d35348e80ebf1180d4afe2dba1704e910160405180910390a1505050565b3373735b14bb79463307aacbed86daf3322b1e6226ab14610573576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81166105c0576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fdba79d534382d1a8ae108e4c8ecb27c6ae42ab8b91d44eedf88bd329f3868d5e906020016103f7565b3373735b14bb79463307aacbed86daf3322b1e6226ab14610680576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152602081815260409182902083905581518481529081018390527f49f492222906ac486c3c1401fa545626df1f0c0e5a77a05597ea2ed66af9850d91015b60405180910390a15050565b3373735b14bb79463307aacbed86daf3322b1e6226ab1461071b576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff831673735b14bb79463307aacbed86daf3322b1e6226ab1480610768575073ffffffffffffffffffffffffffffffffffffffff831630145b1561079f576040517f82d5d76a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f47e7ef2400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152602482018690528616906347e7ef24906044016020604051808303816000875af1158015610814573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108389190610d96565b506040517fde43156e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84169063de43156e906108939089908990899088908890600401610e01565b600060405180830381600087803b1580156108ad57600080fd5b505af11580156108c1573d6000803e3d6000fd5b50505050505050505050565b60008060006108dc8585610ad3565b6040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606084811b8216602084015283901b16603482015291935091508690604801604051602081830303815290604052805190602001206040516020016109c29291907fff00000000000000000000000000000000000000000000000000000000000000815260609290921b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016600183015260158201527f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f603582015260550190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101209695505050505050565b3373735b14bb79463307aacbed86daf3322b1e6226ab14610a4f576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526001602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85169081179091558251858152918201527fd1b36d30f6248e97c473b4d1348ca164a4ef6759022f54a58ec200326c39c45d91016106c2565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610b3b576040517fcb1e7cfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610610b75578284610b78565b83835b909250905073ffffffffffffffffffffffffffffffffffffffff8216610bca576040517f78b507da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b600060208284031215610be357600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610c0e57600080fd5b919050565b600060208284031215610c2557600080fd5b610c2e82610bea565b9392505050565b60008060408385031215610c4857600080fd5b82359150610c5860208401610bea565b90509250929050565b60008060408385031215610c7457600080fd5b50508035926020909101359150565b60008060008060008060a08789031215610c9c57600080fd5b863567ffffffffffffffff811115610cb357600080fd5b87016060818a031215610cc557600080fd5b9550610cd360208801610bea565b945060408701359350610ce860608801610bea565b9250608087013567ffffffffffffffff811115610d0457600080fd5b8701601f81018913610d1557600080fd5b803567ffffffffffffffff811115610d2c57600080fd5b896020828401011115610d3e57600080fd5b60208201935080925050509295509295509295565b600080600060608486031215610d6857600080fd5b610d7184610bea565b9250610d7f60208501610bea565b9150610d8d60408501610bea565b90509250925092565b600060208284031215610da857600080fd5b81518015158114610c2e57600080fd5b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b60808152600086357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1883603018112610e3957600080fd5b870160208101903567ffffffffffffffff811115610e5657600080fd5b803603821315610e6557600080fd5b60606080850152610e7a60e085018284610db8565b91505073ffffffffffffffffffffffffffffffffffffffff610e9e60208a01610bea565b1660a0840152604088013560c084015273ffffffffffffffffffffffffffffffffffffffff871660208401528560408401528281036060840152610ee3818587610db8565b9897505050505050505056fea264697066735822122008474639ce364cbb25d83e495dc4d0a78e2d65a2d539f4c42e4aa870df459f5f64736f6c634300081a0033'

Length of output: 137680


Script:

#!/bin/bash
# Check the git commit history for recent changes in the SystemContract.sol file.
git log -p -- v1/contracts/zevm/SystemContract.sol

Length of output: 7423

v2/types/factories/IGatewayZEVM.sol/IGatewayZEVM__factory.ts (7)

22-62: Enhancement: Expanded Function Parameters.

The call function now includes zrc20, gasLimit, and revertOptions parameters, enhancing its capability to specify gas limits and handle reverts.


Line range hint 192-252: Enhancement: Detailed Revert Handling.

The depositAndRevert function now includes a revertContext parameter, improving error management through detailed revert handling.


398-424: Enhancement: Revert Options in Withdrawal.

The withdraw function now includes a revertOptions parameter, offering flexibility in managing revert scenarios.


538-589: Enhancement: Complex Interactions in withdrawAndCall.

The withdrawAndCall function now includes additional parameters, enabling more complex interactions and improved error handling.


595-652: Enhancement: Detailed Event Tracking.

The Called event now includes revertOptions, allowing for better tracking of transaction contexts.


654-735: Enhancement: Enhanced Withdrawn Event Details.

The Withdrawn event now includes revertOptions, enhancing its ability to provide detailed information about the transaction context.


737-794: Enhancement: Comprehensive Error Handling.

The addition of new error types enhances the contract's ability to handle various failure scenarios effectively.

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 to use simple functions instead of a static-only class.

The class Revertable__factory contains only static members. Consider using simple functions to reduce complexity and improve readability.

// Example refactor to use simple functions
export const RevertableABI = _abi;

export function createRevertableInterface(): RevertableInterface {
  return new Interface(_abi) as RevertableInterface;
}

export function connectRevertable(
  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 +59 to +67
export class ZContract__factory {
static readonly abi = _abi;
static createInterface(): ZContractInterface {
return new Interface(_abi) as ZContractInterface;
}
static connect(address: string, runner?: ContractRunner | null): ZContract {
return new Contract(address, _abi, runner) as unknown as ZContract;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider refactoring the static-only class.

The class ZContract__factory contains only static members. It's recommended to use simple functions or a module pattern instead of a class when only static members are present.

- export class ZContract__factory {
-   static readonly abi = _abi;
-   static createInterface(): ZContractInterface {
-     return new Interface(_abi) as ZContractInterface;
-   }
-   static connect(address: string, runner?: ContractRunner | null): ZContract {
-     return new Contract(address, _abi, runner) as unknown as ZContract;
-   }
- }
+ export const ZContract__factory = {
+   abi: _abi,
+   createInterface(): ZContractInterface {
+     return new Interface(_abi) as ZContractInterface;
+   },
+   connect(address: string, runner?: ContractRunner | null): ZContract {
+     return new Contract(address, _abi, runner) as unknown as ZContract;
+   }
+ };
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
export class ZContract__factory {
static readonly abi = _abi;
static createInterface(): ZContractInterface {
return new Interface(_abi) as ZContractInterface;
}
static connect(address: string, runner?: ContractRunner | null): ZContract {
return new Contract(address, _abi, runner) as unknown as ZContract;
}
}
export const ZContract__factory = {
abi: _abi,
createInterface(): ZContractInterface {
return new Interface(_abi) as ZContractInterface;
},
connect(address: string, runner?: ContractRunner | null): ZContract {
return new Contract(address, _abi, runner) as unknown as ZContract;
}
};
Tools
Biome

[error] 59-67: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)

Comment on lines +89 to +100
export class UniversalContract__factory {
static readonly abi = _abi;
static createInterface(): UniversalContractInterface {
return new Interface(_abi) as UniversalContractInterface;
}
static connect(
address: string,
runner?: ContractRunner | null
): UniversalContract {
return new Contract(address, _abi, runner) as unknown as UniversalContract;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider refactoring the static-only class.

The class UniversalContract__factory contains only static members. It's recommended to use simple functions or a module pattern instead of a class when only static members are present.

- export class UniversalContract__factory {
-   static readonly abi = _abi;
-   static createInterface(): UniversalContractInterface {
-     return new Interface(_abi) as UniversalContractInterface;
-   }
-   static connect(address: string, runner?: ContractRunner | null): UniversalContract {
-     return new Contract(address, _abi, runner) as unknown as UniversalContract;
-   }
- }
+ export const UniversalContract__factory = {
+   abi: _abi,
+   createInterface(): UniversalContractInterface {
+     return new Interface(_abi) as UniversalContractInterface;
+   },
+   connect(address: string, runner?: ContractRunner | null): UniversalContract {
+     return new Contract(address, _abi, runner) as unknown as UniversalContract;
+   }
+ };
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
export class UniversalContract__factory {
static readonly abi = _abi;
static createInterface(): UniversalContractInterface {
return new Interface(_abi) as UniversalContractInterface;
}
static connect(
address: string,
runner?: ContractRunner | null
): UniversalContract {
return new Contract(address, _abi, runner) as unknown as UniversalContract;
}
}
export const UniversalContract__factory = {
abi: _abi,
createInterface(): UniversalContractInterface {
return new Interface(_abi) as UniversalContractInterface;
},
connect(address: string, runner?: ContractRunner | null): UniversalContract {
return new Contract(address, _abi, runner) as unknown as UniversalContract;
}
};
Tools
Biome

[error] 89-100: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)


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.

Use undefined instead of void in TypeScript.

In TypeScript, using void outside of a return type or type parameter can be confusing. Consider using undefined instead for better 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 is discouraged because it can match any non-nullable value. Consider explicitly defining the object shape or using Record<string, unknown> if applicable.

-  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 +370 to +376
"depositAndCall(address,bytes,(address,bool,address,bytes))": TypedContractMethod<
[
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.

Static Analysis: Avoid void Type

Using void outside of return types can be confusing. Consider using undefined instead.

- [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
"depositAndCall(address,bytes,(address,bool,address,bytes))": TypedContractMethod<
[
receiver: AddressLike,
payload: BytesLike,
revertOptions: RevertOptionsStruct
],
[void],
"depositAndCall(address,bytes,(address,bool,address,bytes))": TypedContractMethod<
[
receiver: AddressLike,
payload: BytesLike,
revertOptions: RevertOptionsStruct
],
[undefined],
Tools
Biome

[error] 376-376: 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 for Clarity.

The use of void is flagged as confusing outside return types or type parameters. Replace it with undefined for clarity.

-    [void],
+    [undefined],

Also applies to: 645-645, 651-651, 663-663, 673-673, 756-756, 813-813, 828-828, 835-835

Tools
Biome

[error] 632-632: 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 for Clarity.

The use of void is flagged as confusing outside return types or type parameters. Replace it with undefined for clarity.

-    [void],
+    [undefined],

Also applies to: 647-647, 653-653, 665-665, 675-675, 825-825, 840-840

Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

Comment on lines +69 to +153
export interface UniversalContract extends BaseContract {
connect(runner?: ContractRunner | null): UniversalContract;
waitForDeployment(): Promise<this>;

interface: UniversalContractInterface;

queryFilter<TCEvent extends TypedContractEvent>(
event: TCEvent,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TypedEventLog<TCEvent>>>;
queryFilter<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TypedEventLog<TCEvent>>>;

on<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
on<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;

once<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
once<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;

listeners<TCEvent extends TypedContractEvent>(
event: TCEvent
): Promise<Array<TypedListener<TCEvent>>>;
listeners(eventName?: string): Promise<Array<Listener>>;
removeAllListeners<TCEvent extends TypedContractEvent>(
event?: TCEvent
): Promise<this>;

onCrossChainCall: TypedContractMethod<
[
context: ZContextStruct,
zrc20: AddressLike,
amount: BigNumberish,
message: BytesLike
],
[void],
"nonpayable"
>;

onRevert: TypedContractMethod<
[revertContext: RevertContextStruct],
[void],
"nonpayable"
>;

getFunction<T extends ContractMethod = ContractMethod>(
key: string | FunctionFragment
): T;

getFunction(
nameOrSignature: "onCrossChainCall"
): TypedContractMethod<
[
context: ZContextStruct,
zrc20: AddressLike,
amount: BigNumberish,
message: BytesLike
],
[void],
"nonpayable"
>;
getFunction(
nameOrSignature: "onRevert"
): TypedContractMethod<
[revertContext: RevertContextStruct],
[void],
"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.

Interface UniversalContract is well-defined, but consider using undefined instead of void.

The interface methods are correctly defined, but using undefined instead of void outside a return type or type parameter is recommended.

- [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
export interface UniversalContract extends BaseContract {
connect(runner?: ContractRunner | null): UniversalContract;
waitForDeployment(): Promise<this>;
interface: UniversalContractInterface;
queryFilter<TCEvent extends TypedContractEvent>(
event: TCEvent,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TypedEventLog<TCEvent>>>;
queryFilter<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TypedEventLog<TCEvent>>>;
on<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
on<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;
once<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
once<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;
listeners<TCEvent extends TypedContractEvent>(
event: TCEvent
): Promise<Array<TypedListener<TCEvent>>>;
listeners(eventName?: string): Promise<Array<Listener>>;
removeAllListeners<TCEvent extends TypedContractEvent>(
event?: TCEvent
): Promise<this>;
onCrossChainCall: TypedContractMethod<
[
context: ZContextStruct,
zrc20: AddressLike,
amount: BigNumberish,
message: BytesLike
],
[void],
"nonpayable"
>;
onRevert: TypedContractMethod<
[revertContext: RevertContextStruct],
[void],
"nonpayable"
>;
getFunction<T extends ContractMethod = ContractMethod>(
key: string | FunctionFragment
): T;
getFunction(
nameOrSignature: "onCrossChainCall"
): TypedContractMethod<
[
context: ZContextStruct,
zrc20: AddressLike,
amount: BigNumberish,
message: BytesLike
],
[void],
"nonpayable"
>;
getFunction(
nameOrSignature: "onRevert"
): TypedContractMethod<
[revertContext: RevertContextStruct],
[void],
"nonpayable"
>;
filters: {};
export interface UniversalContract extends BaseContract {
connect(runner?: ContractRunner | null): UniversalContract;
waitForDeployment(): Promise<this>;
interface: UniversalContractInterface;
queryFilter<TCEvent extends TypedContractEvent>(
event: TCEvent,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TypedEventLog<TCEvent>>>;
queryFilter<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TypedEventLog<TCEvent>>>;
on<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
on<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;
once<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
once<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;
listeners<TCEvent extends TypedContractEvent>(
event: TCEvent
): Promise<Array<TypedListener<TCEvent>>>;
listeners(eventName?: string): Promise<Array<Listener>>;
removeAllListeners<TCEvent extends TypedContractEvent>(
event?: TCEvent
): Promise<this>;
onCrossChainCall: TypedContractMethod<
[
context: ZContextStruct,
zrc20: AddressLike,
amount: BigNumberish,
message: BytesLike
],
[undefined],
"nonpayable"
>;
onRevert: TypedContractMethod<
[revertContext: RevertContextStruct],
[undefined],
"nonpayable"
>;
getFunction<T extends ContractMethod = ContractMethod>(
key: string | FunctionFragment
): T;
getFunction(
nameOrSignature: "onCrossChainCall"
): TypedContractMethod<
[
context: ZContextStruct,
zrc20: AddressLike,
amount: BigNumberish,
message: BytesLike
],
[undefined],
"nonpayable"
>;
getFunction(
nameOrSignature: "onRevert"
): TypedContractMethod<
[revertContext: RevertContextStruct],
[undefined],
"nonpayable"
>;
filters: {};
Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 153-153: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

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 in TypeScript Function Signatures.

The use of void outside a return type or type parameter can be confusing. Replace it with undefined for clarity.

- [void],
+ [undefined],

Also applies to: 626-626, 632-632, 644-644, 654-654, 794-794, 809-809, 816-816

Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

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

Outside diff range, codebase verification and nitpick comments (3)
v2/pkg/igatewayzevm.sol/igatewayzevm.go (2)

Update Documentation for Function Signatures

The documentation and comments for the DepositAndRevert and ExecuteRevert functions in the code do not reflect any changes in their function signatures. Please ensure that these comments are updated to match the current function definitions.

  • File: v2/pkg/igatewayzevm.sol/igatewayzevm.go
  • Functions: DepositAndRevert, ExecuteRevert
Analysis chain

Line range hint 289-349:
Ensure documentation reflects changes in function signatures.

The function signatures for DepositAndRevert and ExecuteRevert have been modified. Ensure that any related documentation or comments are updated to reflect these changes.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if documentation or comments reflect the changes in function signatures.

# Test: Search for documentation or comments mentioning `DepositAndRevert` and `ExecuteRevert`. Expect: Updated information.
rg --type go 'DepositAndRevert|ExecuteRevert'

Length of output: 83898


56-56: Issues Found: ABI Changes Not Reflected in Codebase

The functions depositAndRevert and executeRevert are still being used with their original parameters in the codebase, despite the ABI changes. This suggests that the necessary updates to accommodate the ABI changes have not been fully implemented.

  • Ensure that all instances of depositAndRevert and executeRevert in the codebase are updated to match the new ABI signatures.
  • Review and update any dependent systems or applications that interact with these functions.
Analysis chain

Verify impact of ABI changes on existing integrations.

The ABI changes, including the removal of the context parameter from several functions, may affect existing integrations. Ensure that all dependent systems or applications are updated accordingly.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of modified functions in the codebase and check for potential impact.

# Test: Search for function calls to `depositAndRevert` and `executeRevert`. Expect: Usage of new function signatures.
rg --type go -A 5 'depositAndRevert|executeRevert'

Length of output: 248978

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

Inconsistent Withdraw0 Function Signatures

The Withdraw0 function signatures are inconsistent across different variations:

  • GatewayZEVMTransactor includes an additional opts *bind.TransactOpts parameter, which is not present in the GatewayZEVMSession and GatewayZEVMTransactorSession variations.

Please verify if this discrepancy is intentional or if the signatures need to be aligned. If intentional, ensure that the difference is documented clearly to avoid confusion.

  • v2/pkg/gatewayzevm.sol/gatewayzevm.go:
    • GatewayZEVMTransactor: Withdraw0(opts *bind.TransactOpts, receiver []byte, amount *big.Int, chainId *big.Int, revertOptions RevertOptions)
    • GatewayZEVMSession: Withdraw0(receiver []byte, amount *big.Int, chainId *big.Int, revertOptions RevertOptions)
    • GatewayZEVMTransactorSession: Withdraw0(receiver []byte, amount *big.Int, chainId *big.Int, revertOptions RevertOptions)
Analysis chain

Line range hint 713-731:
Verify Withdraw0 function consistency.

The Withdraw0 function has been added in three variations. Ensure that the function signatures are consistent and correctly implemented across all variations.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of `Withdraw0` function signatures.

# Test: Search for all `Withdraw0` function signatures.
# Expect: All signatures should match across Transactor, Session, and TransactorSession.
rg --type go 'func \(_GatewayZEVM \*GatewayZEVM(Transactor|Session|TransactorSession)\) Withdraw0'

Length of output: 735

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5b759b5 and 2ddb701.

Files selected for processing (11)
  • v2/pkg/gatewayzevm.sol/gatewayzevm.go (3 hunks)
  • v2/pkg/igatewayzevm.sol/igatewayzevm.go (3 hunks)
  • v2/pkg/senderzevm.sol/senderzevm.go (1 hunks)
  • v2/src/zevm/GatewayZEVM.sol (3 hunks)
  • v2/src/zevm/interfaces/IGatewayZEVM.sol (2 hunks)
  • v2/test/GatewayZEVM.t.sol (3 hunks)
  • v2/types/GatewayZEVM.ts (23 hunks)
  • v2/types/IGatewayZEVM.sol/IGatewayZEVM.ts (13 hunks)
  • v2/types/factories/GatewayZEVM__factory.ts (18 hunks)
  • v2/types/factories/IGatewayZEVM.sol/IGatewayZEVM__factory.ts (10 hunks)
  • v2/types/factories/SenderZEVM__factory.ts (4 hunks)
Files skipped from review as they are similar to previous changes (2)
  • v2/types/factories/GatewayZEVM__factory.ts
  • v2/types/factories/SenderZEVM__factory.ts
Additional context used
Biome
v2/types/IGatewayZEVM.sol/IGatewayZEVM.ts

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/types/GatewayZEVM.ts

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

Additional comments not posted (21)
v2/src/zevm/interfaces/IGatewayZEVM.sol (1)

Line range hint 54-67: LGTM! But verify the function usage in the codebase.

The removal of the context parameter simplifies the function signatures for executeRevert and depositAndRevert. Ensure that all calls to these functions are updated accordingly.

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

Line range hint 115-116: Verify handling of zero amounts.

The check for zero amounts has been removed from the withdrawAndCall function. Ensure that zero amounts are handled appropriately elsewhere in the contract to avoid unintended behavior.

Verification successful

Zero Amounts Are Handled Appropriately in GatewayZEVM.sol

The GatewayZEVM contract includes checks for zero amounts, which revert transactions if the amount is zero. This ensures that zero amounts are handled correctly, mitigating the risk of unintended behavior due to the removal of such checks from specific functions like withdrawAndCall.

  • Lines in v2/src/zevm/GatewayZEVM.sol verify zero amounts with conditions like if (amount == 0) revert InsufficientZRC20Amount();.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify handling of zero amounts in the `GatewayZEVM` contract.

# Test: Search for any remaining checks or handling of zero amounts.
rg --type solidity 'amount == 0'

Length of output: 67


Script:

#!/bin/bash
# Description: Verify handling of zero amounts in the `GatewayZEVM` contract.

# Test: Search for any checks or handling of zero amounts in Solidity files.
fd -e sol | xargs rg 'amount == 0'

Length of output: 1465


Script:

#!/bin/bash
# Description: Verify handling of zero amounts in the `GatewayZEVM` contract.

# Test: Search for any logic that might handle zero amounts indirectly.
fd -e sol | xargs rg 'require.*amount'

Length of output: 774


Line range hint 130-131: Verify handling of zero amounts.

The check for zero amounts has been removed from the executeRevert function. Ensure that zero amounts are handled appropriately elsewhere in the contract to avoid unintended behavior.

Verification successful

Zero amounts are handled elsewhere in the contract. The removal of the check for zero amounts from the executeRevert function is mitigated by other checks throughout the contract, which revert the transaction if the amount is zero.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify handling of zero amounts in the `GatewayZEVM` contract.

# Test: Search for any remaining checks or handling of zero amounts.
rg --type solidity 'amount == 0'

Length of output: 67


Script:

#!/bin/bash
# Description: Verify handling of zero amounts in the `GatewayZEVM` contract.

# Test: Search for any remaining checks or handling of zero amounts with the correct file type for Solidity.
rg --type sol 'amount == 0'

Length of output: 57


Script:

#!/bin/bash
# Description: Verify handling of zero amounts in the `GatewayZEVM` contract.

# Find all Solidity files and search for any remaining checks or handling of zero amounts.
fd --extension sol --exec rg 'amount == 0' {}

Length of output: 990

v2/types/factories/IGatewayZEVM.sol/IGatewayZEVM__factory.ts (7)

22-24: Ensure Consistency with ABI Changes.

The introduction of the zrc20 parameter as an address type is consistent with the changes described. Verify that this change aligns with the updated contract logic.


693-750: Addition of New Error Types.

New error types like CallerIsNotFungibleModule, EmptyMessage, and others have been added. Ensure these errors are correctly handled in the contract logic.

Verification successful

New Error Types Are Properly Handled in Contract Logic

The newly added error types such as CallerIsNotFungibleModule, EmptyMessage, and others are indeed referenced and handled in the Solidity contract logic. The search results show that these errors are used in various parts of the contract to enforce conditions and revert transactions when necessary.

  • Examples of Error Handling:
    • CallerIsNotFungibleModule is used in several contracts to check the caller's address.
    • InsufficientZRC20Amount and InsufficientZetaAmount are used to validate token amounts.
    • InvalidTarget is used to ensure that the target address is valid.
    • GasFeeTransferFailed and ZRC20TransferFailed are used to handle transfer failures.

These usages indicate that the error types are integrated into the contract logic to manage various failure scenarios effectively.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the handling of new error types in the contract logic.
ast-grep --lang solidity --pattern $'error $_($$$);'

Length of output: 170


Script:

#!/bin/bash
# Search for the usage of the new error types in Solidity files.
rg "CallerIsNotFungibleModule|EmptyMessage|FailedZetaSent|GasFeeTransferFailed|InsufficientZRC20Amount|InsufficientZetaAmount|InvalidTarget|OnlyWZETAOrFungible|WithdrawalFailed|ZRC20BurnFailed|ZRC20DepositFailed|ZRC20TransferFailed" --glob '*.sol' -A 3

Length of output: 25157


31-35: Addition of gasLimit Parameter.

The gasLimit parameter of type uint256 is added to enhance control over transaction execution. Ensure this parameter is correctly utilized in the contract logic.

Verification successful

Correct Utilization of gasLimit Parameter Verified

The gasLimit parameter is utilized in the contract logic, particularly within functions like withdrawAndCall and call in GatewayZEVM.sol. The parameter is involved in calculating gas fees and is tested in various scenarios, confirming its correct usage.

  • v2/src/zevm/GatewayZEVM.sol: Functions withdrawAndCall and call utilize gasLimit.
  • v2/test/GatewayZEVM.t.sol: Tests involving gasLimit.
  • v2/test/ZRC20.t.sol: Additional tests and assertions with gasLimit.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the correct utilization of the `gasLimit` parameter in the contract logic.
ast-grep --lang solidity --pattern $'function $_($_, uint256 gasLimit, $$$) public' 

Length of output: 201


Script:

#!/bin/bash
# Search for the usage of `gasLimit` in Solidity files to verify its utilization in contract logic.
rg 'gasLimit' --glob '*.sol' -A 5

Length of output: 13835


210-230: Addition of RevertContext Tuple.

The RevertContext tuple is introduced for managing asset-related reverts. Verify that this structure is correctly integrated within the contract's error handling mechanisms.

Verification successful

RevertContext Struct Integration Verified

The RevertContext struct is well-integrated into the contract's error handling mechanisms across multiple files. Its usage in contracts, interfaces, and tests confirms its role in managing asset-related reverts.

  • Definition: v2/src/Revert.sol
  • Usage in Contracts: ZetaConnectorNonNative.sol, ZetaConnectorNative.sol, GatewayZEVM.sol, GatewayEVM.sol, etc.
  • Usage in Interfaces: IERC20Custody.sol, IGatewayEVM.sol, IZetaConnector.sol, etc.
  • Test Coverage: Extensive usage in test files such as GatewayZEVM.t.sol, ZetaConnectorNonNative.t.sol, ZetaConnectorNative.t.sol, etc.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the integration of `RevertContext` within the contract's error handling.
ast-grep --lang solidity --pattern $'struct RevertContext { address asset; uint64 amount; bytes revertMessage; }'

Length of output: 231


Script:

#!/bin/bash
# Search for the definition of the `RevertContext` struct in Solidity files.
rg 'struct RevertContext' --type solidity

# Search for the usage of `RevertContext` in Solidity files to verify its integration in error handling.
rg 'RevertContext' --type solidity

Length of output: 144


Script:

#!/bin/bash
# Search for the definition of the `RevertContext` struct in Solidity files with .sol extension.
rg 'struct RevertContext' --glob '*.sol'

# Search for the usage of `RevertContext` in Solidity files with .sol extension to verify its integration in error handling.
rg 'RevertContext' --glob '*.sol'

Length of output: 4440


450-485: Modification of withdrawAndCall Function.

The withdrawAndCall function now includes RevertOptions, enhancing its error handling capabilities. Ensure this change is correctly reflected in the contract logic.

Verification successful

Modification of withdrawAndCall Function Verified

The withdrawAndCall function in both GatewayZEVM.sol and its interface in IGatewayZEVM.sol includes RevertOptions, confirming the enhancement for improved error handling. This change is correctly reflected in the contract logic.

  • Files:
    • v2/src/zevm/GatewayZEVM.sol
    • v2/src/zevm/interfaces/IGatewayZEVM.sol
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the implementation of `RevertOptions` in the `withdrawAndCall` function.
ast-grep --lang solidity --pattern $'function withdrawAndCall($_, $_, $_, $_, RevertOptions memory revertOptions) public'

Length of output: 239


Script:

#!/bin/bash
# Search for the `withdrawAndCall` function in Solidity files to verify the inclusion of `RevertOptions`.
rg 'function withdrawAndCall' --type solidity -A 10

Length of output: 86


Script:

#!/bin/bash
# Search for the `withdrawAndCall` function in `.sol` files to verify the inclusion of `RevertOptions`.
rg 'function withdrawAndCall' --glob '*.sol' -A 10

Length of output: 6989


354-380: Enhancement of withdraw Function with RevertOptions.

The withdraw function now includes RevertOptions, providing more flexibility in handling reverts. Ensure that this addition is correctly implemented in the contract logic.


37-61: Introduction of RevertOptions Tuple.

The RevertOptions tuple adds fields for handling revert scenarios. Ensure that the contract logic properly implements these options to handle errors effectively.

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

35-35: Review the Updated Bin Field.

The Bin field has been updated, indicating changes to the contract's bytecode. Ensure that this update aligns with the intended contract logic and ABI.

v2/types/GatewayZEVM.ts (5)

689-689: Replace void with undefined in TypeScript Function Signatures.

The use of void outside a return type or type parameter can be confusing. Replace it with undefined for clarity.

- [void],
+ [undefined],

Also applies to: 700-700, 712-712

Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


26-31: Verify New RevertOptionsStruct Type.

The RevertOptionsStruct type is introduced for handling revert scenarios. Ensure that this type is consistently used across the interface.

Verification successful

RevertOptionsStruct Usage Verified

The RevertOptionsStruct type is consistently used across the relevant interfaces and modules, indicating it is well-integrated for handling revert scenarios. No issues found with its implementation.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the usage of `RevertOptionsStruct` across the interface.
rg --type ts 'RevertOptionsStruct'

Length of output: 25848


104-112: Verify Event Name Changes.

The event names have been updated to Called and Withdrawn. Ensure these changes are consistently applied across the codebase.

Verification successful

Event Name Changes Verified

The event names "Called" and "Withdrawn" have been consistently updated across the codebase. The changes are reflected in event declarations, handlers, and tests. No inconsistencies were found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the usage of updated event names across the codebase.
rg --type ts 'Called|Withdrawn'

Length of output: 87311


58-60: Verify Modified RevertContextStruct Type.

The RevertContextStruct type has been modified. Ensure that the changes align with the contract's logic and are consistently applied.


95-98: Ensure Correctness of Modified Function Signatures.

The function signatures have been modified to include RevertOptionsStruct. Verify that these changes are correctly implemented.

Verification successful

Function Signatures Correctly Modified to Include RevertOptionsStruct.

The function signatures have been successfully updated to include RevertOptionsStruct and are correctly implemented in the codebase. These changes are reflected in the method handling functions such as encodeFunctionData and decodeFunctionResult.

  • Confirmed in v2/types/GatewayZEVM.ts and related files.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the implementation of modified function signatures with `RevertOptionsStruct`.
rg --type ts 'RevertOptionsStruct'

Length of output: 25848


Script:

#!/bin/bash
# Search for function definitions and usages related to the modified function signatures in GatewayZEVM.ts
rg --type ts 'withdraw\(bytes,uint256,address,\(address,bool,address,bytes\)\)' -A 5
rg --type ts 'withdraw\(bytes,uint256,uint256,\(address,bool,address,bytes\)\)' -A 5
rg --type ts 'withdrawAndCall\(bytes,uint256,uint256,bytes,\(address,bool,address,bytes\)\)' -A 5
rg --type ts 'withdrawAndCall\(bytes,uint256,address,bytes,uint256,\(address,bool,address,bytes\)\)' -A 5

Length of output: 38247

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

Line range hint 1-1:
Verify coverage of zero amount and zero address scenarios.

The removal of tests related to zero amounts and zero addresses aligns with the PR objectives. However, ensure that other tests adequately cover scenarios where zero values might impact functionality.

Verification successful

Zero Amount and Zero Address Scenarios Are Well Covered

The test suite includes numerous test cases that handle scenarios involving zero amounts and zero addresses. These tests ensure that the system correctly handles such edge cases by expecting reverts with appropriate error selectors.

  • Zero Address Scenarios:

    • testWithdrawZRC20FailsIfReceiverIsZeroAddress
    • testWithdrawAndCallZRC20FailsIfReceiverIsZeroAddress
    • testWithdrawZETAFailsIfReceiverIsZeroAddress
    • testCallFailsIfReceiverIsZeroAddress
    • testDepositFailsIfZRC20IsZeroAddress
    • testDepositFailsIfTargetIsZeroAddress
    • testExecuteFailsIfZRC20IsZeroAddress
    • testExecuteFailsIfTargetIsZeroAddress
    • testWhitelistFailsIfZeroAddress
    • testUnwhitelistFailsIfZeroAddress
  • Zero Amount Scenarios:

    • testWithdrawAndCallZRC20FailsIfAmountIsZero
    • testWithdrawZETAFailsIfAmountIsZero
    • testWithdrawAndCallZETAFailsIfAmountIsZero
    • testDepositZRC20AndCallUniversalContractFailsIfAmountIsZero
    • testDepositAndRevertZRC20AndCallUniversalContractFailsIfAmountIsZero

These tests provide comprehensive coverage for zero-related edge cases, ensuring the system's robustness against such inputs.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if there are existing tests that cover zero amount and zero address scenarios.

# Test: Search for test functions related to zero amount and zero address. Expect: Relevant test functions are present.
rg --type solidity -A 5 'function test.*Zero'

Length of output: 80


Script:

#!/bin/bash
# Description: Find Solidity test files and search for test functions related to zero amount and zero address.

# Find all Solidity test files
fd --extension sol --exec rg -A 5 'function test.*Zero' {}

Length of output: 122068

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

663-681: Verify ExecuteRevert function consistency.

The ExecuteRevert function has been added in three variations. Ensure that the function signatures are consistent and correctly implemented across all variations.

Verification successful

ExecuteRevert function signatures are consistent.

The ExecuteRevert function signatures are consistent across the GatewayZEVMTransactor, GatewayZEVMSession, and GatewayZEVMTransactorSession variations. The parameters and return types match as expected. No issues were found in the implementation.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of `ExecuteRevert` function signatures.

# Test: Search for all `ExecuteRevert` function signatures.
# Expect: All signatures should match across Transactor, Session, and TransactorSession.
rg --type go 'func \(_GatewayZEVM \*GatewayZEVM(Transactor|Session|TransactorSession)\) ExecuteRevert'

Length of output: 829


56-57: Verify ABI and Bin consistency.

The ABI and Bin metadata have been updated. Ensure that the ABI changes accurately reflect the contract's intended functionality and that the Bin corresponds to the compiled contract code.


621-639: Verify DepositAndRevert function consistency.

The DepositAndRevert function has been added in three variations. Ensure that the function signatures are consistent and correctly implemented across all variations.

Verification successful

Function signatures are consistent across variations.

The DepositAndRevert function signatures are correctly implemented and consistent across the GatewayZEVMTransactor, GatewayZEVMSession, and GatewayZEVMTransactorSession variations. Each variation appropriately handles parameters and return types as expected.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of `DepositAndRevert` function signatures.

# Test: Search for all `DepositAndRevert` function signatures.
# Expect: All signatures should match across Transactor, Session, and TransactorSession.
rg --type go 'func \(_GatewayZEVM \*GatewayZEVM(Transactor|Session|TransactorSession)\) DepositAndRevert'

Length of output: 841


Line range hint 741-759:
Verify WithdrawAndCall0 function consistency.

The WithdrawAndCall0 function has been added in three variations. Ensure that the function signatures are consistent and correctly implemented across all variations.

Verification successful

WithdrawAndCall0 function signatures are consistent across variations.

The WithdrawAndCall0 function is implemented consistently across the GatewayZEVMTransactor, GatewayZEVMSession, and GatewayZEVMTransactorSession variations. The inclusion of opts *bind.TransactOpts in the GatewayZEVMTransactor version is appropriate and aligns with typical design patterns. No issues found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of `WithdrawAndCall0` function signatures.

# Test: Search for all `WithdrawAndCall0` function signatures.
# Expect: All signatures should match across Transactor, Session, and TransactorSession.
rg --type go 'func \(_GatewayZEVM \*GatewayZEVM(Transactor|Session|TransactorSession)\) WithdrawAndCall0'

Length of output: 880

message: BytesLike
chainId: BigNumberish,
message: 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.

Address the use of void type.

The use of void outside of return types or type parameters can be confusing. Consider using undefined instead for better clarity.

- [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] 418-418: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

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 the use of void type.

The use of void outside of return types or type parameters can be confusing. Consider using undefined instead for better clarity.

- [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] 395-395: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

zrc20: AddressLike,
amount: BigNumberish,
target: AddressLike,
message: BytesLike
message: BytesLike,
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.

Address the use of void type.

The use of void outside of return types or type parameters can be confusing. Consider using undefined instead for better clarity.

- [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] 520-520: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

zrc20: AddressLike,
amount: BigNumberish,
target: AddressLike,
message: BytesLike
message: BytesLike,
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.

Address the use of void type.

The use of void outside of return types or type parameters can be confusing. Consider using undefined instead for better clarity.

- [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] 384-384: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

amount: BigNumberish,
chainId: BigNumberish,
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 the use of void type.

The use of void outside of return types or type parameters can be confusing. Consider using undefined instead for better clarity.

- [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] 544-544: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

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 the use of void type.

The use of void outside of return types or type parameters can be confusing. Consider using undefined instead for better clarity.

- [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] 532-532: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

amount: BigNumberish,
chainId: BigNumberish,
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 the use of void type.

The use of void outside of return types or type parameters can be confusing. Consider using undefined instead for better clarity.

- [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] 406-406: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

@skosito skosito linked an issue Aug 13, 2024 that may be closed by this pull request
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/types/ERC20CustodyEchidnaTest.ts (1)

Line range hint 513-535:
Replace void with undefined in method signatures.

Using void outside return types or type parameters can be confusing. Replace it with undefined for clarity.

-  TypedContractMethod<[to: AddressLike, token: AddressLike, amount: BigNumberish], [void], "nonpayable">
+  TypedContractMethod<[to: AddressLike, token: AddressLike, amount: BigNumberish], [undefined], "nonpayable">

Apply similar changes to other relevant method signatures.

Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2ddb701 and 2d79414.

Files selected for processing (15)
  • v2/pkg/erc20custody.sol/erc20custody.go (11 hunks)
  • v2/pkg/gatewayevm.sol/gatewayevm.go (1 hunks)
  • v2/pkg/gatewayevmupgradetest.sol/gatewayevmupgradetest.go (1 hunks)
  • v2/pkg/ierc20custody.sol/ierc20custody.go (11 hunks)
  • v2/pkg/ierc20custody.sol/ierc20custodyevents.go (11 hunks)
  • v2/src/evm/interfaces/IERC20Custody.sol (1 hunks)
  • v2/types/ERC20Custody.ts (19 hunks)
  • v2/types/ERC20CustodyEchidnaTest.ts (19 hunks)
  • v2/types/IERC20Custody.sol/IERC20Custody.ts (1 hunks)
  • v2/types/IERC20Custody.sol/IERC20CustodyEvents.ts (4 hunks)
  • v2/types/factories/ERC20Custody__factory.ts (11 hunks)
  • v2/types/factories/GatewayEVMUpgradeTest__factory.ts (17 hunks)
  • v2/types/factories/GatewayEVM__factory.ts (14 hunks)
  • v2/types/factories/IERC20Custody.sol/IERC20CustodyEvents__factory.ts (4 hunks)
  • v2/types/factories/IERC20Custody.sol/IERC20Custody__factory.ts (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • v2/types/factories/ERC20Custody__factory.ts
  • v2/types/factories/GatewayEVMUpgradeTest__factory.ts
  • v2/types/factories/GatewayEVM__factory.ts
Additional context used
Biome
v2/types/factories/IERC20Custody.sol/IERC20Custody__factory.ts

[error] 280-291: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)

v2/types/IERC20Custody.sol/IERC20Custody.ts

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/types/ERC20Custody.ts

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/types/ERC20CustodyEchidnaTest.ts

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

Additional comments not posted (61)
v2/types/factories/IERC20Custody.sol/IERC20CustodyEvents__factory.ts (4)

14-24: Renaming and parameter addition for clarity.

The event Withdraw has been renamed to Unwhitelisted, and a token parameter has been added. This change appears to align with the intended functionality of reflecting token unwhitelisting actions.


25-37: New event for token whitelisting.

The introduction of the Whitelisted event with a token parameter provides functionality for tracking token whitelisting actions.


Line range hint 65-95:
Renaming for semantic clarity.

The event WithdrawAndCall has been renamed to WithdrawnAndCalled, improving the clarity of its purpose.


Line range hint 96-144:
Enhanced detail for reversion scenarios.

The event WithdrawAndRevert has been renamed to WithdrawnAndReverted, with a revertContext parameter added. These changes provide more context and detail for reversion scenarios.

v2/src/evm/interfaces/IERC20Custody.sol (3)

13-13: Reordered parameters for logical consistency.

The Withdrawn event's parameters have been reordered, placing to before token. This change aligns with the logical sequence of withdrawal actions.


20-20: Consistent parameter reordering.

The WithdrawnAndCalled event's parameters have been reordered to place to before token, ensuring consistency with the withdrawal logic.


29-29: Maintained consistency in parameter order.

The WithdrawnAndReverted event's parameters have been reordered, placing to before token, maintaining consistency across the interface.

v2/types/IERC20Custody.sol/IERC20CustodyEvents.ts (8)

24-34: Addition of RevertContextStruct is well-defined.

The RevertContextStruct and its output type are appropriately structured to encapsulate revert details. This addition enhances clarity in handling revert scenarios.


47-57: UnwhitelistedEvent namespace is correctly structured.

The UnwhitelistedEvent namespace is well-defined and aligns with the intended functionality for handling unwhitelisting events.


59-69: WhitelistedEvent namespace is correctly structured.

The WhitelistedEvent namespace is well-defined and aligns with the intended functionality for handling whitelisting events.


Line range hint 71-87: WithdrawnEvent namespace is correctly structured.

The WithdrawnEvent namespace is well-defined and aligns with the updated naming conventions and functionality for handling withdrawal events.


Line range hint 89-111: WithdrawnAndCalledEvent namespace is correctly structured.

The WithdrawnAndCalledEvent namespace is well-defined and aligns with the updated naming conventions and functionality for handling withdrawal events with additional calls.


114-136: WithdrawnAndRevertedEvent namespace is correctly structured.

The WithdrawnAndRevertedEvent namespace is well-defined and effectively incorporates the RevertContextStruct to handle reverts in withdrawal events.


190-222: getEvent method updates are consistent.

The getEvent method correctly reflects the renamed events, ensuring accurate retrieval of event fragments.


226-278: filters section updates are consistent.

The filters section correctly reflects the renamed events, ensuring accurate event filtering.

v2/types/IERC20Custody.sol/IERC20Custody.ts (9)

26-36: Addition of RevertContextStruct is well-defined.

The RevertContextStruct and its output type are appropriately structured to encapsulate revert details, aligning with the changes in event handling.


38-92: IERC20CustodyInterface is correctly structured.

The interface reflects the new functionalities for withdrawal and whitelisting, aligning with the contract's intended operations.


94-104: UnwhitelistedEvent namespace is correctly structured.

The UnwhitelistedEvent namespace is well-defined and aligns with the intended functionality for handling unwhitelisting events.


106-116: WhitelistedEvent namespace is correctly structured.

The WhitelistedEvent namespace is well-defined and aligns with the intended functionality for handling whitelisting events.


118-134: WithdrawnEvent namespace is correctly structured.

The WithdrawnEvent namespace is well-defined and aligns with the updated naming conventions and functionality for handling withdrawal events.


136-158: WithdrawnAndCalledEvent namespace is correctly structured.

The WithdrawnAndCalledEvent namespace is well-defined and aligns with the updated naming conventions and functionality for handling withdrawal events with additional calls.


161-183: WithdrawnAndRevertedEvent namespace is correctly structured.

The WithdrawnAndRevertedEvent namespace is well-defined and effectively incorporates the RevertContextStruct to handle reverts in withdrawal events.


303-337: getEvent method updates are consistent.

The getEvent method correctly reflects the renamed events, ensuring accurate retrieval of event fragments.


339-393: filters section updates are consistent.

The filters section correctly reflects the renamed events, ensuring accurate event filtering.

v2/types/ERC20Custody.ts (9)

26-36: Addition of RevertContextStruct is well-defined.

The RevertContextStruct and its output type are appropriately structured to encapsulate revert details, aligning with the changes in event handling.


Line range hint 37-301: ERC20CustodyInterface is correctly structured.

The interface reflects the new functionalities for withdrawal, whitelisting, and role management, aligning with the contract's intended operations.


289-299: UnwhitelistedEvent namespace is correctly structured.

The UnwhitelistedEvent namespace is well-defined and aligns with the intended functionality for handling unwhitelisting events.


301-311: WhitelistedEvent namespace is correctly structured.

The WhitelistedEvent namespace is well-defined and aligns with the intended functionality for handling whitelisting events.


Line range hint 313-329: WithdrawnEvent namespace is correctly structured.

The WithdrawnEvent namespace is well-defined and aligns with the updated naming conventions and functionality for handling withdrawal events.


Line range hint 331-353: WithdrawnAndCalledEvent namespace is correctly structured.

The WithdrawnAndCalledEvent namespace is well-defined and aligns with the updated naming conventions and functionality for handling withdrawal events with additional calls.


356-378: WithdrawnAndRevertedEvent namespace is correctly structured.

The WithdrawnAndRevertedEvent namespace is well-defined and effectively incorporates the RevertContextStruct to handle reverts in withdrawal events.


650-682: getEvent method updates are consistent.

The getEvent method correctly reflects the renamed events, ensuring accurate retrieval of event fragments.


741-793: filters section updates are consistent.

The filters section correctly reflects the renamed events, ensuring accurate event filtering.

v2/types/ERC20CustodyEchidnaTest.ts (3)

26-36: Well-defined types for revert contexts.

The addition of RevertContextStruct and RevertContextStructOutput enhances the handling of revert scenarios by encapsulating necessary details.


310-332: Well-structured event declarations.

The event declarations for UnwhitelistedEvent, WhitelistedEvent, WithdrawnEvent, WithdrawnAndCalledEvent, and WithdrawnAndRevertedEvent are well-structured and enhance event tracking.

Also applies to: 334-397


134-144: Replace void with undefined in method signatures.

Using void outside return types or type parameters can be confusing. Replace it with undefined for clarity.

-  TypedContractMethod<[token: AddressLike], [void], "nonpayable">
+  TypedContractMethod<[token: AddressLike], [undefined], "nonpayable">

Apply similar changes to other relevant method signatures.

Likely invalid or redundant comment.

v2/pkg/ierc20custody.sol/ierc20custodyevents.go (3)

41-41: Consistent parameter reordering for Withdrawn event.

The reordering of parameters in the Withdrawn event and related functions improves readability and maintains consistency.

Also applies to: 556-567


710-722: Consistent parameter reordering for WithdrawnAndCalled event.

The reordering of parameters in the WithdrawnAndCalled event and related functions improves readability and maintains consistency.


866-878: Consistent parameter reordering for WithdrawnAndReverted event.

The reordering of parameters in the WithdrawnAndReverted event and related functions improves readability and maintains consistency.

v2/pkg/ierc20custody.sol/ierc20custody.go (9)

650-659: LGTM: Parameter order change in FilterWithdrawn.

The parameter order change from token, to to to, token aligns with the updated event signature and enhances consistency.


671-680: LGTM: Parameter order change in WatchWithdrawn.

The parameter order change from token, to to to, token aligns with the updated event signature and enhances consistency.


805-814: LGTM: Parameter order change in FilterWithdrawnAndCalled.

The parameter order change from token, to to to, token aligns with the updated event signature and enhances consistency.


826-835: LGTM: Parameter order change in WatchWithdrawnAndCalled.

The parameter order change from token, to to to, token aligns with the updated event signature and enhances consistency.


961-970: LGTM: Parameter order change in FilterWithdrawnAndReverted.

The parameter order change from token, to to to, token aligns with the updated event signature and enhances consistency.


982-991: LGTM: Parameter order change in WatchWithdrawnAndReverted.

The parameter order change from token, to to to, token aligns with the updated event signature and enhances consistency.


642-645: LGTM: Field order change in IERC20CustodyWithdrawn.

The field order change from Token, To to To, Token aligns with the updated event signature and enhances consistency.


796-800: LGTM: Field order change in IERC20CustodyWithdrawnAndCalled.

The field order change from Token, To to To, Token aligns with the updated event signature and enhances consistency.


Line range hint 951-957:
LGTM: Field order change in IERC20CustodyWithdrawnAndReverted.

The field order change from Token, To to To, Token aligns with the updated event signature and enhances consistency.

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

1844-1844: Reordering of fields in ERC20CustodyWithdrawn struct is correct.

The Token field has been moved after the To field to match the updated ABI. This change ensures consistency between the event definition and its Go binding.


1852-1863: Parameter reordering in FilterWithdrawn function is correct.

The function now accepts to before token, aligning with the updated ABI. This ensures that the filtering logic matches the new event parameter order.


1873-1884: Parameter reordering in WatchWithdrawn function is correct.

The function now accepts to before token, aligning with the updated ABI. This ensures that the watch logic matches the new event parameter order.


1998-1998: Reordering of fields in ERC20CustodyWithdrawnAndCalled struct is correct.

The Token field has been moved after the To field to match the updated ABI. This change ensures consistency between the event definition and its Go binding.


2007-2018: Parameter reordering in FilterWithdrawnAndCalled function is correct.

The function now accepts to before token, aligning with the updated ABI. This ensures that the filtering logic matches the new event parameter order.


2028-2039: Parameter reordering in WatchWithdrawnAndCalled function is correct.

The function now accepts to before token, aligning with the updated ABI. This ensures that the watch logic matches the new event parameter order.


2153-2153: Reordering of fields in ERC20CustodyWithdrawnAndReverted struct is correct.

The Token field has been moved after the To field to match the updated ABI. This change ensures consistency between the event definition and its Go binding.


2163-2174: Parameter reordering in FilterWithdrawnAndReverted function is correct.

The function now accepts to before token, aligning with the updated ABI. This ensures that the filtering logic matches the new event parameter order.

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

50-50: Verify ABI structure changes.

The GatewayEVMMetaData structure has been updated with new and modified ABI functions and events. Ensure that the changes align with the intended functionality and that all new functions and events are correctly defined.

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

50-50: Verify ABI consistency with Solidity contract.

The ABI string has been extensively updated. Ensure these changes align with the Solidity contract and intended functionality.


50-50: Check function signature correctness.

The deposit function now has two variants: one payable and one nonpayable. Ensure these changes are correctly implemented and align with the contract's intended functionality.


50-50: Verify error handling comprehensiveness.

New error definitions have been added. Ensure these definitions are comprehensive and align with the contract's error handling strategy.


50-50: Ensure event definitions are comprehensive.

New events like ExecutedWithERC20 and modifications to Reverted have been introduced. Ensure these events provide sufficient information for external applications to respond appropriately.

Verification successful

Event Definitions Verified

The ExecutedWithERC20 and Reverted events are defined correctly in the Solidity contract. They match the expected structure and include the necessary indexed and non-indexed parameters to provide sufficient information for external applications.

  • ExecutedWithERC20: Located in v2/src/evm/interfaces/IGatewayEVM.sol at line 28.
  • Reverted: Located in v2/src/evm/interfaces/IGatewayEVM.sol at line 21.

These definitions ensure that the events are comprehensive and informative.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify event definitions in the Solidity contract.

# Test: Ensure the event definitions are comprehensive and match the Go bindings.
# Expect: No discrepancies between the Go bindings and the Solidity contract.
solc --abi v2/pkg/gatewayevmupgradetest.sol/gatewayevmupgradetest.sol -o build/
grep -E '"name":"ExecutedWithERC20","inputs":\[\{"name":"token","type":"address","indexed":true,"internalType":"address"\},\{"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' build/GatewayEVMUpgradeTest.abi
grep -E '"name":"Reverted","inputs":\[\{"name":"to","type":"address","indexed":true,"internalType":"address"\},\{"name":"token","type":"address","indexed":true,"internalType":"address"\},\{"name":"amount","type":"uint256","indexed":false,"internalType":"uint256"\},\{"name":"data","type":"bytes","indexed":false,"internalType":"bytes"\},\{"name":"revertContext","type":"tuple","indexed":false,"internalType":"structRevertContext","components":\[\{"name":"asset","type":"address","internalType":"address"\},\{"name":"amount","type":"uint64","internalType":"uint64"\},\{"name":"revertMessage","type":"bytes","internalType":"bytes"\}\]\}\],"anonymous":false' build/GatewayEVMUpgradeTest.abi

Length of output: 1374


Script:

#!/bin/bash
# Description: Use ast-grep to find event definitions in the Solidity contract.

# Search for the `ExecutedWithERC20` event definition in the Solidity file.
ast-grep --lang solidity --pattern 'event ExecutedWithERC20(address indexed $_, address indexed $_, uint256 $_, bytes $_);'

# Search for the `Reverted` event definition in the Solidity file.
ast-grep --lang solidity --pattern 'event Reverted(address indexed $_, address indexed $_, uint256 $_, bytes $_, $_);'

Length of output: 480


Script:

#!/bin/bash
# Description: Use rg to find event definitions in the Solidity contract.

# Search for the `ExecutedWithERC20` event definition in the Solidity file.
rg 'event ExecutedWithERC20\(address indexed .*, address indexed .*, uint256 .*, bytes .*\);' --vimgrep

# Search for the `Reverted` event definition in the Solidity file.
rg 'event Reverted\(address indexed .*, address indexed .*, uint256 .*, bytes .*, .*\);' --vimgrep

Length of output: 512

Comment on lines +280 to +291
export class IERC20Custody__factory {
static readonly abi = _abi;
static createInterface(): IERC20CustodyInterface {
return new Interface(_abi) as IERC20CustodyInterface;
}
static connect(
address: string,
runner?: ContractRunner | null
): IERC20Custody {
return new Contract(address, _abi, runner) as unknown as IERC20Custody;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor class with only static members.

The IERC20Custody__factory class contains only static members, which is generally discouraged. Consider refactoring to use simple functions instead.

export const IERC20Custody__factory = {
  abi: _abi,
  createInterface(): IERC20CustodyInterface {
    return new Interface(_abi) as IERC20CustodyInterface;
  },
  connect(address: string, runner?: ContractRunner | null): IERC20Custody {
    return new Contract(address, _abi, runner) as unknown as IERC20Custody;
  },
};
Tools
Biome

[error] 280-291: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)


withdraw: TypedContractMethod<
[token: AddressLike, to: AddressLike, amount: BigNumberish],
[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 in method signatures.

Using void outside of return types can be confusing. Consider replacing it with undefined for clarity.

- [void],
+ [undefined],

Also applies to: 247-247, 259-259, 274-274, 286-286, 299-299

Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

@@ -390,16 +472,22 @@ export interface ERC20Custody extends BaseContract {

unpause: TypedContractMethod<[], [void], "nonpayable">;

unwhitelist: TypedContractMethod<[token: AddressLike], [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.

Replace void with undefined in method signatures.

Using void outside of return types can be confusing. Consider replacing it with undefined for clarity.

- [void],
+ [undefined],

Also applies to: 477-477, 483-483, 574-574, 577-577, 585-585

Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

@skosito skosito changed the title fix: remove amount check in zevm execute fix: various fixes Aug 13, 2024
@skosito skosito linked an issue Aug 13, 2024 that may be closed by this pull request
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 2d79414 and 34ec678.

Files selected for processing (14)
  • v2/pkg/igatewayzevm.sol/igatewayzevm.go (9 hunks)
  • v2/pkg/igatewayzevm.sol/igatewayzevmevents.go (7 hunks)
  • v2/pkg/senderzevm.sol/senderzevm.go (1 hunks)
  • v2/src/zevm/GatewayZEVM.sol (8 hunks)
  • v2/src/zevm/interfaces/IGatewayZEVM.sol (5 hunks)
  • v2/test/GatewayEVMZEVM.t.sol (2 hunks)
  • v2/test/GatewayZEVM.t.sol (8 hunks)
  • v2/types/GatewayZEVM.ts (23 hunks)
  • v2/types/IGatewayZEVM.sol/IGatewayZEVM.ts (13 hunks)
  • v2/types/IGatewayZEVM.sol/IGatewayZEVMEvents.ts (5 hunks)
  • v2/types/factories/GatewayZEVM__factory.ts (18 hunks)
  • v2/types/factories/IGatewayZEVM.sol/IGatewayZEVMEvents__factory.ts (4 hunks)
  • v2/types/factories/IGatewayZEVM.sol/IGatewayZEVM__factory.ts (10 hunks)
  • v2/types/factories/SenderZEVM__factory.ts (4 hunks)
Files skipped from review as they are similar to previous changes (7)
  • v2/pkg/senderzevm.sol/senderzevm.go
  • v2/src/zevm/interfaces/IGatewayZEVM.sol
  • v2/test/GatewayZEVM.t.sol
  • v2/types/IGatewayZEVM.sol/IGatewayZEVMEvents.ts
  • v2/types/factories/GatewayZEVM__factory.ts
  • v2/types/factories/IGatewayZEVM.sol/IGatewayZEVMEvents__factory.ts
  • v2/types/factories/SenderZEVM__factory.ts
Additional context used
Biome
v2/types/IGatewayZEVM.sol/IGatewayZEVM.ts

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 412-412: 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] 526-526: void is confusing outside a return type or a type parameter.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/types/GatewayZEVM.ts

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

Additional comments not posted (27)
v2/test/GatewayEVMZEVM.t.sol (2)

197-197: Ensure consistency of additional parameter in Withdrawn event.

Verify that the additional parameter in the Withdrawn event is consistently applied across all relevant test cases.


137-137: Verify consistency of additional parameter in tests.

Ensure that the additional integer parameter added to the Called event and gatewayZEVM.call function is consistently applied across all related test cases.

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

146-155: Ensure consistency of additional gas limit parameter in Withdrawn event.

Verify that the additional gas limit parameter in the Withdrawn event is consistently applied across all relevant functions.


183-192: Verify removal of zero amount check in withdrawAndCall.

The removal of the zero amount check allows for zero amount operations, which could introduce unintended behavior or vulnerabilities. Ensure that this change aligns with the intended functionality.


266-266: Ensure consistency of additional gas limit parameter in Called event.

Verify that the additional gas limit parameter in the Called event is consistently applied across all relevant functions.

v2/types/IGatewayZEVM.sol/IGatewayZEVM.ts (3)

390-390: Acknowledge existing comments on void type usage.

The existing comments regarding the use of void type are valid. Consider replacing void with undefined for clarity.

Also applies to: 401-401, 412-412, 424-424, 526-526, 538-538, 550-550

Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


26-31: Verify consistent usage of RevertOptionsStruct.

Ensure that the RevertOptionsStruct is consistently used across all relevant function signatures and logic handling revert scenarios.


79-82: Ensure consistency of function signatures with RevertOptionsStruct.

Verify that all relevant function signatures are updated to include RevertOptionsStruct.

Verification successful

Function signatures consistently updated with RevertOptionsStruct.

The function signatures across multiple TypeScript files have been updated to include RevertOptionsStruct, ensuring consistent handling of revert scenarios. The update appears to be applied comprehensively.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistency of function signatures with `RevertOptionsStruct`.

# Test: Search for function signatures using `RevertOptionsStruct`.
rg --type typescript -A 5 'RevertOptionsStruct'

Length of output: 82


Script:

#!/bin/bash
# Description: Verify consistency of function signatures with `RevertOptionsStruct`.

# Test: Search for function signatures using `RevertOptionsStruct` in TypeScript files.
rg 'RevertOptionsStruct' --glob '*.ts' -A 5

Length of output: 118868

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

22-62: Enhanced ABI for call function.

The addition of zrc20, gasLimit, and revertOptions parameters improves control over transactions and error handling.


209-230: Improved error handling in depositAndRevert function.

The inclusion of revertContext enhances the ability to manage revert scenarios effectively.


354-380: Enhanced flexibility in withdraw function.

The addition of revertOptions allows for more nuanced handling of errors during withdrawals.


494-545: Improved robustness in withdrawAndCall function.

The inclusion of zrc20, gasLimit, and revertOptions parameters enhances the function's ability to manage complex transactions.


551-703: Enhanced event tracking for Called and Withdrawn.

The addition of gasLimit and revertOptions parameters provides more context and improves error reporting.

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

42-42: Enhanced ABI for event handling.

The inclusion of gasLimit in the ABI for Called and Withdrawn events provides more detailed information.


264-264: Added GasLimit to IGatewayZEVMEventsCalled.

The inclusion of GasLimit provides additional context for the Called event.


269-271: Updated FilterCalled function signature.

The inclusion of gasLimit ensures compatibility with the updated Called event structure.


425-425: Added GasLimit to IGatewayZEVMEventsWithdrawn.

The inclusion of GasLimit provides additional context for the Withdrawn event.

v2/types/GatewayZEVM.ts (5)

26-31: Added RevertOptionsStruct type.

This new type provides structured handling of revert scenarios, enhancing the contract's functionality.


58-60: Updated RevertContextStruct type.

The changes focus on asset management during reverts, aligning with the contract's objectives.


95-98: Enhanced withdraw and withdrawAndCall functions.

The inclusion of RevertOptionsStruct improves the handling of revert scenarios.


328-351: Updated event namespaces for Called and Withdrawn.

The inclusion of RevertOptionsStruct in events enhances clarity and provides more detailed data.

Also applies to: 465-500


560-566: Enhanced call method with RevertOptionsStruct.

The inclusion of RevertOptionsStruct allows for more nuanced handling of revert scenarios.

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

292-293: LGTM: Simplified function signature.

The removal of the context parameter simplifies the function signature, aligning with the PR's objectives to streamline the interface.


299-300: LGTM: Simplified function signature.

The removal of the context parameter simplifies the function signature, aligning with the PR's objectives to streamline the interface.


306-307: LGTM: Simplified function signature.

The removal of the context parameter simplifies the function signature, aligning with the PR's objectives to streamline the interface.


334-335: LGTM: Simplified function signature.

The removal of the context parameter simplifies the function signature, aligning with the PR's objectives to streamline the interface.


341-342: LGTM: Simplified function signature.

The removal of the context parameter simplifies the function signature, aligning with the PR's objectives to streamline the interface.

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.

Replace void with undefined in TypeScript function signatures.

The use of void outside a return type or type parameter can be confusing. Replace it with undefined for clarity.

- [void],
+ [undefined],

Also applies to: 706-706, 718-718

Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

@skosito skosito linked an issue Aug 13, 2024 that may be closed by this pull request
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 34ec678 and bc9246d.

Files selected for processing (10)
  • v2/pkg/igatewayzevm.sol/igatewayzevm.go (9 hunks)
  • v2/pkg/senderzevm.sol/senderzevm.go (1 hunks)
  • v2/src/zevm/GatewayZEVM.sol (7 hunks)
  • v2/src/zevm/interfaces/IGatewayZEVM.sol (4 hunks)
  • v2/test/GatewayZEVM.t.sol (8 hunks)
  • v2/types/GatewayZEVM.ts (22 hunks)
  • v2/types/IGatewayZEVM.sol/IGatewayZEVM.ts (12 hunks)
  • v2/types/factories/GatewayZEVM__factory.ts (17 hunks)
  • v2/types/factories/IGatewayZEVM.sol/IGatewayZEVM__factory.ts (7 hunks)
  • v2/types/factories/SenderZEVM__factory.ts (4 hunks)
Files skipped from review as they are similar to previous changes (5)
  • v2/pkg/igatewayzevm.sol/igatewayzevm.go
  • v2/src/zevm/interfaces/IGatewayZEVM.sol
  • v2/test/GatewayZEVM.t.sol
  • v2/types/factories/GatewayZEVM__factory.ts
  • v2/types/factories/SenderZEVM__factory.ts
Additional context used
Biome
v2/types/IGatewayZEVM.sol/IGatewayZEVM.ts

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

v2/types/GatewayZEVM.ts

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

Additional comments not posted (46)
v2/src/zevm/GatewayZEVM.sol (7)

146-155: Enhance event transparency with new parameters.

The addition of gas limit and protocol flat fee parameters to the Withdrawn event enhances the transparency and traceability of transactions. This change aligns with best practices for event logging.


183-192: Enhance event transparency with new parameters.

The addition of gas limit and protocol flat fee parameters to the Withdrawn event in withdrawAndCall enhances the transparency and traceability of transactions. This change aligns with best practices for event logging.


214-214: Enhance event transparency with new parameters.

The Withdrawn event in the withdraw function now includes a chain ID and protocol flat fee, which improves transparency and traceability.


238-238: Enhance event transparency with new parameters.

The Withdrawn event in withdrawAndCall now includes a chain ID and protocol flat fee, improving transparency and traceability.


266-266: Enhance event transparency with new parameters.

The Called event now includes a gas limit and revert options, which improves transparency and traceability of contract calls.


355-356: Simplify executeRevert function signature.

The simplification of the executeRevert function signature by removing the revertContext parameter reduces complexity and aligns with the objective of streamlining operations.


355-356: Verify the impact of removing zero-amount checks.

The removal of zero-amount checks in the execute and depositAndCall functions may have security or operational implications. Ensure that these changes do not introduce vulnerabilities or unintended behaviors.

v2/types/IGatewayZEVM.sol/IGatewayZEVM.ts (13)

26-31: Add RevertOptionsStruct for enhanced revert handling.

The introduction of RevertOptionsStruct provides a structured approach to handling revert scenarios, enhancing the robustness of transaction management.


33-43: Add RevertOptionsStructOutput for consistent output handling.

The addition of RevertOptionsStructOutput ensures consistent and clear handling of revert options in output scenarios, aligning with best practices.


58-60: Add RevertContextStruct for improved asset management.

The introduction of RevertContextStruct focuses on asset management during reversion, enhancing the contract's robustness in handling complex transactions.


64-67: Add RevertContextStructOutput for consistent output handling.

The addition of RevertContextStructOutput ensures consistent handling of revert contexts in output scenarios, aligning with best practices.


79-82: Update function signatures for enhanced revert handling.

The updated function signatures now include RevertOptionsStruct, allowing for more complex interactions and improved revert handling.


85-85: Update event signatures for enhanced tracking.

The updated event signatures now include RevertOptionsStruct, allowing for better tracking and management of revert scenarios.


122-148: Update withdraw and withdrawAndCall function signatures.

The updated signatures include RevertOptionsStruct, enhancing flexibility in managing revert scenarios.


188-217: Add CalledEvent structure for improved event handling.

The new CalledEvent structure includes detailed information about the transaction context, improving event-driven architecture.


219-260: Add WithdrawnEvent structure for improved event handling.

The new WithdrawnEvent structure provides detailed information about the transaction context, enhancing event-driven architecture.


375-417: Update function signatures for enhanced revert handling.

The updated function signatures now include RevertOptionsStruct, allowing for more complex interactions and improved revert handling.

Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


531-592: Add Called event structure for detailed tracking.

The Called event structure includes comprehensive details about the transaction context, enhancing tracking and management.


Line range hint 596-683: Add Withdrawn event structure for detailed tracking.

The Withdrawn event structure provides comprehensive details about the transaction context, enhancing tracking and management.


Line range hint 685-742: Add new error types for enhanced error handling.

The introduction of new error types improves the contract's error handling capabilities, aligning with best practices.

v2/types/factories/IGatewayZEVM.sol/IGatewayZEVM__factory.ts (10)

22-62: Update call function signature in ABI.

The updated call function signature now includes gasLimit and revertOptions, enhancing the contract's capability to handle complex interactions.


205-224: Update depositAndRevert function signature in ABI.

The updated depositAndRevert function signature now includes RevertContext, enhancing the contract's capability to handle complex interactions.


285-311: Update executeRevert function signature in ABI.

The updated executeRevert function signature now includes RevertContext, enhancing the contract's capability to handle complex interactions.


317-359: Update withdraw function signature in ABI.

The updated withdraw function signature now includes RevertOptions, enhancing the contract's capability to handle complex interactions.


380-409: Update withdraw function signature in ABI.

The updated withdraw function signature now includes RevertOptions, enhancing the contract's capability to handle complex interactions.


Line range hint 417-465: Update withdrawAndCall function signature in ABI.

The updated withdrawAndCall function signature now includes RevertOptions, enhancing the contract's capability to handle complex interactions.


494-525: Update withdrawAndCall function signature in ABI.

The updated withdrawAndCall function signature now includes RevertOptions, enhancing the contract's capability to handle complex interactions.


531-592: Add Called event structure in ABI.

The Called event structure includes comprehensive details about the transaction context, enhancing tracking and management.


596-683: Add Withdrawn event structure in ABI.

The Withdrawn event structure provides comprehensive details about the transaction context, enhancing tracking and management.


685-742: Add new error types in ABI for enhanced error handling.

The introduction of new error types improves the contract's error handling capabilities, aligning with best practices.

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

35-35: Verify the impact of the updated contract bytecode.

The Bin field of SenderZEVMMetaData has been updated, reflecting changes in the compiled bytecode. Ensure that these changes align with the intended contract logic and do not introduce any unintended side effects.

v2/types/GatewayZEVM.ts (15)

26-31: New RevertOptionsStruct type added.

This new type provides a structured way to handle revert options, enhancing the contract's ability to manage reverts. Ensure that this aligns with the intended functionality.


33-43: New RevertOptionsStructOutput type added.

This output type complements the RevertOptionsStruct, ensuring consistency in handling revert options across the contract's operations. Verify its integration with existing logic.


58-60: Modified RevertContextStruct type.

The fields have been updated to focus on asset management during reverts. Ensure that these changes are reflected in all relevant parts of the contract.


64-66: Modified RevertContextStructOutput type.

The output structure has been updated to match the changes in RevertContextStruct. Verify that this is consistently applied throughout the interface.


95-98: Updated function signatures to include RevertOptionsStruct.

The withdraw and withdrawAndCall methods now incorporate this struct, adding complexity to revert handling. Ensure these changes are tested adequately.


104-112: Renamed events for clarity.

Event names have been updated from Call to Called and Withdrawal to Withdrawn. This enhances clarity regarding their purpose. Verify that these changes are reflected in event handling logic.


133-138: Incorporate RevertOptionsStruct in call function signature.

The addition of this struct to the function signature enhances revert handling capabilities. Ensure that this change is consistent with the intended functionality.


155-155: Incorporate RevertContextStruct in depositAndRevert function signature.

This modification enhances the function's ability to manage reverts. Verify that this change is thoroughly tested.


163-163: Incorporate RevertContextStruct in executeRevert function signature.

Ensure that this addition supports the intended revert handling logic.


205-231: Updated withdraw and withdrawAndCall function signatures.

These functions now require RevertOptionsStruct, adding complexity to revert handling. Ensure these changes are tested adequately.


316-339: Updated CalledEvent structure.

The event now includes RevertOptionsStruct, enhancing its ability to capture revert-related data. Verify that this change is consistently applied across event handling logic.


Line range hint 453-488:
Updated WithdrawnEvent structure.

The event now includes RevertOptionsStruct, enhancing its ability to capture revert-related data. Ensure that this change is consistently applied across event handling logic.


548-554: Replace void with undefined in TypeScript function signatures.

The use of void outside a return type or type parameter can be confusing. Replace it with undefined for clarity.

-    [void],
+    [undefined],

669-675: Replace void with undefined in TypeScript function signatures.

The use of void outside a return type or type parameter can be confusing. Replace it with undefined for clarity.

-    [void],
+    [undefined],

691-711: Replace void with undefined in TypeScript function signatures.

The use of void outside a return type or type parameter can be confusing. Replace it with undefined for clarity.

-    [void],
+    [undefined],
Tools
Biome

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

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bc9246d and a152e7e.

Files selected for processing (3)
  • v2/pkg/senderzevm.sol/senderzevm.go (1 hunks)
  • v2/types/factories/GatewayZEVM__factory.ts (17 hunks)
  • v2/types/factories/SenderZEVM__factory.ts (4 hunks)
Files skipped from review as they are similar to previous changes (2)
  • v2/types/factories/GatewayZEVM__factory.ts
  • v2/types/factories/SenderZEVM__factory.ts
Additional comments not posted (1)
v2/pkg/senderzevm.sol/senderzevm.go (1)

35-35: Verify the correctness of the bytecode change.

The Bin field update reflects changes in the contract's compiled bytecode. Ensure that the new bytecode aligns with the intended functionality and doesn't introduce unintended side effects.

@skosito skosito merged commit 3481d17 into main Aug 14, 2024
9 checks passed
@skosito skosito deleted the remove-amount-check-in-zevm-execute branch August 14, 2024 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants