Skip to content

fix: fix statedb copy#2567

Merged
zzzckck merged 1 commit intobnb-chain:developfrom
will-2012:fix-copy
Jul 10, 2024
Merged

fix: fix statedb copy#2567
zzzckck merged 1 commit intobnb-chain:developfrom
will-2012:fix-copy

Conversation

@will-2012
Copy link
Copy Markdown
Contributor

@will-2012 will-2012 commented Jul 8, 2024

Description

In the force-kill test scenario, it was found that rewind failed. The specific reason was that the data format of the state's undolog was incorrect. Failed to rollback state, error like this:
invalid account index, len: 0

Rationale

bsc/miner/worker.go

Lines 1434 to 1437 in a5810fe

// Create a local environment copy, avoid the data race with snapshot state.
// https://github.com/ethereum/go-ethereum/issues/24299
env := env.copy()

Miner inner workflow uses statedb copy function, but the copy function loses the state's origin fields, so the written undo log is wrong and fails to rollback.

Example

N/A.

Changes

Notable changes:

  • Statedb: copy function

@will-2012 will-2012 marked this pull request as draft July 8, 2024 01:54
@will-2012 will-2012 added the wip work in process label Jul 8, 2024
@NathanBSC
Copy link
Copy Markdown
Contributor

go-ethereum has fix this, not upstreamed
ethereum/go-ethereum#29563

@NathanBSC
Copy link
Copy Markdown
Contributor

NathanBSC commented Jul 8, 2024

LGTM

@will-2012 will-2012 added r4r ready for review and removed wip work in process labels Jul 9, 2024
@will-2012 will-2012 marked this pull request as ready for review July 9, 2024 09:30
@zzzckck zzzckck merged commit a00ffa7 into bnb-chain:develop Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

r4r ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants