From beaf39174f18f9e2e7778f40f6efc4aae47061a7 Mon Sep 17 00:00:00 2001 From: Roberto Bayardo Date: Fri, 17 Mar 2023 08:24:50 -0700 Subject: [PATCH] Update core/gaspool.go Co-authored-by: Inphi --- cmd/evm/internal/t8ntool/execution.go | 8 +++++--- core/gaspool.go | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/evm/internal/t8ntool/execution.go b/cmd/evm/internal/t8ntool/execution.go index 4cc6b7c84606..2e692f244ae8 100644 --- a/cmd/evm/internal/t8ntool/execution.go +++ b/cmd/evm/internal/t8ntool/execution.go @@ -188,9 +188,10 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig, statedb.SetTxContext(tx.Hash(), txIndex) var ( - txContext = core.NewEVMTxContext(msg) - snapshot = statedb.Snapshot() - prevGas = gaspool.Gas() + txContext = core.NewEVMTxContext(msg) + snapshot = statedb.Snapshot() + prevGas = gaspool.Gas() + prevDataGas = gaspool.DataGas() ) evm := vm.NewEVM(vmContext, txContext, statedb, chainConfig, vmConfig) @@ -201,6 +202,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig, log.Info("rejected tx", "index", i, "hash", tx.Hash(), "from", msg.From, "error", err) rejectedTxs = append(rejectedTxs, &rejectedTx{i, err.Error()}) gaspool.SetGas(prevGas) + gaspool.SetDataGas(prevDataGas) continue } includedTxs = append(includedTxs, tx) diff --git a/core/gaspool.go b/core/gaspool.go index 1ff6eae649eb..df9b782d4ca5 100644 --- a/core/gaspool.go +++ b/core/gaspool.go @@ -80,7 +80,7 @@ func (gp *GasPool) SetGas(gas uint64) { gp.gas = gas } -// SetGas sets the amount of data gas with the provided number. +// SetDataGas sets the amount of data gas with the provided number. func (gp *GasPool) SetDataGas(dataGas uint64) { gp.dataGas = dataGas }