smartcontractkit / chainlink

node of the decentralized oracle network, bridging on and off-chain computation
https://chain.link
Other
7.04k stars 1.72k forks source link

CCIP-3420: Fix IsRequestTriggeredWithinTimeframe #14498

Closed b-gopalswami closed 2 months ago

b-gopalswami commented 2 months ago

Porting this change from CCIP. PR: https://github.com/smartcontractkit/ccip/pull/1445

Motivation

The prior approach to find if there is traffic in a lane was not detecting the transactions properly. It could be due to the CCIPSendRequestedWatcher captures the event after it is initiated not any transaction before that.

Solution

The revised approach is to use the FilterCCIPSendRequested by a past derived block number and see if there is any traffic. The block number is derived by this formula: filterFromBlock = latestBlockNumber - (SkipRequestIfAnotherRequestTriggeredWithin/avgBlockTime) By this approach, we will be able to find traffic better.

https://smartcontract-it.atlassian.net/browse/CCIP-3420

### Requires

Resolves