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

Fix Seid Rollback state mismatch error #557

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions server/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
progress. Rollback overwrites a state at height n with the state at height n - 1.
The application also roll back to height n - 1. No blocks are removed, so upon
restarting Tendermint the transactions in block n will be re-executed against the
application.
application. If you wanna rollback multiple blocks, please add --hard option.

Check warning on line 25 in server/rollback.go

View check run for this annotation

Codecov / codecov/patch

server/rollback.go#L25

Added line #L25 was not covered by tests
`,
RunE: func(cmd *cobra.Command, args []string) error {
ctx := GetServerContextFromCmd(cmd)
Expand Down Expand Up @@ -54,7 +54,7 @@

// rollback the app state
lastCommit = app.CommitMultiStore().LastCommitID()
fmt.Printf("App state height %d and hash %X\n", lastCommit.GetVersion(), lastCommit.GetHash())
fmt.Printf("CMS app state height %d and hash %X\n", lastCommit.GetVersion(), lastCommit.GetHash())

Check warning on line 57 in server/rollback.go

View check run for this annotation

Codecov / codecov/patch

server/rollback.go#L57

Added line #L57 was not covered by tests
fmt.Printf("Attempting to rollback app state to height=%d\n", tmHeight)
if err := app.CommitMultiStore().RollbackToVersion(tmHeight); err != nil {
return fmt.Errorf("failed to rollback to version: %w", err)
Expand Down
12 changes: 11 additions & 1 deletion storev2/rootmulti/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,17 @@
if target > math.MaxUint32 {
return fmt.Errorf("rollback height target %d exceeds max uint32", target)
}
return rs.scStore.Rollback(target)
err := rs.scStore.Rollback(target)
if err != nil {
return err
}

Check warning on line 525 in storev2/rootmulti/store.go

View check run for this annotation

Codecov / codecov/patch

storev2/rootmulti/store.go#L522-L525

Added lines #L522 - L525 were not covered by tests
// We need to update the lastCommitInfo after rollback
if rs.scStore.Version() != 0 {
fmt.Printf("Rolled back CMS to version %d\n", rs.scStore.Version())
rs.lastCommitInfo = convertCommitInfo(rs.scStore.LastCommitInfo())
rs.lastCommitInfo = amendCommitInfo(rs.lastCommitInfo, rs.storesParams)
}
return nil

Check warning on line 532 in storev2/rootmulti/store.go

View check run for this annotation

Codecov / codecov/patch

storev2/rootmulti/store.go#L527-L532

Added lines #L527 - L532 were not covered by tests
}

// getStoreByName performs a lookup of a StoreKey given a store name typically
Expand Down
Loading