Skip to content

Commit

Permalink
Remove check block too new check (#10545)
Browse files Browse the repository at this point in the history
* Remove check block too new check

* fix test

* remove error type
  • Loading branch information
infiloop2 authored Sep 7, 2023
1 parent b22efb8 commit d9cddb8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const (
MercuryUnmarshalError PipelineExecutionState = 6
InvalidMercuryRequest PipelineExecutionState = 7
InvalidMercuryResponse PipelineExecutionState = 8 // this will only happen if Mercury server sends bad responses
CheckBlockTooNew PipelineExecutionState = 9
)

type UpkeepInfo = iregistry21.KeeperRegistryBase21UpkeepInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,6 @@ func (r *EvmRegistry) getBlockHash(blockNumber *big.Int) (common.Hash, error) {

// verifyCheckBlock checks that the check block and hash are valid, returns the pipeline execution state and retryable
func (r *EvmRegistry) verifyCheckBlock(ctx context.Context, checkBlock, upkeepId *big.Int, checkHash common.Hash) (state encoding.PipelineExecutionState, retryable bool) {
// verify check block number is not in future (can happen when this node is lagging the other members in DON)
latestBlock := r.bs.latestBlock.Load()
if checkBlock.Int64() > int64(latestBlock.Number) {
r.lggr.Warnf("latest block is %d, check block number %s is in future for upkeepId %s", r.bs.latestBlock.Load(), checkBlock, upkeepId)
return encoding.CheckBlockTooNew, true // retryable since the block can be found in future
}

var h string
var ok bool
// verify check block number and hash are valid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,6 @@ func TestRegistry_VerifyCheckBlock(t *testing.T) {
retryable bool
makeEthCall bool
}{
{
name: "check block number too new",
checkBlock: big.NewInt(500),
latestBlock: ocr2keepers.BlockKey{Number: 400},
upkeepId: big.NewInt(12345),
checkHash: common.HexToHash("0x5bff03de234fe771ac0d685f9ee0fb0b757ea02ec9e6f10e8e2ee806db1b6b83"),
payload: ocr2keepers.UpkeepPayload{
UpkeepID: upkeepId,
Trigger: ocr2keepers.NewTrigger(500, common.HexToHash("0x5bff03de234fe771ac0d685f9ee0fb0b757ea02ec9e6f10e8e2ee806db1b6b83")),
WorkID: "work",
},
state: encoding.CheckBlockTooNew,
retryable: true,
},
{
name: "for an invalid check block number, if hash does not match the check hash, return CheckBlockInvalid",
checkBlock: big.NewInt(500),
Expand Down Expand Up @@ -389,7 +375,7 @@ func TestRegistry_CheckUpkeeps(t *testing.T) {
BlockNumber: 550,
}

trigger0 := ocr2keepers.NewTrigger(590, common.HexToHash("0x1c77db0abe32327cf3ea9de2aadf79876f9e6b6dfcee9d4719a8a2dc8ca289d0"))
trigger0 := ocr2keepers.NewTrigger(575, common.HexToHash("0x1c77db0abe32327cf3ea9de2aadf79876f9e6b6dfcee9d4719a8a2dc8ca289d0"))
trigger1 := ocr2keepers.NewLogTrigger(560, common.HexToHash("0x9840e5b709bfccf6a1b44f34c884bc39403f57923f3f5ead6243cc090546b857"), extension1)
trigger2 := ocr2keepers.NewLogTrigger(570, common.HexToHash("0x1222d75217e2dd461cc77e4091c37abe76277430d97f1963a822b4e94ebb83fc"), extension2)

Expand Down Expand Up @@ -429,12 +415,13 @@ func TestRegistry_CheckUpkeeps(t *testing.T) {
550: "0x9840e5b709bfccf6a1b44f34c884bc39403f57923f3f5ead6243cc090546b857",
560: "0x9840e5b709bfccf6a1b44f34c884bc39403f57923f3f5ead6243cc090546b857",
570: "0x1222d75217e2dd461cc77e4091c37abe76277430d97f1963a822b4e94ebb83fc",
575: "0x9840e5b709bfccf6a1b44f34c884bc39403f57923f3f5ead6243cc090546b857",
},
latestBlock: ocr2keepers.BlockKey{Number: 580},
results: []ocr2keepers.CheckResult{
{
PipelineExecutionState: uint8(encoding.CheckBlockTooNew),
Retryable: true,
PipelineExecutionState: uint8(encoding.CheckBlockInvalid),
Retryable: false,
Eligible: false,
IneligibilityReason: 0,
UpkeepID: uid0,
Expand Down

0 comments on commit d9cddb8

Please sign in to comment.