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

Address bonsai self-destruct stale code present #4906

Merged

Conversation

garyschulte
Copy link
Contributor

PR description

During an initial worldstate sync, a self-destruct that occurs between the initial pivot block and final heal pivot block will leave stale code in bonsai code storage. If subsequently the code is redeployed via create2 to the same contract address, the bonsai db will fail to roll code changes to the block where the redeployment occurs. This presents in a handful of ways such as 'worldstate not present' or 'unable to copy layered worldstate'.

Discussing with @matkt, since the repivot and heal process does not presently have an opportunity to 'heal' the code storage, and we should be able to trust the trielogs, this PR changes the rollCodeForward behavior to overwrite stale code if/when it is found. This should resolve #4784 and give the besu team an opportunity to revisit this in flat database heal work that is ongoing.

Fixed Issue(s)

addresses #4784

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if
    updates are required.

Changelog

@garyschulte garyschulte requested review from shemnon and matkt and removed request for shemnon January 11, 2023 16:06
@garyschulte garyschulte marked this pull request as ready for review January 11, 2023 16:13
@garyschulte garyschulte force-pushed the bugfix/self-destruct-stale-storage branch from de3b3c3 to 640751f Compare January 11, 2023 21:51
@garyschulte
Copy link
Contributor Author

garyschulte commented Jan 12, 2023

Testing with a database that exhibited this error on block 16369752. A self-destruct for contract this occurred during the initial sync/heal phase of besu, and was subsequently recreated on the problem block which exhibited the "unable to copy layered worldstate" error:

https://etherscan.io/address/0x0000000000a1c1accd070e0003838859fe4f7046#internaltx

testing with main yields the error state with this database (empty optional returned for the worldstate)
testing with this PR yields no error and this log output:

...At Address=0x0000000000a1c1accd070e0003838859fe4f7046, expected to create code, but code exists. Overwriting.

Copy link
Contributor

@matkt matkt left a comment

Choose a reason for hiding this comment

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

LGTM if the tests prove that this can unblock the nodes without adding another bug

Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
@garyschulte garyschulte force-pushed the bugfix/self-destruct-stale-storage branch from 2671443 to 9cf72b3 Compare January 13, 2023 17:27
@garyschulte garyschulte enabled auto-merge (squash) January 13, 2023 17:27
@garyschulte garyschulte merged commit aa7f6fd into hyperledger:main Jan 13, 2023
garyschulte added a commit to garyschulte/besu that referenced this pull request Jan 14, 2023
Signed-off-by: garyschulte <garyschulte@gmail.com>
garyschulte added a commit to garyschulte/besu that referenced this pull request Jan 14, 2023
Signed-off-by: garyschulte <garyschulte@gmail.com>
garyschulte added a commit to garyschulte/besu that referenced this pull request Jan 14, 2023
Signed-off-by: garyschulte <garyschulte@gmail.com>
fab-10 pushed a commit to fab-10/besu that referenced this pull request Jan 18, 2023
Signed-off-by: garyschulte <garyschulte@gmail.com>
elenduuche pushed a commit to elenduuche/besu that referenced this pull request Aug 16, 2023
Signed-off-by: garyschulte <garyschulte@gmail.com>
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
Signed-off-by: garyschulte <garyschulte@gmail.com>
@garyschulte garyschulte deleted the bugfix/self-destruct-stale-storage branch January 24, 2024 21:34
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.

Unable to copy layered worldstate on 22.10.2 - Snapshots=False
3 participants