core, eth/tracer/js: fix failing tests

This commit is contained in:
Gary Rong 2024-11-26 14:07:33 +08:00
parent cafdfc6982
commit 0e69f7ad5c
4 changed files with 5 additions and 5 deletions

View file

@ -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()
}

View file

@ -54,8 +54,7 @@ type VMContext struct {
BlockNumber *big.Int
Time uint64
Random *common.Hash
// Effective tx gas price
GasPrice *big.Int
BaseFee *big.Int
StateDB StateDB
}

View file

@ -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,
}
}

View file

@ -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