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

[R4R] fix: Incorrect merkle root issue when enabling pipecommit with miner #1011

Merged
merged 2 commits into from
Jul 22, 2022

Conversation

j75689
Copy link
Contributor

@j75689 j75689 commented Jul 22, 2022

Description

  1. Trie data is incorrect when enabling pipecommit with miner.

image

2. Account root hash is incorrect when doing `statedb.CorrectAccountsRoot `.

Rationale

    1. Because the parlia consensus will call the system contract in FinalizeAndAssemble, and change the state of the world. But before that, the statedb is copied, but this copied statedb will not be used when writing blocks, resulting in incorrect writing of the world state.
    1. When account root is an empty hash, the correct emptyhash value is not assigned.

Example

N/A

Changes

Notable changes:

  • copy the statedb after FinalizeAndAssemble

@j75689 j75689 changed the title fix: Incorrect merkle root issue when enabling pipecommit with miner [R4R] fix: Incorrect merkle root issue when enabling pipecommit with miner Jul 22, 2022
@forcodedancing
Copy link
Contributor

Cool. So we need to put the env copy code after FinalizeAndAssemble to make sure statdb is corrected all places.

@unclezoro unclezoro merged commit 403b19c into bnb-chain:develop Jul 22, 2022
This was referenced Jul 28, 2022
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.

5 participants