-
Notifications
You must be signed in to change notification settings - Fork 75
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
[FIX] Return executed blocks sorted on execution error #772
Conversation
@@ -139,7 +139,7 @@ class BlockExecution( | |||
if (remainingBlocks.isEmpty) { | |||
(executedBlocks.reverse, None) | |||
} else if (error.isDefined) { | |||
(executedBlocks, error) | |||
(executedBlocks.reverse, error) |
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.
i'm struggling with this analysis in the code. Maybe as a work arround we could add a suffix at variables name level, in order to know if the list is in incremental or decremental order. WDYT?
ex.
remainingBlocks
-> remainingBlocksIncOrder
// [bn=1, bn=2, bn=3]
executedBlocks
-> executedBlocksDecOrder
// [bn=3, bn=2, bn=1]
And also add a comment regarding the order of the list returned by this function
wdyt about adding a regression test at least at integration test level? |
9977286
to
64b1b41
Compare
Regression test at an integration level wasn't that easy, I finally added one at unit level that was quite straightforward to add |
0a406e4
to
58ad5d5
Compare
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.
LGTM!
Description
Fixes missing blocks on testnet, caused by:
BlockImport.revertChainReorganisation
to be called with theexecutedBlocks=[1505: 0b, 1504: 0b, 1503: 5a, 1502: 8a]
removeBlocksUntil(0b, 1502)
, meaning that all blocks from the db were deletedOmmersNotValidError
. As this was the chain followed by the two other miners, the testnet irrevocably forkedSimple scenario to reproduce:
Pre-requisites:
ValidationAfterExecError(s"Block has invalid state root hash, expected ${Hex.toHexString(header.stateRoot.toArray)} but got ${Hex.toHexString(stateRootHash.toArray)}")
validation has to be disabledBlockExecution.executeAndValidateBlock
so that all blocks with number 13 are considered invalidReproducing it
Proposed Solution
Return the executedBlocks in proper order
Testing