-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat: Implement rollback command #11179
Conversation
0b780af
to
1408c6d
Compare
store/rootmulti/store.go
Outdated
} | ||
rs.pruneStores() | ||
|
||
if i < target { |
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.
Shouldn't this be <=
?
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.
Shouldn't this be
<=
?
no, it's to check if latest height is changed, I just fixed it.
height, hash, err := tmcmd.RollbackState(ctx.Config) | ||
if err != nil { | ||
return fmt.Errorf("failed to rollback tendermint state: %w", err) | ||
} |
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.
hmm, we need to be sure that both tendermint an SDK will rollback to the same version. In RollbackToVersion
we can essentially rollback to an older version than the target.
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.
RollbackToVersion
only prune heights that are bigger than the height
returned by tendermint's rollback.
I run a 4-peers
It reported the following errors:
|
c90ea14
to
7975cd3
Compare
I just fixed a trivial issue, can you try again. PS: can you share your script to setup devnet, my script don't work with tendermint 0.35 somehow, and I haven't figured it out. I always get this error when I backport this patch to
|
yeah, I will try it later. |
7975cd3
to
18d9acd
Compare
after fixing the rollback in tendermint: tendermint/tendermint#7837, it works now. |
a1a98c5
to
480b7d4
Compare
480b7d4
to
c74ced1
Compare
@yihuang 0.35.2 was released with the patch, can you update then we merge this |
@@ -905,6 +905,30 @@ func (rs *Store) buildCommitInfo(version int64) *types.CommitInfo { | |||
} | |||
} | |||
|
|||
// RollbackToVersion delete the versions after `target` and update the latest version. | |||
func (rs *Store) RollbackToVersion(target int64) int64 { | |||
if target < 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.
the input target should be always greater than 0 right? the State.InitialHeight will be 1.
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, I think so, just for safety here.
Closes: cosmos#10281 fix tendermint rollback changelog update tendermint to recent v0.35.x branch
done |
shall we backport this to 0.45? |
So there aren't any tests for this. Was this tested to actually work? Because in my attempt I came across IAVL issues: #11233 (comment). Did you not come across this? This should not have been merged w/o unit tests for the multi-store IMO. |
I did the basic test manually:
|
I don't see how that's possible. IAVL doesn't let you prune/delete the current version (height). |
@alexanderbez I was able to test this successfully locally on a chain that I submitted txs to in order to change the app hash a few times. |
That doesn't this should've been merged w/o ms unit tests. |
|
Closes: cosmos#10281 fix tendermint rollback changelog update tendermint to recent v0.35.x branch (cherry picked from commit 8296ad9) Co-authored-by: yihuang <huang@crypto.com>
Closes: cosmos#10281 fix tendermint rollback changelog update tendermint to recent v0.35.x branch (cherry picked from commit 8296ad9) # Conflicts: # CHANGELOG.md # go.mod # go.sum Co-authored-by: yihuang <huang@crypto.com>
Closes: cosmos#10281 fix tendermint rollback changelog update tendermint to recent v0.35.x branch (cherry picked from commit 8296ad9) # Conflicts: # CHANGELOG.md # go.mod # go.sum Co-authored-by: yihuang <huang@crypto.com>
Closes: cosmos#10281 fix tendermint rollback changelog update tendermint to recent v0.35.x branch (cherry picked from commit 8296ad9) # Conflicts: # CHANGELOG.md # go.mod # go.sum Co-authored-by: yihuang <huang@crypto.com>
Closes: cosmos#10281 fix tendermint rollback changelog update tendermint to recent v0.35.x branch (cherry picked from commit 8296ad9) # Conflicts: # CHANGELOG.md # go.mod # go.sum Co-authored-by: yihuang <huang@crypto.com>
Closes: cosmos#10281 fix tendermint rollback changelog update tendermint to recent v0.35.x branch (cherry picked from commit 8296ad9) Co-authored-by: yihuang <huang@crypto.com>
Closes: cosmos#10281 fix tendermint rollback changelog update tendermint to recent v0.35.x branch (cherry picked from commit 8296ad9) # Conflicts: # CHANGELOG.md # go.mod # go.sum Co-authored-by: yihuang <huang@crypto.com>
Description
Closes: #10281
Currently it hasfixed after update tendermint.panic: StoreBlockHeight (6) > StateBlockHeight + 1 (5)
error when start after rollback.Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change