Repository navigation
feat: add recovery rewind commands - #13
Open
littlehand26 wants to merge 7 commits into
Open
littlehand26 wants to merge 7 commits into
littlehand26 wants to merge 7 commits into
Conversation
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Comment on lines
+312
to
+314
| for _, prefix := range prefixes { | ||
| resultPrefixes = append(resultPrefixes, prefix) | ||
| } |
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Comment on lines
+533
to
+535
| for _, prefix := range prefixes { | ||
| result = append(result, prefix) | ||
| } |
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The existing
rollbackcommand removes one height and also rewinds theapplication store. Recovering a multi-height fork needs bounded, resumable
commands for removing the CometBFT and index suffixes while the application is
rolled back separately.
Solution
Add two stopped-node recovery commands:
cronosd rewind-cometbft <height>validates the target and repeatedly usesCometBFT's hard rollback while holding the databases open. It also handles a
one-block pending blockstore/state mismatch.
cronosd rewind-indexes <height>scans the mandatorytx.heightnamespace,uses the persisted
FinalizeBlockResponsefor each affected height to removethe exact transaction event entries, removes block-event entries above the
target, and starts the EVM iterator at
target+1. If the same transactionhash exists on both sides of the rewind boundary, the command restores the
retained raw transaction result instead of deleting it.
Index writes are ordered so interrupted runs retain
tx.heightentries asrecovery markers until the corresponding event/hash cleanup is complete. Both
commands report progress and are idempotent. Application rollback remains an
explicit separate step.
Tests
go test ./cmd/cronosd/cmd -count=1go vet ./cmd/cronosd/cmdgit diff --check