From 2d336d256d699fca5fe917bb1745d8d550f9da8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 12 Aug 2024 16:09:02 +0200 Subject: [PATCH 1/4] refactor: remove client/consensus state validation from connection handshake --- .../core/03-connection/keeper/handshake.go | 82 +-------- .../03-connection/keeper/handshake_test.go | 157 +----------------- modules/core/03-connection/types/msgs.go | 42 +---- modules/core/03-connection/types/msgs_test.go | 33 ---- testing/solomachine.go | 7 +- 5 files changed, 12 insertions(+), 309 deletions(-) diff --git a/modules/core/03-connection/keeper/handshake.go b/modules/core/03-connection/keeper/handshake.go index 95e9947ae31..f6acaaca3c6 100644 --- a/modules/core/03-connection/keeper/handshake.go +++ b/modules/core/03-connection/keeper/handshake.go @@ -9,7 +9,6 @@ import ( clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" - ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" "github.com/cosmos/ibc-go/v8/modules/core/exported" ) @@ -72,37 +71,17 @@ func (k Keeper) ConnOpenTry( counterparty types.Counterparty, // counterpartyConnectionIdentifier, counterpartyPrefix and counterpartyClientIdentifier delayPeriod uint64, clientID string, // clientID of chainA - clientState exported.ClientState, // clientState that chainA has for chainB + _ exported.ClientState, // clientState that chainA has for chainB counterpartyVersions []*types.Version, // supported versions of chain A initProof []byte, // proof that chainA stored connectionEnd in state (on ConnOpenInit) - clientProof []byte, // proof that chainA stored a light client of chainB - consensusProof []byte, // proof that chainA stored chainB's consensus state at consensus height + _ []byte, // proof that chainA stored a light client of chainB + _ []byte, // proof that chainA stored chainB's consensus state at consensus height proofHeight exported.Height, // height at which relayer constructs proof of A storing connectionEnd in state - consensusHeight exported.Height, // latest height of chain B which chain A has stored in its chain B client + _ exported.Height, // latest height of chain B which chain A has stored in its chain B client ) (string, error) { // generate a new connection connectionID := k.GenerateConnectionIdentifier(ctx) - // check that the consensus height the counterparty chain is using to store a representation - // of this chain's consensus state is at a height in the past - selfHeight := clienttypes.GetSelfHeight(ctx) - if consensusHeight.GTE(selfHeight) { - return "", errorsmod.Wrapf( - ibcerrors.ErrInvalidHeight, - "consensus height is greater than or equal to the current block height (%s >= %s)", consensusHeight, selfHeight, - ) - } - - // validate client parameters of a chainB client stored on chainA - if err := k.consensusHost.ValidateSelfClient(ctx, clientState); err != nil { - return "", err - } - - expectedConsensusState, err := k.consensusHost.GetSelfConsensusState(ctx, consensusHeight) - if err != nil { - return "", errorsmod.Wrapf(err, "self consensus state not found for height %s", consensusHeight.String()) - } - // expectedConnection defines Chain A's ConnectionEnd // NOTE: chain A's counterparty is chain B (i.e where this code is executed) // NOTE: chainA and chainB must have the same delay period @@ -129,18 +108,6 @@ func (k Keeper) ConnOpenTry( return "", err } - // Check that ChainA stored the clientState provided in the msg - if err := k.VerifyClientState(ctx, connection, proofHeight, clientProof, clientState); err != nil { - return "", err - } - - // Check that ChainA stored the correct ConsensusState of chainB at the given consensusHeight - if err := k.VerifyClientConsensusState( - ctx, connection, proofHeight, consensusHeight, consensusProof, expectedConsensusState, - ); err != nil { - return "", err - } - // store connection in chainB state if err := k.addConnectionToClient(ctx, clientID, connectionID); err != nil { return "", errorsmod.Wrapf(err, "failed to add connection with ID %s to client with ID %s", connectionID, clientID) @@ -163,25 +130,15 @@ func (k Keeper) ConnOpenTry( func (k Keeper) ConnOpenAck( ctx sdk.Context, connectionID string, - clientState exported.ClientState, // client state for chainA on chainB + _ exported.ClientState, // client state for chainA on chainB version *types.Version, // version that ChainB chose in ConnOpenTry counterpartyConnectionID string, tryProof []byte, // proof that connectionEnd was added to ChainB state in ConnOpenTry - clientProof []byte, // proof of client state on chainB for chainA - consensusProof []byte, // proof that chainB has stored ConsensusState of chainA on its client + _ []byte, // proof of client state on chainB for chainA + _ []byte, // proof that chainB has stored ConsensusState of chainA on its client proofHeight exported.Height, // height that relayer constructed proofTry - consensusHeight exported.Height, // latest height of chainA that chainB has stored on its chainA client + _ exported.Height, // latest height of chainA that chainB has stored on its chainA client ) error { - // check that the consensus height the counterparty chain is using to store a representation - // of this chain's consensus state is at a height in the past - selfHeight := clienttypes.GetSelfHeight(ctx) - if consensusHeight.GTE(selfHeight) { - return errorsmod.Wrapf( - ibcerrors.ErrInvalidHeight, - "consensus height is greater than or equal to the current block height (%s >= %s)", consensusHeight, selfHeight, - ) - } - // Retrieve connection connection, found := k.GetConnection(ctx, connectionID) if !found { @@ -204,17 +161,6 @@ func (k Keeper) ConnOpenAck( ) } - // validate client parameters of a chainA client stored on chainB - if err := k.consensusHost.ValidateSelfClient(ctx, clientState); err != nil { - return err - } - - // Retrieve chainA's consensus state at consensusheight - expectedConsensusState, err := k.consensusHost.GetSelfConsensusState(ctx, consensusHeight) - if err != nil { - return errorsmod.Wrapf(err, "self consensus state not found for height %s", consensusHeight.String()) - } - prefix := k.GetCommitmentPrefix() expectedCounterparty := types.NewCounterparty(connection.ClientId, connectionID, commitmenttypes.NewMerklePrefix(prefix.Bytes())) expectedConnection := types.NewConnectionEnd(types.TRYOPEN, connection.Counterparty.ClientId, expectedCounterparty, []*types.Version{version}, connection.DelayPeriod) @@ -227,18 +173,6 @@ func (k Keeper) ConnOpenAck( return err } - // Check that ChainB stored the clientState provided in the msg - if err := k.VerifyClientState(ctx, connection, proofHeight, clientProof, clientState); err != nil { - return err - } - - // Ensure that ChainB has stored the correct ConsensusState for chainA at the consensusHeight - if err := k.VerifyClientConsensusState( - ctx, connection, proofHeight, consensusHeight, consensusProof, expectedConsensusState, - ); err != nil { - return err - } - k.Logger(ctx).Info("connection state updated", "connection-id", connectionID, "previous-state", types.INIT.String(), "new-state", types.OPEN.String()) defer telemetry.IncrCounter(1, "ibc", "connection", "open-ack") diff --git a/modules/core/03-connection/keeper/handshake_test.go b/modules/core/03-connection/keeper/handshake_test.go index dba6f03e448..4d3d5675796 100644 --- a/modules/core/03-connection/keeper/handshake_test.go +++ b/modules/core/03-connection/keeper/handshake_test.go @@ -3,15 +3,11 @@ package keeper_test import ( "time" - sdk "github.com/cosmos/cosmos-sdk/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" host "github.com/cosmos/ibc-go/v8/modules/core/24-host" "github.com/cosmos/ibc-go/v8/modules/core/exported" - ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" ibctesting "github.com/cosmos/ibc-go/v8/testing" - "github.com/cosmos/ibc-go/v8/testing/mock" ) // TestConnOpenInit - chainA initializes (INIT state) a connection with @@ -135,38 +131,6 @@ func (suite *KeeperTestSuite) TestConnOpenTry() { // retrieve client state of chainA to pass as counterpartyClient counterpartyClient = suite.chainA.GetClientState(path.EndpointA.ClientID) }, true}, - {"invalid counterparty client", func() { - err := path.EndpointA.ConnOpenInit() - suite.Require().NoError(err) - - // retrieve client state of chainB to pass as counterpartyClient - counterpartyClient = suite.chainA.GetClientState(path.EndpointA.ClientID) - - // Set an invalid client of chainA on chainB - tmClient, ok := counterpartyClient.(*ibctm.ClientState) - suite.Require().True(ok) - tmClient.ChainId = "wrongchainid" - - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID, tmClient) - }, false}, - {"consensus height >= latest height", func() { - err := path.EndpointA.ConnOpenInit() - suite.Require().NoError(err) - - // retrieve client state of chainA to pass as counterpartyClient - counterpartyClient = suite.chainA.GetClientState(path.EndpointA.ClientID) - - consensusHeight = clienttypes.GetSelfHeight(suite.chainB.GetContext()) - }, false}, - {"self consensus state not found", func() { - err := path.EndpointA.ConnOpenInit() - suite.Require().NoError(err) - - // retrieve client state of chainA to pass as counterpartyClient - counterpartyClient = suite.chainA.GetClientState(path.EndpointA.ClientID) - - consensusHeight = clienttypes.NewHeight(0, 1) - }, false}, {"counterparty versions is empty", func() { err := path.EndpointA.ConnOpenInit() suite.Require().NoError(err) @@ -192,50 +156,6 @@ func (suite *KeeperTestSuite) TestConnOpenTry() { // retrieve client state of chainA to pass as counterpartyClient counterpartyClient = suite.chainA.GetClientState(path.EndpointA.ClientID) }, false}, - {"client state verification failed", func() { - err := path.EndpointA.ConnOpenInit() - suite.Require().NoError(err) - - // retrieve client state of chainA to pass as counterpartyClient - counterpartyClient = suite.chainA.GetClientState(path.EndpointA.ClientID) - - // modify counterparty client without setting in store so it still passes validate but fails proof verification - tmClient, ok := counterpartyClient.(*ibctm.ClientState) - suite.Require().True(ok) - tmClient.LatestHeight = tmClient.LatestHeight.Increment().(clienttypes.Height) - }, false}, - {"consensus state verification failed", func() { - // retrieve client state of chainA to pass as counterpartyClient - counterpartyClient = suite.chainA.GetClientState(path.EndpointA.ClientID) - - // give chainA wrong consensus state for chainB - consState, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetLatestClientConsensusState(suite.chainA.GetContext(), path.EndpointA.ClientID) - suite.Require().True(found) - - tmConsState, ok := consState.(*ibctm.ConsensusState) - suite.Require().True(ok) - - tmConsState.Timestamp = time.Now() - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), path.EndpointA.ClientID, counterpartyClient.GetLatestHeight(), tmConsState) - - err := path.EndpointA.ConnOpenInit() - suite.Require().NoError(err) - }, false}, - {"override self consensus host", func() { - err := path.EndpointA.ConnOpenInit() - suite.Require().NoError(err) - - // retrieve client state of chainA to pass as counterpartyClient - counterpartyClient = suite.chainA.GetClientState(path.EndpointA.ClientID) - - mockValidator := mock.ConsensusHost{ - ValidateSelfClientFn: func(ctx sdk.Context, clientState exported.ClientState) error { - return mock.MockApplicationCallbackError - }, - } - - suite.chainB.App.GetIBCKeeper().SetConsensusHost(&mockValidator) - }, false}, } for _, tc := range testCases { @@ -313,35 +233,6 @@ func (suite *KeeperTestSuite) TestConnOpenAck() { // retrieve client state of chainB to pass as counterpartyClient counterpartyClient = suite.chainB.GetClientState(path.EndpointB.ClientID) }, true}, - {"invalid counterparty client", func() { - err := path.EndpointA.ConnOpenInit() - suite.Require().NoError(err) - - err = path.EndpointB.ConnOpenTry() - suite.Require().NoError(err) - - // retrieve client state of chainB to pass as counterpartyClient - counterpartyClient = suite.chainB.GetClientState(path.EndpointB.ClientID) - - // Set an invalid client of chainA on chainB - tmClient, ok := counterpartyClient.(*ibctm.ClientState) - suite.Require().True(ok) - tmClient.ChainId = "wrongchainid" - - suite.chainB.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainB.GetContext(), path.EndpointB.ClientID, tmClient) - }, false}, - {"consensus height >= latest height", func() { - err := path.EndpointA.ConnOpenInit() - suite.Require().NoError(err) - - // retrieve client state of chainB to pass as counterpartyClient - counterpartyClient = suite.chainB.GetClientState(path.EndpointB.ClientID) - - err = path.EndpointB.ConnOpenTry() - suite.Require().NoError(err) - - consensusHeight = clienttypes.GetSelfHeight(suite.chainA.GetContext()) - }, false}, {"connection not found", func() { // connections are never created @@ -363,6 +254,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() { suite.Require().True(found) connection.Counterparty.ConnectionId = "badconnectionid" + path.EndpointB.ConnectionID = "badconnectionid" suite.chainA.App.GetIBCKeeper().ConnectionKeeper.SetConnection(suite.chainA.GetContext(), path.EndpointA.ConnectionID, connection) @@ -436,18 +328,6 @@ func (suite *KeeperTestSuite) TestConnOpenAck() { version = types.NewVersion(types.DefaultIBCVersionIdentifier, []string{"ORDER_ORDERED", "ORDER_UNORDERED", "ORDER_DAG"}) }, false}, - {"self consensus state not found", func() { - err := path.EndpointA.ConnOpenInit() - suite.Require().NoError(err) - - // retrieve client state of chainB to pass as counterpartyClient - counterpartyClient = suite.chainB.GetClientState(path.EndpointB.ClientID) - - err = path.EndpointB.ConnOpenTry() - suite.Require().NoError(err) - - consensusHeight = clienttypes.NewHeight(0, 1) - }, false}, {"connection state verification failed", func() { // chainB connection is not in INIT err := path.EndpointA.ConnOpenInit() @@ -456,41 +336,6 @@ func (suite *KeeperTestSuite) TestConnOpenAck() { // retrieve client state of chainB to pass as counterpartyClient counterpartyClient = suite.chainB.GetClientState(path.EndpointB.ClientID) }, false}, - {"client state verification failed", func() { - err := path.EndpointA.ConnOpenInit() - suite.Require().NoError(err) - - // retrieve client state of chainB to pass as counterpartyClient - counterpartyClient = suite.chainB.GetClientState(path.EndpointB.ClientID) - - // modify counterparty client without setting in store so it still passes validate but fails proof verification - tmClient, ok := counterpartyClient.(*ibctm.ClientState) - suite.Require().True(ok) - tmClient.LatestHeight = tmClient.LatestHeight.Increment().(clienttypes.Height) - - err = path.EndpointB.ConnOpenTry() - suite.Require().NoError(err) - }, false}, - {"consensus state verification failed", func() { - err := path.EndpointA.ConnOpenInit() - suite.Require().NoError(err) - - // retrieve client state of chainB to pass as counterpartyClient - counterpartyClient = suite.chainB.GetClientState(path.EndpointB.ClientID) - - // give chainB wrong consensus state for chainA - consState, found := suite.chainB.App.GetIBCKeeper().ClientKeeper.GetLatestClientConsensusState(suite.chainB.GetContext(), path.EndpointB.ClientID) - suite.Require().True(found) - - tmConsState, ok := consState.(*ibctm.ConsensusState) - suite.Require().True(ok) - - tmConsState.Timestamp = tmConsState.Timestamp.Add(time.Second) - suite.chainB.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainB.GetContext(), path.EndpointB.ClientID, counterpartyClient.GetLatestHeight(), tmConsState) - - err = path.EndpointB.ConnOpenTry() - suite.Require().NoError(err) - }, false}, } for _, tc := range testCases { diff --git a/modules/core/03-connection/types/msgs.go b/modules/core/03-connection/types/msgs.go index 9d8db1fb548..9f8d9c67dd7 100644 --- a/modules/core/03-connection/types/msgs.go +++ b/modules/core/03-connection/types/msgs.go @@ -125,16 +125,6 @@ func (msg MsgConnectionOpenTry) ValidateBasic() error { if err := host.ConnectionIdentifierValidator(msg.Counterparty.ConnectionId); err != nil { return errorsmod.Wrap(err, "invalid counterparty connection ID") } - if msg.ClientState == nil { - return errorsmod.Wrap(clienttypes.ErrInvalidClient, "counterparty client is nil") - } - clientState, err := clienttypes.UnpackClientState(msg.ClientState) - if err != nil { - return errorsmod.Wrapf(clienttypes.ErrInvalidClient, "unpack err: %v", err) - } - if err := clientState.Validate(); err != nil { - return errorsmod.Wrap(err, "counterparty client is invalid") - } if len(msg.CounterpartyVersions) == 0 { return errorsmod.Wrap(ibcerrors.ErrInvalidVersion, "empty counterparty versions") } @@ -146,16 +136,7 @@ func (msg MsgConnectionOpenTry) ValidateBasic() error { if len(msg.ProofInit) == 0 { return errorsmod.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof init") } - if len(msg.ProofClient) == 0 { - return errorsmod.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit empty proof client") - } - if len(msg.ProofConsensus) == 0 { - return errorsmod.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof of consensus state") - } - if msg.ConsensusHeight.IsZero() { - return errorsmod.Wrap(ibcerrors.ErrInvalidHeight, "consensus height must be non-zero") - } - _, err = sdk.AccAddressFromBech32(msg.Signer) + _, err := sdk.AccAddressFromBech32(msg.Signer) if err != nil { return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) } @@ -215,29 +196,10 @@ func (msg MsgConnectionOpenAck) ValidateBasic() error { if err := ValidateVersion(msg.Version); err != nil { return err } - if msg.ClientState == nil { - return errorsmod.Wrap(clienttypes.ErrInvalidClient, "counterparty client is nil") - } - clientState, err := clienttypes.UnpackClientState(msg.ClientState) - if err != nil { - return errorsmod.Wrapf(clienttypes.ErrInvalidClient, "unpack err: %v", err) - } - if err := clientState.Validate(); err != nil { - return errorsmod.Wrap(err, "counterparty client is invalid") - } if len(msg.ProofTry) == 0 { return errorsmod.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof try") } - if len(msg.ProofClient) == 0 { - return errorsmod.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit empty proof client") - } - if len(msg.ProofConsensus) == 0 { - return errorsmod.Wrap(commitmenttypes.ErrInvalidProof, "cannot submit an empty proof of consensus state") - } - if msg.ConsensusHeight.IsZero() { - return errorsmod.Wrap(ibcerrors.ErrInvalidHeight, "consensus height must be non-zero") - } - _, err = sdk.AccAddressFromBech32(msg.Signer) + _, err := sdk.AccAddressFromBech32(msg.Signer) if err != nil { return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) } diff --git a/modules/core/03-connection/types/msgs_test.go b/modules/core/03-connection/types/msgs_test.go index ba26c117c0e..1ea67f33db6 100644 --- a/modules/core/03-connection/types/msgs_test.go +++ b/modules/core/03-connection/types/msgs_test.go @@ -3,7 +3,6 @@ package types_test import ( "fmt" "testing" - "time" dbm "github.com/cosmos/cosmos-db" "github.com/stretchr/testify/require" @@ -124,18 +123,8 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenTry() { protoAny, err := clienttypes.PackClientState(clientState) suite.Require().NoError(err) - // Pack consensus state into any to test unpacking error - consState := ibctm.NewConsensusState( - time.Now(), commitmenttypes.NewMerkleRoot([]byte("root")), []byte("nextValsHash"), - ) - invalidAny := clienttypes.MustPackConsensusState(consState) counterparty := types.NewCounterparty("connectiontotest", "clienttotest", prefix) - // invalidClientState fails validateBasic - invalidClient := ibctm.NewClientState( - chainID, ibctm.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clienttypes.ZeroHeight(), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, - ) - testCases := []struct { name string msg *types.MsgConnectionOpenTry @@ -146,15 +135,9 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenTry() { {"invalid client ID", types.NewMsgConnectionOpenTry("test/iris", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, 500, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false}, {"invalid counterparty connection ID", types.NewMsgConnectionOpenTry("clienttotesta", "ibc/test", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, 500, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false}, {"invalid counterparty client ID", types.NewMsgConnectionOpenTry("clienttotesta", "connectiontotest", "test/conn1", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, 500, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false}, - {"invalid nil counterparty client", types.NewMsgConnectionOpenTry("clienttotesta", "connectiontotest", "clienttotest", nil, prefix, []*types.Version{ibctesting.ConnectionVersion}, 500, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false}, - {"invalid client unpacking", &types.MsgConnectionOpenTry{"", "clienttotesta", invalidAny, counterparty, 500, []*types.Version{ibctesting.ConnectionVersion}, clientHeight, suite.proof, suite.proof, suite.proof, clientHeight, signer, nil}, false}, - {"counterparty failed validate", types.NewMsgConnectionOpenTry("clienttotesta", "connectiontotest", "clienttotest", invalidClient, prefix, []*types.Version{ibctesting.ConnectionVersion}, 500, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false}, {"empty counterparty prefix", types.NewMsgConnectionOpenTry("clienttotesta", "connectiontotest", "clienttotest", clientState, emptyPrefix, []*types.Version{ibctesting.ConnectionVersion}, 500, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false}, {"empty counterpartyVersions", types.NewMsgConnectionOpenTry("clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{}, 500, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false}, {"empty proofInit", types.NewMsgConnectionOpenTry("clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, 500, emptyProof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false}, - {"empty proofClient", types.NewMsgConnectionOpenTry("clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, 500, suite.proof, emptyProof, suite.proof, clientHeight, clientHeight, signer), false}, - {"empty proofConsensus", types.NewMsgConnectionOpenTry("clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, 500, suite.proof, suite.proof, emptyProof, clientHeight, clientHeight, signer), false}, - {"invalid consensusHeight", types.NewMsgConnectionOpenTry("clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, 500, suite.proof, suite.proof, suite.proof, clientHeight, clienttypes.ZeroHeight(), signer), false}, {"empty singer", types.NewMsgConnectionOpenTry("clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, 500, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, ""), false}, {"success", types.NewMsgConnectionOpenTry("clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{ibctesting.ConnectionVersion}, 500, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), true}, {"invalid version", types.NewMsgConnectionOpenTry("clienttotesta", "connectiontotest", "clienttotest", clientState, prefix, []*types.Version{{}}, 500, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, signer), false}, @@ -177,16 +160,6 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenAck() { chainID, ibctm.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, ) - // Pack consensus state into any to test unpacking error - consState := ibctm.NewConsensusState( - time.Now(), commitmenttypes.NewMerkleRoot([]byte("root")), []byte("nextValsHash"), - ) - invalidAny := clienttypes.MustPackConsensusState(consState) - - // invalidClientState fails validateBasic - invalidClient := ibctm.NewClientState( - chainID, ibctm.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clienttypes.ZeroHeight(), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, - ) connectionID := "connection-0" testCases := []struct { @@ -196,13 +169,7 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenAck() { }{ {"invalid connection ID", types.NewMsgConnectionOpenAck("test/conn1", connectionID, clientState, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, ibctesting.ConnectionVersion, signer), false}, {"invalid counterparty connection ID", types.NewMsgConnectionOpenAck(connectionID, "test/conn1", clientState, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, ibctesting.ConnectionVersion, signer), false}, - {"invalid nil counterparty client", types.NewMsgConnectionOpenAck(connectionID, connectionID, nil, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, ibctesting.ConnectionVersion, signer), false}, - {"invalid unpacking counterparty client", &types.MsgConnectionOpenAck{connectionID, connectionID, ibctesting.ConnectionVersion, invalidAny, clientHeight, suite.proof, suite.proof, suite.proof, clientHeight, signer, nil}, false}, - {"counterparty client failed validate", types.NewMsgConnectionOpenAck(connectionID, connectionID, invalidClient, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, ibctesting.ConnectionVersion, signer), false}, {"empty proofTry", types.NewMsgConnectionOpenAck(connectionID, connectionID, clientState, emptyProof, suite.proof, suite.proof, clientHeight, clientHeight, ibctesting.ConnectionVersion, signer), false}, - {"empty proofClient", types.NewMsgConnectionOpenAck(connectionID, connectionID, clientState, suite.proof, emptyProof, suite.proof, clientHeight, clientHeight, ibctesting.ConnectionVersion, signer), false}, - {"empty proofConsensus", types.NewMsgConnectionOpenAck(connectionID, connectionID, clientState, suite.proof, suite.proof, emptyProof, clientHeight, clientHeight, ibctesting.ConnectionVersion, signer), false}, - {"invalid consensusHeight", types.NewMsgConnectionOpenAck(connectionID, connectionID, clientState, suite.proof, suite.proof, suite.proof, clientHeight, clienttypes.ZeroHeight(), ibctesting.ConnectionVersion, signer), false}, {"invalid version", types.NewMsgConnectionOpenAck(connectionID, connectionID, clientState, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, &types.Version{}, signer), false}, {"empty signer", types.NewMsgConnectionOpenAck(connectionID, connectionID, clientState, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, ibctesting.ConnectionVersion, ""), false}, {"success", types.NewMsgConnectionOpenAck(connectionID, connectionID, clientState, suite.proof, suite.proof, suite.proof, clientHeight, clientHeight, ibctesting.ConnectionVersion, signer), true}, diff --git a/testing/solomachine.go b/testing/solomachine.go index 72b05f7c407..b64c12df026 100644 --- a/testing/solomachine.go +++ b/testing/solomachine.go @@ -289,15 +289,10 @@ func (solo *Solomachine) ConnOpenAck(chain *TestChain, clientID, connectionID st tryProof := solo.GenerateConnOpenTryProof(clientID, connectionID) clientState := ibctm.NewClientState(chain.ChainID, DefaultTrustLevel, TrustingPeriod, UnbondingPeriod, MaxClockDrift, chain.LastHeader.GetHeight().(clienttypes.Height), commitmenttypes.GetSDKSpecs(), UpgradePath) - clientProof := solo.GenerateClientStateProof(clientState) - - consensusState := chain.LastHeader.ConsensusState() - consensusHeight := chain.LastHeader.GetHeight() - consensusProof := solo.GenerateConsensusStateProof(consensusState, consensusHeight) msgConnOpenAck := connectiontypes.NewMsgConnectionOpenAck( connectionID, connectionIDSolomachine, clientState, - tryProof, clientProof, consensusProof, + tryProof, nil, nil, clienttypes.ZeroHeight(), clientState.GetLatestHeight().(clienttypes.Height), ConnectionVersion, chain.SenderAccount.GetAddress().String(), From 45751f96ed1a55b259ebab3a29bb67b21300b71b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 12 Aug 2024 16:31:46 +0200 Subject: [PATCH 2/4] chore: generate proto deprecation notice --- go.mod | 12 +- modules/core/03-connection/types/tx.pb.go | 139 +++++++++++----------- proto/ibc/core/connection/v1/tx.proto | 22 ++-- 3 files changed, 87 insertions(+), 86 deletions(-) diff --git a/go.mod b/go.mod index 19cf654cd2d..f982ef3b52d 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,12 @@ go 1.21 module github.com/cosmos/ibc-go/v8 retract ( - // contain bug in channel upgradability that can result - // in a channel upgrade succeeding but with channel ends - // in incompatible state - [v8.2.0, v8.3.2] - // contain ASA-2024-007 vulnerability - [v8.0.0, v8.1.1] + // contain bug in channel upgradability that can result + // in a channel upgrade succeeding but with channel ends + // in incompatible state + [v8.2.0, v8.3.2] + // contain ASA-2024-007 vulnerability + [v8.0.0, v8.1.1] ) require ( diff --git a/modules/core/03-connection/types/tx.pb.go b/modules/core/03-connection/types/tx.pb.go index afe87287690..6abfa21d06d 100644 --- a/modules/core/03-connection/types/tx.pb.go +++ b/modules/core/03-connection/types/tx.pb.go @@ -118,7 +118,7 @@ type MsgConnectionOpenTry struct { ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` // Deprecated: this field is unused. Crossing hellos are no longer supported in core IBC. PreviousConnectionId string `protobuf:"bytes,2,opt,name=previous_connection_id,json=previousConnectionId,proto3" json:"previous_connection_id,omitempty"` // Deprecated: Do not use. - ClientState *types.Any `protobuf:"bytes,3,opt,name=client_state,json=clientState,proto3" json:"client_state,omitempty"` + ClientState *types.Any `protobuf:"bytes,3,opt,name=client_state,json=clientState,proto3" json:"client_state,omitempty"` // Deprecated: Do not use. Counterparty Counterparty `protobuf:"bytes,4,opt,name=counterparty,proto3" json:"counterparty"` DelayPeriod uint64 `protobuf:"varint,5,opt,name=delay_period,json=delayPeriod,proto3" json:"delay_period,omitempty"` CounterpartyVersions []*Version `protobuf:"bytes,6,rep,name=counterparty_versions,json=counterpartyVersions,proto3" json:"counterparty_versions,omitempty"` @@ -127,13 +127,13 @@ type MsgConnectionOpenTry struct { // INIT` ProofInit []byte `protobuf:"bytes,8,opt,name=proof_init,json=proofInit,proto3" json:"proof_init,omitempty"` // proof of client state included in message - ProofClient []byte `protobuf:"bytes,9,opt,name=proof_client,json=proofClient,proto3" json:"proof_client,omitempty"` + ProofClient []byte `protobuf:"bytes,9,opt,name=proof_client,json=proofClient,proto3" json:"proof_client,omitempty"` // Deprecated: Do not use. // proof of client consensus state - ProofConsensus []byte `protobuf:"bytes,10,opt,name=proof_consensus,json=proofConsensus,proto3" json:"proof_consensus,omitempty"` - ConsensusHeight types1.Height `protobuf:"bytes,11,opt,name=consensus_height,json=consensusHeight,proto3" json:"consensus_height"` + ProofConsensus []byte `protobuf:"bytes,10,opt,name=proof_consensus,json=proofConsensus,proto3" json:"proof_consensus,omitempty"` // Deprecated: Do not use. + ConsensusHeight types1.Height `protobuf:"bytes,11,opt,name=consensus_height,json=consensusHeight,proto3" json:"consensus_height"` // Deprecated: Do not use. Signer string `protobuf:"bytes,12,opt,name=signer,proto3" json:"signer,omitempty"` // optional proof data for host state machines that are unable to introspect their own consensus state - HostConsensusStateProof []byte `protobuf:"bytes,13,opt,name=host_consensus_state_proof,json=hostConsensusStateProof,proto3" json:"host_consensus_state_proof,omitempty"` + HostConsensusStateProof []byte `protobuf:"bytes,13,opt,name=host_consensus_state_proof,json=hostConsensusStateProof,proto3" json:"host_consensus_state_proof,omitempty"` // Deprecated: Do not use. } func (m *MsgConnectionOpenTry) Reset() { *m = MsgConnectionOpenTry{} } @@ -212,19 +212,19 @@ type MsgConnectionOpenAck struct { ConnectionId string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` CounterpartyConnectionId string `protobuf:"bytes,2,opt,name=counterparty_connection_id,json=counterpartyConnectionId,proto3" json:"counterparty_connection_id,omitempty"` Version *Version `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` - ClientState *types.Any `protobuf:"bytes,4,opt,name=client_state,json=clientState,proto3" json:"client_state,omitempty"` + ClientState *types.Any `protobuf:"bytes,4,opt,name=client_state,json=clientState,proto3" json:"client_state,omitempty"` // Deprecated: Do not use. ProofHeight types1.Height `protobuf:"bytes,5,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height"` // proof of the initialization the connection on Chain B: `UNITIALIZED -> // TRYOPEN` ProofTry []byte `protobuf:"bytes,6,opt,name=proof_try,json=proofTry,proto3" json:"proof_try,omitempty"` // proof of client state included in message - ProofClient []byte `protobuf:"bytes,7,opt,name=proof_client,json=proofClient,proto3" json:"proof_client,omitempty"` + ProofClient []byte `protobuf:"bytes,7,opt,name=proof_client,json=proofClient,proto3" json:"proof_client,omitempty"` // Deprecated: Do not use. // proof of client consensus state - ProofConsensus []byte `protobuf:"bytes,8,opt,name=proof_consensus,json=proofConsensus,proto3" json:"proof_consensus,omitempty"` - ConsensusHeight types1.Height `protobuf:"bytes,9,opt,name=consensus_height,json=consensusHeight,proto3" json:"consensus_height"` + ProofConsensus []byte `protobuf:"bytes,8,opt,name=proof_consensus,json=proofConsensus,proto3" json:"proof_consensus,omitempty"` // Deprecated: Do not use. + ConsensusHeight types1.Height `protobuf:"bytes,9,opt,name=consensus_height,json=consensusHeight,proto3" json:"consensus_height"` // Deprecated: Do not use. Signer string `protobuf:"bytes,10,opt,name=signer,proto3" json:"signer,omitempty"` // optional proof data for host state machines that are unable to introspect their own consensus state - HostConsensusStateProof []byte `protobuf:"bytes,11,opt,name=host_consensus_state_proof,json=hostConsensusStateProof,proto3" json:"host_consensus_state_proof,omitempty"` + HostConsensusStateProof []byte `protobuf:"bytes,11,opt,name=host_consensus_state_proof,json=hostConsensusStateProof,proto3" json:"host_consensus_state_proof,omitempty"` // Deprecated: Do not use. } func (m *MsgConnectionOpenAck) Reset() { *m = MsgConnectionOpenAck{} } @@ -474,65 +474,66 @@ func init() { func init() { proto.RegisterFile("ibc/core/connection/v1/tx.proto", fileDescriptor_5d00fde5fc97399e) } var fileDescriptor_5d00fde5fc97399e = []byte{ - // 927 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x41, 0x6f, 0xe3, 0x44, - 0x14, 0xc7, 0xe3, 0xd6, 0x49, 0x9b, 0x97, 0x2c, 0x85, 0x51, 0xda, 0x7a, 0xbd, 0xac, 0x93, 0x2d, - 0x48, 0xad, 0x56, 0xd4, 0xde, 0xee, 0x82, 0x28, 0xd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xc4, 0x03, 0xfa, 0x0e, 0xde, 0x99, 0xfd, 0xd6, 0x7e, 0x50, 0xb8, 0xd6, 0x69, 0x10, 0xe9, - 0x1f, 0x2e, 0xa2, 0x9e, 0xbf, 0x70, 0x0c, 0x4e, 0xf1, 0x85, 0x0f, 0x9d, 0x8b, 0x05, 0x16, 0xce, - 0xb0, 0x8f, 0x7e, 0x52, 0x60, 0x3d, 0x1f, 0xfc, 0x47, 0x85, 0xeb, 0xc9, 0x0c, 0x7d, 0x7f, 0xd1, - 0x8c, 0xd4, 0x45, 0x00, 0x1b, 0x82, 0x89, 0xb1, 0x4c, 0x72, 0xb9, 0x7d, 0x43, 0xcd, 0x2c, 0x46, - 0xba, 0x55, 0x50, 0x98, 0xac, 0xa9, 0x97, 0x7f, 0x78, 0xfd, 0xe2, 0xa1, 0x72, 0xf4, 0xec, 0xe5, - 0x95, 0xa1, 0xbc, 0xba, 0x32, 0x94, 0x7f, 0xae, 0x0c, 0xe5, 0xd7, 0x6b, 0xa3, 0xf4, 0xea, 0xda, - 0x28, 0xfd, 0x75, 0x6d, 0x94, 0xbe, 0x3d, 0x70, 0x49, 0x78, 0x3e, 0xec, 0x99, 0x0e, 0x1d, 0x58, - 0xf2, 0xd2, 0x4c, 0x7a, 0xce, 0xae, 0x4b, 0xad, 0xd1, 0xbe, 0x35, 0xa0, 0xfd, 0xe1, 0x25, 0x66, - 0xe2, 0xd2, 0xfb, 0xe8, 0xc9, 0x6e, 0xe6, 0xde, 0x1b, 0x46, 0x3e, 0x66, 0xbd, 0x0a, 0x7f, 0xe1, - 0x3f, 0xf9, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x92, 0xe1, 0xc5, 0x47, 0xbf, 0x0b, 0x00, 0x00, + // 938 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xc7, 0xbd, 0x89, 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 0x21, 0x96, 0x4a, 0x73, 0xe3, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/proto/ibc/core/connection/v1/tx.proto b/proto/ibc/core/connection/v1/tx.proto index 3ba8ff45660..648cb4bac1c 100644 --- a/proto/ibc/core/connection/v1/tx.proto +++ b/proto/ibc/core/connection/v1/tx.proto @@ -60,7 +60,7 @@ message MsgConnectionOpenTry { string client_id = 1; // Deprecated: this field is unused. Crossing hellos are no longer supported in core IBC. string previous_connection_id = 2 [deprecated = true]; - google.protobuf.Any client_state = 3; + google.protobuf.Any client_state = 3 [deprecated = true]; Counterparty counterparty = 4 [(gogoproto.nullable) = false]; uint64 delay_period = 5; repeated Version counterparty_versions = 6; @@ -69,13 +69,13 @@ message MsgConnectionOpenTry { // INIT` bytes proof_init = 8; // proof of client state included in message - bytes proof_client = 9; + bytes proof_client = 9 [deprecated = true]; // proof of client consensus state - bytes proof_consensus = 10; - ibc.core.client.v1.Height consensus_height = 11 [(gogoproto.nullable) = false]; + bytes proof_consensus = 10 [deprecated = true]; + ibc.core.client.v1.Height consensus_height = 11 [deprecated = true, (gogoproto.nullable) = false]; string signer = 12; // optional proof data for host state machines that are unable to introspect their own consensus state - bytes host_consensus_state_proof = 13; + bytes host_consensus_state_proof = 13 [deprecated = true]; } // MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. @@ -91,19 +91,19 @@ message MsgConnectionOpenAck { string connection_id = 1; string counterparty_connection_id = 2; Version version = 3; - google.protobuf.Any client_state = 4; + google.protobuf.Any client_state = 4 [deprecated = true]; ibc.core.client.v1.Height proof_height = 5 [(gogoproto.nullable) = false]; // proof of the initialization the connection on Chain B: `UNITIALIZED -> // TRYOPEN` bytes proof_try = 6; // proof of client state included in message - bytes proof_client = 7; + bytes proof_client = 7 [deprecated = true]; // proof of client consensus state - bytes proof_consensus = 8; - ibc.core.client.v1.Height consensus_height = 9 [(gogoproto.nullable) = false]; + bytes proof_consensus = 8 [deprecated = true]; + ibc.core.client.v1.Height consensus_height = 9 [deprecated = true, (gogoproto.nullable) = false]; string signer = 10; // optional proof data for host state machines that are unable to introspect their own consensus state - bytes host_consensus_state_proof = 11; + bytes host_consensus_state_proof = 11 [deprecated = true]; } // MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. @@ -143,4 +143,4 @@ message MsgUpdateParams { } // MsgUpdateParamsResponse defines the MsgUpdateParams response type. -message MsgUpdateParamsResponse {} \ No newline at end of file +message MsgUpdateParamsResponse {} From ab413b0b621cfa1a707e219b565a44937a5d65d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 12 Aug 2024 16:32:24 +0200 Subject: [PATCH 3/4] add changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index da517e87049..961356b9cc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,12 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog +## [v8.5.0]() + +### State Machine Breaking + +* (core/03-connection)[\#7129](https://github.com/cosmos/ibc-go/pull/7129) Remove verification of self client and consensus state from connection handshake. + ## [v8.4.0](https://github.com/cosmos/ibc-go/releases/tag/v8.4.0) - 2024-07-29 ### Improvements From 354d3979bfcada569855b1025d98a430bbfd81ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 12 Aug 2024 16:37:22 +0200 Subject: [PATCH 4/4] refactor: remove unpacking from msg server --- modules/core/keeper/msg_server.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 27dae2e0c2e..dacea0e8b4b 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -149,13 +149,8 @@ func (k Keeper) ConnectionOpenInit(goCtx context.Context, msg *connectiontypes.M func (k Keeper) ConnectionOpenTry(goCtx context.Context, msg *connectiontypes.MsgConnectionOpenTry) (*connectiontypes.MsgConnectionOpenTryResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - targetClient, err := clienttypes.UnpackClientState(msg.ClientState) - if err != nil { - return nil, err - } - if _, err := k.ConnectionKeeper.ConnOpenTry( - ctx, msg.Counterparty, msg.DelayPeriod, msg.ClientId, targetClient, + ctx, msg.Counterparty, msg.DelayPeriod, msg.ClientId, nil, msg.CounterpartyVersions, msg.ProofInit, msg.ProofClient, msg.ProofConsensus, msg.ProofHeight, msg.ConsensusHeight, ); err != nil { @@ -169,13 +164,8 @@ func (k Keeper) ConnectionOpenTry(goCtx context.Context, msg *connectiontypes.Ms func (k Keeper) ConnectionOpenAck(goCtx context.Context, msg *connectiontypes.MsgConnectionOpenAck) (*connectiontypes.MsgConnectionOpenAckResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - targetClient, err := clienttypes.UnpackClientState(msg.ClientState) - if err != nil { - return nil, err - } - if err := k.ConnectionKeeper.ConnOpenAck( - ctx, msg.ConnectionId, targetClient, msg.Version, msg.CounterpartyConnectionId, + ctx, msg.ConnectionId, nil, msg.Version, msg.CounterpartyConnectionId, msg.ProofTry, msg.ProofClient, msg.ProofConsensus, msg.ProofHeight, msg.ConsensusHeight, ); err != nil {