From d3b8732f7e2143e32d44271f08235a52be7f82ab Mon Sep 17 00:00:00 2001 From: Gabriel de Quadros Ligneul Date: Fri, 12 Jul 2024 15:01:41 -0300 Subject: [PATCH] Use multicall Stylus contract to delegate call --- system_tests/program_test.go | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/system_tests/program_test.go b/system_tests/program_test.go index 0164218bad..b748739cdc 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -1762,30 +1762,18 @@ func TestWasmRecreateWithDelegatecall(t *testing.T) { defer cleanup() storage := deployWasm(t, ctx, auth, l2client, rustFile("storage")) + multicall := deployWasm(t, ctx, auth, l2client, rustFile("multicall")) zero := common.Hash{} val := common.HexToHash("0x121233445566") - // deploy mock that contains the delegatecall method - mock, tx, _, err := mocksgen.DeployProgramTest(&auth, l2client) - Require(t, err) - _, err = EnsureTxSucceeded(ctx, l2client, tx) - Require(t, err) - mockAbi, err := mocksgen.ProgramTestMetaData.GetAbi() - Require(t, err) - - data, err := mockAbi.Pack("delegatecallProgram", storage, argsForStorageWrite(zero, val)) - Require(t, err) - storeTx := l2info.PrepareTxTo("Owner", &mock, l2info.TransferGas, nil, data) + data := argsForMulticall(vm.DELEGATECALL, storage, big.NewInt(0), argsForStorageWrite(zero, val)) + storeTx := l2info.PrepareTxTo("Owner", &multicall, l2info.TransferGas, nil, data) - data, err = mockAbi.Pack("delegatecallProgram", storage, argsForStorageRead(zero)) - Require(t, err) - loadTx := l2info.PrepareTxTo("Owner", &mock, l2info.TransferGas, nil, data) + data = argsForMulticall(vm.DELEGATECALL, storage, big.NewInt(0), argsForStorageRead(zero)) + loadTx := l2info.PrepareTxTo("Owner", &multicall, l2info.TransferGas, nil, data) - want, err := mockAbi.Methods["delegatecallProgram"].Outputs.Pack(val[:]) - Require(t, err) - - testWasmRecreate(t, builder, storeTx, loadTx, want) + testWasmRecreate(t, builder, storeTx, loadTx, val[:]) } // createMapFromDb is used in verifying if wasm store rebuilding works