From c00a2e194e80849c21214efbeff231625d1f9297 Mon Sep 17 00:00:00 2001 From: Aleksandr Kuperman Date: Mon, 13 May 2024 14:19:25 +0100 Subject: [PATCH] chore: resolving TODOs, adding comments --- contracts/multisigs/GuardCM.sol | 5 +++-- .../bridge_verifier/ProcessBridgedDataWormhole.sol | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/contracts/multisigs/GuardCM.sol b/contracts/multisigs/GuardCM.sol index a467379..6133416 100644 --- a/contracts/multisigs/GuardCM.sol +++ b/contracts/multisigs/GuardCM.sol @@ -348,9 +348,11 @@ contract GuardCM is VerifyData { /// @dev Sets bridge mediator and L2 verifier contracts addresses on L1 and L2 chain Ids. /// @notice It is the contract owner responsibility to set correct L1 bridge mediator contracts, /// corresponding L2 verifier contracts, and supported chain Ids. + /// Note that it is out of scope of the verification procedure to check if any other chain Id formats, + /// like Wormhole one, is correctly setup during the bridge call. /// @param bridgeMediatorL1s Bridge mediator contract addresses on L1. /// @param verifierL2s Corresponding L2 verifier contract addresses on L1. - /// @param chainIds Corresponding L2 chain Ids. + /// @param chainIds Corresponding L2 chain Ids (original EVM numbers). /// @param bridgeMediatorL2s Corresponding L2 bridge mediators. function setBridgeMediatorL1BridgeParams( address[] memory bridgeMediatorL1s, @@ -373,7 +375,6 @@ contract GuardCM is VerifyData { for (uint256 i = 0; i < chainIds.length; ++i) { // Check for zero addresses // Note that bridgeMediatorL2-s can be zero addresses, for example, for Arbitrum case - // TODO: make possible bridgeMediatorL1s[i] to be address(0) in order to remove the L2 chain from the list? if (bridgeMediatorL1s[i] == address(0) || verifierL2s[i] == address(0)) { revert ZeroAddress(); } diff --git a/contracts/multisigs/bridge_verifier/ProcessBridgedDataWormhole.sol b/contracts/multisigs/bridge_verifier/ProcessBridgedDataWormhole.sol index 8df2080..c9cc2d8 100644 --- a/contracts/multisigs/bridge_verifier/ProcessBridgedDataWormhole.sol +++ b/contracts/multisigs/bridge_verifier/ProcessBridgedDataWormhole.sol @@ -28,9 +28,11 @@ contract ProcessBridgedDataWormhole is VerifyBridgedData { // sendPayloadToEvm selector in bridge mediator L1 bytes4 public constant SEND_MESSAGE = bytes4(keccak256(bytes("sendPayloadToEvm(uint16,address,bytes,uint256,uint256)"))); // Minimum payload length for message sent via Wormhole accounting for all required encoding and at least one selector - uint256 public constant MIN_OPTIMISM_PAYLOAD_LENGTH = 324; + uint256 public constant MIN_WORMHOLE_PAYLOAD_LENGTH = 324; /// @dev Processes bridged data: checks the header and verifies the payload. + /// @notice It is out of scope of the verification procedure to check if the Wormhole format chain Id corresponding + /// to the original EVM chain Id is correctly setup during the bridge call. /// @param data Full data bytes with the header. /// @param bridgeMediatorL2 Address of a bridged mediator on L2. /// @param chainId L2 chain Id. @@ -47,8 +49,8 @@ contract ProcessBridgedDataWormhole is VerifyBridgedData { } // Check if the data length is less than a size of a selector plus the message minimum payload size - if (data.length < MIN_OPTIMISM_PAYLOAD_LENGTH) { - revert IncorrectDataLength(data.length, MIN_OPTIMISM_PAYLOAD_LENGTH); + if (data.length < MIN_WORMHOLE_PAYLOAD_LENGTH) { + revert IncorrectDataLength(data.length, MIN_WORMHOLE_PAYLOAD_LENGTH); } // Copy the data without the selector