Skip to content

Commit ed5fc16

Browse files
committed
eth/tracers, internal/ethapi: refactor ToMessage
SkipFromEOACheck was always passed as true, so the parameter can be removed.
1 parent fdaff4e commit ed5fc16

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

eth/tracers/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc
984984
return nil, err
985985
}
986986
var (
987-
msg = args.ToMessage(blockContext.BaseFee, true, true)
987+
msg = args.ToMessage(blockContext.BaseFee, true)
988988
tx = args.ToTransaction(types.LegacyTxType)
989989
traceConfig *TraceConfig
990990
)

internal/ethapi/api.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -699,15 +699,15 @@ func doCall(ctx context.Context, b Backend, args TransactionArgs, state *state.S
699699
} else {
700700
gp.AddGas(globalGasCap)
701701
}
702-
return applyMessage(ctx, b, args, state, header, timeout, gp, &blockCtx, &vm.Config{NoBaseFee: true}, precompiles, true)
702+
return applyMessage(ctx, b, args, state, header, timeout, gp, &blockCtx, &vm.Config{NoBaseFee: true}, precompiles)
703703
}
704704

705-
func applyMessage(ctx context.Context, b Backend, args TransactionArgs, state *state.StateDB, header *types.Header, timeout time.Duration, gp *core.GasPool, blockContext *vm.BlockContext, vmConfig *vm.Config, precompiles vm.PrecompiledContracts, skipChecks bool) (*core.ExecutionResult, error) {
705+
func applyMessage(ctx context.Context, b Backend, args TransactionArgs, state *state.StateDB, header *types.Header, timeout time.Duration, gp *core.GasPool, blockContext *vm.BlockContext, vmConfig *vm.Config, precompiles vm.PrecompiledContracts) (*core.ExecutionResult, error) {
706706
// Get a new instance of the EVM.
707707
if err := args.CallDefaults(gp.Gas(), blockContext.BaseFee, b.ChainConfig().ChainID); err != nil {
708708
return nil, err
709709
}
710-
msg := args.ToMessage(header.BaseFee, skipChecks, skipChecks)
710+
msg := args.ToMessage(header.BaseFee, true)
711711
// Lower the basefee to 0 to avoid breaking EVM
712712
// invariants (basefee < feecap).
713713
if msg.GasPrice.Sign() == 0 {
@@ -858,7 +858,7 @@ func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNr
858858
if err := args.CallDefaults(gasCap, header.BaseFee, b.ChainConfig().ChainID); err != nil {
859859
return 0, err
860860
}
861-
call := args.ToMessage(header.BaseFee, true, true)
861+
call := args.ToMessage(header.BaseFee, true)
862862

863863
// Run the gas estimation and wrap any revertals into a custom return
864864
estimate, revert, err := gasestimator.Estimate(ctx, call, opts, gasCap)
@@ -1301,7 +1301,7 @@ func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrH
13011301
statedb := db.Copy()
13021302
// Set the accesslist to the last al
13031303
args.AccessList = &accessList
1304-
msg := args.ToMessage(header.BaseFee, true, true)
1304+
msg := args.ToMessage(header.BaseFee, true)
13051305

13061306
// Apply the transaction with the access list tracer
13071307
tracer := logger.NewAccessListTracer(accessList, addressesToExclude)

internal/ethapi/simulate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header,
287287
tracer.reset(txHash, uint(i))
288288
sim.state.SetTxContext(txHash, i)
289289
// EoA check is always skipped, even in validation mode.
290-
msg := call.ToMessage(header.BaseFee, !sim.validate, true)
290+
msg := call.ToMessage(header.BaseFee, !sim.validate)
291291
result, err := applyMessageWithEVM(ctx, evm, msg, timeout, sim.gp)
292292
if err != nil {
293293
txErr := txValidationError(err)

internal/ethapi/transaction_args.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ func (args *TransactionArgs) CallDefaults(globalGasCap uint64, baseFee *big.Int,
443443
// core evm. This method is used in calls and traces that do not require a real
444444
// live transaction.
445445
// Assumes that fields are not nil, i.e. setDefaults or CallDefaults has been called.
446-
func (args *TransactionArgs) ToMessage(baseFee *big.Int, skipNonceCheck, skipEoACheck bool) *core.Message {
446+
func (args *TransactionArgs) ToMessage(baseFee *big.Int, skipNonceCheck bool) *core.Message {
447447
var (
448448
gasPrice *big.Int
449449
gasFeeCap *big.Int
@@ -491,8 +491,7 @@ func (args *TransactionArgs) ToMessage(baseFee *big.Int, skipNonceCheck, skipEoA
491491
BlobHashes: args.BlobHashes,
492492
SetCodeAuthorizations: args.AuthorizationList,
493493
SkipNonceChecks: skipNonceCheck,
494-
SkipFromEOACheck: skipEoACheck,
495-
SkipTxGasLimitCheck: true,
494+
SkipTransactionChecks: true,
496495
}
497496
}
498497

0 commit comments

Comments
 (0)