diff --git a/.gas-snapshot b/.gas-snapshot index 2cc94e3..28d1bd9 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,7 +1,7 @@ -AxelarHelperTest:testCustomOrderingAxelar() (gas: 341805) -AxelarHelperTest:testFancyAxelar() (gas: 236169) -AxelarHelperTest:testMultiDstAxelar() (gas: 391397) -AxelarHelperTest:testSimpleAxelar() (gas: 189999) +AxelarHelperTest:testCustomOrderingAxelar() (gas: 340185) +AxelarHelperTest:testFancyAxelar() (gas: 236007) +AxelarHelperTest:testMultiDstAxelar() (gas: 391073) +AxelarHelperTest:testSimpleAxelar() (gas: 189189) CelerHelperTest:testCustomOrderingCeler() (gas: 108685) CelerHelperTest:testFancyCeler() (gas: 118987) CelerHelperTest:testMultiDstCeler() (gas: 151884) @@ -17,10 +17,10 @@ LayerZeroHelperTest:testFancyLZ() (gas: 296242) LayerZeroHelperTest:testMultiDstLZ() (gas: 476527) LayerZeroHelperTest:testSimpleLZ() (gas: 245817) LayerZeroHelperTest:testSimpleLZWithEstimates() (gas: 246414) -LayerZeroV2HelperTest:testCustomEventSelector() (gas: 341769) -LayerZeroV2HelperTest:testMultipleDestinations() (gas: 649473) -LayerZeroV2HelperTest:testMultipleDestinationsCustomEventSelector() (gas: 649584) -LayerZeroV2HelperTest:testSingleDestination() (gas: 344507) +LayerZeroV2HelperTest:testCustomEventSelector() (gas: 341707) +LayerZeroV2HelperTest:testMultipleDestinations() (gas: 649225) +LayerZeroV2HelperTest:testMultipleDestinationsCustomEventSelector() (gas: 649336) +LayerZeroV2HelperTest:testSingleDestination() (gas: 344445) StargateHelperTest:testCustomOrderingSG() (gas: 798922) StargateHelperTest:testFancySG() (gas: 591061) StargateHelperTest:testSimpleSG() (gas: 538333) @@ -31,7 +31,7 @@ WormholeAutomaticRelayerHelperTest:testFancyWormhole() (gas: 224754) WormholeAutomaticRelayerHelperTest:testMultiDstWormhole() (gas: 345999) WormholeAutomaticRelayerHelperTest:testMultiDstWormholeWithAdditionalVAA() (gas: 374447) WormholeAutomaticRelayerHelperTest:testSimpleWormhole() (gas: 177619) -WormholeSpecializedRelayerHelperTest:testCustomOrderingWormhole() (gas: 599240) -WormholeSpecializedRelayerHelperTest:testFancyWormhole() (gas: 332394) -WormholeSpecializedRelayerHelperTest:testMultiDstWormhole() (gas: 635874) -WormholeSpecializedRelayerHelperTest:testSimpleWormhole() (gas: 335186) \ No newline at end of file +WormholeSpecializedRelayerHelperTest:testCustomOrderingWormhole() (gas: 599230) +WormholeSpecializedRelayerHelperTest:testFancyWormhole() (gas: 332389) +WormholeSpecializedRelayerHelperTest:testMultiDstWormhole() (gas: 635864) +WormholeSpecializedRelayerHelperTest:testSimpleWormhole() (gas: 335181) \ No newline at end of file diff --git a/src/celer/CelerHelper.sol b/src/celer/CelerHelper.sol index ffd473d..0f280a9 100644 --- a/src/celer/CelerHelper.sol +++ b/src/celer/CelerHelper.sol @@ -283,7 +283,7 @@ contract CelerHelper is Test { /// @param fromMessageBus represents the source message bus address /// @param message represents the message data /// @return gasEstimate the estimated gas - function _estimateGas(address fromMessageBus, bytes memory message) internal returns (uint256 gasEstimate) { + function _estimateGas(address fromMessageBus, bytes memory message) internal view returns (uint256 gasEstimate) { /// NOTE: In celer two fees are involved, but only the 1st one is /// estimated here /// 1: Sync, Sign and Store Cost [Source Fees] diff --git a/src/layerzero-v2/LayerZeroV2Helper.sol b/src/layerzero-v2/LayerZeroV2Helper.sol index ecb0be7..4bfc3cb 100644 --- a/src/layerzero-v2/LayerZeroV2Helper.sol +++ b/src/layerzero-v2/LayerZeroV2Helper.sol @@ -132,7 +132,6 @@ contract LayerZeroV2Helper is Test { /// @return the decoded packet function decodePacket(bytes calldata encodedPacket) public pure returns (Packet memory) { /// @dev decode the packet header - uint8 version = uint8(encodedPacket[0]); uint64 nonce = toUint64(encodedPacket, 1); uint32 srcEid = toUint32(encodedPacket, 9); address sender = toAddress(encodedPacket, 13); diff --git a/test/Axelar.t.sol b/test/Axelar.t.sol index d9f8319..a71f200 100644 --- a/test/Axelar.t.sol +++ b/test/Axelar.t.sol @@ -33,9 +33,9 @@ contract AnotherTarget { } function execute( - bytes32 commandId, + bytes32, /*commandId*/ string calldata sourceChain, - string calldata sourceAddress, + string calldata, /*sourceAddress*/ bytes calldata payload ) external { require( diff --git a/test/Celer.t.sol b/test/Celer.t.sol index 0864d34..a0d8bb7 100644 --- a/test/Celer.t.sol +++ b/test/Celer.t.sol @@ -11,13 +11,15 @@ contract Target { Fail, // execution failed, finalized Success, // execution succeeded, finalized Retry // execution rejected, can retry later + } - function executeMessage(address _sender, uint64 _srcChainId, bytes calldata _message, address _executor) - external - payable - returns (ExecutionStatus) - { + function executeMessage( + address, /*_sender*/ + uint64, /*_srcChainId*/ + bytes calldata _message, + address /*_executor*/ + ) external payable returns (ExecutionStatus) { value = abi.decode(_message, (uint256)); return ExecutionStatus.Success; @@ -35,13 +37,14 @@ contract AnotherTarget { Fail, // execution failed, finalized Success, // execution succeeded, finalized Retry // execution rejected, can retry later + } constructor(uint64 _expectedChainId) { expectedChainId = _expectedChainId; } - function executeMessage(address _sender, uint64 _srcChainId, bytes calldata _message, address _executor) + function executeMessage(address, /*_sender*/ uint64 _srcChainId, bytes calldata _message, address /*_executor*/ ) external payable returns (ExecutionStatus) diff --git a/test/Hyperlane.t.sol b/test/Hyperlane.t.sol index c2c3db7..ea5aa12 100644 --- a/test/Hyperlane.t.sol +++ b/test/Hyperlane.t.sol @@ -22,7 +22,7 @@ interface IInterchainGasPaymaster { contract Target { uint256 public value; - function handle(uint32 _origin, bytes32 _sender, bytes calldata _message) external { + function handle(uint32, /*_origin*/ bytes32, /*_sender*/ bytes calldata _message) external { value = abi.decode(_message, (uint256)); } } @@ -38,7 +38,7 @@ contract AnotherTarget { expectedOrigin = _expectedOrigin; } - function handle(uint32 _origin, bytes32 _sender, bytes calldata _message) external { + function handle(uint32 _origin, bytes32, /*_sender*/ bytes calldata _message) external { require(_origin == expectedOrigin, "Unexpected origin"); (value, kevin, bob) = abi.decode(_message, (uint256, address, bytes32)); } diff --git a/test/LayerZero.t.sol b/test/LayerZero.t.sol index f284464..c712fb8 100644 --- a/test/LayerZero.t.sol +++ b/test/LayerZero.t.sol @@ -19,9 +19,12 @@ interface ILayerZeroEndpoint { contract Target { uint256 public value; - function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) - external - { + function lzReceive( + uint16, /*_srcChainId*/ + bytes calldata, /*_srcAddress*/ + uint64, /*_nonce*/ + bytes calldata _payload + ) external { value = abi.decode(_payload, (uint256)); } } @@ -37,7 +40,7 @@ contract AnotherTarget { expectedId = _expectedId; } - function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) + function lzReceive(uint16 _srcChainId, bytes calldata, /*_srcAddress*/ uint64, /*_nonce*/ bytes calldata _payload) external { require(_srcChainId == expectedId, "Unexpected id"); diff --git a/test/LayerZeroV2.t.sol b/test/LayerZeroV2.t.sol index 1c992cc..581ef3d 100644 --- a/test/LayerZeroV2.t.sol +++ b/test/LayerZeroV2.t.sol @@ -43,11 +43,11 @@ contract Target { uint256 public value; function lzReceive( - Origin calldata _origin, - bytes32 _guid, + Origin calldata, /*_origin*/ + bytes32, /*_guid*/ bytes calldata _message, - address _executor, - bytes calldata _extraData + address, /*_executor*/ + bytes calldata /*_extraData*/ ) external payable { value = abi.decode(_message, (uint256)); } diff --git a/test/Wormhole.AutomaticRelayer.t.sol b/test/Wormhole.AutomaticRelayer.t.sol index 000677d..5ae4e3e 100644 --- a/test/Wormhole.AutomaticRelayer.t.sol +++ b/test/Wormhole.AutomaticRelayer.t.sol @@ -81,10 +81,10 @@ contract Target is IWormholeReceiver { function receiveWormholeMessages( bytes memory payload, - bytes[] memory additionalVaas, - bytes32 sourceAddress, - uint16 sourceChain, - bytes32 deliveryHash + bytes[] memory, /*additionalVaas*/ + bytes32, /*sourceAddress*/ + uint16, /*sourceChain*/ + bytes32 /*deliveryHash*/ ) external payable { value = abi.decode(payload, (uint256)); } @@ -97,9 +97,9 @@ contract AdditionalVAATarget is IWormholeReceiver { function receiveWormholeMessages( bytes memory payload, bytes[] memory additionalVaas, - bytes32 sourceAddress, - uint16 sourceChain, - bytes32 deliveryHash + bytes32, /*sourceAddress*/ + uint16, /*sourceChain*/ + bytes32 /*deliveryHash*/ ) external payable { value = abi.decode(payload, (uint256)); vaalen = additionalVaas.length; @@ -119,10 +119,10 @@ contract AnotherTarget { function receiveWormholeMessages( bytes memory payload, - bytes[] memory additionalVaas, - bytes32 sourceAddress, + bytes[] memory, /*additionalVaas*/ + bytes32, /*sourceAddress*/ uint16 sourceChain, - bytes32 deliveryHash + bytes32 /*deliveryHash*/ ) external payable { require(sourceChain == expectedChainId, "Unexpected origin"); (value, kevin, bob) = abi.decode(payload, (uint256, address, bytes32)); @@ -137,11 +137,11 @@ contract CCTPTarget { } function receiveWormholeMessages( - bytes memory payload, + bytes memory, /*payload*/ bytes[] memory additionalVaas, - bytes32 sourceAddress, - uint16 sourceChain, - bytes32 deliveryHash + bytes32, /*sourceAddress*/ + uint16, /*sourceChain*/ + bytes32 /*deliveryHash*/ ) external payable { (bytes memory message, bytes memory attestation) = abi.decode(additionalVaas[0], (bytes, bytes)); transmitter.receiveMessage(message, attestation); diff --git a/test/Wormhole.SpecializedRelayer.t.sol b/test/Wormhole.SpecializedRelayer.t.sol index fd0f275..3a8d71f 100644 --- a/test/Wormhole.SpecializedRelayer.t.sol +++ b/test/Wormhole.SpecializedRelayer.t.sol @@ -20,8 +20,7 @@ contract Target { function receiveMessage(bytes memory encodedMessage) public { // call the Wormhole core contract to parse and verify the encodedMessage - (IWormhole.VM memory wormholeMessage, bool valid, string memory reason) = - wormhole.parseAndVerifyVM(encodedMessage); + (IWormhole.VM memory wormholeMessage, bool valid,) = wormhole.parseAndVerifyVM(encodedMessage); // do security checks and set value require(valid); value = abi.decode(wormholeMessage.payload, (uint256)); @@ -42,8 +41,7 @@ contract AnotherTarget { function receiveMessage(bytes memory encodedMessage) public { // call the Wormhole core contract to parse and verify the encodedMessage - (IWormhole.VM memory wormholeMessage, bool valid, string memory reason) = - wormhole.parseAndVerifyVM(encodedMessage); + (IWormhole.VM memory wormholeMessage, bool valid,) = wormhole.parseAndVerifyVM(encodedMessage); // do security checks and set value require(valid); require(wormholeMessage.emitterChainId == 2); @@ -93,7 +91,7 @@ contract WormholeSpecializedRelayerHelperTest is Test { POLYGON_FORK_ID = vm.createSelectFork(RPC_POLYGON_MAINNET); target = new Target(IWormhole(L2_1_CORE)); - anotherTarget = new AnotherTarget(IWormhole(L2_1_CORE),address(this)); + anotherTarget = new AnotherTarget(IWormhole(L2_1_CORE), address(this)); ARBITRUM_FORK_ID = vm.createSelectFork(RPC_ARBITRUM_MAINNET); altTarget = new Target(IWormhole(L2_2_CORE));