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: missing tss update in erc20custody, zetaConnector and gatewayEVM #363

Merged
merged 14 commits into from
Sep 30, 2024

Conversation

skosito
Copy link
Contributor

@skosito skosito commented Sep 25, 2024

  • adds tss update function with proper role
  • sets role to tss address in initializer

Summary by CodeRabbit

  • New Features

    • Introduced a new role, "TSS Updater," allowing authorized users to update the TSS address in both ERC20Custody and GatewayEVM contracts.
    • Added a public function to update the TSS address across multiple contracts, enhancing control over critical address management.
    • Emitted events to signal updates to the TSS address for better tracking.
  • Bug Fixes

    • Implemented checks to prevent the TSS address from being set to zero, ensuring robust error handling.
  • Tests

    • Expanded test coverage for TSS address updates, including checks for authorization and invalid inputs.

Copy link
Contributor

coderabbitai bot commented Sep 25, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes introduce a new function, updateTSSAddress, in the ERC20Custody, GatewayEVM, and ZetaConnectorBase contracts, allowing the administrator to update the TSS address with appropriate access controls. This function ensures that the new address is not a zero address and revokes the relevant roles from the old address while granting them to the new address. Corresponding events are emitted to signal these updates. Additionally, test cases have been added across various test contracts to validate the functionality and access control of these updates.

Changes

Files Change Summary
v2/contracts/evm/ERC20Custody.sol Added TSS_UPDATER_ROLE constant and updateTSSAddress function for updating TSS address with access control.
v2/contracts/evm/GatewayEVM.sol Added TSS_UPDATER_ROLE constant and updateTSSAddress function for updating TSS address with access control.
v2/contracts/evm/ZetaConnectorBase.sol Added tssAddress variable and updateTSSAddress function for managing TSS address with access control.
v2/test/ERC20Custody.t.sol Introduced tests for updateTSSAddress including success and failure scenarios for updating TSS address.
v2/test/GatewayEVM.t.sol Introduced tests for updateTSSAddress including success and failure scenarios for updating TSS address.
v2/test/ZetaConnectorNative.t.sol Added tests for updateTSSAddress, verifying role management and event emission upon TSS address update.
v2/contracts/evm/interfaces/IERC20Custody.sol Added UpdatedCustodyTSSAddress event declaration.
v2/contracts/evm/interfaces/IGatewayEVM.sol Added UpdatedGatewayTSSAddress event declaration.
v2/contracts/evm/interfaces/IZetaConnector.sol Added UpdatedZetaConnectorTSSAddress event declaration.

Possibly related PRs

  • feat: improve revert handling #361: The GatewayEVM contract in this PR includes an updateTSSAddress function, which is directly related to the updateTSSAddress function added in the main PR for the ERC20Custody contract, indicating a shared functionality for updating the TSS address.

Suggested reviewers

  • fadeev
  • CharlieMc0
  • brewmaster012
  • andresaiello
  • fbac
  • lumtis

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>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation 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 Sep 25, 2024

Codecov Report

Attention: Patch coverage is 82.60870% with 4 lines in your changes missing coverage. Please review.

Project coverage is 83.07%. Comparing base (514eaac) to head (518753a).

Files with missing lines Patch % Lines
v2/contracts/evm/GatewayEVM.sol 62.50% 3 Missing ⚠️
v2/contracts/evm/ZetaConnectorBase.sol 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #363      +/-   ##
==========================================
- Coverage   83.10%   83.07%   -0.03%     
==========================================
  Files           8        8              
  Lines         361      384      +23     
  Branches      118      122       +4     
==========================================
+ Hits          300      319      +19     
- Misses         61       65       +4     

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

🧹 Outside diff range and nitpick comments (4)
v2/contracts/evm/ERC20Custody.sol (1)

64-69: LGTM with suggestion: Consider adding an event for TSS address updates.

The updateTSSAddress function is correctly implemented with proper access control and a zero address check. This aligns with the PR objectives of adding a TSS update function with appropriate role permissions.

Consider emitting an event when the TSS address is updated. This would be beneficial for off-chain monitoring and transparency. Here's a suggested implementation:

 function updateTSSAddress(address newTSSAddress) external onlyRole(TSS_UPDATER_ROLE) {
     if (newTSSAddress == address(0)) revert ZeroAddress();
+    address oldTSSAddress = tssAddress;
     tssAddress = newTSSAddress;
+    emit TSSAddressUpdated(oldTSSAddress, newTSSAddress);
 }

+event TSSAddressUpdated(address indexed oldTSSAddress, address indexed newTSSAddress);
v2/contracts/evm/GatewayEVM.sol (2)

88-92: Approve updateTSSAddress function with suggestions for improvement

The updateTSSAddress function successfully implements the main objective of the PR, allowing for secure updates to the TSS address. The use of onlyRole(TSS_UPDATER_ROLE) ensures proper access control, and the zero address check is a good security practice.

However, consider the following improvements:

  1. Emit an event when the TSS address is updated for better off-chain monitoring.
  2. Add a check to prevent updating the TSS address to the same value to save gas.

