From 513bc566af1030651d282e28ad1e484b906afb8e Mon Sep 17 00:00:00 2001 From: Chris De Leon Date: Fri, 5 Jan 2024 18:25:42 -0800 Subject: [PATCH] refactors test helper functions --- .../src/v0.8/l2ep/test/v1_0_0/L2EPTest.t.sol | 58 +++++++++++++++++ .../ArbitrumCrossDomainForwarder.t.sol | 6 -- .../ArbitrumCrossDomainGovernor.t.sol | 26 +------- .../ArbitrumSequencerUptimeFeed.t.sol | 3 +- .../v1_0_0/arbitrum/ArbitrumValidator.t.sol | 4 +- .../OptimismCrossDomainForwarder.t.sol | 18 +----- .../OptimismCrossDomainGovernor.t.sol | 64 +++++-------------- .../scroll/ScrollCrossDomainForwarder.t.sol | 18 +----- .../scroll/ScrollCrossDomainGovernor.t.sol | 64 +++++-------------- 9 files changed, 101 insertions(+), 160 deletions(-) diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/L2EPTest.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/L2EPTest.t.sol index 1beff6dbc86..13d4fd1c56e 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/L2EPTest.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/L2EPTest.t.sol @@ -1,9 +1,15 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; +import {MultiSend} from "../../../../v0.8/vendor/MultiSend.sol"; +import {Greeter} from "../../../../v0.8/tests/Greeter.sol"; import {Test} from "forge-std/Test.sol"; contract L2EPTest is Test { + /// @param expectedGasUsage - the expected gas usage + /// @param startGasUsage - the gas usage before the code of interest is run + /// @param finalGasUsage - the gas usage after the code of interest is run + /// @param deviation - the amount of gas that the actual usage is allowed to deviate by (e.g. (expectedGas - deviation) <= actualGasUsage <= (expectedGas + deviation)) function assertGasUsageIsCloseTo( uint256 expectedGasUsage, uint256 startGasUsage, @@ -14,4 +20,56 @@ contract L2EPTest is Test { assertLe(gasUsed, expectedGasUsage + deviation); assertGe(gasUsed, expectedGasUsage - deviation); } + + /// @param selector - the function selector + /// @param greeterAddr - the address of the Greeter contract + /// @param message - the new greeting message, which will be passed as an argument to Greeter#setGreeting + /// @return a 2-layer encoding such that decoding the first layer provides the CrossDomainForwarder#forward + /// function selector and the corresponding arguments to the forward function, and decoding the + /// second layer provides the Greeter#setGreeting function selector and the corresponding + /// arguments to the set greeting function (which in this case is the input message) + function encodeCrossDomainSetGreetingMsg( + bytes4 selector, + address greeterAddr, + string memory message + ) public pure returns (bytes memory) { + return abi.encodeWithSelector(selector, greeterAddr, abi.encodeWithSelector(Greeter.setGreeting.selector, message)); + } + + /// @param selector - the function selector + /// @param multiSendAddr - the address of the MultiSend contract + /// @param encodedTxs - an encoded list of transactions (e.g. abi.encodePacked(encodeMultiSendTx("some data"), ...)) + /// @return a 2-layer encoding such that decoding the first layer provides the CrossDomainGoverner#forwardDelegate + /// function selector and the corresponding arguments to the forwardDelegate function, and decoding the + /// second layer provides the MultiSend#multiSend function selector and the corresponding + /// arguments to the multiSend function (which in this case is the input encodedTxs) + function encodeCrossDomainMultiSendMsg( + bytes4 selector, + address multiSendAddr, + bytes memory encodedTxs + ) public pure returns (bytes memory) { + return + abi.encodeWithSelector(selector, multiSendAddr, abi.encodeWithSelector(MultiSend.multiSend.selector, encodedTxs)); + } + + /// @param greeterAddr - the address of the greeter contract + /// @param data - the transaction data string + /// @return an encoded transaction structured as specified in the MultiSend#multiSend comments + function encodeMultiSendTx(address greeterAddr, bytes memory data) public pure returns (bytes memory) { + bytes memory txData = abi.encodeWithSelector(Greeter.setGreeting.selector, data); + return + abi.encodePacked( + uint8(0), // operation + greeterAddr, // to + uint256(0), // value + uint256(txData.length), // data length + txData // data as bytes + ); + } + + /// @param l1Address - Address on L1 + /// @return an Arbitrum L2 address + function toArbitrumL2AliasAddress(address l1Address) public pure returns (address) { + return address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111)); + } } diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumCrossDomainForwarder.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumCrossDomainForwarder.t.sol index 27a7780042a..19424300429 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumCrossDomainForwarder.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumCrossDomainForwarder.t.sol @@ -32,12 +32,6 @@ contract ArbitrumCrossDomainForwarderTest is L2EPTest { s_greeter = new Greeter(address(s_arbitrumCrossDomainForwarder)); vm.stopPrank(); } - - /// @param l1Address - Address on L1 - /// @return an Arbitrum L2 address - function toArbitrumL2AliasAddress(address l1Address) public pure returns (address) { - return address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111)); - } } contract Constructor is ArbitrumCrossDomainForwarderTest { diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumCrossDomainGovernor.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumCrossDomainGovernor.t.sol index 0df46479eb0..d49d50d4088 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumCrossDomainGovernor.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumCrossDomainGovernor.t.sol @@ -35,26 +35,6 @@ contract ArbitrumCrossDomainGovernorTest is L2EPTest { s_multiSend = new MultiSend(); vm.stopPrank(); } - - /// @param l1Address - Address on L1 - /// @return an Arbitrum L2 address - function toArbitrumL2AliasAddress(address l1Address) public pure returns (address) { - return address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111)); - } - - /// @param data - the transaction data string - /// @return an encoded transaction structured as specified in the MultiSend#multiSend comments - function encodeMultiSendTx(bytes memory data) public view returns (bytes memory) { - bytes memory txData = abi.encodeWithSelector(Greeter.setGreeting.selector, data); - return - abi.encodePacked( - uint8(0), // operation - address(s_greeter), // to - uint256(0), // value - uint256(txData.length), // data length - txData // data as bytes - ); - } } contract Constructor is ArbitrumCrossDomainGovernorTest { @@ -166,7 +146,7 @@ contract ForwardDelegate is ArbitrumCrossDomainGovernorTest { address(s_multiSend), abi.encodeWithSelector( MultiSend.multiSend.selector, - abi.encodePacked(encodeMultiSendTx("foo"), encodeMultiSendTx("bar")) + abi.encodePacked(encodeMultiSendTx(address(s_greeter), "foo"), encodeMultiSendTx(address(s_greeter), "bar")) ) ); @@ -187,7 +167,7 @@ contract ForwardDelegate is ArbitrumCrossDomainGovernorTest { address(s_multiSend), abi.encodeWithSelector( MultiSend.multiSend.selector, - abi.encodePacked(encodeMultiSendTx("foo"), encodeMultiSendTx("bar")) + abi.encodePacked(encodeMultiSendTx(address(s_greeter), "foo"), encodeMultiSendTx(address(s_greeter), "bar")) ) ); @@ -209,7 +189,7 @@ contract ForwardDelegate is ArbitrumCrossDomainGovernorTest { address(s_multiSend), abi.encodeWithSelector( MultiSend.multiSend.selector, - abi.encodePacked(encodeMultiSendTx("foo"), encodeMultiSendTx("")) + abi.encodePacked(encodeMultiSendTx(address(s_greeter), "foo"), encodeMultiSendTx(address(s_greeter), "")) ) ); diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumSequencerUptimeFeed.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumSequencerUptimeFeed.t.sol index b2d7d9000ba..1481b881068 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumSequencerUptimeFeed.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumSequencerUptimeFeed.t.sol @@ -20,8 +20,7 @@ contract ArbitrumSequencerUptimeFeedTest is L2EPTest { address internal s_mockL1OwnerAddr = vm.addr(0x1); address internal s_strangerAddr = vm.addr(0x2); address internal s_deployerAddr = vm.addr(0x3); - address internal s_l2MessengerAddr = - address(uint160(s_mockL1OwnerAddr) + uint160(0x1111000000000000000000000000000000001111)); + address internal s_l2MessengerAddr = toArbitrumL2AliasAddress(s_mockL1OwnerAddr); /// L2EP contracts ArbitrumSequencerUptimeFeed internal s_arbitrumSequencerUptimeFeed; diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumValidator.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumValidator.t.sol index 7be62e45c70..709081188be 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumValidator.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumValidator.t.sol @@ -66,9 +66,7 @@ contract Validate is ArbitrumValidatorTest { s_arbitrumValidator.addAccess(s_eoaValidator); // Gets the ArbitrumValidator L2 address - address arbitrumValidatorL2Addr = address( - uint160(address(s_arbitrumValidator)) + uint160(0x1111000000000000000000000000000000001111) - ); + address arbitrumValidatorL2Addr = toArbitrumL2AliasAddress(address(s_arbitrumValidator)); // Sets block.timestamp to a later date, funds the ArbitrumValidator contract, and sets msg.sender and tx.origin uint256 futureTimestampInSeconds = block.timestamp + 5000; diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismCrossDomainForwarder.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismCrossDomainForwarder.t.sol index c2322399113..de432f31a6e 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismCrossDomainForwarder.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismCrossDomainForwarder.t.sol @@ -36,20 +36,6 @@ contract OptimismCrossDomainForwarderTest is L2EPTest { s_greeter = new Greeter(address(s_optimismCrossDomainForwarder)); vm.stopPrank(); } - - /// @param message - the new greeting message, which will be passed as an argument to Greeter#setGreeting - /// @return a 2-layer encoding such that decoding the first layer provides the CrossDomainForwarder#forward - /// function selector and the corresponding arguments to the forward function, and decoding the - /// second layer provides the Greeter#setGreeting function selector and the corresponding - /// arguments to the set greeting function (which in this case is the input message) - function encodeCrossDomainForwardMessage(string memory message) public view returns (bytes memory) { - return - abi.encodeWithSelector( - s_optimismCrossDomainForwarder.forward.selector, - address(s_greeter), - abi.encodeWithSelector(s_greeter.setGreeting.selector, message) - ); - } } contract Constructor is OptimismCrossDomainForwarderTest { @@ -94,7 +80,7 @@ contract Forward is OptimismCrossDomainForwarderTest { // Sends the message s_mockOptimismCrossDomainMessenger.sendMessage( address(s_optimismCrossDomainForwarder), // target - encodeCrossDomainForwardMessage(greeting), // message + encodeCrossDomainSetGreetingMsg(s_optimismCrossDomainForwarder.forward.selector, address(s_greeter), greeting), // message 0 // gas limit ); @@ -114,7 +100,7 @@ contract Forward is OptimismCrossDomainForwarderTest { vm.expectRevert("Invalid greeting length"); s_mockOptimismCrossDomainMessenger.sendMessage( address(s_optimismCrossDomainForwarder), // target - encodeCrossDomainForwardMessage(""), // message + encodeCrossDomainSetGreetingMsg(s_optimismCrossDomainForwarder.forward.selector, address(s_greeter), ""), // message 0 // gas limit ); diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismCrossDomainGovernor.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismCrossDomainGovernor.t.sol index 32068e7e03d..0bbeabbf0a7 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismCrossDomainGovernor.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismCrossDomainGovernor.t.sol @@ -36,48 +36,6 @@ contract OptimismCrossDomainGovernorTest is L2EPTest { s_multiSend = new MultiSend(); vm.stopPrank(); } - - /// @param message - the new greeting message, which will be passed as an argument to Greeter#setGreeting - /// @return a 2-layer encoding such that decoding the first layer provides the CrossDomainGoverner#forward - /// function selector and the corresponding arguments to the forward function, and decoding the - /// second layer provides the Greeter#setGreeting function selector and the corresponding - /// arguments to the set greeting function (which in this case is the input message) - function encodeCrossDomainForwardMessage(string memory message) public view returns (bytes memory) { - return - abi.encodeWithSelector( - s_optimismCrossDomainGovernor.forward.selector, - address(s_greeter), - abi.encodeWithSelector(s_greeter.setGreeting.selector, message) - ); - } - - /// @param data - the transaction data string - /// @return an encoded transaction structured as specified in the MultiSend#multiSend comments - function encodeMultiSendTx(bytes memory data) public view returns (bytes memory) { - bytes memory txData = abi.encodeWithSelector(Greeter.setGreeting.selector, data); - return - abi.encodePacked( - uint8(0), // operation - address(s_greeter), // to - uint256(0), // value - uint256(txData.length), // data length - txData // data as bytes - ); - } - - /// @param encodedTxs - an encoded list of transactions (e.g. abi.encodePacked(encodeMultiSendTx("some data"), ...)) - /// @return a 2-layer encoding such that decoding the first layer provides the CrossDomainGoverner#forwardDelegate - /// function selector and the corresponding arguments to the forwardDelegate function, and decoding the - /// second layer provides the MultiSend#multiSend function selector and the corresponding - /// arguments to the multiSend function (which in this case is the input encodedTxs) - function encodeCrossDomainForwardDelegateMessage(bytes memory encodedTxs) public view returns (bytes memory) { - return - abi.encodeWithSelector( - s_optimismCrossDomainGovernor.forwardDelegate.selector, - address(s_multiSend), - abi.encodeWithSelector(MultiSend.multiSend.selector, encodedTxs) - ); - } } contract Constructor is OptimismCrossDomainGovernorTest { @@ -122,7 +80,7 @@ contract Forward is OptimismCrossDomainGovernorTest { // Sends the message s_mockOptimismCrossDomainMessenger.sendMessage( address(s_optimismCrossDomainGovernor), // target - encodeCrossDomainForwardMessage(greeting), // message + encodeCrossDomainSetGreetingMsg(s_optimismCrossDomainGovernor.forward.selector, address(s_greeter), greeting), // message 0 // gas limit ); @@ -142,7 +100,7 @@ contract Forward is OptimismCrossDomainGovernorTest { vm.expectRevert("Invalid greeting length"); s_mockOptimismCrossDomainMessenger.sendMessage( address(s_optimismCrossDomainGovernor), // target - encodeCrossDomainForwardMessage(""), // message + encodeCrossDomainSetGreetingMsg(s_optimismCrossDomainGovernor.forward.selector, address(s_greeter), ""), // message 0 // gas limit ); @@ -189,7 +147,11 @@ contract ForwardDelegate is OptimismCrossDomainGovernorTest { // Sends the message s_mockOptimismCrossDomainMessenger.sendMessage( address(s_optimismCrossDomainGovernor), // target - encodeCrossDomainForwardDelegateMessage(abi.encodePacked(encodeMultiSendTx("foo"), encodeMultiSendTx("bar"))), // message + encodeCrossDomainMultiSendMsg( + s_optimismCrossDomainGovernor.forwardDelegate.selector, + address(s_multiSend), + abi.encodePacked(encodeMultiSendTx(address(s_greeter), "foo"), encodeMultiSendTx(address(s_greeter), "bar")) + ), // message 0 // gas limit ); @@ -208,7 +170,11 @@ contract ForwardDelegate is OptimismCrossDomainGovernorTest { // Sends the message s_mockOptimismCrossDomainMessenger.sendMessage( address(s_optimismCrossDomainGovernor), // target - encodeCrossDomainForwardDelegateMessage(abi.encodePacked(encodeMultiSendTx("foo"), encodeMultiSendTx("bar"))), // message + encodeCrossDomainMultiSendMsg( + s_optimismCrossDomainGovernor.forwardDelegate.selector, + address(s_multiSend), + abi.encodePacked(encodeMultiSendTx(address(s_greeter), "foo"), encodeMultiSendTx(address(s_greeter), "bar")) + ), // message 0 // gas limit ); @@ -228,7 +194,11 @@ contract ForwardDelegate is OptimismCrossDomainGovernorTest { vm.expectRevert("Governor delegatecall reverted"); s_mockOptimismCrossDomainMessenger.sendMessage( address(s_optimismCrossDomainGovernor), // target - encodeCrossDomainForwardDelegateMessage(abi.encodePacked(encodeMultiSendTx("foo"), encodeMultiSendTx(""))), // message + encodeCrossDomainMultiSendMsg( + s_optimismCrossDomainGovernor.forwardDelegate.selector, + address(s_multiSend), + abi.encodePacked(encodeMultiSendTx(address(s_greeter), "foo"), encodeMultiSendTx(address(s_greeter), "")) + ), // message 0 // gas limit ); diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollCrossDomainForwarder.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollCrossDomainForwarder.t.sol index e9d864df67f..78fcc1abbc6 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollCrossDomainForwarder.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollCrossDomainForwarder.t.sol @@ -33,20 +33,6 @@ contract ScrollCrossDomainForwarderTest is L2EPTest { s_greeter = new Greeter(address(s_scrollCrossDomainForwarder)); vm.stopPrank(); } - - /// @param message - the new greeting message, which will be passed as an argument to Greeter#setGreeting - /// @return a 2-layer encoding such that decoding the first layer provides the CrossDomainForwarder#forward - /// function selector and the corresponding arguments to the forward function, and decoding the - /// second layer provides the Greeter#setGreeting function selector and the corresponding - /// arguments to the set greeting function (which in this case is the input message) - function encodeCrossDomainForwardMessage(string memory message) public view returns (bytes memory) { - return - abi.encodeWithSelector( - s_scrollCrossDomainForwarder.forward.selector, - address(s_greeter), - abi.encodeWithSelector(s_greeter.setGreeting.selector, message) - ); - } } contract Constructor is ScrollCrossDomainForwarderTest { @@ -92,7 +78,7 @@ contract Forward is ScrollCrossDomainForwarderTest { s_mockScrollCrossDomainMessenger.sendMessage( address(s_scrollCrossDomainForwarder), // target 0, // value - encodeCrossDomainForwardMessage(greeting), // message + encodeCrossDomainSetGreetingMsg(s_scrollCrossDomainForwarder.forward.selector, address(s_greeter), greeting), // message 0 // gas limit ); @@ -113,7 +99,7 @@ contract Forward is ScrollCrossDomainForwarderTest { s_mockScrollCrossDomainMessenger.sendMessage( address(s_scrollCrossDomainForwarder), // target 0, // value - encodeCrossDomainForwardMessage(""), // message + encodeCrossDomainSetGreetingMsg(s_scrollCrossDomainForwarder.forward.selector, address(s_greeter), ""), // message 0 // gas limit ); diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollCrossDomainGovernor.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollCrossDomainGovernor.t.sol index a5bc0e951dd..3d22e0b8bb8 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollCrossDomainGovernor.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollCrossDomainGovernor.t.sol @@ -36,48 +36,6 @@ contract ScrollCrossDomainGovernorTest is L2EPTest { s_multiSend = new MultiSend(); vm.stopPrank(); } - - /// @param message - the new greeting message, which will be passed as an argument to Greeter#setGreeting - /// @return a 2-layer encoding such that decoding the first layer provides the CrossDomainGoverner#forward - /// function selector and the corresponding arguments to the forward function, and decoding the - /// second layer provides the Greeter#setGreeting function selector and the corresponding - /// arguments to the set greeting function (which in this case is the input message) - function encodeCrossDomainForwardMessage(string memory message) public view returns (bytes memory) { - return - abi.encodeWithSelector( - s_scrollCrossDomainGovernor.forward.selector, - address(s_greeter), - abi.encodeWithSelector(s_greeter.setGreeting.selector, message) - ); - } - - /// @param data - the transaction data string - /// @return an encoded transaction structured as specified in the MultiSend#multiSend comments - function encodeMultiSendTx(bytes memory data) public view returns (bytes memory) { - bytes memory txData = abi.encodeWithSelector(Greeter.setGreeting.selector, data); - return - abi.encodePacked( - uint8(0), // operation - address(s_greeter), // to - uint256(0), // value - uint256(txData.length), // data length - txData // data as bytes - ); - } - - /// @param encodedTxs - an encoded list of transactions (e.g. abi.encodePacked(encodeMultiSendTx("some data"), ...)) - /// @return a 2-layer encoding such that decoding the first layer provides the CrossDomainGoverner#forwardDelegate - /// function selector and the corresponding arguments to the forwardDelegate function, and decoding the - /// second layer provides the MultiSend#multiSend function selector and the corresponding - /// arguments to the multiSend function (which in this case is the input encodedTxs) - function encodeCrossDomainForwardDelegateMessage(bytes memory encodedTxs) public view returns (bytes memory) { - return - abi.encodeWithSelector( - s_scrollCrossDomainGovernor.forwardDelegate.selector, - address(s_multiSend), - abi.encodeWithSelector(MultiSend.multiSend.selector, encodedTxs) - ); - } } contract Constructor is ScrollCrossDomainGovernorTest { @@ -123,7 +81,7 @@ contract Forward is ScrollCrossDomainGovernorTest { s_mockScrollCrossDomainMessenger.sendMessage( address(s_scrollCrossDomainGovernor), // target 0, // value - encodeCrossDomainForwardMessage(greeting), // message + encodeCrossDomainSetGreetingMsg(s_scrollCrossDomainGovernor.forward.selector, address(s_greeter), greeting), // message 0 // gas limit ); @@ -144,7 +102,7 @@ contract Forward is ScrollCrossDomainGovernorTest { s_mockScrollCrossDomainMessenger.sendMessage( address(s_scrollCrossDomainGovernor), // target 0, // value - encodeCrossDomainForwardMessage(""), // message + encodeCrossDomainSetGreetingMsg(s_scrollCrossDomainGovernor.forward.selector, address(s_greeter), ""), // message 0 // gas limit ); @@ -192,7 +150,11 @@ contract ForwardDelegate is ScrollCrossDomainGovernorTest { s_mockScrollCrossDomainMessenger.sendMessage( address(s_scrollCrossDomainGovernor), // target 0, // value - encodeCrossDomainForwardDelegateMessage(abi.encodePacked(encodeMultiSendTx("foo"), encodeMultiSendTx("bar"))), // message + encodeCrossDomainMultiSendMsg( + s_scrollCrossDomainGovernor.forwardDelegate.selector, + address(s_multiSend), + abi.encodePacked(encodeMultiSendTx(address(s_greeter), "foo"), encodeMultiSendTx(address(s_greeter), "bar")) + ), // message 0 // gas limit ); @@ -212,7 +174,11 @@ contract ForwardDelegate is ScrollCrossDomainGovernorTest { s_mockScrollCrossDomainMessenger.sendMessage( address(s_scrollCrossDomainGovernor), // target 0, // value - encodeCrossDomainForwardDelegateMessage(abi.encodePacked(encodeMultiSendTx("foo"), encodeMultiSendTx("bar"))), // message + encodeCrossDomainMultiSendMsg( + s_scrollCrossDomainGovernor.forwardDelegate.selector, + address(s_multiSend), + abi.encodePacked(encodeMultiSendTx(address(s_greeter), "foo"), encodeMultiSendTx(address(s_greeter), "bar")) + ), // message 0 // gas limit ); @@ -233,7 +199,11 @@ contract ForwardDelegate is ScrollCrossDomainGovernorTest { s_mockScrollCrossDomainMessenger.sendMessage( address(s_scrollCrossDomainGovernor), // target 0, // value - encodeCrossDomainForwardDelegateMessage(abi.encodePacked(encodeMultiSendTx("foo"), encodeMultiSendTx(""))), // message + encodeCrossDomainMultiSendMsg( + s_scrollCrossDomainGovernor.forwardDelegate.selector, + address(s_multiSend), + abi.encodePacked(encodeMultiSendTx(address(s_greeter), "foo"), encodeMultiSendTx(address(s_greeter), "")) + ), // message 0 // gas limit );