Skip to content

Commit

Permalink
remove app version check in state sync
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwaters authored Sep 28, 2023
1 parent 2e2de0b commit 23daa74
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions statesync/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func (s *syncer) Sync(snapshot *snapshot, chunks *chunkQueue) (sm.State, *types.
}

// Verify app and app version
if err := s.verifyApp(snapshot, state.Version.Consensus.App); err != nil {
if err := s.verifyApp(snapshot); err != nil {
return sm.State{}, nil, err
}

Expand Down Expand Up @@ -482,20 +482,12 @@ func (s *syncer) requestChunk(snapshot *snapshot, chunk uint32) {
}

// verifyApp verifies the sync, checking the app hash, last block height and app version
func (s *syncer) verifyApp(snapshot *snapshot, appVersion uint64) error {
func (s *syncer) verifyApp(snapshot *snapshot) error {
resp, err := s.connQuery.InfoSync(proxy.RequestInfo)
if err != nil {
return fmt.Errorf("failed to query ABCI app for appHash: %w", err)
}

// sanity check that the app version in the block matches the application's own record
// of its version
if resp.AppVersion != appVersion {
// An error here most likely means that the app hasn't inplemented state sync
// or the Info call correctly
return fmt.Errorf("app version mismatch. Expected: %d, got: %d",
appVersion, resp.AppVersion)
}
if !bytes.Equal(snapshot.trustedAppHash, resp.LastBlockAppHash) {
s.logger.Error("appHash verification failed",
"expected", snapshot.trustedAppHash,
Expand Down

0 comments on commit 23daa74

Please sign in to comment.