Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: more than one block range for a contract #1377

Closed
typedarray opened this issue Dec 26, 2024 · 1 comment
Closed

feat: more than one block range for a contract #1377

typedarray opened this issue Dec 26, 2024 · 1 comment

Comments

@typedarray
Copy link
Collaborator

Problem / use case

Sometimes, it's useful to skip certain block ranges when indexing a contract. For example, the Hyperliquid testnet appears to have some block ranges where the RPC does not work.

Currently you can only pass startBlock and endBlock.

Proposed solution

We could replace startBlock and endBlock with a blocks field that supports multiple ranges. Also, this could be a good time to introduce tags like "latest" which would represent the latest block when the server starts up (very common for block intervals / cron).

Examples

Simple bounded range

-  startBlock: 1000,
-  endBlock: 2000,
+  blocks: [1000, 2000],

Multiple ranges

+  blocks: [[1000, 2000], [2050, "latest"]],

No endBlock (live indexing)

-  startBlock: 1000,
+  blocks: [1000, undefined],

Open questions

  1. How should the (very common) case of endBlock: undefined look? Perhaps we could come up with a tag like "latest". Could be "live", "realtime", or "latest" if we use something else to mean "the latest block when the server started up".
@tk-o
Copy link
Contributor

tk-o commented Dec 26, 2024

We could go with factory functions to describe numerical ranges:

  • between(x, y)
  • lt(x) & lte(x)
  • gt(x) & gte(x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants