Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ferranbt committed Feb 26, 2024
1 parent a1188d0 commit fbd21bf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,8 @@ func DoCall(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash
args.KettleAddress = &acc
}

// DoCall is also used in EstimateGas which does not have to include
// gas parameters or nonce. We need to set them to default values.
args.setDefaults(ctx, b)
tx := args.ToTransaction()

Expand All @@ -1048,6 +1050,9 @@ func DoCall(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash
SkipAccountChecks: true,
}

// Run the MEVM but unlike with the send transaction endpoint, do not
// finalize the transactional store (third callback param). Otherwise,
// the updated kv entries will be committed to the store.
_, result, _, err := runMEVM(ctx, b, state, header, tx, msg, true)
if err != nil {
return nil, err
Expand Down Expand Up @@ -2017,7 +2022,10 @@ func runMEVM(ctx context.Context, b Backend, state *state.StateDB, header *types
}

if result.Failed() {
return nil, result, storeFinalize, nil
// If the execution fails we do not return an error but the transaction result itself
// since some callers of this function (i.e. estimate gas) differentiate between
// unrecoverable errors (i.e. nonce is incorrect) and failed executions.
return nil, result, nil, nil
}

if storageAccessTracer.hasStoredState {
Expand Down
1 change: 1 addition & 0 deletions internal/ethapi/transaction_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b Backend) erro
return nil
}
// Now attempt to fill in default value depending on whether London is active or not.
// Confidential requests do not use London pricing rules.
head := b.CurrentHeader()
if b.ChainConfig().IsLondon(head.Number) && !args.IsConfidential {
// London is active, set maxPriorityFeePerGas and maxFeePerGas.
Expand Down

0 comments on commit fbd21bf

Please sign in to comment.