check-commitment-hist-at-blk: Compute block commitment correctly + refactoring of commitment readers#19364
Open
check-commitment-hist-at-blk: Compute block commitment correctly + refactoring of commitment readers#19364
Conversation
taratorio
reviewed
Feb 20, 2026
| WithHistory() bool | ||
| CheckDataAvailable(d kv.Domain, step kv.Step) error | ||
| Read(d kv.Domain, plainKey []byte, stepSize uint64) (enc []byte, step kv.Step, err error) | ||
| Clone() StateReader |
Member
There was a problem hiding this comment.
Clone needs to accept a tx - the idea of Clone is to clone the reader but with a new fresh tx
Member
There was a problem hiding this comment.
To give you a bit more context: the reason Clone(tx) exists is to support parallel commitment trie in the backtester.
In order for the backtesterStateReader to work with parallel commitment it needs to spawn itself with many RoTx-es.
That is why in the trie we have:
if sdc.stateReader != nil {
mainTtx.stateReader = sdc.stateReader.Clone(tx)
}
So that when we set the stateReader to be the backtestStateReader it will clone itself 16 times with 16 different RoTx-es for the para-trie experiments
antonis19
commented
Feb 20, 2026
antonis19
commented
Feb 20, 2026
taratorio
reviewed
Feb 23, 2026
taratorio
reviewed
Feb 23, 2026
taratorio
reviewed
Feb 23, 2026
taratorio
reviewed
Feb 24, 2026
taratorio
reviewed
Feb 24, 2026
Member
|
fyi, i tried this pr just now: |
…t-integrity-check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR :
erigon snapshots check-commitment-hist-at-blkcommand, so that the state root for the block can be calculated correctly by reading branch data as of the beginning of the block and account and storage state data as of the end of block. The old behavior was that both plain state (accounts+storage) and commitment branch data were being read as of the end of the block, so the already updated MPT branches were being read instead of them being recomputed.