Skip to content

Commit

Permalink
Revert "test: fails when using GRPC prior to upgrade"
Browse files Browse the repository at this point in the history
This reverts commit 82118d4.
  • Loading branch information
rootulp committed Apr 2, 2024
1 parent 82118d4 commit 81954c4
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions app/test/ica_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
v2 "github.com/celestiaorg/celestia-app/pkg/appconsts/v2"
"github.com/celestiaorg/celestia-app/test/util"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/x/params/types/proposal"
icahosttypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/types"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
Expand All @@ -30,37 +31,42 @@ func TestICA(t *testing.T) {
supportedVersions := []uint64{v1.Version, v2.Version}
require.Equal(t, supportedVersions, testApp.SupportedVersions())

ctx := testApp.NewContext(true, tmproto.Header{
Version: version.Consensus{
App: 1,
},
})
testApp.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{
Height: 2,
Version: version.Consensus{App: 1},
}})

// app version should not have changed yet
require.EqualValues(t, 1, testApp.AppVersion())

// Create the ICA host query client
conn, err := grpc.Dial(":9090", grpc.WithTransportCredentials(insecure.NewCredentials()))
gotBefore, err := testApp.ParamsKeeper.Params(ctx, &proposal.QueryParamsRequest{
Subspace: icahosttypes.SubModuleName,
Key: string(icahosttypes.KeyHostEnabled),
})
require.Equal(t, "", gotBefore.Param.Value)
require.NoError(t, err)
defer conn.Close()
icaClient := icahosttypes.NewQueryClient(conn)

// Query the ICA host params
goCtx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
paramsResp, err := icaClient.Params(goCtx, &icahosttypes.QueryParamsRequest{})
require.NoError(t, err)
require.Equal(t, true, paramsResp.Params.HostEnabled)
require.Len(t, paramsResp.Params.AllowMessages, 0)

// Upgrade from v1 -> v2
// now the app version changes
respEndBlock := testApp.EndBlock(abci.RequestEndBlock{Height: 2})
testApp.Commit()

require.NotNil(t, respEndBlock.ConsensusParamUpdates.Version)
require.EqualValues(t, 2, respEndBlock.ConsensusParamUpdates.Version.AppVersion)
require.EqualValues(t, 2, testApp.AppVersion())

// Query the ICA host params again
goCtx, cancel = context.WithTimeout(context.Background(), time.Second)
conn, err := grpc.Dial(":9090", grpc.WithTransportCredentials(insecure.NewCredentials()))
require.NoError(t, err)
defer conn.Close()

icaClient := icahosttypes.NewQueryClient(conn)
goCtx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
paramsResp, err = icaClient.Params(goCtx, &icahosttypes.QueryParamsRequest{})
paramsResp, err := icaClient.Params(goCtx, &icahosttypes.QueryParamsRequest{})
require.NoError(t, err)
require.Equal(t, true, paramsResp.Params.HostEnabled)
require.Len(t, paramsResp.Params.AllowMessages, 12)
Expand Down

0 comments on commit 81954c4

Please sign in to comment.