Skip to content

Commit

Permalink
internal/ethapi: don't estimate gas if no limit provided in eth_creat…
Browse files Browse the repository at this point in the history
…eAccessList (ethereum#25467)
  • Loading branch information
gzliudan committed Jun 17, 2024
1 parent 50c56f6 commit 22f29d1
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1998,9 +1998,11 @@ func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrH
}
owner := common.Address{}

// If the gas amount is not set, extract this as it will depend on access
// lists and we'll need to reestimate every time
nogas := args.Gas == nil
// If the gas amount is not set, default to RPC gas cap.
if args.Gas == nil {
tmp := hexutil.Uint64(b.RPCGasCap())
args.Gas = &tmp
}

// Ensure any missing fields are filled, extract the recipient and input data
if err := args.setDefaults(ctx, b); err != nil {
Expand All @@ -2025,15 +2027,6 @@ func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrH
accessList := prevTracer.AccessList()
log.Trace("Creating access list", "input", accessList)

// If no gas amount was specified, each unique access list needs it's own
// gas calculation. This is quite expensive, but we need to be accurate
// and it's convered by the sender only anyway.
if nogas {
args.Gas = nil
if err := args.setDefaults(ctx, b); err != nil {
return nil, 0, nil, err // shouldn't happen, just in case
}
}
// Copy the original db so we don't modify it
statedb := db.Copy()
// Set the accesslist to the last al
Expand Down

0 comments on commit 22f29d1

Please sign in to comment.