Skip to content

Commit

Permalink
historicalTraceWorker: add logs and small fix (#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
blxdyx authored Jan 8, 2025
1 parent 3b99128 commit a53da48
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions cmd/state/exec3/historical_trace_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,15 @@ func processResultQueueHistorical(consumer TraceConsumer, rws *state.ResultsQueu
stopedAtBlockEnd = txTask.Final

if txTask.Error != nil {
log.Error("txTask exec error", "block", txTask.BlockNum, "txIndex", txTask.TxIndex, "err", txTask.Error)
return outputTxNum, false, txTask.Error
}

if txTask.TxIndex >= 0 && !txTask.Final {
txTask.CreateReceipt(tx)
}
if err := consumer.Reduce(txTask, tx); err != nil {
log.Error("Reduce exec error", "block", txTask.BlockNum, "txIndex", txTask.TxIndex, "err", err)
return outputTxNum, false, err
}

Expand Down
4 changes: 3 additions & 1 deletion consensus/parlia/feynmanfork.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ func (p *Parlia) updateValidatorSetV2(chain consensus.ChainHeaderReader, ibs *st
return true, err
}

_, historyMode := ibs.StateReader.(*state.HistoryReaderV3)

// On case exec at middle of block, the cache is nil.
if validatorItemsCache == nil && maxElectedValidatorsCache == big.NewInt(0) {
if historyMode || (validatorItemsCache == nil && maxElectedValidatorsCache == big.NewInt(0)) {
data = (*txs)[*curIndex].GetData()
}

Expand Down
3 changes: 1 addition & 2 deletions consensus/parlia/parlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ func (p *Parlia) finalize(header *types.Header, ibs *state.IntraBlockState, txs
if txIndex == len(txs)-1 && finish {
if fs := finality.GetFinalizationService(); fs != nil {
curSnap, _ := p.snapshot(chain, number, header.Hash(), nil, true)
if curSnap.Attestation != nil {
if curSnap != nil && curSnap.Attestation != nil {
fs.UpdateFinality(curSnap.Attestation.SourceHash, curSnap.Attestation.TargetHash)
}
}
Expand Down Expand Up @@ -1436,7 +1436,6 @@ func (p *Parlia) distributeToSystem(val libcommon.Address, ibs *state.IntraBlock
func (p *Parlia) distributeToValidator(val libcommon.Address, ibs *state.IntraBlockState, header *types.Header,
txs *types.Transactions, receipts *types.Receipts, systemTxs *types.Transactions,
usedGas *uint64, mining bool, systemTxCall consensus.SystemTxCall, curIndex, txIndex *int) (bool, error) {

if *curIndex == *txIndex {
bal, err := ibs.GetBalance(consensus.SystemAddress)
if err != nil {
Expand Down

0 comments on commit a53da48

Please sign in to comment.