Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
revert on selfdestruct
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Benfield committed Mar 28, 2024
1 parent 66c69d7 commit 7334d0a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contracts
2 changes: 1 addition & 1 deletion go-ethereum
32 changes: 32 additions & 0 deletions system_tests/program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7334d0a

Please sign in to comment.