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

chain_getBlockHash not implemented properly #1925

Open
Tracked by #39
tomaka opened this issue Jan 20, 2022 · 7 comments
Open
Tracked by #39

chain_getBlockHash not implemented properly #1925

tomaka opened this issue Jan 20, 2022 · 7 comments
Labels
blocked Can't work on this issue because it is blocked on something out of our control

Comments

@tomaka
Copy link
Contributor

tomaka commented Jan 20, 2022

chain_getBlockHash is very problematic to implement. If the JSON-RPC client requests for example block number 2,000,000 while the head is for example around 9,000,000 then we have no reasonable way to know it.
Asking a full node for the block with that number works, but because we have no proof of ancestry we have no guarantee that this block is the correct one.

@rphmeier
Copy link

MMRs!

@xlc
Copy link
Contributor

xlc commented Aug 12, 2022

Without this it is impossible to iterate blocks so I would give this a bump on priority.

@tomaka
Copy link
Contributor Author

tomaka commented Aug 12, 2022

This is unfixable before Beefy is shipped.

@tomaka tomaka added the blocked Can't work on this issue because it is blocked on something out of our control label Aug 12, 2022
@gilescope
Copy link
Contributor

If the head is 9,000,000 it would be nice if recent block numbers were supported. Presumably the hash of block 8,999,999 is known? If so it could be returned rather than the currennt None. Maybe it's hard to go all the way back but we must have cached some recent blocks and know their chain height?

@tomaka
Copy link
Contributor Author

tomaka commented Oct 2, 2022

Recent block numbers are supported, but this is completely useless because there's no future-proof way to define "recent".

gilescope added a commit to gilescope/dotsamaworld that referenced this issue Oct 2, 2022
@gilescope
Copy link
Contributor

gilescope commented Oct 10, 2022

Maybe I'm reading the runes wrong on this one but it looks like only 0 is supported; should it not care about the height parameter here if it is implemented:

When I'm asking for the recent (as in within 1-2 blocks from the head that I know it should have history of) blocks I just seem to get null returned.

@tomaka
Copy link
Contributor Author

tomaka commented Oct 10, 2022

Ah right, we used to look in the cache of recent blocks, but I intentionally removed that hastily after realizing that the cache of recent blocks could contain non-canonical blocks (i.e. can contain multiple blocks of the same number, without a way to know which one is on the best chain and which one isn't).

I can restore that behavior by improving the cache to store the canonical chain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Can't work on this issue because it is blocked on something out of our control
Projects
None yet
Development

No branches or pull requests

4 participants