hyperlane-xyz / hyperlane-monorepo

The home for Hyperlane core contracts, sdk packages, and other infrastructure
https://hyperlane.xyz
Other
240 stars 273 forks source link

Implement a backward & forward-backward version of a watermarked cursor #3336

Open tkporter opened 4 months ago

tkporter commented 4 months ago

Problem

See the first part of https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/3264 for a little background on WatermarkContractSync / the RateLimitedContractSyncCursor, which we use for indexing IGP payments and message deliveries.

At the moment, we've only implemented RateLimitedContractSyncCursor as a forward-only cursor. This makes sense as the "rate limiting" part is only something that kicks in when we're close to the tip. However this means that we end up indexing IGP payments & message deliveries from the beginning of time moving forward.

Solution

We should be able to index IGP payments and message deliveries in a "forward backward" manner, just like we're able to do with message indexing. This way we can spin up a relayer or scraper and immediately start getting useful data from the tip.

I imagine it'd work something like:

tkporter commented 1 month ago

Noting as @daniel-savu had mentioned that after https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/3267 this is no longer super important because we're less bottlenecked on IGP indexing. Gonna de-prio accordingly