Here's a suggested implementation incorporating these improvements:

 function updateTSSAddress(address newTSSAddress) external onlyRole(TSS_UPDATER_ROLE) {
     if (newTSSAddress == address(0)) revert ZeroAddress();
+    if (newTSSAddress == tssAddress) revert SameAddress();
     tssAddress = newTSSAddress;
+    emit TSSAddressUpdated(newTSSAddress);
 }

+event TSSAddressUpdated(address newTSSAddress);

Don't forget to add the SameAddress error to your error declarations.


Line range hint 45-92: Summary: TSS update functionality successfully implemented

The changes in this PR successfully implement the TSS update functionality in the GatewayEVM contract. The implementation includes:

  1. A new TSS_UPDATER_ROLE for access control.
  2. Granting this role to the initial TSS address in the initialize function.
  3. A new updateTSSAddress function with appropriate access control and basic safety checks.

These changes align well with the PR objectives and enhance the contract's functionality. The suggested improvements (emitting an event and checking for same address updates) would further increase the robustness and efficiency of the implementation.

Consider documenting the rationale behind granting the TSS_UPDATER_ROLE to the initial TSS address, as this architectural decision might have implications for the system's security model and upgrade patterns.

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

47-47: [Nitpick] Group role constants together for better readability

Consider moving the declaration of TSS_UPDATER_ROLE to be with the other role constants (TSS_ROLE, WITHDRAWER_ROLE, etc.) to maintain consistency and improve code organization.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between ebb5193 and 85c6325.

