From d1280bf27280c54f49f055fdadf99ba92c506901 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Sun, 14 Jan 2024 23:52:57 +0100 Subject: [PATCH 1/4] chore: rename proofXyz -> xyzProof --- .../controller/ibc_middleware_test.go | 8 +-- .../host/ibc_module_test.go | 4 +- .../core/03-connection/keeper/handshake.go | 28 ++++---- .../03-connection/keeper/handshake_test.go | 20 +++--- modules/core/03-connection/keeper/verify.go | 8 +-- modules/core/03-connection/types/msgs.go | 20 +++--- modules/core/04-channel/keeper/handshake.go | 16 ++--- modules/core/04-channel/keeper/timeout.go | 4 +- .../core/04-channel/keeper/timeout_test.go | 4 +- modules/core/04-channel/keeper/upgrade.go | 32 ++++----- .../core/04-channel/keeper/upgrade_test.go | 38 +++++------ modules/core/04-channel/types/msgs.go | 66 +++++++++---------- modules/core/ante/ante_test.go | 4 +- modules/core/keeper/msg_server_test.go | 38 +++++------ testing/chain.go | 4 +- testing/endpoint.go | 62 ++++++++--------- testing/solomachine.go | 24 +++---- 17 files changed, 190 insertions(+), 190 deletions(-) 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 568edb2b031..ee7f13fc4e1 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 f5fdde6c5c1..c2ab5ae1dc1 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/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 765a0384a3c..f96f09a7fc4 100644 --- a/modules/core/03-connection/keeper/verify.go +++ b/modules/core/03-connection/keeper/verify.go @@ -371,7 +371,7 @@ func (k Keeper) VerifyChannelUpgradeError( ctx sdk.Context, connection exported.ConnectionI, proofHeight exported.Height, - proofErrorReceipt []byte, + errorReceiptProof []byte, portID, channelID string, errorReceipt channeltypes.ErrorReceipt, @@ -400,7 +400,7 @@ func (k Keeper) VerifyChannelUpgradeError( if err := clientState.VerifyMembership( ctx, clientStore, k.cdc, proofHeight, 0, 0, // skip delay period checks for non-packet processing verification - proofErrorReceipt, merklePath, bz, + errorReceiptProof, 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 cac392c49ee..5b927af7347 100644 --- a/modules/core/03-connection/types/msgs.go +++ b/modules/core/03-connection/types/msgs.go @@ -80,7 +80,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) @@ -91,9 +91,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, @@ -161,7 +161,7 @@ func (msg MsgConnectionOpenTry) UnpackInterfaces(unpacker codectypes.AnyUnpacker // 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, @@ -171,9 +171,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, @@ -228,12 +228,12 @@ func (msg MsgConnectionOpenAck) ValidateBasic() error { // 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 ccb1633f98d..1f888596b90 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,7 +429,7 @@ func (k Keeper) ChanCloseConfirm( portID, channelID string, chanCap *capabilitytypes.Capability, - proofInit []byte, + initProof []byte, proofHeight exported.Height, counterpartyUpgradeSequence uint64, ) error { @@ -471,7 +471,7 @@ func (k Keeper) ChanCloseConfirm( } 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 5e7e0a07450..15a7091ac09 100644 --- a/modules/core/04-channel/keeper/timeout.go +++ b/modules/core/04-channel/keeper/timeout.go @@ -208,7 +208,7 @@ func (k Keeper) TimeoutOnClose( chanCap *capabilitytypes.Capability, packet exported.PacketI, proof, - proofClosed []byte, + closedProof []byte, proofHeight exported.Height, nextSequenceRecv uint64, counterpartyUpgradeSequence uint64, @@ -277,7 +277,7 @@ func (k Keeper) TimeoutOnClose( // 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 22db7d65e2f..4427992ff44 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..1fa223465a6 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, + counterpartyChannelProof, + counterpartyUpgradeProof []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, counterpartyChannelProof, 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, counterpartyUpgradeProof, 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, + counterpartyChannelProof []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, counterpartyChannelProof, 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/msgs.go b/modules/core/04-channel/types/msgs.go index 24f4fcaecd1..024e0268235 100644 --- a/modules/core/04-channel/types/msgs.go +++ b/modules/core/04-channel/types/msgs.go @@ -94,7 +94,7 @@ func (msg MsgChannelOpenInit) ValidateBasic() error { 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) @@ -102,7 +102,7 @@ func NewMsgChannelOpenTry( PortId: portID, Channel: channel, CounterpartyVersion: counterpartyVersion, - ProofInit: proofInit, + ProofInit: initProof, ProofHeight: proofHeight, Signer: signer, } @@ -139,7 +139,7 @@ func (msg MsgChannelOpenTry) ValidateBasic() error { // 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{ @@ -147,7 +147,7 @@ func NewMsgChannelOpenAck( ChannelId: channelID, CounterpartyChannelId: counterpartyChannelID, CounterpartyVersion: cpv, - ProofTry: proofTry, + ProofTry: tryProof, ProofHeight: proofHeight, Signer: signer, } @@ -176,13 +176,13 @@ func (msg MsgChannelOpenAck) ValidateBasic() error { // 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, } @@ -234,13 +234,13 @@ func (msg MsgChannelCloseInit) ValidateBasic() error { // NewMsgChannelCloseConfirm creates a new MsgChannelCloseConfirm instance func NewMsgChannelCloseConfirm( - 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, @@ -267,12 +267,12 @@ func (msg MsgChannelCloseConfirm) ValidateBasic() error { // 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, } @@ -299,13 +299,13 @@ func (msg MsgRecvPacket) GetDataSignBytes() []byte { // 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, } @@ -329,7 +329,7 @@ func (msg MsgTimeout) ValidateBasic() error { // NewMsgTimeoutOnClose constructs new MsgTimeoutOnClose func NewMsgTimeoutOnClose( packet Packet, nextSequenceRecv uint64, - proofUnreceived, proofClose []byte, + proofUnreceived, closeProof []byte, proofHeight clienttypes.Height, signer string, counterpartyUpgradeSequence uint64, ) *MsgTimeoutOnClose { @@ -337,7 +337,7 @@ func NewMsgTimeoutOnClose( Packet: packet, NextSequenceRecv: nextSequenceRecv, ProofUnreceived: proofUnreceived, - ProofClose: proofClose, + ProofClose: closeProof, ProofHeight: proofHeight, Signer: signer, CounterpartyUpgradeSequence: counterpartyUpgradeSequence, @@ -365,14 +365,14 @@ func (msg MsgTimeoutOnClose) ValidateBasic() error { // 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, } @@ -437,8 +437,8 @@ func NewMsgChannelUpgradeTry( proposedConnectionHops []string, counterpartyUpgradeFields UpgradeFields, counterpartyUpgradeSequence uint64, - proofChannel []byte, - proofUpgrade []byte, + channelProof []byte, + upgradeProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgChannelUpgradeTry { @@ -448,8 +448,8 @@ func NewMsgChannelUpgradeTry( ProposedUpgradeConnectionHops: proposedConnectionHops, CounterpartyUpgradeFields: counterpartyUpgradeFields, CounterpartyUpgradeSequence: counterpartyUpgradeSequence, - ProofChannel: proofChannel, - ProofUpgrade: proofUpgrade, + ProofChannel: channelProof, + ProofUpgrade: upgradeProof, ProofHeight: proofHeight, Signer: signer, } @@ -497,13 +497,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, } @@ -538,8 +538,8 @@ func NewMsgChannelUpgradeConfirm( channelID string, counterpartyChannelState State, counterpartyUpgrade Upgrade, - proofChannel, - proofUpgrade []byte, + channelProof, + upgradeProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgChannelUpgradeConfirm { @@ -548,8 +548,8 @@ func NewMsgChannelUpgradeConfirm( ChannelId: channelID, CounterpartyChannelState: counterpartyChannelState, CounterpartyUpgrade: counterpartyUpgrade, - ProofChannel: proofChannel, - ProofUpgrade: proofUpgrade, + ProofChannel: channelProof, + ProofUpgrade: upgradeProof, ProofHeight: proofHeight, Signer: signer, } @@ -593,7 +593,7 @@ func NewMsgChannelUpgradeOpen( portID, channelID string, counterpartyChannelState State, - proofChannel []byte, + channelProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgChannelUpgradeOpen { @@ -601,7 +601,7 @@ func NewMsgChannelUpgradeOpen( PortId: portID, ChannelId: channelID, CounterpartyChannelState: counterpartyChannelState, - ProofChannel: proofChannel, + ProofChannel: channelProof, ProofHeight: proofHeight, Signer: signer, } @@ -640,7 +640,7 @@ var _ sdk.Msg = &MsgChannelUpgradeTimeout{} func NewMsgChannelUpgradeTimeout( portID, channelID string, counterpartyChannel Channel, - proofChannel []byte, + channelProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgChannelUpgradeTimeout { @@ -648,7 +648,7 @@ func NewMsgChannelUpgradeTimeout( PortId: portID, ChannelId: channelID, CounterpartyChannel: counterpartyChannel, - ProofChannel: proofChannel, + ProofChannel: channelProof, ProofHeight: proofHeight, Signer: signer, } @@ -687,7 +687,7 @@ var _ sdk.Msg = &MsgChannelUpgradeCancel{} func NewMsgChannelUpgradeCancel( portID, channelID string, errorReceipt ErrorReceipt, - proofErrReceipt []byte, + errorReceiptProof []byte, proofHeight clienttypes.Height, signer string, ) *MsgChannelUpgradeCancel { @@ -695,7 +695,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 734d71cc290..a8b33f3a701 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(), 0) + return channeltypes.NewMsgTimeoutOnClose(packet, 1, proof, closedProof, proofHeight, suite.path.EndpointA.Chain.SenderAccount.GetAddress().String(), 0) } func (suite *AnteTestSuite) createUpdateClientMessage() sdk.Msg { diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index 5b647181fe8..8d0dfcd0f71 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.NewMsgTimeoutOnClose(packet, 1, proof, proofClosed, proofHeight, suite.chainA.SenderAccount.GetAddress().String(), counterpartyUpgradeSequence) + msg := channeltypes.NewMsgTimeoutOnClose(packet, 1, proof, closedProof, proofHeight, suite.chainA.SenderAccount.GetAddress().String(), counterpartyUpgradeSequence) _, err := keeper.Keeper.TimeoutOnClose(*suite.chainA.App.GetIBCKeeper(), suite.chainA.GetContext(), msg) @@ -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/testing/chain.go b/testing/chain.go index ccaebff7475..8edcca9520e 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 fcf5099562f..ace9948c878 100644 --- a/testing/endpoint.go +++ b/testing/endpoint.go @@ -232,12 +232,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(), ) @@ -259,11 +259,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(), @@ -292,28 +292,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. @@ -555,14 +555,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.NewMsgTimeoutOnClose( packet, nextSeqRecv, - proof, proofClosed, proofHeight, endpoint.Chain.SenderAccount.GetAddress().String(), + proof, closedProof, proofHeight, endpoint.Chain.SenderAccount.GetAddress().String(), endpoint.Counterparty.GetChannel().UpgradeSequence, ) @@ -574,12 +574,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. @@ -625,7 +625,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) @@ -640,8 +640,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(), ) @@ -654,7 +654,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) @@ -663,8 +663,8 @@ func (endpoint *Endpoint) ChanUpgradeAck() error { endpoint.ChannelConfig.PortID, endpoint.ChannelID, counterpartyUpgrade, - proofChannel, - proofUpgrade, + channelProof, + upgradeProof, height, endpoint.Chain.SenderAccount.GetAddress().String(), ) @@ -677,7 +677,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) @@ -687,8 +687,8 @@ func (endpoint *Endpoint) ChanUpgradeConfirm() error { endpoint.ChannelID, endpoint.Counterparty.GetChannel().State, counterpartyUpgrade, - proofChannel, - proofUpgrade, + channelProof, + upgradeProof, height, endpoint.Chain.SenderAccount.GetAddress().String(), ) @@ -702,13 +702,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(), ) @@ -722,13 +722,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(), ) @@ -850,9 +850,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 81eb087f6bc..7165348193c 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(), 0, // use default value for channel that hasn't undergone an upgrade @@ -409,11 +409,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(), ) @@ -441,13 +441,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) + closedProof := solo.GenerateChanClosedProof(transfertypes.PortID, transfertypes.Version, channelID) proofUnreceived := solo.GenerateReceiptAbsenceProof(packet) msgTimeout := channeltypes.NewMsgTimeoutOnClose( packet, 1, // nextSequenceRecv is unused for UNORDERED channels proofUnreceived, - proofClosed, + closedProof, clienttypes.ZeroHeight(), chain.SenderAccount.GetAddress().String(), 0, // use default value for channel that hasn't undergone an upgrade From 05fbe5fccfb3611647cf8de47d0b4924d01cc746 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Mon, 15 Jan 2024 08:32:35 +0100 Subject: [PATCH 2/4] more renaming --- .../01-developer-guide/05-upgrades.md | 4 +- modules/core/02-client/client/cli/tx.go | 6 +- modules/core/02-client/keeper/client.go | 4 +- modules/core/02-client/keeper/client_test.go | 34 +++---- modules/core/02-client/types/msgs.go | 6 +- .../core/04-channel/types/expected_keepers.go | 2 +- modules/core/04-channel/types/msgs.go | 4 +- modules/core/exported/client.go | 4 +- modules/core/keeper/msg_server_test.go | 6 +- .../light-clients/07-tendermint/upgrade.go | 6 +- .../07-tendermint/upgrade_test.go | 88 +++++++++---------- .../light-clients/08-wasm/types/upgrade.go | 8 +- .../08-wasm/types/upgrade_test.go | 20 ++--- testing/solomachine.go | 8 +- 14 files changed, 100 insertions(+), 100 deletions(-) diff --git a/docs/docs/03-light-clients/01-developer-guide/05-upgrades.md b/docs/docs/03-light-clients/01-developer-guide/05-upgrades.md index a6fc3858c3d..2e0b0baf578 100644 --- a/docs/docs/03-light-clients/01-developer-guide/05-upgrades.md +++ b/docs/docs/03-light-clients/01-developer-guide/05-upgrades.md @@ -24,8 +24,8 @@ func (cs ClientState) VerifyUpgradeAndUpdateState( store sdk.KVStore, newClient ClientState, newConsState ConsensusState, - proofUpgradeClient, - proofUpgradeConsState []byte, + upgradeClientProof, + upgradeConsensusStateProof []byte, ) error ``` 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 187e2968f49..50dc9b34bcd 100644 --- a/modules/core/02-client/keeper/client.go +++ b/modules/core/02-client/keeper/client.go @@ -116,7 +116,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 { @@ -138,7 +138,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 e201f4d7bf7..b1506d9dd2e 100644 --- a/modules/core/02-client/keeper/client_test.go +++ b/modules/core/02-client/keeper/client_test.go @@ -307,12 +307,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 { @@ -340,8 +340,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, }, @@ -366,8 +366,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" }, @@ -396,8 +396,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) @@ -431,8 +431,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: false, }, @@ -460,8 +460,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: false, }, @@ -491,7 +491,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 77aee0828ee..65cb2fede8b 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -133,7 +133,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 { @@ -148,8 +148,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/04-channel/types/expected_keepers.go b/modules/core/04-channel/types/expected_keepers.go index d46c514182e..9d55c1624c8 100644 --- a/modules/core/04-channel/types/expected_keepers.go +++ b/modules/core/04-channel/types/expected_keepers.go @@ -86,7 +86,7 @@ type ConnectionKeeper interface { ctx sdk.Context, connection exported.ConnectionI, proofHeight exported.Height, - proofErrorReceipt []byte, + errorReceiptProof []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 024e0268235..f3f9af995f4 100644 --- a/modules/core/04-channel/types/msgs.go +++ b/modules/core/04-channel/types/msgs.go @@ -329,14 +329,14 @@ func (msg MsgTimeout) ValidateBasic() error { // NewMsgTimeoutOnClose constructs new MsgTimeoutOnClose func NewMsgTimeoutOnClose( packet Packet, nextSequenceRecv uint64, - proofUnreceived, closeProof []byte, + unreceivedProof, closeProof []byte, proofHeight clienttypes.Height, signer string, counterpartyUpgradeSequence uint64, ) *MsgTimeoutOnClose { return &MsgTimeoutOnClose{ Packet: packet, NextSequenceRecv: nextSequenceRecv, - ProofUnreceived: proofUnreceived, + ProofUnreceived: unreceivedProof, ProofClose: closeProof, ProofHeight: proofHeight, Signer: signer, diff --git a/modules/core/exported/client.go b/modules/core/exported/client.go index 75e58a898c5..fec1564c4c3 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 8d0dfcd0f71..82498657c15 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -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, diff --git a/modules/light-clients/07-tendermint/upgrade.go b/modules/light-clients/07-tendermint/upgrade.go index 61124f6c2f5..beccdf0a346 100644 --- a/modules/light-clients/07-tendermint/upgrade.go +++ b/modules/light-clients/07-tendermint/upgrade.go @@ -29,7 +29,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") @@ -51,10 +51,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/modules/light-clients/08-wasm/types/upgrade.go b/modules/light-clients/08-wasm/types/upgrade.go index 3addb071d54..6f4ea5ef589 100644 --- a/modules/light-clients/08-wasm/types/upgrade.go +++ b/modules/light-clients/08-wasm/types/upgrade.go @@ -19,8 +19,8 @@ func (cs ClientState) VerifyUpgradeAndUpdateState( clientStore storetypes.KVStore, upgradedClient exported.ClientState, upgradedConsState exported.ConsensusState, - proofUpgradeClient, - proofUpgradeConsState []byte, + upgradeClientProof, + upgradeConsensusStateProof []byte, ) error { wasmUpgradeClientState, ok := upgradedClient.(*ClientState) if !ok { @@ -38,8 +38,8 @@ func (cs ClientState) VerifyUpgradeAndUpdateState( VerifyUpgradeAndUpdateState: &VerifyUpgradeAndUpdateStateMsg{ UpgradeClientState: wasmUpgradeClientState.Data, UpgradeConsensusState: wasmUpgradeConsState.Data, - ProofUpgradeClient: proofUpgradeClient, - ProofUpgradeConsensusState: proofUpgradeConsState, + ProofUpgradeClient: upgradeClientProof, + ProofUpgradeConsensusState: upgradeConsensusStateProof, }, } diff --git a/modules/light-clients/08-wasm/types/upgrade_test.go b/modules/light-clients/08-wasm/types/upgrade_test.go index 6006066ecc7..7c75a90870f 100644 --- a/modules/light-clients/08-wasm/types/upgrade_test.go +++ b/modules/light-clients/08-wasm/types/upgrade_test.go @@ -122,10 +122,10 @@ func (suite *TypesTestSuite) TestVerifyClientMessage() { func (suite *TypesTestSuite) TestVerifyUpgradeAndUpdateState() { var ( - upgradedClient exported.ClientState - upgradedConsState exported.ConsensusState - proofUpgradedClient []byte - proofUpgradedConsState []byte + upgradedClient exported.ClientState + upgradedConsState exported.ConsensusState + upgradedClientProof []byte + upgradedConsensusStateProof []byte ) testCases := []struct { @@ -150,8 +150,8 @@ func (suite *TypesTestSuite) TestVerifyUpgradeAndUpdateState() { // verify payload values suite.Require().Equal(expectedUpgradedClient.Data, payload.VerifyUpgradeAndUpdateState.UpgradeClientState) suite.Require().Equal(expectedUpgradedConsensus.Data, payload.VerifyUpgradeAndUpdateState.UpgradeConsensusState) - suite.Require().Equal(proofUpgradedClient, payload.VerifyUpgradeAndUpdateState.ProofUpgradeClient) - suite.Require().Equal(proofUpgradedConsState, payload.VerifyUpgradeAndUpdateState.ProofUpgradeConsensusState) + suite.Require().Equal(upgradedClientProof, payload.VerifyUpgradeAndUpdateState.ProofUpgradeClient) + suite.Require().Equal(upgradedConsensusStateProof, payload.VerifyUpgradeAndUpdateState.ProofUpgradeConsensusState) // verify other Sudo fields are nil suite.Require().Nil(payload.UpdateState) @@ -223,8 +223,8 @@ func (suite *TypesTestSuite) TestVerifyUpgradeAndUpdateState() { clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), defaultWasmClientID) - proofUpgradedClient = wasmtesting.MockUpgradedClientStateProofBz - proofUpgradedConsState = wasmtesting.MockUpgradedConsensusStateProofBz + upgradedClientProof = wasmtesting.MockUpgradedClientStateProofBz + upgradedConsensusStateProof = wasmtesting.MockUpgradedConsensusStateProofBz err = clientState.VerifyUpgradeAndUpdateState( suite.chainA.GetContext(), @@ -232,8 +232,8 @@ func (suite *TypesTestSuite) TestVerifyUpgradeAndUpdateState() { clientStore, upgradedClient, upgradedConsState, - proofUpgradedClient, - proofUpgradedConsState, + upgradedClientProof, + upgradedConsensusStateProof, ) expPass := tc.expErr == nil diff --git a/testing/solomachine.go b/testing/solomachine.go index 7165348193c..7ea627de441 100644 --- a/testing/solomachine.go +++ b/testing/solomachine.go @@ -425,11 +425,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(), ) @@ -442,11 +442,11 @@ 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) { closedProof := solo.GenerateChanClosedProof(transfertypes.PortID, transfertypes.Version, channelID) - proofUnreceived := solo.GenerateReceiptAbsenceProof(packet) + unreceivedProof := solo.GenerateReceiptAbsenceProof(packet) msgTimeout := channeltypes.NewMsgTimeoutOnClose( packet, 1, // nextSequenceRecv is unused for UNORDERED channels - proofUnreceived, + unreceivedProof, closedProof, clienttypes.ZeroHeight(), chain.SenderAccount.GetAddress().String(), From 97ea2e36547aae727d1022a2dbc6f11e239bf091 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Mon, 15 Jan 2024 13:12:16 +0100 Subject: [PATCH 3/4] rename VerifyChannelUpgradeError proof parameters for consistency with the other verification functions --- modules/core/03-connection/keeper/verify.go | 8 ++++---- modules/core/04-channel/types/expected_keepers.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/core/03-connection/keeper/verify.go b/modules/core/03-connection/keeper/verify.go index f96f09a7fc4..6048ccf9c79 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, - errorReceiptProof []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 - errorReceiptProof, merklePath, bz, + proof, merklePath, bz, ); err != nil { return errorsmod.Wrapf(err, "failed upgrade error receipt verification for client (%s)", clientID) } diff --git a/modules/core/04-channel/types/expected_keepers.go b/modules/core/04-channel/types/expected_keepers.go index 9d55c1624c8..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, - errorReceiptProof []byte, + height exported.Height, + proof []byte, portID, channelID string, errorReceipt ErrorReceipt, From 4293dd45481e2e13f8337a74d554477cea5f750d Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Mon, 15 Jan 2024 20:03:45 +0100 Subject: [PATCH 4/4] remove counterparty prefix from proof names --- modules/core/04-channel/keeper/upgrade.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/core/04-channel/keeper/upgrade.go b/modules/core/04-channel/keeper/upgrade.go index 1fa223465a6..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, - counterpartyChannelProof, - counterpartyUpgradeProof []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, counterpartyChannelProof, + 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, counterpartyUpgradeProof, + proofHeight, upgradeProof, channel.Counterparty.PortId, channel.Counterparty.ChannelId, types.NewUpgrade(counterpartyUpgradeFields, types.Timeout{}, 0), @@ -472,7 +472,7 @@ func (k Keeper) ChanUpgradeOpen( portID, channelID string, counterpartyChannelState types.State, - counterpartyChannelProof []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, counterpartyChannelProof, + proofHeight, channelProof, channel.Counterparty.PortId, channel.Counterparty.ChannelId, counterpartyChannel,