diff --git a/header/header.go b/header/header.go index 3ec691307d..1e43d3bd13 100644 --- a/header/header.go +++ b/header/header.go @@ -12,7 +12,6 @@ import ( core "github.com/tendermint/tendermint/types" v1 "github.com/celestiaorg/celestia-app/v2/pkg/appconsts/v1" - v2 "github.com/celestiaorg/celestia-app/v2/pkg/appconsts/v2" "github.com/celestiaorg/celestia-app/v2/pkg/da" libhead "github.com/celestiaorg/go-header" "github.com/celestiaorg/rsmt2d" @@ -115,13 +114,9 @@ func (eh *ExtendedHeader) Validate() error { return fmt.Errorf("ValidateBasic error on RawHeader at height %d: %w", eh.Height(), err) } - if eh.RawHeader.Version.App != v1.Version && eh.RawHeader.Version.App != v2.Version { - return fmt.Errorf( - "app version mismatch, expected: %d or %d, got %d", - v1.Version, - v2.Version, - eh.RawHeader.Version.App, - ) + if eh.RawHeader.Version.App != v1.Version { + return fmt.Errorf("app version mismatch, expected: %d, got %d", v1.Version, + eh.RawHeader.Version.App) } err = eh.Commit.ValidateBasic() diff --git a/header/headertest/validate_test.go b/header/headertest/validate_test.go deleted file mode 100644 index 8d95c357de..0000000000 --- a/header/headertest/validate_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package headertest - -import ( - "fmt" - "strconv" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - "github.com/tendermint/tendermint/types" - - "github.com/celestiaorg/celestia-app/v2/pkg/da" - - "github.com/celestiaorg/celestia-node/header" -) - -func TestValidate(t *testing.T) { - testCases := []struct { - extendedHeader *header.ExtendedHeader - wantErr error - }{ - { - extendedHeader: getExtendedHeader(t, 1), - wantErr: nil, - }, - { - extendedHeader: getExtendedHeader(t, 2), - wantErr: nil, - }, - { - extendedHeader: getExtendedHeader(t, 3), - wantErr: fmt.Errorf("app version mismatch, expected: 1 or 2, got 3"), - }, - } - - for i, tc := range testCases { - t.Run(strconv.Itoa(i), func(t *testing.T) { - got := tc.extendedHeader.Validate() - assert.Equal(t, tc.wantErr, got) - }) - } -} - -func getExtendedHeader(t *testing.T, appVersion uint64) *header.ExtendedHeader { - validatorSet, privValidators := RandValidatorSet(1, 1) - rawHeader := RandRawHeader(t) - rawHeader.Version.App = appVersion - rawHeader.ValidatorsHash = validatorSet.Hash() - - minHeader := da.MinDataAvailabilityHeader() - rawHeader.DataHash = minHeader.Hash() - - blockID := RandBlockID(t) - blockID.Hash = rawHeader.Hash() - voteSet := types.NewVoteSet(rawHeader.ChainID, rawHeader.Height, 0, tmproto.PrecommitType, validatorSet) - commit, err := MakeCommit(blockID, rawHeader.Height, 0, voteSet, privValidators, time.Now()) - require.NoError(t, err) - - result, err := header.MakeExtendedHeader(rawHeader, commit, validatorSet, nil) - require.NoError(t, err) - return result -}