Skip to content

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

Merged
unclezoro merged 2 commits intobnb-chain:developfrom
j75689:fix/pipecommit
Jul 22, 2022
Merged

[R4R] fix: Incorrect merkle root issue when enabling pipecommit with miner#1011
unclezoro merged 2 commits intobnb-chain:developfrom
j75689:fix/pipecommit

Conversation

@j75689
Copy link
Copy Markdown
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
Copy Markdown
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