Skip to content

Commit

Permalink
eth/tracers,internal/ethapi: use correct baseFee when BlockOverrides …
Browse files Browse the repository at this point in the history
…is provided in call/traceCall (ethereum#29051)
  • Loading branch information
gzliudan committed Aug 19, 2024
1 parent fd14169 commit f7cef6d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions eth/api_tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,8 @@ func (api *PrivateDebugAPI) TraceCall(ctx context.Context, args ethapi.Transacti
}
}
// Execute the trace
// TODO: replace block.BaseFee() with vmctx.BaseFee
// reference: https://github.com/ethereum/go-ethereum/pull/29051
msg, err := args.ToMessage(api.eth.ApiBackend, block.Number(), api.eth.ApiBackend.RPCGasCap(), block.BaseFee())
if err != nil {
return nil, err
Expand Down
14 changes: 8 additions & 6 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1330,12 +1330,6 @@ func DoCall(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash
return nil, 0, false, err, nil
}

msg, err := args.ToMessage(b, header.Number, globalGasCap, header.BaseFee)
if err != nil {
return nil, 0, false, err, nil
}
msg.SetBalanceTokenFeeForCall()

// Setup context so it may be cancelled the call has completed
// or, in case of unmetered gas, setup a context with a timeout.
var cancel context.CancelFunc
Expand Down Expand Up @@ -1364,6 +1358,14 @@ func DoCall(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash
return nil, 0, false, err, nil
}

// TODO: replace header.BaseFee with blockCtx.BaseFee
// reference: https://github.com/ethereum/go-ethereum/pull/29051
msg, err := args.ToMessage(b, header.Number, globalGasCap, header.BaseFee)
if err != nil {
return nil, 0, false, err, nil
}
msg.SetBalanceTokenFeeForCall()

// Get a new instance of the EVM.
evm, vmError, err := b.GetEVM(ctx, msg, statedb, XDCxState, header, &vm.Config{NoBaseFee: true})
if err != nil {
Expand Down

0 comments on commit f7cef6d

Please sign in to comment.