mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-31 12:08:37 +00:00
remove unused error return from core.PreExecution
This commit is contained in:
parent
3bfba9bc2a
commit
22adcf749c
5 changed files with 15 additions and 28 deletions
|
|
@ -86,9 +86,7 @@ func (p *StateProcessor) Process(ctx context.Context, block *types.Block, stated
|
||||||
)
|
)
|
||||||
defer evm.Release()
|
defer evm.Release()
|
||||||
// Run the pre-execution system calls
|
// Run the pre-execution system calls
|
||||||
if err := PreExecution(ctx, block.BeaconRoot(), block.ParentHash(), config, evm, block.Number(), block.Time()); err != nil {
|
PreExecution(ctx, block.BeaconRoot(), block.ParentHash(), config, evm, block.Number(), block.Time())
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
// Iterate over and process the individual transactions
|
// Iterate over and process the individual transactions
|
||||||
for i, tx := range block.Transactions() {
|
for i, tx := range block.Transactions() {
|
||||||
msg, err := TransactionToMessage(tx, signer, header.BaseFee)
|
msg, err := TransactionToMessage(tx, signer, header.BaseFee)
|
||||||
|
|
@ -127,7 +125,7 @@ func (p *StateProcessor) Process(ctx context.Context, block *types.Block, stated
|
||||||
}
|
}
|
||||||
|
|
||||||
// PreExecution processes pre-execution system calls.
|
// PreExecution processes pre-execution system calls.
|
||||||
func PreExecution(ctx context.Context, beaconRoot *common.Hash, parent common.Hash, config *params.ChainConfig, evm *vm.EVM, number *big.Int, time uint64) error {
|
func PreExecution(ctx context.Context, beaconRoot *common.Hash, parent common.Hash, config *params.ChainConfig, evm *vm.EVM, number *big.Int, time uint64) {
|
||||||
_, _, spanEnd := telemetry.StartSpan(ctx, "core.preExecution")
|
_, _, spanEnd := telemetry.StartSpan(ctx, "core.preExecution")
|
||||||
defer spanEnd(nil)
|
defer spanEnd(nil)
|
||||||
|
|
||||||
|
|
@ -139,7 +137,6 @@ func PreExecution(ctx context.Context, beaconRoot *common.Hash, parent common.Ha
|
||||||
if config.IsPrague(number, time) || config.IsUBT(number, time) {
|
if config.IsPrague(number, time) || config.IsUBT(number, time) {
|
||||||
ProcessParentBlockHash(parent, evm)
|
ProcessParentBlockHash(parent, evm)
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PostExecution processes post-execution system calls when Prague is enabled.
|
// PostExecution processes post-execution system calls when Prague is enabled.
|
||||||
|
|
|
||||||
|
|
@ -250,9 +250,8 @@ func (eth *Ethereum) stateAtTransaction(ctx context.Context, block *types.Block,
|
||||||
defer evm.Release()
|
defer evm.Release()
|
||||||
|
|
||||||
// Run pre-execution system calls
|
// Run pre-execution system calls
|
||||||
if err := core.PreExecution(ctx, block.BeaconRoot(), block.ParentHash(), eth.blockchain.Config(), evm, block.Number(), block.Time()); err != nil {
|
core.PreExecution(ctx, block.BeaconRoot(), block.ParentHash(), eth.blockchain.Config(), evm, block.Number(), block.Time())
|
||||||
return nil, vm.BlockContext{}, nil, nil, err
|
|
||||||
}
|
|
||||||
if txIndex == 0 && len(block.Transactions()) == 0 {
|
if txIndex == 0 && len(block.Transactions()) == 0 {
|
||||||
return nil, context, statedb, release, nil
|
return nil, context, statedb, release, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -372,12 +372,9 @@ func (api *API) traceChain(start, end *types.Block, config *TraceConfig, closed
|
||||||
// as per EIP-4788.
|
// as per EIP-4788.
|
||||||
context := core.NewEVMBlockContext(next.Header(), api.chainContext(ctx), nil)
|
context := core.NewEVMBlockContext(next.Header(), api.chainContext(ctx), nil)
|
||||||
evm := vm.NewEVM(context, statedb, api.backend.ChainConfig(), vm.Config{})
|
evm := vm.NewEVM(context, statedb, api.backend.ChainConfig(), vm.Config{})
|
||||||
|
defer evm.Release()
|
||||||
|
|
||||||
if err := core.PreExecution(ctx, next.BeaconRoot(), next.ParentHash(), api.backend.ChainConfig(), evm, next.Number(), next.Time()); err != nil {
|
core.PreExecution(ctx, next.BeaconRoot(), next.ParentHash(), api.backend.ChainConfig(), evm, next.Number(), next.Time())
|
||||||
failed = err
|
|
||||||
break
|
|
||||||
}
|
|
||||||
evm.Release()
|
|
||||||
// Clean out any pending release functions of trace state. Note this
|
// Clean out any pending release functions of trace state. Note this
|
||||||
// step must be done after constructing tracing state, because the
|
// step must be done after constructing tracing state, because the
|
||||||
// tracing state of block next depends on the parent state and construction
|
// tracing state of block next depends on the parent state and construction
|
||||||
|
|
@ -527,9 +524,8 @@ func (api *API) IntermediateRoots(ctx context.Context, hash common.Hash, config
|
||||||
)
|
)
|
||||||
defer evm.Release()
|
defer evm.Release()
|
||||||
// Run pre-execution system calls
|
// Run pre-execution system calls
|
||||||
if err := core.PreExecution(ctx, block.BeaconRoot(), block.ParentHash(), chainConfig, evm, block.Number(), block.Time()); err != nil {
|
core.PreExecution(ctx, block.BeaconRoot(), block.ParentHash(), chainConfig, evm, block.Number(), block.Time())
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
for i, tx := range block.Transactions() {
|
for i, tx := range block.Transactions() {
|
||||||
if err := ctx.Err(); err != nil {
|
if err := ctx.Err(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -588,9 +584,8 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
|
||||||
defer evm.Release()
|
defer evm.Release()
|
||||||
|
|
||||||
// Run pre-execution system calls
|
// Run pre-execution system calls
|
||||||
if err := core.PreExecution(ctx, block.BeaconRoot(), block.ParentHash(), api.backend.ChainConfig(), evm, block.Number(), block.Time()); err != nil {
|
core.PreExecution(ctx, block.BeaconRoot(), block.ParentHash(), api.backend.ChainConfig(), evm, block.Number(), block.Time())
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
// JS tracers have high overhead. In this case run a parallel
|
// JS tracers have high overhead. In this case run a parallel
|
||||||
// process that generates states in one thread and traces txes
|
// process that generates states in one thread and traces txes
|
||||||
// in separate worker threads.
|
// in separate worker threads.
|
||||||
|
|
@ -761,9 +756,8 @@ func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block
|
||||||
defer evm.Release()
|
defer evm.Release()
|
||||||
|
|
||||||
// Run pre-execution system calls
|
// Run pre-execution system calls
|
||||||
if err := core.PreExecution(ctx, block.BeaconRoot(), block.ParentHash(), chainConfig, evm, block.Number(), block.Time()); err != nil {
|
core.PreExecution(ctx, block.BeaconRoot(), block.ParentHash(), chainConfig, evm, block.Number(), block.Time())
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
for i, tx := range block.Transactions() {
|
for i, tx := range block.Transactions() {
|
||||||
// Prepare the transaction for un-traced execution
|
// Prepare the transaction for un-traced execution
|
||||||
msg, _ := core.TransactionToMessage(tx, signer, block.BaseFee())
|
msg, _ := core.TransactionToMessage(tx, signer, block.BaseFee())
|
||||||
|
|
|
||||||
|
|
@ -319,9 +319,8 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header,
|
||||||
evm.SetPrecompiles(precompiles)
|
evm.SetPrecompiles(precompiles)
|
||||||
}
|
}
|
||||||
// Run pre-execution system calls
|
// Run pre-execution system calls
|
||||||
if err := core.PreExecution(ctx, header.ParentBeaconRoot, header.ParentHash, sim.chainConfig, evm, header.Number, header.Time); err != nil {
|
core.PreExecution(ctx, header.ParentBeaconRoot, header.ParentHash, sim.chainConfig, evm, header.Number, header.Time)
|
||||||
return nil, nil, nil, err
|
|
||||||
}
|
|
||||||
var allLogs []*types.Log
|
var allLogs []*types.Log
|
||||||
for i, call := range block.Calls {
|
for i, call := range block.Calls {
|
||||||
// Terminate if the context is cancelled
|
// Terminate if the context is cancelled
|
||||||
|
|
|
||||||
|
|
@ -318,9 +318,7 @@ func (miner *Miner) prepareWork(ctx context.Context, genParams *generateParams,
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// Run pre-execution system calls
|
// Run pre-execution system calls
|
||||||
if err := core.PreExecution(ctx, header.ParentBeaconRoot, header.ParentHash, miner.chainConfig, env.evm, header.Number, header.Time); err != nil {
|
core.PreExecution(ctx, header.ParentBeaconRoot, header.ParentHash, miner.chainConfig, env.evm, header.Number, header.Time)
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return env, nil
|
return env, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue