Skip to content

Commit

Permalink
internal/ethapi: use overriden baseFee for gasPrice (#29051)
Browse files Browse the repository at this point in the history
commit ethereum/go-ethereum@e47a7c2.

eth_call and debug_traceCall allow users to override various block fields,
among them base fee. However the overriden base fee was not considered for
computing the effective gas price of that message, and instead base fee of the
base block was used. This has been fixed in this commit.
  • Loading branch information
ArtificialPB authored and minh-bq committed Jan 21, 2025
1 parent 830b35c commit 982b893
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion eth/tracers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc
config.BlockOverrides.Apply(&vmctx)
}
// Execute the trace
msg, err := args.ToMessage(api.backend.RPCGasCap(), block.BaseFee())
msg, err := args.ToMessage(api.backend.RPCGasCap(), vmctx.BaseFee)
if err != nil {
return nil, err
}
Expand Down
8 changes: 4 additions & 4 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1054,14 +1054,14 @@ func doCall(
defer cancel()

// Get a new instance of the EVM.
msg, err := args.ToMessage(globalGasCap, header.BaseFee)
if err != nil {
return nil, err
}
blockCtx := core.NewEVMBlockContext(header, NewChainContext(ctx, b), nil)
if blockOverrides != nil {
blockOverrides.Apply(&blockCtx)
}
msg, err := args.ToMessage(globalGasCap, blockCtx.BaseFee)
if err != nil {
return nil, err
}
evm, vmError, err := b.GetEVM(ctx, msg, state, header, &vm.Config{NoBaseFee: true}, &blockCtx)
if err != nil {
return nil, err
Expand Down

0 comments on commit 982b893

Please sign in to comment.