Skip to content

Estimate by offset #5

Open
Open
@mhofman

Description

@mhofman

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions