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

Estimate by offset #5

Open
mhofman opened this issue Jan 8, 2025 · 0 comments · May be fixed by #6
Open

Estimate by offset #5

mhofman opened this issue Jan 8, 2025 · 0 comments · May be fixed by #6
Assignees

Comments

@mhofman
Copy link
Member

mhofman commented Jan 8, 2025

The most recent blocks are not automatically the most representative of the future performance of the chain. In the case of the agoric mainnet chain for example, we're seeing somewhat cyclic performance degradation with a primary interval of 7.2 days (and a secondary interval of 1.6 days).

The primary use case is to estimate the expected time of a future block.
The existing -height command line option would accept an -offset argument that would be parsed as a date/time offset (e.g. 7d). In that case the tool should estimate the time of the requested block (breq) based on the timings of the blocks starting at the given offest:

  • query the chain's current block (bcur) height and time.
  • search for the first block (bz) with a time >= bcur.time - offset.
    • Unfortunately it seems that block.time is not indexed because the block_search RPC endpoint does not return any value for query="block.time >= TIME 2024-12-31T01:40:00Z", which should the right syntax so we may need to do a binary search (likely weighted by the calculated average block time between intermediate results of the search)
  • Let range = breq.height - bcur.height
    • If bcur.height - bz.height < range, update bz info with block query for height = bcur.height - range
  • Query bt block info from height = bz.height + range
  • Let time_delta = bt.time - bz.time

The estimated breq.time = bcur.time + time_delta

@mujahidkay mujahidkay linked a pull request Jan 8, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants