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

2935: off by one bug #438

Closed
wants to merge 1 commit into from
Closed

Conversation

jsign
Copy link
Collaborator

@jsign jsign commented May 8, 2024

No description provided.

Signed-off-by: Ignacio Hagopian <[email protected]>
@@ -185,7 +185,7 @@ func InsertBlockHashHistoryAtEip2935Fork(statedb *state.StateDB, prevNumber uint
statedb.Witness().TouchFullAccount(params.HistoryStorageAddress[:], true)

ancestor := chain.GetHeader(prevHash, prevNumber)
for i := prevNumber; i > 0 && i >= prevNumber-params.Eip2935BlockHashHistorySize; i-- {
for i := prevNumber; i > 0 && i > prevNumber-params.Eip2935BlockHashHistorySize; i-- {
Copy link
Collaborator Author

@jsign jsign May 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prevNumber-params.Eip2935BlockHashHistorySize is currentBlockNumber-params.Eip2935BlockHashHistorySize-1, so we were migrating one extra block than needed, which overrides the actual previous block hash.

The interesting part is that I found this because the replay data had a BLOCKHASH exactly at the first block we replay, which is the right moment to see this bug effect.

In the previous replay code we had the "save all the history" style, so this bug that affects the ring buffer wasn't a problem.

@jsign jsign requested a review from gballet May 8, 2024 12:32
@jsign jsign marked this pull request as ready for review May 8, 2024 12:32
@jsign jsign modified the milestone: verkle-gen-devnet-7 May 8, 2024
@jsign jsign mentioned this pull request May 8, 2024
Copy link
Owner

@gballet gballet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but let's wait for devnet7 before merging.

@jsign jsign added this to the verkle-gen-devnet-7 milestone May 9, 2024
@jsign
Copy link
Collaborator Author

jsign commented Jul 29, 2024

Close due to 2935 changes.

@jsign jsign closed this Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants