From 6b239298120324b1db4717a81b23d27d7f3b8c6a Mon Sep 17 00:00:00 2001 From: Michael Benfield Date: Wed, 27 Mar 2024 17:44:25 -0700 Subject: [PATCH] revert on selfdestruct --- contracts | 2 +- go-ethereum | 2 +- system_tests/program_test.go | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/contracts b/contracts index aeaae5d1c..36074a092 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit aeaae5d1cf934473ff630985cae3b076093b1587 +Subproject commit 36074a092741027d7fae7a126696fe6315de2a6a diff --git a/go-ethereum b/go-ethereum index 8f86e725d..846839164 160000 --- a/go-ethereum +++ b/go-ethereum @@ -1 +1 @@ -Subproject commit 8f86e725d972a204fb91f40bf74b93b298b8689d +Subproject commit 8468391640657b3eb9ed791d4b1c3ff3b6577a8e diff --git a/system_tests/program_test.go b/system_tests/program_test.go index 8dd8384b2..5f26699bb 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -39,6 +39,38 @@ import ( var oneEth = arbmath.UintToBig(1e18) +func TestSelfDestruct(t *testing.T) { + t.Parallel() + + builder, auth, cleanup := setupProgramTest(t, true) + ctx := builder.ctx + l2info := builder.L2Info + l2client := builder.L2.Client + defer cleanup() + + ensure := func(tx *types.Transaction, err error) *types.Receipt { + t.Helper() + Require(t, err) + receipt, err := EnsureTxSucceeded(ctx, l2client, tx) + Require(t, err) + return receipt + } + pack := func(data []byte, err error) []byte { + Require(t, err) + return data + } + + mockAddr, tx, _, err := mocksgen.DeployProgramTest(&auth, l2client) + ensure(tx, err) + multiAddr := deployWasm(t, ctx, auth, l2client, rustFile("multicall")) + callSelfDestruct, _ := util.NewCallParser(mocksgen.ProgramTestABI, "callSelfDestruct") + + delegate := argsForMulticall(vm.DELEGATECALL, mockAddr, nil, pack(callSelfDestruct(multiAddr))) + tx = l2info.PrepareTxTo("Owner", &multiAddr, 1e9, nil, delegate) + Require(t, l2client.SendTransaction(ctx, tx)) + EnsureTxFailed(t, ctx, l2client, tx) +} + func TestProgramKeccak(t *testing.T) { t.Parallel() keccakTest(t, true)