From 374fc17b2cf0da4c0cc4c11bc4af375534fe257b Mon Sep 17 00:00:00 2001 From: Tsahi Zidenberg Date: Mon, 25 Nov 2024 11:25:07 -0700 Subject: [PATCH] Add balance acocunting to opSelfdestruct6780 The same logic exists in opSelfdestruct --- core/vm/instructions.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/vm/instructions.go b/core/vm/instructions.go index c921f768f6..6f150a6d5d 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -857,6 +857,10 @@ func opSelfdestruct6780(pc *uint64, interpreter *EVMInterpreter, scope *ScopeCon interpreter.evm.StateDB.SubBalance(scope.Contract.Address(), balance, tracing.BalanceDecreaseSelfdestruct) interpreter.evm.StateDB.AddBalance(beneficiary.Bytes20(), balance, tracing.BalanceIncreaseSelfdestruct) interpreter.evm.StateDB.Selfdestruct6780(scope.Contract.Address()) + if beneficiary.Bytes20() == scope.Contract.Address() { + // Arbitrum: calling selfdestruct(this) burns the balance + interpreter.evm.StateDB.ExpectBalanceBurn(balance.ToBig()) + } if tracer := interpreter.evm.Config.Tracer; tracer != nil { if tracer.OnEnter != nil { tracer.OnEnter(interpreter.evm.depth, byte(SELFDESTRUCT), scope.Contract.Address(), beneficiary.Bytes20(), []byte{}, 0, balance.ToBig())