@@ -945,22 +945,6 @@ func opSelfdestruct(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext
945945 tracer .CaptureEnter (SELFDESTRUCT , scope .Contract .Address (), beneficiary .Bytes20 (), []byte {}, 0 , balance )
946946 tracer .CaptureExit ([]byte {}, 0 , nil )
947947 }
948- if interpreter .evm .chainRules .IsPrague {
949- contractAddr := scope .Contract .Address ()
950- beneficiaryAddr := beneficiary .Bytes20 ()
951- // If the beneficiary isn't the contract, we need to touch the beneficiary's balance.
952- // If the beneficiary is the contract itself, there're two possibilities:
953- // 1. The contract was created in the same transaction: the balance is already touched (no need to touch again)
954- // 2. The contract wasn't created in the same transaction: there's no net change in balance,
955- // and SELFDESTRUCT will perform no action on the account header. (we touch since we did SubBalance+AddBalance above)
956- if contractAddr != beneficiaryAddr || interpreter .evm .StateDB .WasCreatedInCurrentTx (contractAddr ) {
957- statelessGas := interpreter .evm .Accesses .TouchAddressOnReadAndComputeGas (beneficiaryAddr [:], uint256.Int {}, utils .BalanceLeafKey )
958- if ! scope .Contract .UseGas (statelessGas ) {
959- scope .Contract .Gas = 0
960- return nil , ErrOutOfGas
961- }
962- }
963- }
964948 return nil , errStopToken
965949}
966950
@@ -977,6 +961,22 @@ func opSelfdestruct6780(pc *uint64, interpreter *EVMInterpreter, scope *ScopeCon
977961 tracer .CaptureEnter (SELFDESTRUCT , scope .Contract .Address (), beneficiary .Bytes20 (), []byte {}, 0 , balance )
978962 tracer .CaptureExit ([]byte {}, 0 , nil )
979963 }
964+ if interpreter .evm .chainRules .IsPrague {
965+ contractAddr := scope .Contract .Address ()
966+ beneficiaryAddr := beneficiary .Bytes20 ()
967+ // If the beneficiary isn't the contract, we need to touch the beneficiary's balance.
968+ // If the beneficiary is the contract itself, there're two possibilities:
969+ // 1. The contract was created in the same transaction: the balance is already touched (no need to touch again)
970+ // 2. The contract wasn't created in the same transaction: there's no net change in balance,
971+ // and SELFDESTRUCT will perform no action on the account header. (we touch since we did SubBalance+AddBalance above)
972+ if contractAddr != beneficiaryAddr || interpreter .evm .StateDB .WasCreatedInCurrentTx (contractAddr ) {
973+ statelessGas := interpreter .evm .Accesses .TouchAddressOnReadAndComputeGas (beneficiaryAddr [:], uint256.Int {}, utils .BalanceLeafKey )
974+ if ! scope .Contract .UseGas (statelessGas ) {
975+ scope .Contract .Gas = 0
976+ return nil , ErrOutOfGas
977+ }
978+ }
979+ }
980980 return nil , errStopToken
981981}
982982
0 commit comments