mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
Create new block context for each parallel task
This commit is contained in:
parent
48c1f9078d
commit
5860b8e89c
1 changed files with 10 additions and 11 deletions
|
|
@ -88,8 +88,7 @@ type ExecutionTask struct {
|
|||
// next k elements in dependencies -> transaction indexes on which transaction i is dependent on
|
||||
dependencies []int
|
||||
|
||||
blockContext vm.BlockContext
|
||||
coinbase common.Address
|
||||
coinbase common.Address
|
||||
}
|
||||
|
||||
func (task *ExecutionTask) Execute(mvh *blockstm.MVHashMap, incarnation int) (err error) {
|
||||
|
|
@ -98,7 +97,9 @@ func (task *ExecutionTask) Execute(mvh *blockstm.MVHashMap, incarnation int) (er
|
|||
task.statedb.SetMVHashmap(mvh)
|
||||
task.statedb.SetIncarnation(incarnation)
|
||||
|
||||
evm := vm.NewEVM(task.blockContext, vm.TxContext{}, task.statedb, task.config, task.evmConfig)
|
||||
blockContext := NewEVMBlockContext(task.header, task.blockChain, nil)
|
||||
|
||||
evm := vm.NewEVM(blockContext, vm.TxContext{}, task.statedb, task.config, task.evmConfig)
|
||||
|
||||
// Create a new context to be used in the EVM environment.
|
||||
txContext := NewEVMTxContext(task.msg)
|
||||
|
|
@ -125,8 +126,8 @@ func (task *ExecutionTask) Execute(mvh *blockstm.MVHashMap, incarnation int) (er
|
|||
|
||||
reads := task.statedb.MVReadMap()
|
||||
|
||||
if _, ok := reads[blockstm.NewSubpathKey(task.blockContext.Coinbase, state.BalancePath)]; ok {
|
||||
log.Info("Coinbase is in MVReadMap", "address", task.blockContext.Coinbase)
|
||||
if _, ok := reads[blockstm.NewSubpathKey(blockContext.Coinbase, state.BalancePath)]; ok {
|
||||
log.Info("Coinbase is in MVReadMap", "address", blockContext.Coinbase)
|
||||
|
||||
task.shouldRerunWithoutFeeDelay = true
|
||||
}
|
||||
|
|
@ -304,8 +305,6 @@ func (p *ParallelStateProcessor) Process(block *types.Block, statedb *state.Stat
|
|||
metadata = true
|
||||
}
|
||||
|
||||
blockContext := NewEVMBlockContext(header, p.bc, nil)
|
||||
|
||||
// Iterate over and process the individual transactions
|
||||
for i, tx := range block.Transactions() {
|
||||
msg, err := tx.AsMessage(types.MakeSigner(p.config, header.Number), header.BaseFee)
|
||||
|
|
@ -340,8 +339,6 @@ func (p *ParallelStateProcessor) Process(block *types.Block, statedb *state.Stat
|
|||
receipts: &receipts,
|
||||
allLogs: &allLogs,
|
||||
dependencies: deps[i],
|
||||
blockContext: blockContext,
|
||||
coinbase: coinbase,
|
||||
}
|
||||
|
||||
tasks = append(tasks, task)
|
||||
|
|
@ -365,7 +362,6 @@ func (p *ParallelStateProcessor) Process(block *types.Block, statedb *state.Stat
|
|||
receipts: &receipts,
|
||||
allLogs: &allLogs,
|
||||
dependencies: nil,
|
||||
blockContext: blockContext,
|
||||
coinbase: coinbase,
|
||||
}
|
||||
|
||||
|
|
@ -419,7 +415,10 @@ func (p *ParallelStateProcessor) Process(block *types.Block, statedb *state.Stat
|
|||
}
|
||||
|
||||
if err != nil {
|
||||
log.Error("blockstm error executing block", "err", err)
|
||||
if err != context.Canceled {
|
||||
log.Error("blockstm error executing block", "err", err)
|
||||
}
|
||||
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue