Skip to content

Commit e47a7c2

Browse files
authored
internal/ethapi: use overriden baseFee for gasPrice (ethereum#29051)
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.
1 parent b590cae commit e47a7c2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

eth/tracers/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc
919919
config.BlockOverrides.Apply(&vmctx)
920920
}
921921
// Execute the trace
922-
msg, err := args.ToMessage(api.backend.RPCGasCap(), block.BaseFee())
922+
msg, err := args.ToMessage(api.backend.RPCGasCap(), vmctx.BaseFee)
923923
if err != nil {
924924
return nil, err
925925
}

internal/ethapi/api.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,14 +1093,14 @@ func doCall(ctx context.Context, b Backend, args TransactionArgs, state *state.S
10931093
defer cancel()
10941094

10951095
// Get a new instance of the EVM.
1096-
msg, err := args.ToMessage(globalGasCap, header.BaseFee)
1097-
if err != nil {
1098-
return nil, err
1099-
}
11001096
blockCtx := core.NewEVMBlockContext(header, NewChainContext(ctx, b), nil)
11011097
if blockOverrides != nil {
11021098
blockOverrides.Apply(&blockCtx)
11031099
}
1100+
msg, err := args.ToMessage(globalGasCap, blockCtx.BaseFee)
1101+
if err != nil {
1102+
return nil, err
1103+
}
11041104
evm := b.GetEVM(ctx, msg, state, header, &vm.Config{NoBaseFee: true}, &blockCtx)
11051105

11061106
// Wait for the context to be done and cancel the evm. Even if the

0 commit comments

Comments
 (0)