essential-contributions / essential-node

Derive current head from essential builder and sync state between nodes
Apache License 2.0
2 stars 1 forks source link

`essential-node-db`: Change `get_block_number` to `get_block_header` #76

Closed mitchmindtree closed 1 month ago

mitchmindtree commented 2 months ago

Currently we have get_block_number, but there are also cases where, given a block address (e.g. returned by get_latest_finalized_block_address) you might want to get the block timestamp, or perhaps the state root or something else in the future.

I ran into this in the builder where it would be useful to be able to fetch the previous block number and timestamp in one query.

Perhaps we can achieve this by changing get_block_number to get_block_header and return all of the block "header" info?

For now, this could just be a tuple with the number and timestamp (u64, Duration), but ideally in the future we might have some essential-node-types crate with a BlockHeader type that would have number: i64, timestamp: Duration and maybe also other fields like state root or whatever else.