Skip to content

Commit

Permalink
fix: keep running the whole tipset task without cancel (#1219)
Browse files Browse the repository at this point in the history
* Keep running the whole tipset task without cancel

* Add error to errordetected

---------

Co-authored-by: Terry <[email protected]>
  • Loading branch information
Terryhung and Terry authored Jun 6, 2023
1 parent bdf1d1c commit b86896a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
1 change: 0 additions & 1 deletion chain/indexer/integrated/tipset/tipset.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ func (ti *TipSetIndexer) TipSet(ctx context.Context, ts *types.TipSet) (chan *Re
if res.Error != nil {
llt.Errorw("task returned with error", "error", res.Error.Error())
errCh <- res.Error
return
}
// processor is complete if we receive a result
executingTasks[res.Task] = true
Expand Down
11 changes: 7 additions & 4 deletions tasks/fevm/blockheader/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,27 @@ func (p *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
cid, err := executed.Key().Cid()
if err != nil {
log.Errorf("Error at getting cid: [%v] err: %v", cid, err)
return nil, report, err
report.ErrorsDetected = err
return nil, report, nil
}

hash, err := ethtypes.EthHashFromCid(cid)
if err != nil {
log.Errorf("Error at finding hash: [%v] err: %v", hash, err)
return nil, report, err
report.ErrorsDetected = err
return nil, report, nil
}

ethBlock, err := p.node.EthGetBlockByHash(ctx, hash, false)
if err != nil {
log.Errorf("EthGetBlockByHash: [hash: %v] err: %v", hash.String(), err)
return nil, report, err
report.ErrorsDetected = err
return nil, report, nil
}

if ethBlock.Number == 0 {
log.Warn("block number == 0")
return nil, report, err
return nil, report, nil
}
return &fevm.FEVMBlockHeader{
Height: int64(executed.Height()),
Expand Down
9 changes: 4 additions & 5 deletions tasks/fevm/contract/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ func (p *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut

actorChanges, err := p.node.ActorStateChanges(ctx, current, executed)
if err != nil {
return nil, report, err
report.ErrorsDetected = err
return nil, report, nil
}

out := make(fevm.FEVMContractList, 0)
Expand Down Expand Up @@ -109,10 +110,8 @@ func (p *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
}

if len(errs) > 0 {
err = fmt.Errorf("%v", errs)
} else {
err = nil
report.ErrorsDetected = fmt.Errorf("%v", errs)
}

return model.PersistableList{out}, report, err
return model.PersistableList{out}, report, nil
}
9 changes: 4 additions & 5 deletions tasks/fevm/receipt/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ func (p *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
messages, err := p.node.ChainGetMessagesInTipset(ctx, executed.Key())
if err != nil {
log.Errorf("Error at getting messages. ts: %v, height: %v, err: %v", executed.String(), executed.Height(), err)
return nil, report, err
report.ErrorsDetected = err
return nil, report, nil
}
errs := []error{}
out := make(fevm.FEVMReceiptList, 0)
Expand Down Expand Up @@ -115,10 +116,8 @@ func (p *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
}

if len(errs) > 0 {
err = fmt.Errorf("%v", errs)
} else {
err = nil
report.ErrorsDetected = fmt.Errorf("%v", errs)
}

return model.PersistableList{out}, report, err
return model.PersistableList{out}, report, nil
}
9 changes: 4 additions & 5 deletions tasks/fevm/transaction/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ func (p *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
messages, err := p.node.ChainGetMessagesInTipset(ctx, executed.Key())
if err != nil {
log.Errorf("Error at getting messages. ts: %v, height: %v, err: %v", executed.String(), executed.Height(), err)
return nil, report, err
report.ErrorsDetected = err
return nil, report, nil
}
errs := []error{}
out := make(fevm.FEVMTransactionList, 0)
Expand Down Expand Up @@ -127,10 +128,8 @@ func (p *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
}

if len(errs) > 0 {
err = fmt.Errorf("%v", errs)
} else {
err = nil
report.ErrorsDetected = fmt.Errorf("%v", errs)
}

return model.PersistableList{out}, report, err
return model.PersistableList{out}, report, nil
}

0 comments on commit b86896a

Please sign in to comment.