diff --git a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go index fb5d54bf740..5ec07fb8ea2 100644 --- a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go +++ b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go @@ -280,10 +280,10 @@ func (suite *InterchainAccountsTestSuite) TestChanOpenTry() { suite.Require().NoError(err) channelKey := host.ChannelKey(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - proofInit, proofHeight := path.EndpointB.Chain.QueryProof(channelKey) + initProof, proofHeight := path.EndpointB.Chain.QueryProof(channelKey) // use chainA (controller) for ChanOpenTry - msg := channeltypes.NewMsgChannelOpenTry(path.EndpointA.ChannelConfig.PortID, TestVersion, channeltypes.ORDERED, []string{path.EndpointA.ConnectionID}, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, TestVersion, proofInit, proofHeight, icatypes.ModuleName) + msg := channeltypes.NewMsgChannelOpenTry(path.EndpointA.ChannelConfig.PortID, TestVersion, channeltypes.ORDERED, []string{path.EndpointA.ConnectionID}, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, TestVersion, initProof, proofHeight, icatypes.ModuleName) handler := suite.chainA.GetSimApp().MsgServiceRouter().Handler(msg) _, err = handler(suite.chainA.GetContext(), msg) @@ -427,10 +427,10 @@ func (suite *InterchainAccountsTestSuite) TestChanOpenConfirm() { // query proof from ChainB channelKey := host.ChannelKey(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - proofAck, proofHeight := path.EndpointB.Chain.QueryProof(channelKey) + ackProof, proofHeight := path.EndpointB.Chain.QueryProof(channelKey) // use chainA (controller) for ChanOpenConfirm - msg := channeltypes.NewMsgChannelOpenConfirm(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, proofAck, proofHeight, icatypes.ModuleName) + msg := channeltypes.NewMsgChannelOpenConfirm(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, ackProof, proofHeight, icatypes.ModuleName) handler := suite.chainA.GetSimApp().MsgServiceRouter().Handler(msg) _, err = handler(suite.chainA.GetContext(), msg) diff --git a/modules/apps/27-interchain-accounts/host/ibc_module_test.go b/modules/apps/27-interchain-accounts/host/ibc_module_test.go index 3491f47d52d..827284ac310 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module_test.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module_test.go @@ -257,10 +257,10 @@ func (suite *InterchainAccountsTestSuite) TestChanOpenAck() { // query proof from ChainA channelKey := host.ChannelKey(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - proofTry, proofHeight := path.EndpointA.Chain.QueryProof(channelKey) + tryProof, proofHeight := path.EndpointA.Chain.QueryProof(channelKey) // use chainB (host) for ChanOpenAck - msg := channeltypes.NewMsgChannelOpenAck(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, path.EndpointA.ChannelID, TestVersion, proofTry, proofHeight, icatypes.ModuleName) + msg := channeltypes.NewMsgChannelOpenAck(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, path.EndpointA.ChannelID, TestVersion, tryProof, proofHeight, icatypes.ModuleName) handler := suite.chainB.GetSimApp().MsgServiceRouter().Handler(msg) _, err = handler(suite.chainB.GetContext(), msg) diff --git a/modules/core/02-client/client/cli/tx.go b/modules/core/02-client/client/cli/tx.go index 19fd8b3f90b..92e6a5ec5e7 100644 --- a/modules/core/02-client/client/cli/tx.go +++ b/modules/core/02-client/client/cli/tx.go @@ -229,10 +229,10 @@ func newUpgradeClientCmd() *cobra.Command { } } - proofUpgradeClient := []byte(args[3]) - proofUpgradeConsensus := []byte(args[4]) + upgradeClientProof := []byte(args[3]) + upgradeConsensusProof := []byte(args[4]) - msg, err := types.NewMsgUpgradeClient(clientID, clientState, consensusState, proofUpgradeClient, proofUpgradeConsensus, clientCtx.GetFromAddress().String()) + msg, err := types.NewMsgUpgradeClient(clientID, clientState, consensusState, upgradeClientProof, upgradeConsensusProof, clientCtx.GetFromAddress().String()) if err != nil { return err } diff --git a/modules/core/02-client/keeper/client.go b/modules/core/02-client/keeper/client.go index db24eee27b6..da4d38229cf 100644 --- a/modules/core/02-client/keeper/client.go +++ b/modules/core/02-client/keeper/client.go @@ -115,7 +115,7 @@ func (k Keeper) UpdateClient(ctx sdk.Context, clientID string, clientMsg exporte // UpgradeClient upgrades the client to a new client state if this new client was committed to // by the old client at the specified upgrade height func (k Keeper) UpgradeClient(ctx sdk.Context, clientID string, upgradedClient exported.ClientState, upgradedConsState exported.ConsensusState, - proofUpgradeClient, proofUpgradeConsState []byte, + upgradeClientProof, upgradeConsensusStateProof []byte, ) error { clientState, found := k.GetClientState(ctx, clientID) if !found { @@ -129,7 +129,7 @@ func (k Keeper) UpgradeClient(ctx sdk.Context, clientID string, upgradedClient e } if err := clientState.VerifyUpgradeAndUpdateState(ctx, k.cdc, clientStore, - upgradedClient, upgradedConsState, proofUpgradeClient, proofUpgradeConsState, + upgradedClient, upgradedConsState, upgradeClientProof, upgradeConsensusStateProof, ); err != nil { return errorsmod.Wrapf(err, "cannot upgrade client with ID %s", clientID) } diff --git a/modules/core/02-client/keeper/client_test.go b/modules/core/02-client/keeper/client_test.go index 0f0786fa873..368faa0dbf3 100644 --- a/modules/core/02-client/keeper/client_test.go +++ b/modules/core/02-client/keeper/client_test.go @@ -308,12 +308,12 @@ func (suite *KeeperTestSuite) TestUpdateClientTendermint() { func (suite *KeeperTestSuite) TestUpgradeClient() { var ( - path *ibctesting.Path - upgradedClient exported.ClientState - upgradedConsState exported.ConsensusState - lastHeight exported.Height - proofUpgradedClient, proofUpgradedConsState []byte - upgradedClientBz, upgradedConsStateBz []byte + path *ibctesting.Path + upgradedClient exported.ClientState + upgradedConsState exported.ConsensusState + lastHeight exported.Height + upgradedClientProof, upgradedConsensusStateProof []byte + upgradedClientBz, upgradedConsStateBz []byte ) testCases := []struct { @@ -341,8 +341,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) }, expPass: true, }, @@ -367,8 +367,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) path.EndpointA.ClientID = "wrongclientid" }, @@ -397,8 +397,8 @@ func (suite *KeeperTestSuite) TestUpgradeClient() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) // set frozen client in store tmClient, ok := cs.(*ibctm.ClientState) @@ -432,8 +432,37 @@ func (suite *KeeperTestSuite) TestUpgradeClient() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + }, + expPass: false, + }, + { + name: "unsuccessful upgrade: upgraded height is not greater than current height", + setup: func() { + // last Height is at next block + lastHeight = clienttypes.NewHeight(1, uint64(suite.chainB.GetContext().BlockHeight()+1)) + + // zero custom fields and store in upgrade store + err := suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedClientBz) + suite.Require().NoError(err) + err = suite.chainB.GetSimApp().UpgradeKeeper.SetUpgradedConsensusState(suite.chainB.GetContext(), int64(lastHeight.GetRevisionHeight()), upgradedConsStateBz) + suite.Require().NoError(err) + + // change upgradedClient height to be lower than current client state height + tmClient := upgradedClient.(*ibctm.ClientState) + tmClient.LatestHeight = clienttypes.NewHeight(0, 1) + upgradedClient = tmClient + + suite.coordinator.CommitBlock(suite.chainB) + err = path.EndpointA.UpdateClient() + suite.Require().NoError(err) + + cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) + suite.Require().True(found) + + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) }, expPass: false, }, @@ -463,7 +492,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() { tc.setup() - err = suite.chainA.App.GetIBCKeeper().ClientKeeper.UpgradeClient(suite.chainA.GetContext(), path.EndpointA.ClientID, upgradedClient, upgradedConsState, proofUpgradedClient, proofUpgradedConsState) + err = suite.chainA.App.GetIBCKeeper().ClientKeeper.UpgradeClient(suite.chainA.GetContext(), path.EndpointA.ClientID, upgradedClient, upgradedConsState, upgradedClientProof, upgradedConsensusStateProof) if tc.expPass { suite.Require().NoError(err, "verify upgrade failed on valid case: %s", tc.name) diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index 1eb5472ca87..023e5d87b01 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -151,7 +151,7 @@ func (msg MsgUpdateClient) UnpackInterfaces(unpacker codectypes.AnyUnpacker) err // NewMsgUpgradeClient creates a new MsgUpgradeClient instance func NewMsgUpgradeClient(clientID string, clientState exported.ClientState, consState exported.ConsensusState, - proofUpgradeClient, proofUpgradeConsState []byte, signer string, + upgradeClientProof, upgradeConsensusStateProof []byte, signer string, ) (*MsgUpgradeClient, error) { anyClient, err := PackClientState(clientState) if err != nil { @@ -166,8 +166,8 @@ func NewMsgUpgradeClient(clientID string, clientState exported.ClientState, cons ClientId: clientID, ClientState: anyClient, ConsensusState: anyConsState, - ProofUpgradeClient: proofUpgradeClient, - ProofUpgradeConsensusState: proofUpgradeConsState, + ProofUpgradeClient: upgradeClientProof, + ProofUpgradeConsensusState: upgradeConsensusStateProof, Signer: signer, }, nil } diff --git a/modules/core/03-connection/keeper/handshake.go b/modules/core/03-connection/keeper/handshake.go index e83ea803c9f..c38d0504edd 100644 --- a/modules/core/03-connection/keeper/handshake.go +++ b/modules/core/03-connection/keeper/handshake.go @@ -74,9 +74,9 @@ func (k Keeper) ConnOpenTry( clientID string, // clientID of chainA clientState exported.ClientState, // clientState that chainA has for chainB counterpartyVersions []*types.Version, // supported versions of chain A - proofInit []byte, // proof that chainA stored connectionEnd in state (on ConnOpenInit) - proofClient []byte, // proof that chainA stored a light client of chainB - proofConsensus []byte, // proof that chainA stored chainB's consensus state at consensus height + 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 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 ) (string, error) { @@ -123,20 +123,20 @@ func (k Keeper) ConnOpenTry( // Check that ChainA committed expectedConnectionEnd to its state if err := k.VerifyConnectionState( - ctx, connection, proofHeight, proofInit, counterparty.ConnectionId, + ctx, connection, proofHeight, initProof, counterparty.ConnectionId, expectedConnection, ); err != nil { return "", err } // Check that ChainA stored the clientState provided in the msg - if err := k.VerifyClientState(ctx, connection, proofHeight, proofClient, clientState); err != nil { + 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, proofConsensus, expectedConsensusState, + ctx, connection, proofHeight, consensusHeight, consensusProof, expectedConsensusState, ); err != nil { return "", err } @@ -166,9 +166,9 @@ func (k Keeper) ConnOpenAck( clientState exported.ClientState, // client state for chainA on chainB version *types.Version, // version that ChainB chose in ConnOpenTry counterpartyConnectionID string, - proofTry []byte, // proof that connectionEnd was added to ChainB state in ConnOpenTry - proofClient []byte, // proof of client state on chainB for chainA - proofConsensus []byte, // proof that chainB has stored ConsensusState of chainA on its client + 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 proofHeight exported.Height, // height that relayer constructed proofTry consensusHeight exported.Height, // latest height of chainA that chainB has stored on its chainA client ) error { @@ -221,20 +221,20 @@ func (k Keeper) ConnOpenAck( // Ensure that ChainB stored expected connectionEnd in its state during ConnOpenTry if err := k.VerifyConnectionState( - ctx, connection, proofHeight, proofTry, counterpartyConnectionID, + ctx, connection, proofHeight, tryProof, counterpartyConnectionID, expectedConnection, ); err != nil { return err } // Check that ChainB stored the clientState provided in the msg - if err := k.VerifyClientState(ctx, connection, proofHeight, proofClient, clientState); err != nil { + 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, proofConsensus, expectedConsensusState, + ctx, connection, proofHeight, consensusHeight, consensusProof, expectedConsensusState, ); err != nil { return err } @@ -261,7 +261,7 @@ func (k Keeper) ConnOpenAck( func (k Keeper) ConnOpenConfirm( ctx sdk.Context, connectionID string, - proofAck []byte, // proof that connection opened on ChainA during ConnOpenAck + ackProof []byte, // proof that connection opened on ChainA during ConnOpenAck proofHeight exported.Height, // height that relayer constructed proofAck ) error { // Retrieve connection @@ -284,7 +284,7 @@ func (k Keeper) ConnOpenConfirm( // Check that connection on ChainA is open if err := k.VerifyConnectionState( - ctx, connection, proofHeight, proofAck, connection.Counterparty.ConnectionId, + ctx, connection, proofHeight, ackProof, connection.Counterparty.ConnectionId, expectedConnection, ); err != nil { return err diff --git a/modules/core/03-connection/keeper/handshake_test.go b/modules/core/03-connection/keeper/handshake_test.go index eaaa0ab3125..c60361aaccc 100644 --- a/modules/core/03-connection/keeper/handshake_test.go +++ b/modules/core/03-connection/keeper/handshake_test.go @@ -240,22 +240,22 @@ func (suite *KeeperTestSuite) TestConnOpenTry() { suite.Require().NoError(err) connectionKey := host.ConnectionKey(path.EndpointA.ConnectionID) - proofInit, proofHeight := suite.chainA.QueryProof(connectionKey) + initProof, proofHeight := suite.chainA.QueryProof(connectionKey) if consensusHeight.IsZero() { // retrieve consensus state height to provide proof for consensusHeight = counterpartyClient.GetLatestHeight() } consensusKey := host.FullConsensusStateKey(path.EndpointA.ClientID, consensusHeight) - proofConsensus, _ := suite.chainA.QueryProof(consensusKey) + consensusProof, _ := suite.chainA.QueryProof(consensusKey) // retrieve proof of counterparty clientstate on chainA clientKey := host.FullClientStateKey(path.EndpointA.ClientID) - proofClient, _ := suite.chainA.QueryProof(clientKey) + clientProof, _ := suite.chainA.QueryProof(clientKey) connectionID, err := suite.chainB.App.GetIBCKeeper().ConnectionKeeper.ConnOpenTry( suite.chainB.GetContext(), counterparty, delayPeriod, path.EndpointB.ClientID, counterpartyClient, - versions, proofInit, proofClient, proofConsensus, + versions, initProof, clientProof, consensusProof, proofHeight, consensusHeight, ) @@ -491,7 +491,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() { suite.Require().NoError(err) connectionKey := host.ConnectionKey(path.EndpointB.ConnectionID) - proofTry, proofHeight := suite.chainB.QueryProof(connectionKey) + tryProof, proofHeight := suite.chainB.QueryProof(connectionKey) if consensusHeight.IsZero() { // retrieve consensus state height to provide proof for @@ -499,15 +499,15 @@ func (suite *KeeperTestSuite) TestConnOpenAck() { consensusHeight = clientState.GetLatestHeight() } consensusKey := host.FullConsensusStateKey(path.EndpointB.ClientID, consensusHeight) - proofConsensus, _ := suite.chainB.QueryProof(consensusKey) + consensusProof, _ := suite.chainB.QueryProof(consensusKey) // retrieve proof of counterparty clientstate on chainA clientKey := host.FullClientStateKey(path.EndpointB.ClientID) - proofClient, _ := suite.chainB.QueryProof(clientKey) + clientProof, _ := suite.chainB.QueryProof(clientKey) err = suite.chainA.App.GetIBCKeeper().ConnectionKeeper.ConnOpenAck( suite.chainA.GetContext(), path.EndpointA.ConnectionID, counterpartyClient, version, path.EndpointB.ConnectionID, - proofTry, proofClient, proofConsensus, proofHeight, consensusHeight, + tryProof, clientProof, consensusProof, proofHeight, consensusHeight, ) if tc.expPass { @@ -570,10 +570,10 @@ func (suite *KeeperTestSuite) TestConnOpenConfirm() { suite.Require().NoError(err) connectionKey := host.ConnectionKey(path.EndpointA.ConnectionID) - proofAck, proofHeight := suite.chainA.QueryProof(connectionKey) + ackProof, proofHeight := suite.chainA.QueryProof(connectionKey) err = suite.chainB.App.GetIBCKeeper().ConnectionKeeper.ConnOpenConfirm( - suite.chainB.GetContext(), path.EndpointB.ConnectionID, proofAck, proofHeight, + suite.chainB.GetContext(), path.EndpointB.ConnectionID, ackProof, proofHeight, ) if tc.expPass { diff --git a/modules/core/03-connection/keeper/verify.go b/modules/core/03-connection/keeper/verify.go index bac330da440..6b5b035a06e 100644 --- a/modules/core/03-connection/keeper/verify.go +++ b/modules/core/03-connection/keeper/verify.go @@ -370,8 +370,8 @@ func (k Keeper) VerifyNextSequenceRecv( func (k Keeper) VerifyChannelUpgradeError( ctx sdk.Context, connection exported.ConnectionI, - proofHeight exported.Height, - proofErrorReceipt []byte, + height exported.Height, + proof []byte, portID, channelID string, errorReceipt channeltypes.ErrorReceipt, @@ -398,9 +398,9 @@ func (k Keeper) VerifyChannelUpgradeError( } if err := clientState.VerifyMembership( - ctx, clientStore, k.cdc, proofHeight, + ctx, clientStore, k.cdc, height, 0, 0, // skip delay period checks for non-packet processing verification - proofErrorReceipt, merklePath, bz, + proof, merklePath, bz, ); err != nil { return errorsmod.Wrapf(err, "failed upgrade error receipt verification for client (%s)", clientID) } @@ -413,7 +413,7 @@ func (k Keeper) VerifyChannelUpgrade( ctx sdk.Context, connection exported.ConnectionI, proofHeight exported.Height, - proofUpgrade []byte, + upgradeProof []byte, portID, channelID string, upgrade channeltypes.Upgrade, @@ -442,7 +442,7 @@ func (k Keeper) VerifyChannelUpgrade( if err := clientState.VerifyMembership( ctx, clientStore, k.cdc, proofHeight, 0, 0, // skip delay period checks for non-packet processing verification - proofUpgrade, merklePath, bz, + upgradeProof, merklePath, bz, ); err != nil { return errorsmod.Wrapf(err, "failed upgrade verification for client (%s) on channel (%s)", clientID, channelID) } diff --git a/modules/core/03-connection/types/msgs.go b/modules/core/03-connection/types/msgs.go index c46c783767e..9d8db1fb548 100644 --- a/modules/core/03-connection/types/msgs.go +++ b/modules/core/03-connection/types/msgs.go @@ -89,7 +89,7 @@ func NewMsgConnectionOpenTry( counterpartyClient exported.ClientState, counterpartyPrefix commitmenttypes.MerklePrefix, counterpartyVersions []*Version, delayPeriod uint64, - proofInit, proofClient, proofConsensus []byte, + initProof, clientProof, consensusProof []byte, proofHeight, consensusHeight clienttypes.Height, signer string, ) *MsgConnectionOpenTry { counterparty := NewCounterparty(counterpartyClientID, counterpartyConnectionID, counterpartyPrefix) @@ -100,9 +100,9 @@ func NewMsgConnectionOpenTry( Counterparty: counterparty, CounterpartyVersions: counterpartyVersions, DelayPeriod: delayPeriod, - ProofInit: proofInit, - ProofClient: proofClient, - ProofConsensus: proofConsensus, + ProofInit: initProof, + ProofClient: clientProof, + ProofConsensus: consensusProof, ProofHeight: proofHeight, ConsensusHeight: consensusHeight, Signer: signer, @@ -179,7 +179,7 @@ func (msg MsgConnectionOpenTry) GetSigners() []sdk.AccAddress { // NewMsgConnectionOpenAck creates a new MsgConnectionOpenAck instance func NewMsgConnectionOpenAck( connectionID, counterpartyConnectionID string, counterpartyClient exported.ClientState, - proofTry, proofClient, proofConsensus []byte, + tryProof, clientProof, consensusProof []byte, proofHeight, consensusHeight clienttypes.Height, version *Version, signer string, @@ -189,9 +189,9 @@ func NewMsgConnectionOpenAck( ConnectionId: connectionID, CounterpartyConnectionId: counterpartyConnectionID, ClientState: protoAny, - ProofTry: proofTry, - ProofClient: proofClient, - ProofConsensus: proofConsensus, + ProofTry: tryProof, + ProofClient: clientProof, + ProofConsensus: consensusProof, ProofHeight: proofHeight, ConsensusHeight: consensusHeight, Version: version, @@ -255,12 +255,12 @@ func (msg MsgConnectionOpenAck) GetSigners() []sdk.AccAddress { // NewMsgConnectionOpenConfirm creates a new MsgConnectionOpenConfirm instance func NewMsgConnectionOpenConfirm( - connectionID string, proofAck []byte, proofHeight clienttypes.Height, + connectionID string, ackProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgConnectionOpenConfirm { return &MsgConnectionOpenConfirm{ ConnectionId: connectionID, - ProofAck: proofAck, + ProofAck: ackProof, ProofHeight: proofHeight, Signer: signer, } diff --git a/modules/core/04-channel/keeper/handshake.go b/modules/core/04-channel/keeper/handshake.go index 3aaad5a95d2..4d89df0df88 100644 --- a/modules/core/04-channel/keeper/handshake.go +++ b/modules/core/04-channel/keeper/handshake.go @@ -111,7 +111,7 @@ func (k Keeper) ChanOpenTry( portCap *capabilitytypes.Capability, counterparty types.Counterparty, counterpartyVersion string, - proofInit []byte, + initProof []byte, proofHeight exported.Height, ) (string, *capabilitytypes.Capability, error) { // connection hops only supports a single connection @@ -166,7 +166,7 @@ func (k Keeper) ChanOpenTry( ) if err := k.connectionKeeper.VerifyChannelState( - ctx, connectionEnd, proofHeight, proofInit, + ctx, connectionEnd, proofHeight, initProof, counterparty.PortId, counterparty.ChannelId, expectedChannel, ); err != nil { return "", nil, err @@ -221,7 +221,7 @@ func (k Keeper) ChanOpenAck( chanCap *capabilitytypes.Capability, counterpartyVersion, counterpartyChannelID string, - proofTry []byte, + tryProof []byte, proofHeight exported.Height, ) error { channel, found := k.GetChannel(ctx, portID, channelID) @@ -259,7 +259,7 @@ func (k Keeper) ChanOpenAck( ) return k.connectionKeeper.VerifyChannelState( - ctx, connectionEnd, proofHeight, proofTry, + ctx, connectionEnd, proofHeight, tryProof, channel.Counterparty.PortId, counterpartyChannelID, expectedChannel) } @@ -297,7 +297,7 @@ func (k Keeper) ChanOpenConfirm( portID, channelID string, chanCap *capabilitytypes.Capability, - proofAck []byte, + ackProof []byte, proofHeight exported.Height, ) error { channel, found := k.GetChannel(ctx, portID, channelID) @@ -337,7 +337,7 @@ func (k Keeper) ChanOpenConfirm( ) return k.connectionKeeper.VerifyChannelState( - ctx, connectionEnd, proofHeight, proofAck, + ctx, connectionEnd, proofHeight, ackProof, channel.Counterparty.PortId, channel.Counterparty.ChannelId, expectedChannel) } @@ -429,10 +429,10 @@ func (k Keeper) ChanCloseConfirm( portID, channelID string, chanCap *capabilitytypes.Capability, - proofInit []byte, + initProof []byte, proofHeight exported.Height, ) error { - return k.ChanCloseConfirmWithCounterpartyUpgradeSequence(ctx, portID, channelID, chanCap, proofInit, proofHeight, 0) + return k.ChanCloseConfirmWithCounterpartyUpgradeSequence(ctx, portID, channelID, chanCap, initProof, proofHeight, 0) } // ChanCloseConfirmWithCounterpartyUpgradeSequence is called by the counterparty module to @@ -446,7 +446,7 @@ func (k Keeper) ChanCloseConfirmWithCounterpartyUpgradeSequence( portID, channelID string, chanCap *capabilitytypes.Capability, - proofInit []byte, + initProof []byte, proofHeight exported.Height, counterpartyUpgradeSequence uint64, ) error { @@ -488,7 +488,7 @@ func (k Keeper) ChanCloseConfirmWithCounterpartyUpgradeSequence( } if err := k.connectionKeeper.VerifyChannelState( - ctx, connectionEnd, proofHeight, proofInit, + ctx, connectionEnd, proofHeight, initProof, channel.Counterparty.PortId, channel.Counterparty.ChannelId, expectedChannel, ); err != nil { diff --git a/modules/core/04-channel/keeper/timeout.go b/modules/core/04-channel/keeper/timeout.go index b97b099bdfe..510e32ab3e8 100644 --- a/modules/core/04-channel/keeper/timeout.go +++ b/modules/core/04-channel/keeper/timeout.go @@ -208,11 +208,11 @@ func (k Keeper) TimeoutOnClose( chanCap *capabilitytypes.Capability, packet exported.PacketI, proof, - proofClosed []byte, + closedProof []byte, proofHeight exported.Height, nextSequenceRecv uint64, ) error { - return k.TimeoutOnCloseWithCounterpartyUpgradeSequence(ctx, chanCap, packet, proof, proofClosed, proofHeight, nextSequenceRecv, 0) + return k.TimeoutOnCloseWithCounterpartyUpgradeSequence(ctx, chanCap, packet, proof, closedProof, proofHeight, nextSequenceRecv, 0) } // TimeoutOnCloseWithCounterpartyUpgradeSequence is called by a module in order @@ -228,7 +228,7 @@ func (k Keeper) TimeoutOnCloseWithCounterpartyUpgradeSequence( chanCap *capabilitytypes.Capability, packet exported.PacketI, proof, - proofClosed []byte, + closedProof []byte, proofHeight exported.Height, nextSequenceRecv uint64, counterpartyUpgradeSequence uint64, @@ -297,7 +297,7 @@ func (k Keeper) TimeoutOnCloseWithCounterpartyUpgradeSequence( // check that the opposing channel end has closed if err := k.connectionKeeper.VerifyChannelState( - ctx, connectionEnd, proofHeight, proofClosed, + ctx, connectionEnd, proofHeight, closedProof, channel.Counterparty.PortId, channel.Counterparty.ChannelId, expectedChannel, ); err != nil { diff --git a/modules/core/04-channel/keeper/timeout_test.go b/modules/core/04-channel/keeper/timeout_test.go index 64ed7d1ca8b..18df05efc54 100644 --- a/modules/core/04-channel/keeper/timeout_test.go +++ b/modules/core/04-channel/keeper/timeout_test.go @@ -759,7 +759,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { unorderedPacketKey := host.PacketReceiptKey(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) orderedPacketKey := host.NextSequenceRecvKey(packet.GetDestPort(), packet.GetDestChannel()) - proofClosed, proofHeight := suite.chainB.QueryProof(channelKey) + closedProof, proofHeight := suite.chainB.QueryProof(channelKey) if ordered { proof, _ = suite.chainB.QueryProof(orderedPacketKey) @@ -772,7 +772,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() { chanCap, packet, proof, - proofClosed, + closedProof, proofHeight, nextSeqRecv, counterpartyUpgradeSequence, diff --git a/modules/core/04-channel/keeper/upgrade.go b/modules/core/04-channel/keeper/upgrade.go index b64f75fa540..f5cc52e39f7 100644 --- a/modules/core/04-channel/keeper/upgrade.go +++ b/modules/core/04-channel/keeper/upgrade.go @@ -74,8 +74,8 @@ func (k Keeper) ChanUpgradeTry( proposedConnectionHops []string, counterpartyUpgradeFields types.UpgradeFields, counterpartyUpgradeSequence uint64, - proofCounterpartyChannel, - proofCounterpartyUpgrade []byte, + channelProof, + upgradeProof []byte, proofHeight clienttypes.Height, ) (types.Channel, types.Upgrade, error) { channel, found := k.GetChannel(ctx, portID, channelID) @@ -114,7 +114,7 @@ func (k Keeper) ChanUpgradeTry( if err := k.connectionKeeper.VerifyChannelState( ctx, connection, - proofHeight, proofCounterpartyChannel, + proofHeight, channelProof, channel.Counterparty.PortId, channel.Counterparty.ChannelId, counterpartyChannel, @@ -163,7 +163,7 @@ func (k Keeper) ChanUpgradeTry( if err := k.connectionKeeper.VerifyChannelUpgrade( ctx, connection, - proofHeight, proofCounterpartyUpgrade, + proofHeight, upgradeProof, channel.Counterparty.PortId, channel.Counterparty.ChannelId, types.NewUpgrade(counterpartyUpgradeFields, types.Timeout{}, 0), @@ -245,8 +245,8 @@ func (k Keeper) ChanUpgradeAck( portID, channelID string, counterpartyUpgrade types.Upgrade, - proofChannel, - proofUpgrade []byte, + channelProof, + upgradeProof []byte, proofHeight clienttypes.Height, ) error { channel, found := k.GetChannel(ctx, portID, channelID) @@ -281,7 +281,7 @@ func (k Keeper) ChanUpgradeAck( if err := k.connectionKeeper.VerifyChannelState( ctx, connection, - proofHeight, proofChannel, + proofHeight, channelProof, channel.Counterparty.PortId, channel.Counterparty.ChannelId, counterpartyChannel, @@ -293,7 +293,7 @@ func (k Keeper) ChanUpgradeAck( if err := k.connectionKeeper.VerifyChannelUpgrade( ctx, connection, - proofHeight, proofUpgrade, + proofHeight, upgradeProof, channel.Counterparty.PortId, channel.Counterparty.ChannelId, counterpartyUpgrade, @@ -373,8 +373,8 @@ func (k Keeper) ChanUpgradeConfirm( channelID string, counterpartyChannelState types.State, counterpartyUpgrade types.Upgrade, - proofChannel, - proofUpgrade []byte, + channelProof, + upgradeProof []byte, proofHeight clienttypes.Height, ) error { channel, found := k.GetChannel(ctx, portID, channelID) @@ -412,7 +412,7 @@ func (k Keeper) ChanUpgradeConfirm( if err := k.connectionKeeper.VerifyChannelState( ctx, connection, - proofHeight, proofChannel, + proofHeight, channelProof, channel.Counterparty.PortId, channel.Counterparty.ChannelId, counterpartyChannel, @@ -423,7 +423,7 @@ func (k Keeper) ChanUpgradeConfirm( if err := k.connectionKeeper.VerifyChannelUpgrade( ctx, connection, - proofHeight, proofUpgrade, + proofHeight, upgradeProof, channel.Counterparty.PortId, channel.Counterparty.ChannelId, counterpartyUpgrade, @@ -472,7 +472,7 @@ func (k Keeper) ChanUpgradeOpen( portID, channelID string, counterpartyChannelState types.State, - proofCounterpartyChannel []byte, + channelProof []byte, proofHeight clienttypes.Height, ) error { channel, found := k.GetChannel(ctx, portID, channelID) @@ -536,7 +536,7 @@ func (k Keeper) ChanUpgradeOpen( if err := k.connectionKeeper.VerifyChannelState( ctx, connection, - proofHeight, proofCounterpartyChannel, + proofHeight, channelProof, channel.Counterparty.PortId, channel.Counterparty.ChannelId, counterpartyChannel, @@ -683,7 +683,7 @@ func (k Keeper) ChanUpgradeTimeout( ctx sdk.Context, portID, channelID string, counterpartyChannel types.Channel, - proofCounterpartyChannel []byte, + counterpartyChannelProof []byte, proofHeight exported.Height, ) error { channel, found := k.GetChannel(ctx, portID, channelID) @@ -756,7 +756,7 @@ func (k Keeper) ChanUpgradeTimeout( if err := k.connectionKeeper.VerifyChannelState( ctx, connection, - proofHeight, proofCounterpartyChannel, + proofHeight, counterpartyChannelProof, channel.Counterparty.PortId, channel.Counterparty.ChannelId, counterpartyChannel, diff --git a/modules/core/04-channel/keeper/upgrade_test.go b/modules/core/04-channel/keeper/upgrade_test.go index 690fe77b22f..d478a05b40f 100644 --- a/modules/core/04-channel/keeper/upgrade_test.go +++ b/modules/core/04-channel/keeper/upgrade_test.go @@ -312,7 +312,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeTry() { // ensure clients are up to date to receive valid proofs suite.Require().NoError(path.EndpointB.UpdateClient()) - proofChannel, proofUpgrade, proofHeight := path.EndpointA.QueryChannelUpgradeProof() + channelProof, upgradeProof, proofHeight := path.EndpointA.QueryChannelUpgradeProof() _, upgrade, err := suite.chainB.GetSimApp().IBCKeeper.ChannelKeeper.ChanUpgradeTry( suite.chainB.GetContext(), @@ -321,8 +321,8 @@ func (suite *KeeperTestSuite) TestChanUpgradeTry() { proposedUpgrade.Fields.ConnectionHops, counterpartyUpgrade.Fields, path.EndpointA.GetChannel().UpgradeSequence, - proofChannel, - proofUpgrade, + channelProof, + upgradeProof, proofHeight, ) @@ -777,11 +777,11 @@ func (suite *KeeperTestSuite) TestChanUpgradeAck() { tc.malleate() - proofChannel, proofUpgrade, proofHeight := path.EndpointB.QueryChannelUpgradeProof() + channelProof, upgradeProof, proofHeight := path.EndpointB.QueryChannelUpgradeProof() err = suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.ChanUpgradeAck( suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, counterpartyUpgrade, - proofChannel, proofUpgrade, proofHeight, + channelProof, upgradeProof, proofHeight, ) expPass := tc.expError == nil @@ -1052,11 +1052,11 @@ func (suite *KeeperTestSuite) TestChanUpgradeConfirm() { tc.malleate() - proofChannel, proofUpgrade, proofHeight := path.EndpointA.QueryChannelUpgradeProof() + channelProof, upgradeProof, proofHeight := path.EndpointA.QueryChannelUpgradeProof() err = suite.chainB.GetSimApp().IBCKeeper.ChannelKeeper.ChanUpgradeConfirm( suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, counterpartyChannelState, counterpartyUpgrade, - proofChannel, proofUpgrade, proofHeight, + channelProof, upgradeProof, proofHeight, ) expPass := tc.expError == nil @@ -1269,11 +1269,11 @@ func (suite *KeeperTestSuite) TestChanUpgradeOpen() { tc.malleate() channelKey := host.ChannelKey(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - proofChannel, proofHeight := path.EndpointB.QueryProof(channelKey) + channelProof, proofHeight := path.EndpointB.QueryProof(channelKey) err = suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.ChanUpgradeOpen( suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, - path.EndpointB.GetChannel().State, proofChannel, proofHeight, + path.EndpointB.GetChannel().State, channelProof, proofHeight, ) if tc.expError == nil { @@ -1910,7 +1910,7 @@ func (suite *KeeperTestSuite) TestWriteUpgradeCancelChannel() { func (suite *KeeperTestSuite) TestChanUpgradeTimeout() { var ( path *ibctesting.Path - proofChannel []byte + channelProof []byte proofHeight exported.Height ) @@ -1932,7 +1932,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeTimeout() { timeoutUpgrade() channelKey := host.ChannelKey(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - proofChannel, proofHeight = path.EndpointB.QueryProof(channelKey) + channelProof, proofHeight = path.EndpointB.QueryProof(channelKey) }, nil, }, @@ -1995,7 +1995,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeTimeout() { suite.Require().NoError(path.EndpointA.UpdateClient()) channelKey := host.ChannelKey(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - proofChannel, proofHeight = path.EndpointB.QueryProof(channelKey) + channelProof, proofHeight = path.EndpointB.QueryProof(channelKey) // modify state so the proof becomes invalid. channel.State = types.FLUSHING @@ -2016,7 +2016,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeTimeout() { suite.Require().NoError(path.EndpointA.UpdateClient()) channelKey := host.ChannelKey(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - proofChannel, proofHeight = path.EndpointB.QueryProof(channelKey) + channelProof, proofHeight = path.EndpointB.QueryProof(channelKey) }, types.ErrInvalidUpgradeSequence, }, @@ -2030,7 +2030,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeTimeout() { suite.Require().NoError(path.EndpointB.UpdateClient()) channelKey := host.ChannelKey(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - proofChannel, proofHeight = path.EndpointB.QueryProof(channelKey) + channelProof, proofHeight = path.EndpointB.QueryProof(channelKey) }, types.ErrTimeoutNotReached, }, @@ -2046,7 +2046,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeTimeout() { suite.Require().NoError(path.EndpointA.UpdateClient()) channelKey := host.ChannelKey(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - proofChannel, proofHeight = path.EndpointB.QueryProof(channelKey) + channelProof, proofHeight = path.EndpointB.QueryProof(channelKey) }, types.ErrInvalidCounterparty, }, @@ -2067,7 +2067,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeTimeout() { suite.Require().NoError(path.EndpointB.UpdateClient()) channelKey := host.ChannelKey(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - proofChannel, proofHeight = path.EndpointB.QueryProof(channelKey) + channelProof, proofHeight = path.EndpointB.QueryProof(channelKey) }, connectiontypes.ErrConnectionNotFound, }, @@ -2082,7 +2082,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeTimeout() { suite.Require().NoError(path.EndpointA.UpdateClient()) channelKey := host.ChannelKey(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - proofChannel, proofHeight = path.EndpointB.QueryProof(channelKey) + channelProof, proofHeight = path.EndpointB.QueryProof(channelKey) }, types.ErrUpgradeTimeoutFailed, }, @@ -2105,7 +2105,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeTimeout() { suite.Require().NoError(path.EndpointA.ChanUpgradeAck()) channelKey := host.ChannelKey(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - proofChannel, proofHeight = path.EndpointB.QueryProof(channelKey) + channelProof, proofHeight = path.EndpointB.QueryProof(channelKey) tc.malleate() @@ -2114,7 +2114,7 @@ func (suite *KeeperTestSuite) TestChanUpgradeTimeout() { path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.GetChannel(), - proofChannel, + channelProof, proofHeight, ) diff --git a/modules/core/04-channel/types/expected_keepers.go b/modules/core/04-channel/types/expected_keepers.go index d46c514182e..820a25277ad 100644 --- a/modules/core/04-channel/types/expected_keepers.go +++ b/modules/core/04-channel/types/expected_keepers.go @@ -85,8 +85,8 @@ type ConnectionKeeper interface { VerifyChannelUpgradeError( ctx sdk.Context, connection exported.ConnectionI, - proofHeight exported.Height, - proofErrorReceipt []byte, + height exported.Height, + proof []byte, portID, channelID string, errorReceipt ErrorReceipt, diff --git a/modules/core/04-channel/types/msgs.go b/modules/core/04-channel/types/msgs.go index e07d17c5670..df404c2bc1c 100644 --- a/modules/core/04-channel/types/msgs.go +++ b/modules/core/04-channel/types/msgs.go @@ -103,7 +103,7 @@ func (msg MsgChannelOpenInit) GetSigners() []sdk.AccAddress { func NewMsgChannelOpenTry( portID, version string, channelOrder Order, connectionHops []string, counterpartyPortID, counterpartyChannelID, counterpartyVersion string, - proofInit []byte, proofHeight clienttypes.Height, signer string, + initProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgChannelOpenTry { counterparty := NewCounterparty(counterpartyPortID, counterpartyChannelID) channel := NewChannel(TRYOPEN, channelOrder, counterparty, connectionHops, version) @@ -111,7 +111,7 @@ func NewMsgChannelOpenTry( PortId: portID, Channel: channel, CounterpartyVersion: counterpartyVersion, - ProofInit: proofInit, + ProofInit: initProof, ProofHeight: proofHeight, Signer: signer, } @@ -157,7 +157,7 @@ func (msg MsgChannelOpenTry) GetSigners() []sdk.AccAddress { // NewMsgChannelOpenAck creates a new MsgChannelOpenAck instance func NewMsgChannelOpenAck( - portID, channelID, counterpartyChannelID string, cpv string, proofTry []byte, proofHeight clienttypes.Height, + portID, channelID, counterpartyChannelID string, cpv string, tryProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgChannelOpenAck { return &MsgChannelOpenAck{ @@ -165,7 +165,7 @@ func NewMsgChannelOpenAck( ChannelId: channelID, CounterpartyChannelId: counterpartyChannelID, CounterpartyVersion: cpv, - ProofTry: proofTry, + ProofTry: tryProof, ProofHeight: proofHeight, Signer: signer, } @@ -203,13 +203,13 @@ func (msg MsgChannelOpenAck) GetSigners() []sdk.AccAddress { // NewMsgChannelOpenConfirm creates a new MsgChannelOpenConfirm instance func NewMsgChannelOpenConfirm( - portID, channelID string, proofAck []byte, proofHeight clienttypes.Height, + portID, channelID string, ackProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgChannelOpenConfirm { return &MsgChannelOpenConfirm{ PortId: portID, ChannelId: channelID, - ProofAck: proofAck, + ProofAck: ackProof, ProofHeight: proofHeight, Signer: signer, } @@ -282,13 +282,13 @@ func (msg MsgChannelCloseInit) GetSigners() []sdk.AccAddress { // Please use NewMsgChannelCloseConfirmWithCounterpartyUpgradeSequence to provide the // counterparty upgrade sequence in this version. func NewMsgChannelCloseConfirm( - portID, channelID string, proofInit []byte, proofHeight clienttypes.Height, + portID, channelID string, initProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgChannelCloseConfirm { return &MsgChannelCloseConfirm{ PortId: portID, ChannelId: channelID, - ProofInit: proofInit, + ProofInit: initProof, ProofHeight: proofHeight, Signer: signer, CounterpartyUpgradeSequence: 0, @@ -298,13 +298,13 @@ func NewMsgChannelCloseConfirm( // NewMsgChannelCloseConfirmWithCounterpartyUpgradeSequence creates a new MsgChannelCloseConfirm instance // with a non-zero counterparty upgrade sequence. func NewMsgChannelCloseConfirmWithCounterpartyUpgradeSequence( - portID, channelID string, proofInit []byte, proofHeight clienttypes.Height, + portID, channelID string, initProof []byte, proofHeight clienttypes.Height, signer string, counterpartyUpgradeSequence uint64, ) *MsgChannelCloseConfirm { return &MsgChannelCloseConfirm{ PortId: portID, ChannelId: channelID, - ProofInit: proofInit, + ProofInit: initProof, ProofHeight: proofHeight, Signer: signer, CounterpartyUpgradeSequence: counterpartyUpgradeSequence, @@ -340,12 +340,12 @@ func (msg MsgChannelCloseConfirm) GetSigners() []sdk.AccAddress { // NewMsgRecvPacket constructs new MsgRecvPacket func NewMsgRecvPacket( - packet Packet, proofCommitment []byte, proofHeight clienttypes.Height, + packet Packet, commitmentProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgRecvPacket { return &MsgRecvPacket{ Packet: packet, - ProofCommitment: proofCommitment, + ProofCommitment: commitmentProof, ProofHeight: proofHeight, Signer: signer, } @@ -381,13 +381,13 @@ func (msg MsgRecvPacket) GetSigners() []sdk.AccAddress { // NewMsgTimeout constructs new MsgTimeout func NewMsgTimeout( - packet Packet, nextSequenceRecv uint64, proofUnreceived []byte, + packet Packet, nextSequenceRecv uint64, unreceivedProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgTimeout { return &MsgTimeout{ Packet: packet, NextSequenceRecv: nextSequenceRecv, - ProofUnreceived: proofUnreceived, + ProofUnreceived: unreceivedProof, ProofHeight: proofHeight, Signer: signer, } @@ -424,14 +424,14 @@ func (msg MsgTimeout) GetSigners() []sdk.AccAddress { // to provide the counterparty upgrade sequence. func NewMsgTimeoutOnClose( packet Packet, nextSequenceRecv uint64, - proofUnreceived, proofClose []byte, + unreceivedProof, closeProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgTimeoutOnClose { return &MsgTimeoutOnClose{ Packet: packet, NextSequenceRecv: nextSequenceRecv, - ProofUnreceived: proofUnreceived, - ProofClose: proofClose, + ProofUnreceived: unreceivedProof, + ProofClose: closeProof, ProofHeight: proofHeight, Signer: signer, CounterpartyUpgradeSequence: 0, @@ -442,15 +442,15 @@ func NewMsgTimeoutOnClose( // with the provided counterparty upgrade sequence. func NewMsgTimeoutOnCloseWithCounterpartyUpgradeSequence( packet Packet, nextSequenceRecv uint64, - proofUnreceived, proofClose []byte, + unreceivedProof, closeProof []byte, proofHeight clienttypes.Height, signer string, counterpartyUpgradeSequence uint64, ) *MsgTimeoutOnClose { return &MsgTimeoutOnClose{ Packet: packet, NextSequenceRecv: nextSequenceRecv, - ProofUnreceived: proofUnreceived, - ProofClose: proofClose, + ProofUnreceived: unreceivedProof, + ProofClose: closeProof, ProofHeight: proofHeight, Signer: signer, CounterpartyUpgradeSequence: counterpartyUpgradeSequence, @@ -487,14 +487,14 @@ func (msg MsgTimeoutOnClose) GetSigners() []sdk.AccAddress { // NewMsgAcknowledgement constructs a new MsgAcknowledgement func NewMsgAcknowledgement( packet Packet, - ack, proofAcked []byte, + ack, ackedProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgAcknowledgement { return &MsgAcknowledgement{ Packet: packet, Acknowledgement: ack, - ProofAcked: proofAcked, + ProofAcked: ackedProof, ProofHeight: proofHeight, Signer: signer, } @@ -568,8 +568,8 @@ func NewMsgChannelUpgradeTry( proposedConnectionHops []string, counterpartyUpgradeFields UpgradeFields, counterpartyUpgradeSequence uint64, - proofChannel []byte, - proofUpgrade []byte, + channelProof []byte, + upgradeProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgChannelUpgradeTry { @@ -579,8 +579,8 @@ func NewMsgChannelUpgradeTry( ProposedUpgradeConnectionHops: proposedConnectionHops, CounterpartyUpgradeFields: counterpartyUpgradeFields, CounterpartyUpgradeSequence: counterpartyUpgradeSequence, - ProofChannel: proofChannel, - ProofUpgrade: proofUpgrade, + ProofChannel: channelProof, + ProofUpgrade: upgradeProof, ProofHeight: proofHeight, Signer: signer, } @@ -628,13 +628,13 @@ var _ sdk.Msg = &MsgChannelUpgradeAck{} // NewMsgChannelUpgradeAck constructs a new MsgChannelUpgradeAck // nolint:interfacer -func NewMsgChannelUpgradeAck(portID, channelID string, counterpartyUpgrade Upgrade, proofChannel, proofUpgrade []byte, proofHeight clienttypes.Height, signer string) *MsgChannelUpgradeAck { +func NewMsgChannelUpgradeAck(portID, channelID string, counterpartyUpgrade Upgrade, channelProof, upgradeProof []byte, proofHeight clienttypes.Height, signer string) *MsgChannelUpgradeAck { return &MsgChannelUpgradeAck{ PortId: portID, ChannelId: channelID, CounterpartyUpgrade: counterpartyUpgrade, - ProofChannel: proofChannel, - ProofUpgrade: proofUpgrade, + ProofChannel: channelProof, + ProofUpgrade: upgradeProof, ProofHeight: proofHeight, Signer: signer, } @@ -669,8 +669,8 @@ func NewMsgChannelUpgradeConfirm( channelID string, counterpartyChannelState State, counterpartyUpgrade Upgrade, - proofChannel, - proofUpgrade []byte, + channelProof, + upgradeProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgChannelUpgradeConfirm { @@ -679,8 +679,8 @@ func NewMsgChannelUpgradeConfirm( ChannelId: channelID, CounterpartyChannelState: counterpartyChannelState, CounterpartyUpgrade: counterpartyUpgrade, - ProofChannel: proofChannel, - ProofUpgrade: proofUpgrade, + ProofChannel: channelProof, + ProofUpgrade: upgradeProof, ProofHeight: proofHeight, Signer: signer, } @@ -724,7 +724,7 @@ func NewMsgChannelUpgradeOpen( portID, channelID string, counterpartyChannelState State, - proofChannel []byte, + channelProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgChannelUpgradeOpen { @@ -732,7 +732,7 @@ func NewMsgChannelUpgradeOpen( PortId: portID, ChannelId: channelID, CounterpartyChannelState: counterpartyChannelState, - ProofChannel: proofChannel, + ProofChannel: channelProof, ProofHeight: proofHeight, Signer: signer, } @@ -771,7 +771,7 @@ var _ sdk.Msg = &MsgChannelUpgradeTimeout{} func NewMsgChannelUpgradeTimeout( portID, channelID string, counterpartyChannel Channel, - proofChannel []byte, + channelProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgChannelUpgradeTimeout { @@ -779,7 +779,7 @@ func NewMsgChannelUpgradeTimeout( PortId: portID, ChannelId: channelID, CounterpartyChannel: counterpartyChannel, - ProofChannel: proofChannel, + ProofChannel: channelProof, ProofHeight: proofHeight, Signer: signer, } @@ -818,7 +818,7 @@ var _ sdk.Msg = &MsgChannelUpgradeCancel{} func NewMsgChannelUpgradeCancel( portID, channelID string, errorReceipt ErrorReceipt, - proofErrReceipt []byte, + errorReceiptProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgChannelUpgradeCancel { @@ -826,7 +826,7 @@ func NewMsgChannelUpgradeCancel( PortId: portID, ChannelId: channelID, ErrorReceipt: errorReceipt, - ProofErrorReceipt: proofErrReceipt, + ProofErrorReceipt: errorReceiptProof, ProofHeight: proofHeight, Signer: signer, } diff --git a/modules/core/ante/ante_test.go b/modules/core/ante/ante_test.go index 1b9a8c15c64..daf4e688055 100644 --- a/modules/core/ante/ante_test.go +++ b/modules/core/ante/ante_test.go @@ -145,9 +145,9 @@ func (suite *AnteTestSuite) createTimeoutOnCloseMessage(isRedundant bool) sdk.Ms proof, proofHeight := suite.chainA.QueryProof(packetKey) channelKey := host.ChannelKey(packet.GetDestPort(), packet.GetDestChannel()) - proofClosed, _ := suite.chainA.QueryProof(channelKey) + closedProof, _ := suite.chainA.QueryProof(channelKey) - return channeltypes.NewMsgTimeoutOnClose(packet, 1, proof, proofClosed, proofHeight, suite.path.EndpointA.Chain.SenderAccount.GetAddress().String()) + return channeltypes.NewMsgTimeoutOnClose(packet, 1, proof, closedProof, proofHeight, suite.path.EndpointA.Chain.SenderAccount.GetAddress().String()) } func (suite *AnteTestSuite) createUpdateClientMessage() sdk.Msg { diff --git a/modules/core/exported/client.go b/modules/core/exported/client.go index cf5d11ca617..a8f0bfb0240 100644 --- a/modules/core/exported/client.go +++ b/modules/core/exported/client.go @@ -136,8 +136,8 @@ type ClientState interface { store storetypes.KVStore, newClient ClientState, newConsState ConsensusState, - proofUpgradeClient, - proofUpgradeConsState []byte, + upgradeClientProof, + upgradeConsensusStateProof []byte, ) error } diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index 3add1fbbf01..656b9dcc258 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -758,9 +758,9 @@ func (suite *KeeperTestSuite) TestHandleTimeoutOnClosePacket() { proof, proofHeight := suite.chainB.QueryProof(packetKey) channelKey := host.ChannelKey(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - proofClosed, _ := suite.chainB.QueryProof(channelKey) + closedProof, _ := suite.chainB.QueryProof(channelKey) - msg := channeltypes.NewMsgTimeoutOnCloseWithCounterpartyUpgradeSequence(packet, 1, proof, proofClosed, proofHeight, suite.chainA.SenderAccount.GetAddress().String(), counterpartyUpgradeSequence) + msg := channeltypes.NewMsgTimeoutOnCloseWithCounterpartyUpgradeSequence(packet, 1, proof, closedProof, proofHeight, suite.chainA.SenderAccount.GetAddress().String(), counterpartyUpgradeSequence) _, err := keeper.Keeper.TimeoutOnClose(*suite.chainA.App.GetIBCKeeper(), suite.chainA.GetContext(), msg) @@ -828,11 +828,11 @@ func (suite *KeeperTestSuite) TestUpgradeClient() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradeClient, _ := suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ := suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradeClientProof, _ := suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ := suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) msg, err = clienttypes.NewMsgUpgradeClient(path.EndpointA.ClientID, upgradedClient, upgradedConsState, - proofUpgradeClient, proofUpgradedConsState, suite.chainA.SenderAccount.GetAddress().String()) + upgradeClientProof, upgradedConsensusStateProof, suite.chainA.SenderAccount.GetAddress().String()) suite.Require().NoError(err) }, expPass: true, @@ -1152,7 +1152,7 @@ func (suite *KeeperTestSuite) TestChannelUpgradeTry() { counterpartyUpgrade, found := suite.chainA.GetSimApp().GetIBCKeeper().ChannelKeeper.GetUpgrade(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) suite.Require().True(found) - proofChannel, proofUpgrade, proofHeight := path.EndpointA.QueryChannelUpgradeProof() + channelProof, upgradeProof, proofHeight := path.EndpointA.QueryChannelUpgradeProof() msg = &channeltypes.MsgChannelUpgradeTry{ PortId: path.EndpointB.ChannelConfig.PortID, @@ -1160,8 +1160,8 @@ func (suite *KeeperTestSuite) TestChannelUpgradeTry() { ProposedUpgradeConnectionHops: []string{ibctesting.FirstConnectionID}, CounterpartyUpgradeSequence: counterpartySequence, CounterpartyUpgradeFields: counterpartyUpgrade.Fields, - ProofChannel: proofChannel, - ProofUpgrade: proofUpgrade, + ProofChannel: channelProof, + ProofUpgrade: upgradeProof, ProofHeight: proofHeight, Signer: suite.chainB.SenderAccount.GetAddress().String(), } @@ -1418,14 +1418,14 @@ func (suite *KeeperTestSuite) TestChannelUpgradeAck() { counterpartyUpgrade := path.EndpointB.GetChannelUpgrade() - proofChannel, proofUpgrade, proofHeight := path.EndpointB.QueryChannelUpgradeProof() + channelProof, upgradeProof, proofHeight := path.EndpointB.QueryChannelUpgradeProof() msg = &channeltypes.MsgChannelUpgradeAck{ PortId: path.EndpointA.ChannelConfig.PortID, ChannelId: path.EndpointA.ChannelID, CounterpartyUpgrade: counterpartyUpgrade, - ProofChannel: proofChannel, - ProofUpgrade: proofUpgrade, + ProofChannel: channelProof, + ProofUpgrade: upgradeProof, ProofHeight: proofHeight, Signer: suite.chainA.SenderAccount.GetAddress().String(), } @@ -1520,15 +1520,15 @@ func (suite *KeeperTestSuite) TestChannelUpgradeConfirm() { counterpartyChannelState := path.EndpointA.GetChannel().State counterpartyUpgrade := path.EndpointA.GetChannelUpgrade() - proofChannel, proofUpgrade, proofHeight := path.EndpointA.QueryChannelUpgradeProof() + channelProof, upgradeProof, proofHeight := path.EndpointA.QueryChannelUpgradeProof() msg = &channeltypes.MsgChannelUpgradeConfirm{ PortId: path.EndpointB.ChannelConfig.PortID, ChannelId: path.EndpointB.ChannelID, CounterpartyChannelState: counterpartyChannelState, CounterpartyUpgrade: counterpartyUpgrade, - ProofChannel: proofChannel, - ProofUpgrade: proofUpgrade, + ProofChannel: channelProof, + ProofUpgrade: upgradeProof, ProofHeight: proofHeight, Signer: suite.chainA.SenderAccount.GetAddress().String(), } @@ -1638,11 +1638,11 @@ func (suite *KeeperTestSuite) TestChannelUpgradeConfirm() { err := path.EndpointB.UpdateClient() suite.Require().NoError(err) - proofChannel, proofUpgrade, proofHeight := path.EndpointA.QueryChannelUpgradeProof() + channelProof, upgradeProof, proofHeight := path.EndpointA.QueryChannelUpgradeProof() msg.CounterpartyUpgrade = upgrade - msg.ProofChannel = proofChannel - msg.ProofUpgrade = proofUpgrade + msg.ProofChannel = channelProof + msg.ProofUpgrade = upgradeProof msg.ProofHeight = proofHeight }, func(res *channeltypes.MsgChannelUpgradeConfirmResponse, events []abci.Event, err error) { @@ -1723,15 +1723,15 @@ func (suite *KeeperTestSuite) TestChannelUpgradeConfirm() { counterpartyChannelState := path.EndpointA.GetChannel().State counterpartyUpgrade := path.EndpointA.GetChannelUpgrade() - proofChannel, proofUpgrade, proofHeight := path.EndpointA.QueryChannelUpgradeProof() + channelProof, upgradeProof, proofHeight := path.EndpointA.QueryChannelUpgradeProof() msg = &channeltypes.MsgChannelUpgradeConfirm{ PortId: path.EndpointB.ChannelConfig.PortID, ChannelId: path.EndpointB.ChannelID, CounterpartyChannelState: counterpartyChannelState, CounterpartyUpgrade: counterpartyUpgrade, - ProofChannel: proofChannel, - ProofUpgrade: proofUpgrade, + ProofChannel: channelProof, + ProofUpgrade: upgradeProof, ProofHeight: proofHeight, Signer: suite.chainA.SenderAccount.GetAddress().String(), } @@ -1866,13 +1866,13 @@ func (suite *KeeperTestSuite) TestChannelUpgradeOpen() { counterpartyChannel := path.EndpointB.GetChannel() channelKey := host.ChannelKey(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - proofChannel, proofHeight := path.EndpointB.QueryProof(channelKey) + channelProof, proofHeight := path.EndpointB.QueryProof(channelKey) msg = &channeltypes.MsgChannelUpgradeOpen{ PortId: path.EndpointA.ChannelConfig.PortID, ChannelId: path.EndpointA.ChannelID, CounterpartyChannelState: counterpartyChannel.State, - ProofChannel: proofChannel, + ProofChannel: channelProof, ProofHeight: proofHeight, Signer: suite.chainA.SenderAccount.GetAddress().String(), } diff --git a/modules/light-clients/07-tendermint/upgrade.go b/modules/light-clients/07-tendermint/upgrade.go index a3159459816..59dfe066419 100644 --- a/modules/light-clients/07-tendermint/upgrade.go +++ b/modules/light-clients/07-tendermint/upgrade.go @@ -30,7 +30,7 @@ import ( func (cs ClientState) VerifyUpgradeAndUpdateState( ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, upgradedClient exported.ClientState, upgradedConsState exported.ConsensusState, - proofUpgradeClient, proofUpgradeConsState []byte, + upgradeClientProof, upgradeConsStateProof []byte, ) error { if len(cs.UpgradePath) == 0 { return errorsmod.Wrap(clienttypes.ErrInvalidUpgradeClient, "cannot upgrade client, no upgrade path set") @@ -60,10 +60,10 @@ func (cs ClientState) VerifyUpgradeAndUpdateState( // unmarshal proofs var merkleProofClient, merkleProofConsState commitmenttypes.MerkleProof - if err := cdc.Unmarshal(proofUpgradeClient, &merkleProofClient); err != nil { + if err := cdc.Unmarshal(upgradeClientProof, &merkleProofClient); err != nil { return errorsmod.Wrapf(commitmenttypes.ErrInvalidProof, "could not unmarshal client merkle proof: %v", err) } - if err := cdc.Unmarshal(proofUpgradeConsState, &merkleProofConsState); err != nil { + if err := cdc.Unmarshal(upgradeConsStateProof, &merkleProofConsState); err != nil { return errorsmod.Wrapf(commitmenttypes.ErrInvalidProof, "could not unmarshal consensus state merkle proof: %v", err) } diff --git a/modules/light-clients/07-tendermint/upgrade_test.go b/modules/light-clients/07-tendermint/upgrade_test.go index 9cedda0b206..3663a04938b 100644 --- a/modules/light-clients/07-tendermint/upgrade_test.go +++ b/modules/light-clients/07-tendermint/upgrade_test.go @@ -12,14 +12,14 @@ import ( func (suite *TendermintTestSuite) TestVerifyUpgrade() { var ( - newChainID string - upgradedClient exported.ClientState - upgradedConsState exported.ConsensusState - lastHeight clienttypes.Height - path *ibctesting.Path - proofUpgradedClient, proofUpgradedConsState []byte - upgradedClientBz, upgradedConsStateBz []byte - err error + newChainID string + upgradedClient exported.ClientState + upgradedConsState exported.ConsensusState + lastHeight clienttypes.Height + path *ibctesting.Path + upgradedClientProof, upgradedConsensusStateProof []byte + upgradedClientBz, upgradedConsStateBz []byte + err error ) testCases := []struct { @@ -46,8 +46,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) }, expPass: true, }, @@ -75,8 +75,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) }, expPass: true, }, @@ -100,8 +100,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) }, expPass: false, }, @@ -129,8 +129,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) }, expPass: false, }, @@ -154,8 +154,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) }, expPass: false, }, @@ -176,8 +176,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) }, expPass: false, }, @@ -205,8 +205,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) }, expPass: false, }, @@ -218,9 +218,9 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedClient = []byte("proof") + upgradedClientProof = []byte("proof") }, expPass: false, }, @@ -232,9 +232,9 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState = []byte("proof") + upgradedConsensusStateProof = []byte("proof") }, expPass: false, }, @@ -251,8 +251,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) }, expPass: false, }, @@ -269,8 +269,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) }, expPass: false, }, @@ -292,8 +292,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) // SetClientState with empty upgrade path tmClient, _ := cs.(*ibctm.ClientState) @@ -320,8 +320,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) }, expPass: false, }, @@ -343,8 +343,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) }, expPass: false, }, @@ -366,8 +366,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) }, expPass: false, }, @@ -389,8 +389,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) }, expPass: false, }, @@ -418,8 +418,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID) suite.Require().True(found) - proofUpgradedClient, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) - proofUpgradedConsState, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) + upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), cs.GetLatestHeight().GetRevisionHeight()) }, expPass: false, }, @@ -467,8 +467,8 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() { clientStore, upgradedClient, upgradedConsState, - proofUpgradedClient, - proofUpgradedConsState, + upgradedClientProof, + upgradedConsensusStateProof, ) if tc.expPass { diff --git a/testing/chain.go b/testing/chain.go index 42eae7d7260..9cb73f08bd4 100644 --- a/testing/chain.go +++ b/testing/chain.go @@ -279,9 +279,9 @@ func (chain *TestChain) QueryConsensusStateProof(clientID string) ([]byte, clien consensusHeight := clientState.GetLatestHeight().(clienttypes.Height) consensusKey := host.FullConsensusStateKey(clientID, consensusHeight) - proofConsensus, _ := chain.QueryProof(consensusKey) + consensusProof, _ := chain.QueryProof(consensusKey) - return proofConsensus, consensusHeight + return consensusProof, consensusHeight } // NextBlock sets the last header to the current header and increments the current header to be diff --git a/testing/endpoint.go b/testing/endpoint.go index f84e5ae70f6..18f42baab89 100644 --- a/testing/endpoint.go +++ b/testing/endpoint.go @@ -233,12 +233,12 @@ func (endpoint *Endpoint) ConnOpenTry() error { err := endpoint.UpdateClient() require.NoError(endpoint.Chain.TB, err) - counterpartyClient, proofClient, proofConsensus, consensusHeight, proofInit, proofHeight := endpoint.QueryConnectionHandshakeProof() + counterpartyClient, clientProof, consensusProof, consensusHeight, initProof, proofHeight := endpoint.QueryConnectionHandshakeProof() msg := connectiontypes.NewMsgConnectionOpenTry( endpoint.ClientID, endpoint.Counterparty.ConnectionID, endpoint.Counterparty.ClientID, counterpartyClient, endpoint.Counterparty.Chain.GetPrefix(), []*connectiontypes.Version{ConnectionVersion}, endpoint.ConnectionConfig.DelayPeriod, - proofInit, proofClient, proofConsensus, + initProof, clientProof, consensusProof, proofHeight, consensusHeight, endpoint.Chain.SenderAccount.GetAddress().String(), ) @@ -260,11 +260,11 @@ func (endpoint *Endpoint) ConnOpenAck() error { err := endpoint.UpdateClient() require.NoError(endpoint.Chain.TB, err) - counterpartyClient, proofClient, proofConsensus, consensusHeight, proofTry, proofHeight := endpoint.QueryConnectionHandshakeProof() + counterpartyClient, clientProof, consensusProof, consensusHeight, tryProof, proofHeight := endpoint.QueryConnectionHandshakeProof() msg := connectiontypes.NewMsgConnectionOpenAck( endpoint.ConnectionID, endpoint.Counterparty.ConnectionID, counterpartyClient, // testing doesn't use flexible selection - proofTry, proofClient, proofConsensus, + tryProof, clientProof, consensusProof, proofHeight, consensusHeight, ConnectionVersion, endpoint.Chain.SenderAccount.GetAddress().String(), @@ -293,28 +293,28 @@ func (endpoint *Endpoint) ConnOpenConfirm() error { // client state, proof of the counterparty consensus state, the consensus state height, proof of // the counterparty connection, and the proof height for all the proofs returned. func (endpoint *Endpoint) QueryConnectionHandshakeProof() ( - clientState exported.ClientState, proofClient, - proofConsensus []byte, consensusHeight clienttypes.Height, - proofConnection []byte, proofHeight clienttypes.Height, + clientState exported.ClientState, clientProof, + consensusProof []byte, consensusHeight clienttypes.Height, + connectioProof []byte, proofHeight clienttypes.Height, ) { // obtain the client state on the counterparty chain clientState = endpoint.Counterparty.Chain.GetClientState(endpoint.Counterparty.ClientID) // query proof for the client state on the counterparty clientKey := host.FullClientStateKey(endpoint.Counterparty.ClientID) - proofClient, proofHeight = endpoint.Counterparty.QueryProof(clientKey) + clientProof, proofHeight = endpoint.Counterparty.QueryProof(clientKey) consensusHeight = clientState.GetLatestHeight().(clienttypes.Height) // query proof for the consensus state on the counterparty consensusKey := host.FullConsensusStateKey(endpoint.Counterparty.ClientID, consensusHeight) - proofConsensus, _ = endpoint.Counterparty.QueryProofAtHeight(consensusKey, proofHeight.GetRevisionHeight()) + consensusProof, _ = endpoint.Counterparty.QueryProofAtHeight(consensusKey, proofHeight.GetRevisionHeight()) // query proof for the connection on the counterparty connectionKey := host.ConnectionKey(endpoint.Counterparty.ConnectionID) - proofConnection, _ = endpoint.Counterparty.QueryProofAtHeight(connectionKey, proofHeight.GetRevisionHeight()) + connectioProof, _ = endpoint.Counterparty.QueryProofAtHeight(connectionKey, proofHeight.GetRevisionHeight()) - return clientState, proofClient, proofConsensus, consensusHeight, proofConnection, proofHeight + return clientState, clientProof, consensusProof, consensusHeight, connectioProof, proofHeight } // ChanOpenInit will construct and execute a MsgChannelOpenInit on the associated endpoint. @@ -556,14 +556,14 @@ func (endpoint *Endpoint) TimeoutOnClose(packet channeltypes.Packet) error { proof, proofHeight := endpoint.Counterparty.QueryProof(packetKey) channelKey := host.ChannelKey(packet.GetDestPort(), packet.GetDestChannel()) - proofClosed, _ := endpoint.Counterparty.QueryProof(channelKey) + closedProof, _ := endpoint.Counterparty.QueryProof(channelKey) nextSeqRecv, found := endpoint.Counterparty.Chain.App.GetIBCKeeper().ChannelKeeper.GetNextSequenceRecv(endpoint.Counterparty.Chain.GetContext(), endpoint.ChannelConfig.PortID, endpoint.ChannelID) require.True(endpoint.Chain.TB, found) timeoutOnCloseMsg := channeltypes.NewMsgTimeoutOnCloseWithCounterpartyUpgradeSequence( packet, nextSeqRecv, - proof, proofClosed, proofHeight, endpoint.Chain.SenderAccount.GetAddress().String(), + proof, closedProof, proofHeight, endpoint.Chain.SenderAccount.GetAddress().String(), endpoint.Counterparty.GetChannel().UpgradeSequence, ) @@ -575,12 +575,12 @@ func (endpoint *Endpoint) TimeoutOnClose(packet channeltypes.Packet) error { // endpoint's chain, and the height at which the proof was queried. func (endpoint *Endpoint) QueryChannelUpgradeProof() ([]byte, []byte, clienttypes.Height) { channelKey := host.ChannelKey(endpoint.ChannelConfig.PortID, endpoint.ChannelID) - proofChannel, height := endpoint.QueryProof(channelKey) + channelProof, height := endpoint.QueryProof(channelKey) upgradeKey := host.ChannelUpgradeKey(endpoint.ChannelConfig.PortID, endpoint.ChannelID) - proofUpgrade, _ := endpoint.QueryProof(upgradeKey) + upgradeProof, _ := endpoint.QueryProof(upgradeKey) - return proofChannel, proofUpgrade, height + return channelProof, upgradeProof, height } // ChanUpgradeInit sends a MsgChannelUpgradeInit on the associated endpoint. @@ -626,7 +626,7 @@ func (endpoint *Endpoint) ChanUpgradeTry() error { require.NoError(endpoint.Chain.TB, err) upgrade := endpoint.GetProposedUpgrade() - proofChannel, proofUpgrade, height := endpoint.Counterparty.QueryChannelUpgradeProof() + channelProof, upgradeProof, height := endpoint.Counterparty.QueryChannelUpgradeProof() counterpartyUpgrade, found := endpoint.Counterparty.Chain.App.GetIBCKeeper().ChannelKeeper.GetUpgrade(endpoint.Counterparty.Chain.GetContext(), endpoint.Counterparty.ChannelConfig.PortID, endpoint.Counterparty.ChannelID) require.True(endpoint.Chain.TB, found) @@ -641,8 +641,8 @@ func (endpoint *Endpoint) ChanUpgradeTry() error { upgrade.Fields.ConnectionHops, counterpartyUpgrade.Fields, endpoint.Counterparty.GetChannel().UpgradeSequence, - proofChannel, - proofUpgrade, + channelProof, + upgradeProof, height, endpoint.Chain.SenderAccount.GetAddress().String(), ) @@ -655,7 +655,7 @@ func (endpoint *Endpoint) ChanUpgradeAck() error { err := endpoint.UpdateClient() require.NoError(endpoint.Chain.TB, err) - proofChannel, proofUpgrade, height := endpoint.Counterparty.QueryChannelUpgradeProof() + channelProof, upgradeProof, height := endpoint.Counterparty.QueryChannelUpgradeProof() counterpartyUpgrade, found := endpoint.Counterparty.Chain.App.GetIBCKeeper().ChannelKeeper.GetUpgrade(endpoint.Counterparty.Chain.GetContext(), endpoint.Counterparty.ChannelConfig.PortID, endpoint.Counterparty.ChannelID) require.True(endpoint.Chain.TB, found) @@ -664,8 +664,8 @@ func (endpoint *Endpoint) ChanUpgradeAck() error { endpoint.ChannelConfig.PortID, endpoint.ChannelID, counterpartyUpgrade, - proofChannel, - proofUpgrade, + channelProof, + upgradeProof, height, endpoint.Chain.SenderAccount.GetAddress().String(), ) @@ -678,7 +678,7 @@ func (endpoint *Endpoint) ChanUpgradeConfirm() error { err := endpoint.UpdateClient() require.NoError(endpoint.Chain.TB, err) - proofChannel, proofUpgrade, height := endpoint.Counterparty.QueryChannelUpgradeProof() + channelProof, upgradeProof, height := endpoint.Counterparty.QueryChannelUpgradeProof() counterpartyUpgrade, found := endpoint.Counterparty.Chain.App.GetIBCKeeper().ChannelKeeper.GetUpgrade(endpoint.Counterparty.Chain.GetContext(), endpoint.Counterparty.ChannelConfig.PortID, endpoint.Counterparty.ChannelID) require.True(endpoint.Chain.TB, found) @@ -688,8 +688,8 @@ func (endpoint *Endpoint) ChanUpgradeConfirm() error { endpoint.ChannelID, endpoint.Counterparty.GetChannel().State, counterpartyUpgrade, - proofChannel, - proofUpgrade, + channelProof, + upgradeProof, height, endpoint.Chain.SenderAccount.GetAddress().String(), ) @@ -703,13 +703,13 @@ func (endpoint *Endpoint) ChanUpgradeOpen() error { require.NoError(endpoint.Chain.TB, err) channelKey := host.ChannelKey(endpoint.Counterparty.ChannelConfig.PortID, endpoint.Counterparty.ChannelID) - proofChannel, height := endpoint.Counterparty.QueryProof(channelKey) + channelProof, height := endpoint.Counterparty.QueryProof(channelKey) msg := channeltypes.NewMsgChannelUpgradeOpen( endpoint.ChannelConfig.PortID, endpoint.ChannelID, endpoint.Counterparty.GetChannel().State, - proofChannel, + channelProof, height, endpoint.Chain.SenderAccount.GetAddress().String(), ) @@ -723,13 +723,13 @@ func (endpoint *Endpoint) ChanUpgradeTimeout() error { require.NoError(endpoint.Chain.TB, err) channelKey := host.ChannelKey(endpoint.Counterparty.ChannelConfig.PortID, endpoint.Counterparty.ChannelID) - proofChannel, height := endpoint.Counterparty.Chain.QueryProof(channelKey) + channelProof, height := endpoint.Counterparty.Chain.QueryProof(channelKey) msg := channeltypes.NewMsgChannelUpgradeTimeout( endpoint.ChannelConfig.PortID, endpoint.ChannelID, endpoint.Counterparty.GetChannel(), - proofChannel, + channelProof, height, endpoint.Chain.SenderAccount.GetAddress().String(), ) @@ -851,9 +851,9 @@ func (endpoint *Endpoint) QueryClientStateProof() (exported.ClientState, []byte) clientState := endpoint.GetClientState() clientKey := host.FullClientStateKey(endpoint.ClientID) - proofClient, _ := endpoint.QueryProof(clientKey) + clientProof, _ := endpoint.QueryProof(clientKey) - return clientState, proofClient + return clientState, clientProof } // GetProposedUpgrade returns a valid upgrade which can be used for UpgradeInit and UpgradeTry. diff --git a/testing/solomachine.go b/testing/solomachine.go index 2293f285bec..72b05f7c407 100644 --- a/testing/solomachine.go +++ b/testing/solomachine.go @@ -286,18 +286,18 @@ func (solo *Solomachine) ConnOpenInit(chain *TestChain, clientID string) string // ConnOpenAck performs the connection open ack handshake step on the tendermint chain for the associated // solo machine client. func (solo *Solomachine) ConnOpenAck(chain *TestChain, clientID, connectionID string) { - proofTry := solo.GenerateConnOpenTryProof(clientID, connectionID) + tryProof := solo.GenerateConnOpenTryProof(clientID, connectionID) clientState := ibctm.NewClientState(chain.ChainID, DefaultTrustLevel, TrustingPeriod, UnbondingPeriod, MaxClockDrift, chain.LastHeader.GetHeight().(clienttypes.Height), commitmenttypes.GetSDKSpecs(), UpgradePath) - proofClient := solo.GenerateClientStateProof(clientState) + clientProof := solo.GenerateClientStateProof(clientState) consensusState := chain.LastHeader.ConsensusState() consensusHeight := chain.LastHeader.GetHeight() - proofConsensus := solo.GenerateConsensusStateProof(consensusState, consensusHeight) + consensusProof := solo.GenerateConsensusStateProof(consensusState, consensusHeight) msgConnOpenAck := connectiontypes.NewMsgConnectionOpenAck( connectionID, connectionIDSolomachine, clientState, - proofTry, proofClient, proofConsensus, + tryProof, clientProof, consensusProof, clienttypes.ZeroHeight(), clientState.GetLatestHeight().(clienttypes.Height), ConnectionVersion, chain.SenderAccount.GetAddress().String(), @@ -332,13 +332,13 @@ func (solo *Solomachine) ChanOpenInit(chain *TestChain, connectionID string) str // ChanOpenAck performs the channel open ack handshake step on the tendermint chain for the associated // solo machine client. func (solo *Solomachine) ChanOpenAck(chain *TestChain, channelID string) { - proofTry := solo.GenerateChanOpenTryProof(transfertypes.PortID, transfertypes.Version, channelID) + tryProof := solo.GenerateChanOpenTryProof(transfertypes.PortID, transfertypes.Version, channelID) msgChanOpenAck := channeltypes.NewMsgChannelOpenAck( transfertypes.PortID, channelID, channelIDSolomachine, transfertypes.Version, - proofTry, + tryProof, clienttypes.ZeroHeight(), chain.SenderAccount.GetAddress().String(), ) @@ -351,11 +351,11 @@ func (solo *Solomachine) ChanOpenAck(chain *TestChain, channelID string) { // ChanCloseConfirm performs the channel close confirm handshake step on the tendermint chain for the associated // solo machine client. func (solo *Solomachine) ChanCloseConfirm(chain *TestChain, portID, channelID string) { - proofInit := solo.GenerateChanClosedProof(portID, transfertypes.Version, channelID) + initProof := solo.GenerateChanClosedProof(portID, transfertypes.Version, channelID) msgChanCloseConfirm := channeltypes.NewMsgChannelCloseConfirm( portID, channelID, - proofInit, + initProof, clienttypes.ZeroHeight(), chain.SenderAccount.GetAddress().String(), ) @@ -408,11 +408,11 @@ func (solo *Solomachine) RecvPacket(chain *TestChain, packet channeltypes.Packet // AcknowledgePacket creates an acknowledgement proof and broadcasts a MsgAcknowledgement. func (solo *Solomachine) AcknowledgePacket(chain *TestChain, packet channeltypes.Packet) { - proofAck := solo.GenerateAcknowledgementProof(packet) + ackProof := solo.GenerateAcknowledgementProof(packet) transferAck := channeltypes.NewResultAcknowledgement([]byte{byte(1)}).Acknowledgement() msgAcknowledgement := channeltypes.NewMsgAcknowledgement( packet, transferAck, - proofAck, + ackProof, clienttypes.ZeroHeight(), chain.SenderAccount.GetAddress().String(), ) @@ -424,11 +424,11 @@ func (solo *Solomachine) AcknowledgePacket(chain *TestChain, packet channeltypes // TimeoutPacket creates a unreceived packet proof and broadcasts a MsgTimeout. func (solo *Solomachine) TimeoutPacket(chain *TestChain, packet channeltypes.Packet) { - proofUnreceived := solo.GenerateReceiptAbsenceProof(packet) + unreceivedProof := solo.GenerateReceiptAbsenceProof(packet) msgTimeout := channeltypes.NewMsgTimeout( packet, 1, // nextSequenceRecv is unused for UNORDERED channels - proofUnreceived, + unreceivedProof, clienttypes.ZeroHeight(), chain.SenderAccount.GetAddress().String(), ) @@ -440,13 +440,13 @@ func (solo *Solomachine) TimeoutPacket(chain *TestChain, packet channeltypes.Pac // TimeoutPacket creates a channel closed and unreceived packet proof and broadcasts a MsgTimeoutOnClose. func (solo *Solomachine) TimeoutPacketOnClose(chain *TestChain, packet channeltypes.Packet, channelID string) { - proofClosed := solo.GenerateChanClosedProof(transfertypes.PortID, transfertypes.Version, channelID) - proofUnreceived := solo.GenerateReceiptAbsenceProof(packet) + closedProof := solo.GenerateChanClosedProof(transfertypes.PortID, transfertypes.Version, channelID) + unreceivedProof := solo.GenerateReceiptAbsenceProof(packet) msgTimeout := channeltypes.NewMsgTimeoutOnClose( packet, 1, // nextSequenceRecv is unused for UNORDERED channels - proofUnreceived, - proofClosed, + unreceivedProof, + closedProof, clienttypes.ZeroHeight(), chain.SenderAccount.GetAddress().String(), )