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

WIP fix: check state root for buffered blocks #8026

Conversation

fgimenez
Copy link
Member

@fgimenez fgimenez commented May 1, 2024

When connecting buffered blocks state root validation does not occur. As state root validation does not occur later except for the tip when a new canonical head is chosen.

The proposed solution is to use exhaustive validation when inserting buffered blocks in try_insert_validated_block(). This will increase the processing time as state roots must be checked however, it will prevent unvalidated blocks from being added to the chain.

@fgimenez fgimenez force-pushed the fgimenez/check-state-root-for-buffered-blocks branch from 1053c79 to 2e45e58 Compare May 2, 2024 17:30
@emhane
Copy link
Member

emhane commented May 10, 2024

do you have an example showing that being optimistic about validation here has caused problems? I'm not familiar enough with this part of the code to say what the source for blocks that go into the buffer is, assuming they are not validated before they are put in the buffer?

@emhane emhane added C-security Issue or pull request related to security. A-blockchain-tree Related to sidechains, reorgs and pending blocks labels May 10, 2024
@fgimenez
Copy link
Member Author

do you have an example showing that being optimistic about validation here has caused problems?

nope, the fix here is trying to prevent the situation from happening, no idea if it has already happened

I'm not familiar enough with this part of the code to say what the source for blocks that go into the buffer is, assuming they are not validated before they are put in the buffer?

not very familiar either, as I understand it blocks are buffered when they are received and the block they build upon is not yet available, they are stored for later. the issue is, state root is only validated for blocks building on top of the canonical chain or for the last one in a set of buffered blocks, not for the ones in the middle (these are only executed).

this makes it possible to introduce blocks in the chain with a malicious state root in the header, would require building several slots in a row though, but still possible.

@fgimenez
Copy link
Member Author

this approach has a big impact on performance and won't be followed to fix this issue, closing

@fgimenez fgimenez closed this May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-blockchain-tree Related to sidechains, reorgs and pending blocks C-security Issue or pull request related to security.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants