diff --git a/statesync/reactor_test.go b/statesync/reactor_test.go index 82abe3090..ed24c4604 100644 --- a/statesync/reactor_test.go +++ b/statesync/reactor_test.go @@ -242,7 +242,7 @@ func makeMockAppConnSnapshot(appHash string, snapshot *snapshot, chunks []*chunk func makeMockAppConnQuery(appHash string, height int64) *proxymocks.AppConnQuery { connQuery := &proxymocks.AppConnQuery{} connQuery.On("InfoSync", proxy.RequestInfo).Return(&abci.ResponseInfo{ - AppVersion: 9, + AppVersion: testAppVersion, LastBlockHeight: height, LastBlockAppHash: []byte(appHash), }, nil) @@ -257,7 +257,7 @@ func makeTestStateAndCommit(appHash string, height int64) (sm.State, *types.Comm Version: tmstate.Version{ Consensus: tmversion.Consensus{ Block: version.BlockProtocol, - App: 9, + App: testAppVersion, }, Software: version.OCCoreSemVer, @@ -278,6 +278,7 @@ func makeTestStateAndCommit(appHash string, height int64) (sm.State, *types.Comm ConsensusParams: *types.DefaultConsensusParams(), LastHeightConsensusParamsChanged: 1, } + state.ConsensusParams.Version.AppVersion = testAppVersion commit := &types.Commit{BlockID: types.BlockID{Hash: []byte(blockHash)}} diff --git a/statesync/syncer_test.go b/statesync/syncer_test.go index d6e663490..b810e164b 100644 --- a/statesync/syncer_test.go +++ b/statesync/syncer_test.go @@ -2,6 +2,7 @@ package statesync import ( "errors" + "fmt" "testing" "time" @@ -621,7 +622,8 @@ func TestSyncer_applyChunks_RejectSenders(t *testing.T) { func TestSyncer_verifyApp(t *testing.T) { boom := errors.New("boom") const appVersion = 9 - appVersionMismatchErr := errors.New("app version mismatch. Expected: 9, got: 2") + const invalidAppVersion = appVersion + 1 + appVersionMismatchErr := fmt.Errorf("app version mismatch. Expected: %d, got: %d", appVersion, invalidAppVersion) s := &snapshot{Height: 3, Format: 1, Chunks: 5, Hash: []byte{1, 2, 3}, trustedAppHash: []byte("app_hash")} testcases := map[string]struct { @@ -637,7 +639,7 @@ func TestSyncer_verifyApp(t *testing.T) { "invalid app version": {&abci.ResponseInfo{ LastBlockHeight: 3, LastBlockAppHash: []byte("app_hash"), - AppVersion: 2, + AppVersion: invalidAppVersion, }, nil, appVersionMismatchErr}, "invalid height": {&abci.ResponseInfo{ LastBlockHeight: 5,