🔇 Files ignored due to path filters (55)
  • v2/docs/src/SUMMARY.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/Revert.sol/interface.Revertable.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/Revert.sol/struct.RevertContext.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/Revert.sol/struct.RevertOptions.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/ERC20Custody.sol/contract.ERC20Custody.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/GatewayEVM.sol/contract.GatewayEVM.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/ZetaConnectorBase.sol/abstract.ZetaConnectorBase.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/ZetaConnectorNative.sol/contract.ZetaConnectorNative.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/ZetaConnectorNonNative.sol/contract.ZetaConnectorNonNative.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20Custody.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyErrors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyEvents.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVM.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMErrors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMEvents.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IZetaConnector.sol/interface.IZetaConnectorEvents.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IZetaNonEthNew.sol/interface.IZetaNonEthNew.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/GatewayZEVM.sol/contract.GatewayZEVM.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/README.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/SystemContract.sol/contract.SystemContract.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/SystemContract.sol/interface.SystemContractErrors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/ZRC20.sol/contract.ZRC20.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/ZRC20.sol/interface.ZRC20Errors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVM.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMErrors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMEvents.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/ISystem.sol/interface.ISystem.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IWZETA.sol/interface.IWETH9.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IZRC20.sol/enum.CoinType.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20Metadata.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.ZRC20Events.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/UniversalContract.sol/interface.UniversalContract.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/UniversalContract.sol/interface.zContract.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/UniversalContract.sol/struct.zContext.md is excluded by !v2/docs/**
  • v2/docs/src/index.md is excluded by !v2/docs/**
  • v2/pkg/erc20custody.sol/erc20custody.go is excluded by !v2/pkg/**
  • v2/pkg/erc20custody.t.sol/erc20custodytest.go is excluded by !v2/pkg/**
  • v2/pkg/erc20custodyechidnatest.sol/erc20custodyechidnatest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevm.sol/gatewayevm.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevm.t.sol/gatewayevminboundtest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevm.t.sol/gatewayevmtest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevmechidnatest.sol/gatewayevmechidnatest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevmupgrade.t.sol/gatewayevmuupsupgradetest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevmzevm.t.sol/gatewayevmzevmtest.go is excluded by !v2/pkg/**
  • v2/pkg/zetaconnectornative.t.sol/zetaconnectornativetest.go is excluded by !v2/pkg/**
  • v2/pkg/zetaconnectornonnative.t.sol/zetaconnectornonnativetest.go is excluded by !v2/pkg/**
  • v2/types/ERC20Custody.ts is excluded by !v2/types/**
  • v2/types/ERC20CustodyEchidnaTest.ts is excluded by !v2/types/**
  • v2/types/GatewayEVM.ts is excluded by !v2/types/**
  • v2/types/GatewayEVMEchidnaTest.ts is excluded by !v2/types/**
  • v2/types/factories/ERC20CustodyEchidnaTest__factory.ts is excluded by !v2/types/**
  • v2/types/factories/ERC20Custody__factory.ts is excluded by !v2/types/**
  • v2/types/factories/GatewayEVMEchidnaTest__factory.ts is excluded by !v2/types/**
  • v2/types/factories/GatewayEVM__factory.ts is excluded by !v2/types/**
📒 Files selected for processing (4)
  • v2/contracts/evm/ERC20Custody.sol (3 hunks)
  • v2/contracts/evm/GatewayEVM.sol (3 hunks)
  • v2/test/ERC20Custody.t.sol (2 hunks)
  • v2/test/GatewayEVM.t.sol (2 hunks)
🔇 Additional comments not posted (10)
v2/contracts/evm/ERC20Custody.sol (2)

35-36: LGTM: New role constant added correctly.

The TSS_UPDATER_ROLE constant is properly defined using keccak256, consistent with other role definitions in the contract. This addition aligns with the PR objective of implementing a TSS update function with appropriate role permissions.


51-51: LGTM: TSS_UPDATER_ROLE granted in constructor.

The TSS_UPDATER_ROLE is correctly granted to the tssAddress_ in the constructor. This ensures that the TSS address has the necessary permissions to update itself from the contract's initialization, aligning with the PR objectives.

v2/contracts/evm/GatewayEVM.sol (1)

45-46: LGTM: New role constant added correctly

The addition of the TSS_UPDATER_ROLE constant is well-implemented and consistent with the existing role definitions in the contract. This new role aligns with the PR objectives to implement a TSS update function with appropriate permissions.

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

83-88: Test testTSSUpgrade correctly verifies TSS address update

The test correctly verifies that the TSS address can be updated by an account with the TSS_UPDATER_ROLE.


90-94: Test testTSSUpgradeFailsIfSenderIsNotTSSUpdater correctly checks unauthorized access

The test properly ensures that an account without the TSS_UPDATER_ROLE cannot update the TSS address, expecting a revert with the appropriate error.


96-100: Test testTSSUpgradeFailsIfZeroAddress correctly handles zero address update

The test correctly verifies that attempting to update the TSS address to the zero address results in a revert with the expected ZeroAddress error.

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

48-48: Addition of TSS_UPDATER_ROLE constant is appropriate and consistent.

The new constant TSS_UPDATER_ROLE is correctly defined and follows the existing naming conventions alongside other role constants.


84-89: Test testTSSUpgrade effectively verifies TSS address update functionality.

This test ensures that the TSS address can be updated by an authorized account (tssAddress) and that the new address is correctly set to owner. The use of vm.startPrank(tssAddress) accurately simulates the correct permissions.


91-95: Test correctly handles unauthorized access in testTSSUpgradeFailsIfSenderIsNotTSSUpdater.

The test verifies that an account without the TSS_UPDATER_ROLE (in this case, owner) cannot update the TSS address, and it expects the correct revert with AccessControlUnauthorizedAccount error.


97-101: Validation of zero address in testTSSUpgradeFailsIfZeroAddress is correctly implemented.

The test confirms that attempting to update the TSS address to the zero address reverts with the ZeroAddress error, ensuring robustness against invalid inputs.

v2/contracts/evm/ERC20Custody.sol Outdated Show resolved Hide resolved
v2/contracts/evm/GatewayEVM.sol Outdated Show resolved Hide resolved
v2/contracts/evm/ERC20Custody.sol Outdated Show resolved Hide resolved
v2/contracts/evm/GatewayEVM.sol Outdated Show resolved Hide resolved
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

🧹 Outside diff range and nitpick comments (2)
v2/contracts/evm/interfaces/IERC20Custody.sol (1)

43-46: LGTM! Consider a minor comment improvement.

The new UpdatedCustodyTSSAddress event is well-defined and appropriately placed within the IERC20CustodyEvents interface. It follows the existing naming conventions and provides a clear purpose.

Consider updating the comment to be more specific:

-    /// @notice Emitted when tss address is updated
+    /// @notice Emitted when the custody TSS address is updated
     /// @param newTSSAddress new tss address
     event UpdatedCustodyTSSAddress(address newTSSAddress);

This change aligns the comment more closely with the event's name and purpose.

v2/contracts/evm/interfaces/IGatewayEVM.sol (1)

52-55: LGTM! Consider adding more detailed documentation.

The addition of the UpdatedGatewayTSSAddress event is appropriate and well-placed within the IGatewayEVMEvents interface. It will be useful for tracking changes to the TSS address.

Consider expanding the event documentation to provide more context:

/// @notice Emitted when the Gateway TSS (Threshold Signature Scheme) address is updated
/// @param newTSSAddress The new TSS address
event UpdatedGatewayTSSAddress(address newTSSAddress);

This additional context helps developers understand the significance of the TSS in the Gateway system.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 85c6325 and 80894a5.

🔇 Files ignored due to path filters (71)
  • v2/docs/src/contracts/Revert.sol/interface.Revertable.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/Revert.sol/struct.RevertContext.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/Revert.sol/struct.RevertOptions.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/ERC20Custody.sol/contract.ERC20Custody.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/GatewayEVM.sol/contract.GatewayEVM.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/ZetaConnectorBase.sol/abstract.ZetaConnectorBase.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/ZetaConnectorNative.sol/contract.ZetaConnectorNative.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/ZetaConnectorNonNative.sol/contract.ZetaConnectorNonNative.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20Custody.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyErrors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyEvents.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVM.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMErrors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMEvents.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IZetaConnector.sol/interface.IZetaConnectorEvents.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IZetaNonEthNew.sol/interface.IZetaNonEthNew.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/GatewayZEVM.sol/contract.GatewayZEVM.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/SystemContract.sol/contract.SystemContract.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/SystemContract.sol/interface.SystemContractErrors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/ZRC20.sol/contract.ZRC20.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/ZRC20.sol/interface.ZRC20Errors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVM.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMErrors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMEvents.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/ISystem.sol/interface.ISystem.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IWZETA.sol/interface.IWETH9.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IZRC20.sol/enum.CoinType.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20Metadata.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.ZRC20Events.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/UniversalContract.sol/interface.UniversalContract.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/UniversalContract.sol/interface.zContract.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/UniversalContract.sol/struct.zContext.md is excluded by !v2/docs/**
  • v2/pkg/erc20custody.sol/erc20custody.go is excluded by !v2/pkg/**
  • v2/pkg/erc20custody.t.sol/erc20custodytest.go is excluded by !v2/pkg/**
  • v2/pkg/erc20custodyechidnatest.sol/erc20custodyechidnatest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevm.sol/gatewayevm.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevm.t.sol/gatewayevminboundtest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevm.t.sol/gatewayevmtest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevmechidnatest.sol/gatewayevmechidnatest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevmupgrade.t.sol/gatewayevmuupsupgradetest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevmupgradetest.sol/gatewayevmupgradetest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevmzevm.t.sol/gatewayevmzevmtest.go is excluded by !v2/pkg/**
  • v2/pkg/ierc20custody.sol/ierc20custody.go is excluded by !v2/pkg/**
  • v2/pkg/ierc20custody.sol/ierc20custodyevents.go is excluded by !v2/pkg/**
  • v2/pkg/igatewayevm.sol/igatewayevm.go is excluded by !v2/pkg/**
  • v2/pkg/igatewayevm.sol/igatewayevmevents.go is excluded by !v2/pkg/**
  • v2/pkg/zetaconnectornative.sol/zetaconnectornative.go is excluded by !v2/pkg/**
  • v2/pkg/zetaconnectornative.t.sol/zetaconnectornativetest.go is excluded by !v2/pkg/**
  • v2/pkg/zetaconnectornonnative.sol/zetaconnectornonnative.go is excluded by !v2/pkg/**
  • v2/pkg/zetaconnectornonnative.t.sol/zetaconnectornonnativetest.go is excluded by !v2/pkg/**
  • v2/types/ERC20Custody.ts is excluded by !v2/types/**
  • v2/types/ERC20CustodyEchidnaTest.ts is excluded by !v2/types/**
  • v2/types/GatewayEVM.ts is excluded by !v2/types/**
  • v2/types/GatewayEVMEchidnaTest.ts is excluded by !v2/types/**
  • v2/types/GatewayEVMUpgradeTest.ts is excluded by !v2/types/**
  • v2/types/IERC20Custody.sol/IERC20Custody.ts is excluded by !v2/types/**
  • v2/types/IERC20Custody.sol/IERC20CustodyEvents.ts is excluded by !v2/types/**
  • v2/types/IGatewayEVM.sol/IGatewayEVM.ts is excluded by !v2/types/**
  • v2/types/IGatewayEVM.sol/IGatewayEVMEvents.ts is excluded by !v2/types/**
  • v2/types/factories/ERC20CustodyEchidnaTest__factory.ts is excluded by !v2/types/**
  • v2/types/factories/ERC20Custody__factory.ts is excluded by !v2/types/**
  • v2/types/factories/GatewayEVMEchidnaTest__factory.ts is excluded by !v2/types/**
  • v2/types/factories/GatewayEVMUpgradeTest__factory.ts is excluded by !v2/types/**
  • v2/types/factories/GatewayEVM__factory.ts is excluded by !v2/types/**
  • v2/types/factories/IERC20Custody.sol/IERC20CustodyEvents__factory.ts is excluded by !v2/types/**
  • v2/types/factories/IERC20Custody.sol/IERC20Custody__factory.ts is excluded by !v2/types/**
  • v2/types/factories/IGatewayEVM.sol/IGatewayEVMEvents__factory.ts is excluded by !v2/types/**
  • v2/types/factories/IGatewayEVM.sol/IGatewayEVM__factory.ts is excluded by !v2/types/**
  • v2/types/factories/ZetaConnectorNative__factory.ts is excluded by !v2/types/**
  • v2/types/factories/ZetaConnectorNonNative__factory.ts is excluded by !v2/types/**
📒 Files selected for processing (6)
  • v2/contracts/evm/ERC20Custody.sol (1 hunks)
  • v2/contracts/evm/GatewayEVM.sol (1 hunks)
  • v2/contracts/evm/interfaces/IERC20Custody.sol (1 hunks)
  • v2/contracts/evm/interfaces/IGatewayEVM.sol (1 hunks)
  • v2/test/ERC20Custody.t.sol (2 hunks)
  • v2/test/GatewayEVM.t.sol (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • v2/contracts/evm/ERC20Custody.sol
  • v2/contracts/evm/GatewayEVM.sol
  • v2/test/GatewayEVM.t.sol
🔇 Additional comments not posted (6)
v2/contracts/evm/interfaces/IERC20Custody.sol (1)

43-46: Verify implementation and test coverage for TSS address update.

The addition of the UpdatedCustodyTSSAddress event suggests a new functionality to update the TSS address. However, there's no corresponding method in the IERC20Custody interface for this update.

Please ensure that:

  1. The implementation contract correctly implements the TSS address update functionality.
  2. Appropriate access controls are in place for this update.
  3. Unit tests cover this new functionality, including emitting the event.

Run the following script to verify the implementation and test coverage:

This script will help verify the proper implementation, access control, event emission, and test coverage for the new TSS address update functionality.

v2/test/ERC20Custody.t.sol (5)

48-48: LGTM: Default admin role constant added correctly.

The DEFAULT_ADMIN_ROLE constant is correctly defined with the appropriate value (0x00) for OpenZeppelin's AccessControl. This addition aligns with the existing role constants in the contract and will be useful for access control checks in the new test functions.


84-91: LGTM: Comprehensive test for TSS address update.

This test function effectively verifies the TSS address update functionality:

  1. It correctly sets the caller context to the owner.
  2. It checks for the expected event emission.
  3. It verifies the state change by asserting the new TSS address.

The test covers both the behavior and the state change, ensuring the updateTSSAddress function works as expected.


93-99: LGTM: Proper access control test for TSS address update.

This test function effectively verifies that the TSS address update is protected by access control:

  1. It correctly sets an unauthorized caller context (TSS address).
  2. It expects the appropriate AccessControlUnauthorizedAccount error with the correct parameters.
  3. It attempts to update the TSS address, which should fail.

The test ensures that only authorized accounts (with the DEFAULT_ADMIN_ROLE) can update the TSS address.


101-105: LGTM: Proper input validation test for TSS address update.

This test function effectively verifies that the TSS address cannot be set to a zero address:

  1. It correctly sets the caller context to the owner to isolate the test to input validation.
  2. It expects the appropriate ZeroAddress error.
  3. It attempts to update the TSS address to a zero address, which should fail.

The test ensures that the updateTSSAddress function properly validates its input, preventing the TSS address from being set to an invalid value.


Line range hint 48-105: LGTM: Comprehensive test coverage for TSS address update functionality.

The additions to this test file significantly improve the test coverage for the TSS address update feature:

  1. The DEFAULT_ADMIN_ROLE constant is correctly defined for use in access control tests.
  2. testTSSUpgrade verifies the successful updating of the TSS address.
  3. testTSSUpgradeFailsIfSenderIsNotTSSUpdater ensures proper access control.
  4. testTSSUpgradeFailsIfZeroAddress validates input to prevent setting an invalid TSS address.

These tests collectively cover the happy path, access control, and input validation aspects of the TSS address update functionality, enhancing the overall robustness of the ERC20Custody contract tests.

vm.expectEmit(true, true, true, true, address(gateway));
emit UpdatedGatewayTSSAddress(tssAddress);
gateway.updateTSSAddress(tssAddress);
address newTssAddress = gateway.tssAddress();
Copy link
Member

Choose a reason for hiding this comment

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

I might think we're missing assertion for checking the roles on previous TSS have been revoked? Same for the other contract

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

🧹 Outside diff range and nitpick comments (1)
v2/contracts/evm/GatewayEVM.sol (1)

74-83: LGTM! Consider adding more detailed documentation.

The _execute function is well-implemented as an internal utility for executing arbitrary calls. It correctly handles the return value and reverts on failure.

Consider adding more detailed documentation, especially regarding:

  1. The purpose of this internal function within the contract's architecture.
  2. The security implications of executing arbitrary calls.
  3. How the msg.value is handled and potential risks associated with it.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6accdcc and 887acbf.

⛔ Files ignored due to path filters (76)
  • v2/docs/src/contracts/Revert.sol/interface.Revertable.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/Revert.sol/struct.RevertContext.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/Revert.sol/struct.RevertOptions.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/ERC20Custody.sol/contract.ERC20Custody.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/GatewayEVM.sol/contract.GatewayEVM.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/ZetaConnectorBase.sol/abstract.ZetaConnectorBase.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/ZetaConnectorNative.sol/contract.ZetaConnectorNative.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/ZetaConnectorNonNative.sol/contract.ZetaConnectorNonNative.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20Custody.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyErrors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyEvents.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IGatewayEVM.sol/interface.Callable.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVM.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMErrors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMEvents.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IGatewayEVM.sol/struct.MessageContext.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IZetaConnector.sol/interface.IZetaConnectorEvents.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IZetaNonEthNew.sol/interface.IZetaNonEthNew.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/GatewayZEVM.sol/contract.GatewayZEVM.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/SystemContract.sol/contract.SystemContract.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/SystemContract.sol/interface.SystemContractErrors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/ZRC20.sol/contract.ZRC20.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/ZRC20.sol/interface.ZRC20Errors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVM.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMErrors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMEvents.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IGatewayZEVM.sol/struct.CallOptions.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/ISystem.sol/interface.ISystem.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IWZETA.sol/interface.IWETH9.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IZRC20.sol/enum.CoinType.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20Metadata.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.ZRC20Events.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/UniversalContract.sol/interface.UniversalContract.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/UniversalContract.sol/interface.zContract.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/UniversalContract.sol/struct.zContext.md is excluded by !v2/docs/**
  • v2/pkg/erc20custody.sol/erc20custody.go is excluded by !v2/pkg/**
  • v2/pkg/erc20custody.t.sol/erc20custodytest.go is excluded by !v2/pkg/**
  • v2/pkg/erc20custodyechidnatest.sol/erc20custodyechidnatest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevm.sol/gatewayevm.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevm.t.sol/gatewayevminboundtest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevm.t.sol/gatewayevmtest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevmechidnatest.sol/gatewayevmechidnatest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevmupgrade.t.sol/gatewayevmuupsupgradetest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevmupgradetest.sol/gatewayevmupgradetest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevmzevm.t.sol/gatewayevmzevmtest.go is excluded by !v2/pkg/**
  • v2/pkg/ierc20custody.sol/ierc20custody.go is excluded by !v2/pkg/**
  • v2/pkg/ierc20custody.sol/ierc20custodyevents.go is excluded by !v2/pkg/**
  • v2/pkg/igatewayevm.sol/igatewayevm.go is excluded by !v2/pkg/**
  • v2/pkg/igatewayevm.sol/igatewayevmevents.go is excluded by !v2/pkg/**
  • v2/pkg/receiverevm.sol/receiverevm.go is excluded by !v2/pkg/**
  • v2/pkg/zetaconnectornative.sol/zetaconnectornative.go is excluded by !v2/pkg/**
  • v2/pkg/zetaconnectornative.t.sol/zetaconnectornativetest.go is excluded by !v2/pkg/**
  • v2/pkg/zetaconnectornonnative.sol/zetaconnectornonnative.go is excluded by !v2/pkg/**
  • v2/pkg/zetaconnectornonnative.t.sol/zetaconnectornonnativetest.go is excluded by !v2/pkg/**
  • v2/types/ERC20Custody.ts is excluded by !v2/types/**
  • v2/types/ERC20CustodyEchidnaTest.ts is excluded by !v2/types/**
  • v2/types/GatewayEVM.ts is excluded by !v2/types/**
  • v2/types/GatewayEVMEchidnaTest.ts is excluded by !v2/types/**
  • v2/types/GatewayEVMUpgradeTest.ts is excluded by !v2/types/**
  • v2/types/IERC20Custody.sol/IERC20Custody.ts is excluded by !v2/types/**
  • v2/types/IERC20Custody.sol/IERC20CustodyEvents.ts is excluded by !v2/types/**
  • v2/types/IGatewayEVM.sol/IGatewayEVM.ts is excluded by !v2/types/**
  • v2/types/IGatewayEVM.sol/IGatewayEVMEvents.ts is excluded by !v2/types/**
  • v2/types/factories/ERC20CustodyEchidnaTest__factory.ts is excluded by !v2/types/**
  • v2/types/factories/ERC20Custody__factory.ts is excluded by !v2/types/**
  • v2/types/factories/GatewayEVMEchidnaTest__factory.ts is excluded by !v2/types/**
  • v2/types/factories/GatewayEVMUpgradeTest__factory.ts is excluded by !v2/types/**
  • v2/types/factories/GatewayEVM__factory.ts is excluded by !v2/types/**
  • v2/types/factories/IERC20Custody.sol/IERC20CustodyEvents__factory.ts is excluded by !v2/types/**
  • v2/types/factories/IERC20Custody.sol/IERC20Custody__factory.ts is excluded by !v2/types/**
  • v2/types/factories/IGatewayEVM.sol/IGatewayEVMEvents__factory.ts is excluded by !v2/types/**
  • v2/types/factories/IGatewayEVM.sol/IGatewayEVM__factory.ts is excluded by !v2/types/**
  • v2/types/factories/ReceiverEVM__factory.ts is excluded by !v2/types/**
  • v2/types/factories/ZetaConnectorNative__factory.ts is excluded by !v2/types/**
  • v2/types/factories/ZetaConnectorNonNative__factory.ts is excluded by !v2/types/**
📒 Files selected for processing (4)
  • v2/contracts/evm/GatewayEVM.sol (1 hunks)
  • v2/contracts/evm/interfaces/IGatewayEVM.sol (1 hunks)
  • v2/test/ERC20Custody.t.sol (2 hunks)
  • v2/test/GatewayEVM.t.sol (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • v2/contracts/evm/interfaces/IGatewayEVM.sol
  • v2/test/ERC20Custody.t.sol
  • v2/test/GatewayEVM.t.sol
🔇 Additional comments (2)
v2/contracts/evm/GatewayEVM.sol (2)

85-96: LGTM! Event emission added as requested.

The updateTSSAddress function is well-implemented with proper access control and role management. The zero address check adds an extra layer of security.

The event emission (UpdatedGatewayTSSAddress) has been added as requested in the previous review, which improves the contract's observability.


74-96: Overall improvements to contract flexibility and maintainability

The additions of the _execute and updateTSSAddress functions enhance the contract in the following ways:

  1. The _execute function centralizes the logic for executing calls, potentially improving maintainability.
  2. The updateTSSAddress function adds necessary flexibility to update the TSS address, addressing the main objective of this PR.

These changes align well with the PR objectives and don't introduce apparent security vulnerabilities.

@skosito skosito changed the title fix: missing tss update in erc20custody and gatewayEVM fix: missing tss update in erc20custody, zetaConnector and gatewayEVM Sep 27, 2024
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: 4

🧹 Outside diff range and nitpick comments (2)
v2/contracts/evm/ZetaConnectorBase.sol (2)

55-67: Add a Check to Prevent Unnecessary Updates

The updateTSSAddress function does not check if the newTSSAddress is different from the current tssAddress. Updating to the same address unnecessarily revokes and grants roles.

Include a condition to verify the new address is different:

function updateTSSAddress(address newTSSAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {
    if (newTSSAddress == address(0)) revert ZeroAddress();
+   if (newTSSAddress == tssAddress) revert("New TSS address must be different from the current address");

    _revokeRole(WITHDRAWER_ROLE, tssAddress);
    _revokeRole(TSS_ROLE, tssAddress);

    _grantRole(WITHDRAWER_ROLE, newTSSAddress);
    _grantRole(TSS_ROLE, newTSSAddress);

    tssAddress = newTSSAddress;

    emit UpdatedZetaConnectorTSSAddress(newTSSAddress);
}

58-62: Ensure Atomic Role Transfer to Prevent Access Gaps

There is a brief moment after revoking roles from the old tssAddress and before granting them to the newTSSAddress where no address holds the necessary roles. While this function executes atomically, consider the order of operations to ensure security best practices.

Consider assigning the new address before revoking and granting roles:

function updateTSSAddress(address newTSSAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {
    if (newTSSAddress == address(0)) revert ZeroAddress();
+   address oldTssAddress = tssAddress;
+   tssAddress = newTSSAddress;

    _revokeRole(WITHDRAWER_ROLE, oldTssAddress);
    _revokeRole(TSS_ROLE, oldTssAddress);

    _grantRole(WITHDRAWER_ROLE, newTSSAddress);
    _grantRole(TSS_ROLE, newTSSAddress);

    emit UpdatedZetaConnectorTSSAddress(newTSSAddress);
}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 887acbf and 518753a.

⛔ Files ignored due to path filters (63)
  • v2/docs/src/contracts/Revert.sol/interface.Revertable.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/Revert.sol/struct.RevertContext.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/Revert.sol/struct.RevertOptions.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/ERC20Custody.sol/contract.ERC20Custody.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/GatewayEVM.sol/contract.GatewayEVM.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/ZetaConnectorBase.sol/abstract.ZetaConnectorBase.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/ZetaConnectorNative.sol/contract.ZetaConnectorNative.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/ZetaConnectorNonNative.sol/contract.ZetaConnectorNonNative.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20Custody.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyErrors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IERC20Custody.sol/interface.IERC20CustodyEvents.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IGatewayEVM.sol/interface.Callable.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVM.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMErrors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IGatewayEVM.sol/interface.IGatewayEVMEvents.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IGatewayEVM.sol/struct.MessageContext.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IZetaConnector.sol/interface.IZetaConnectorEvents.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/evm/interfaces/IZetaNonEthNew.sol/interface.IZetaNonEthNew.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/GatewayZEVM.sol/contract.GatewayZEVM.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/SystemContract.sol/contract.SystemContract.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/SystemContract.sol/interface.SystemContractErrors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/ZRC20.sol/contract.ZRC20.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/ZRC20.sol/interface.ZRC20Errors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVM.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMErrors.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IGatewayZEVM.sol/interface.IGatewayZEVMEvents.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IGatewayZEVM.sol/struct.CallOptions.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/ISystem.sol/interface.ISystem.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IWZETA.sol/interface.IWETH9.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IZRC20.sol/enum.CoinType.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20Metadata.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.ZRC20Events.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/UniversalContract.sol/interface.UniversalContract.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/UniversalContract.sol/interface.zContract.md is excluded by !v2/docs/**
  • v2/docs/src/contracts/zevm/interfaces/UniversalContract.sol/struct.zContext.md is excluded by !v2/docs/**
  • v2/pkg/erc20custody.t.sol/erc20custodytest.go is excluded by !v2/pkg/**
  • v2/pkg/erc20custodyechidnatest.sol/erc20custodyechidnatest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevm.sol/gatewayevm.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevm.t.sol/gatewayevminboundtest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevm.t.sol/gatewayevmtest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevmechidnatest.sol/gatewayevmechidnatest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevmupgrade.t.sol/gatewayevmuupsupgradetest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevmupgradetest.sol/gatewayevmupgradetest.go is excluded by !v2/pkg/**
  • v2/pkg/gatewayevmzevm.t.sol/gatewayevmzevmtest.go is excluded by !v2/pkg/**
  • v2/pkg/izetaconnector.sol/izetaconnectorevents.go is excluded by !v2/pkg/**
  • v2/pkg/zetaconnectorbase.sol/zetaconnectorbase.go is excluded by !v2/pkg/**
  • v2/pkg/zetaconnectornative.sol/zetaconnectornative.go is excluded by !v2/pkg/**
  • v2/pkg/zetaconnectornative.t.sol/zetaconnectornativetest.go is excluded by !v2/pkg/**
  • v2/pkg/zetaconnectornonnative.sol/zetaconnectornonnative.go is excluded by !v2/pkg/**
  • v2/pkg/zetaconnectornonnative.t.sol/zetaconnectornonnativetest.go is excluded by !v2/pkg/**
  • v2/types/IZetaConnector.sol/IZetaConnectorEvents.ts is excluded by !v2/types/**
  • v2/types/ZetaConnectorBase.ts is excluded by !v2/types/**
  • v2/types/ZetaConnectorNative.ts is excluded by !v2/types/**
  • v2/types/ZetaConnectorNonNative.ts is excluded by !v2/types/**
  • v2/types/factories/ERC20CustodyEchidnaTest__factory.ts is excluded by !v2/types/**
  • v2/types/factories/GatewayEVMEchidnaTest__factory.ts is excluded by !v2/types/**
  • v2/types/factories/GatewayEVMUpgradeTest__factory.ts is excluded by !v2/types/**
  • v2/types/factories/GatewayEVM__factory.ts is excluded by !v2/types/**
  • v2/types/factories/IZetaConnector.sol/IZetaConnectorEvents__factory.ts is excluded by !v2/types/**
  • v2/types/factories/ZetaConnectorBase__factory.ts is excluded by !v2/types/**
  • v2/types/factories/ZetaConnectorNative__factory.ts is excluded by !v2/types/**
  • v2/types/factories/ZetaConnectorNonNative__factory.ts is excluded by !v2/types/**
📒 Files selected for processing (5)
  • v2/contracts/evm/ZetaConnectorBase.sol (2 hunks)
  • v2/contracts/evm/interfaces/IZetaConnector.sol (1 hunks)
  • v2/test/ERC20Custody.t.sol (2 hunks)
  • v2/test/GatewayEVM.t.sol (1 hunks)
  • v2/test/ZetaConnectorNative.t.sol (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • v2/test/ERC20Custody.t.sol
  • v2/test/GatewayEVM.t.sol
🔇 Additional comments (2)
v2/contracts/evm/interfaces/IZetaConnector.sol (1)

27-29: LGTM: New event UpdatedZetaConnectorTSSAddress is well-defined and documented.

The new event UpdatedZetaConnectorTSSAddress is a good addition to the interface. It follows the existing coding style and documentation patterns. The event name and parameter are clear and appropriate for its purpose of signaling updates to the TSS address.

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

49-49: Consistency in Role Definitions

The addition of TSS_ROLE aligns with the existing role constants and follows the established pattern, ensuring consistency in role management.

v2/contracts/evm/ZetaConnectorBase.sol Show resolved Hide resolved
v2/contracts/evm/ZetaConnectorBase.sol Show resolved Hide resolved
v2/test/ZetaConnectorNative.t.sol Show resolved Hide resolved
@lumtis lumtis merged commit 07bc421 into main Sep 30, 2024
9 of 10 checks passed
@lumtis lumtis deleted the missing-tss-updater branch September 30, 2024 09:00
/// @param destination Address to call.
/// @param data Calldata to pass to the call.
/// @return The result of the call.
function _execute(address destination, bytes calldata data) internal returns (bytes memory) {
Copy link
Member

Choose a reason for hiding this comment

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

May I miss something, what is this function added in this PR?

/// @param destination Address to call.
/// @param data Calldata to pass to the call.
/// @return The result of the call.
function _execute(address destination, bytes calldata data) internal returns (bytes memory) {
Copy link

Choose a reason for hiding this comment

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

Also, flagging this here, why was this function added to the PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bad merge, was cleaned up after #368

@@ -58,6 +58,22 @@ contract ERC20Custody is IERC20Custody, ReentrancyGuard, AccessControl, Pausable
_unpause();
}

/// @notice Update tss address
/// @param newTSSAddress new tss address
function updateTSSAddress(address newTSSAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {
Copy link

@J4X-98 J4X-98 Oct 9, 2024

Choose a reason for hiding this comment

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

Theoretically, here, the same address that is already used could be passed. That alone can lead to no real issues, but it would also be nice to check that. The same goes for the other 2


/// @notice Emitted when tss address is updated
/// @param newTSSAddress new tss address
event UpdatedCustodyTSSAddress(address newTSSAddress);
Copy link

Choose a reason for hiding this comment

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

The event should contain both the old and the new values. The same goes for the one in GatewayEVM and Zetaconnector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants