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

feature: Add optional worldstate move flag to debug_setHead #7821

Conversation

garyschulte
Copy link
Contributor

PR description

This PR adds an optional parameter to debug_setHead that allows one to move the head worldstate along with the blockchain. This is a no-op for Forest, but for DiffBased worldstates like bonsai and verkle, this will roll the head worldstate to the specified block number / block hash.

This is a debug method only and should not be used when a consensus client is directing besu, or while the node is actively importing or proposing blocks.

This feature is a stop-gap measure until #7475 is complete. This debug feature will allow users to move bonsai worldstate head far back into block history so that expensive operations like debug_traceBlock can be run on historical blocks. Otherwise, trying to execute RPC calls on old historical states will inevitably encounter an OOM (out of memory) while trying to roll the worldstate back in-memory.

This is a debug feature, if used incorrectly (like while some concurrent process is trying to move or modify the worldstate) it will corrupt the database.

Fixed Issue(s)

related to #7804

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests

@garyschulte garyschulte force-pushed the feature/debug-setHead-with-worldstate branch 3 times, most recently from 5ef0329 to 296fb44 Compare October 29, 2024 20:58

return JsonRpcSuccessResponse.SUCCESS_RESULT;
}

private void rollWorldStateIncrementally(
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we can move this logic directly in the bonsai archive class ? I feel that this method can be used in other part of the code

@garyschulte garyschulte self-assigned this Oct 31, 2024
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
…and resources

Signed-off-by: garyschulte <garyschulte@gmail.com>
…usly

Signed-off-by: garyschulte <garyschulte@gmail.com>
@garyschulte garyschulte force-pushed the feature/debug-setHead-with-worldstate branch from 296fb44 to 90b1391 Compare November 4, 2024 22:38
…e able to roll forward and backward

Signed-off-by: garyschulte <garyschulte@gmail.com>
@garyschulte garyschulte enabled auto-merge (squash) November 4, 2024 22:44
@garyschulte garyschulte merged commit d415b7d into hyperledger:main Nov 4, 2024
43 checks passed
JanetMo pushed a commit to JanetMo/besu that referenced this pull request Nov 17, 2024
…ger#7821)

* add optional worldstate move to debug_setHead
* make state rolling occur incrementally so as not to overwhelm memory and resources

Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: Marlene Marz <m.marz@kabelmail.de>
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