mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
e3: apply inline-retry (#6336)
This commit is contained in:
parent
43f83cd7d8
commit
d95f0ca51e
@ -70,11 +70,17 @@ func NewWorker(lock sync.Locker, ctx context.Context, background bool, chainDb k
|
||||
starkNetEvm: &vm.CVMAdapter{Cvm: vm.NewCVM(nil)},
|
||||
evm: vm.NewEVM(evmtypes.BlockContext{}, evmtypes.TxContext{}, nil, chainConfig, vm.Config{}),
|
||||
}
|
||||
w.getHeader = func(hash common.Hash, number uint64) *types.Header {
|
||||
h, err := blockReader.Header(ctx, w.chainTx, hash, number)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
||||
w.ibs = state.New(w.stateReader)
|
||||
|
||||
w.posa, w.isPoSA = engine.(consensus.PoSA)
|
||||
|
||||
return w
|
||||
}
|
||||
|
||||
@ -186,7 +192,12 @@ func (rw *Worker) RunTxTask(txTask *exec22.TxTask) {
|
||||
rw.starkNetEvm.Reset(evmtypes.TxContext{}, ibs)
|
||||
vmenv = rw.starkNetEvm
|
||||
} else {
|
||||
rw.evm.ResetBetweenBlocks(txTask.EvmBlockContext, core.NewEVMTxContext(msg), ibs, vmConfig, txTask.Rules)
|
||||
blockContext := txTask.EvmBlockContext
|
||||
if !rw.background {
|
||||
getHashFn := core.GetHashFn(header, rw.getHeader)
|
||||
blockContext = core.NewEVMBlockContext(header, getHashFn, rw.engine, nil /* author */)
|
||||
}
|
||||
rw.evm.ResetBetweenBlocks(blockContext, core.NewEVMTxContext(msg), ibs, vmConfig, txTask.Rules)
|
||||
vmenv = rw.evm
|
||||
}
|
||||
applyRes, err := core.ApplyMessage(vmenv, msg, gp, true /* refunds */, false /* gasBailout */)
|
||||
|
@ -717,10 +717,15 @@ func processResultQueue(rws *exec22.TxTaskQueue, outputTxNum *atomic2.Uint64, rs
|
||||
txTask = heap.Pop(rws).(*exec22.TxTask)
|
||||
resultsSize.Add(-txTask.ResultsSize)
|
||||
if txTask.Error != nil || !rs.ReadsValid(txTask.ReadLists) {
|
||||
rs.AddWork(txTask)
|
||||
repeatCount.Inc()
|
||||
continue
|
||||
//fmt.Printf("Rolled back %d block %d txIndex %d\n", txTask.TxNum, txTask.BlockNum, txTask.TxIndex)
|
||||
|
||||
// immediately retry once
|
||||
applyWorker.RunTxTask(txTask)
|
||||
if txTask.Error != nil {
|
||||
//log.Info("second fail", "blk", txTask.BlockNum, "txn", txTask.BlockNum)
|
||||
rs.AddWork(txTask)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if err := rs.ApplyState(applyTx, txTask, agg); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user