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
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
-heightcommand line option would accept an-offsetargument 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 givenoffest:bcur) height and time.bz) with atime >= bcur.time - offset.block.timeis not indexed because theblock_searchRPC endpoint does not return any value forquery="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)range = breq.height - bcur.heightbcur.height - bz.height < range, updatebzinfo with block query forheight = bcur.height - rangebtblock info fromheight = bz.height + rangetime_delta = bt.time - bz.timeThe estimated
breq.time = bcur.time + time_delta