From 47b566266cb4a177145436139ea6c08eb8b9d5c5 Mon Sep 17 00:00:00 2001 From: gop Date: Wed, 21 Aug 2024 12:42:41 -0500 Subject: [PATCH] Doing refund on OpSuicide based on the current state size and the block base fee --- core/vm/instructions.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/vm/instructions.go b/core/vm/instructions.go index b75868c036..f3f52f5e53 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -19,6 +19,7 @@ package vm import ( "fmt" "math" + "math/big" "github.com/dominant-strategies/go-quai/common" "github.com/dominant-strategies/go-quai/core/types" @@ -831,6 +832,8 @@ func opSuicide(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([] } balance := interpreter.evm.StateDB.GetBalance(addr) interpreter.evm.StateDB.AddBalance(beneficiaryAddr, balance) + refund := new(big.Int).Mul(interpreter.evm.Context.BaseFee, new(big.Int).SetUint64(params.CallNewAccountGas(interpreter.evm.Context.QuaiStateSize))) + interpreter.evm.StateDB.AddBalance(beneficiaryAddr, refund) interpreter.evm.StateDB.Suicide(addr) return nil, nil }