-
Notifications
You must be signed in to change notification settings - Fork 770
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
Client: Add executeBlocks debug option #1538
Conversation
…f initialization and execution logic
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small comment/question, but overall looks good to me 👍
last = blockRange.length === 2 ? (blockRange[1][0] as number) : first | ||
txHashes = blockRange[0][1] as string[] | ||
|
||
if ((blockRange[0][1] as string[]).length > 0 && blockRange.length === 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For readability's sake, could this just be if (txHashes.length > 0 && ...
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are totally right, didn't see the forest for all the trees. 😛 Won't rerun CI for this, I'll try to remember to update on some follow-up PR and have otherwise added to the tiny-fixes-issue.
This is cool. What is the client behavior in case we run into a bad block? I think it deletes the block from database by default right? It would be useful to keep this bad block in the database instead, such that we can figure out the consensus bug (these bad blocks are bad blocks reported by our client; assuming that the canonical chain follows through it is thus a false positive by our client and it would thus be useful to keep the block, such that we can use this flag to re-run and debug the block). |
This should be completely side-effects free respectively not modify any state (in the broader sense) within the client, that's why I settled this pretty high in the call hierachy and also didn't use the existing VM execution logic but wrote an own version with some inspiration from the engine API block execution. This is running on a copy of the VM and also not goes in any fail logic or accidentally emits events which could have side effects. One nice thing is that one also can adopt the log messages for the use case and do e.g. more detailed execution logic than one would normally do. |
(so this is a completely separate "client mode" without running the |
This PR adds a new option
--executeBlocks
to the client. The option can be used to re-execute blocks in the client which are already synced for debugging purposes without changing the state of the client DB in any way.Option can be used as follows:
Run a single block:
Run a range of blocks:
Run selected txs from a block:
Option can very well be combined with a
DEBUG=vm:*
VM debug logger activated. This should hopefully help to debug on things like the Shanghai dDoS blocks as well as various other scenarios.