From 0e69f7ad5caa1983d7efc696e251abc46a77da43 Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Tue, 26 Nov 2024 14:07:33 +0800 Subject: [PATCH] core, eth/tracer/js: fix failing tests --- core/state_transition.go | 1 + core/tracing/hooks.go | 5 ++--- core/vm/evm.go | 2 +- eth/tracers/js/goja.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/state_transition.go b/core/state_transition.go index f70bfa1b98..cb7d71efcb 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -188,6 +188,7 @@ func TransactionToMessage(tx *types.Transaction, s types.Signer, baseFee *big.In // state and would never be accepted within a block. func ApplyMessage(evm *vm.EVM, msg *Message, gp *GasPool) (*ExecutionResult, error) { evm.SetTxContext(NewEVMTxContext(msg)) + return NewStateTransition(evm, msg, gp).TransitionDb() } diff --git a/core/tracing/hooks.go b/core/tracing/hooks.go index a21bb1577b..13e0b8b1aa 100644 --- a/core/tracing/hooks.go +++ b/core/tracing/hooks.go @@ -54,9 +54,8 @@ type VMContext struct { BlockNumber *big.Int Time uint64 Random *common.Hash - // Effective tx gas price - GasPrice *big.Int - StateDB StateDB + BaseFee *big.Int + StateDB StateDB } // BlockEvent is emitted upon tracing an incoming block. diff --git a/core/vm/evm.go b/core/vm/evm.go index 34e5fa766b..07e4a272fa 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -605,7 +605,7 @@ func (evm *EVM) GetVMContext() *tracing.VMContext { BlockNumber: evm.Context.BlockNumber, Time: evm.Context.Time, Random: evm.Context.Random, - GasPrice: evm.TxContext.GasPrice, + BaseFee: evm.Context.BaseFee, StateDB: evm.StateDB, } } diff --git a/eth/tracers/js/goja.go b/eth/tracers/js/goja.go index 35abd00017..227ea57226 100644 --- a/eth/tracers/js/goja.go +++ b/eth/tracers/js/goja.go @@ -260,7 +260,7 @@ func (t *jsTracer) OnTxStart(env *tracing.VMContext, tx *types.Transaction, from t.activePrecompiles = vm.ActivePrecompiles(rules) t.ctx["block"] = t.vm.ToValue(t.env.BlockNumber.Uint64()) t.ctx["gas"] = t.vm.ToValue(tx.Gas()) - gasPriceBig, err := t.toBig(t.vm, env.GasPrice.String()) + gasPriceBig, err := t.toBig(t.vm, tx.EffectiveGasTipValue(env.BaseFee).String()) if err != nil { t.err = err return