Skip to content

Commit

Permalink
improve check block old detection (#10733)
Browse files Browse the repository at this point in the history
* Improve check block too old detection

* extract var and add exploratory comment

* improve string

* proper extract var

* update log
  • Loading branch information
infiloop2 authored Sep 20, 2023
1 parent 1bbf996 commit 5129a99
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,11 @@ func (r *EvmRegistry) checkUpkeeps(ctx context.Context, payloads []ocr2keepers.U
if req.Error != nil {
latestBlock := r.bs.latestBlock.Load()
checkBlock, _, _ := r.getBlockAndUpkeepId(payloads[index].UpkeepID, payloads[index].Trigger)
// primitive way of checking errors
if strings.Contains(req.Error.Error(), "header not found") && int64(latestBlock.Number)-checkBlock.Int64() > checkBlockTooOldRange {
// Exploratory: remove reliance on primitive way of checking errors
blockNotFound := (strings.Contains(req.Error.Error(), "header not found") || strings.Contains(req.Error.Error(), "missing trie node"))
if blockNotFound && int64(latestBlock.Number)-checkBlock.Int64() > checkBlockTooOldRange {
// Check block not found in RPC and it is too old, non-retryable error
r.lggr.Warnf("header not found error encountered in check result for upkeepId %s, check block %d, latest block %d: %s", results[index].UpkeepID.String(), checkBlock.Int64(), int64(latestBlock.Number), req.Error)
r.lggr.Warnf("block not found error encountered in check result for upkeepId %s, check block %d, latest block %d: %s", results[index].UpkeepID.String(), checkBlock.Int64(), int64(latestBlock.Number), req.Error)
results[index].Retryable = false
results[index].PipelineExecutionState = uint8(encoding.CheckBlockTooOld)
} else {
Expand Down

0 comments on commit 5129a99

Please sign in to comment.