ibc: client params allowlist (#7855)
* ibc: client params allowlist * genesis and gRPC * client * lint * spec * fixes * validate localhost client * move client types back to exported * update genesis * sort clients by id
This commit is contained in:
parent
116d0460fc
commit
136f3ade88
@ -6,91 +6,6 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types";
|
||||
import "gogoproto/gogo.proto";
|
||||
import "google/protobuf/any.proto";
|
||||
|
||||
// Msg defines the ibc/client Msg service.
|
||||
service Msg {
|
||||
// CreateClient defines a rpc handler method for MsgCreateClient.
|
||||
rpc CreateClient(MsgCreateClient) returns (MsgCreateClientResponse);
|
||||
|
||||
// UpdateClient defines a rpc handler method for MsgUpdateClient.
|
||||
rpc UpdateClient(MsgUpdateClient) returns (MsgUpdateClientResponse);
|
||||
|
||||
// UpgradeClient defines a rpc handler method for MsgUpgradeClient.
|
||||
rpc UpgradeClient(MsgUpgradeClient) returns (MsgUpgradeClientResponse);
|
||||
|
||||
// SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour.
|
||||
rpc SubmitMisbehaviour(MsgSubmitMisbehaviour) returns (MsgSubmitMisbehaviourResponse);
|
||||
}
|
||||
|
||||
// MsgCreateClient defines a message to create an IBC client
|
||||
message MsgCreateClient {
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
// client unique identifier
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
// light client state
|
||||
google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""];
|
||||
// consensus state associated with the client that corresponds to a given
|
||||
// height.
|
||||
google.protobuf.Any consensus_state = 3 [(gogoproto.moretags) = "yaml:\"consensus_state\""];
|
||||
// signer address
|
||||
string signer = 4;
|
||||
}
|
||||
|
||||
// MsgCreateClientResponse defines the Msg/CreateClient response type.
|
||||
message MsgCreateClientResponse { }
|
||||
|
||||
// MsgUpdateClient defines an sdk.Msg to update a IBC client state using
|
||||
// the given header.
|
||||
message MsgUpdateClient {
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
// client unique identifier
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
// header to update the light client
|
||||
google.protobuf.Any header = 2;
|
||||
// signer address
|
||||
string signer = 3;
|
||||
}
|
||||
|
||||
// MsgUpdateClientResponse defines the Msg/UpdateClient response type.
|
||||
message MsgUpdateClientResponse { }
|
||||
|
||||
// MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client state
|
||||
message MsgUpgradeClient {
|
||||
// client unique identifier
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
// upgraded client state
|
||||
google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""];
|
||||
// height at which old chain halts and upgrades (i.e last block executed)
|
||||
Height upgrade_height = 3 [(gogoproto.moretags) = "yaml:\"upgrade_height\""];
|
||||
// proof that old chain committed to new client
|
||||
bytes proof_upgrade = 4 [(gogoproto.moretags) = "yaml:\"proof_upgrade\""];
|
||||
// signer address
|
||||
string signer = 5;
|
||||
}
|
||||
|
||||
// MsgUpgradeClientResponse defines the Msg/UpgradeClient response type.
|
||||
message MsgUpgradeClientResponse { }
|
||||
|
||||
// MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for
|
||||
// light client misbehaviour.
|
||||
message MsgSubmitMisbehaviour {
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
// client unique identifier
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
// misbehaviour used for freezing the light client
|
||||
google.protobuf.Any misbehaviour = 2;
|
||||
// signer address
|
||||
string signer = 3;
|
||||
}
|
||||
|
||||
// MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response type.
|
||||
message MsgSubmitMisbehaviourResponse { }
|
||||
|
||||
// IdentifiedClientState defines a client state with an additional client
|
||||
// identifier field.
|
||||
message IdentifiedClientState {
|
||||
@ -151,3 +66,9 @@ message Height {
|
||||
// the height within the given version
|
||||
uint64 version_height = 2 [(gogoproto.moretags) = "yaml:\"version_height\""];
|
||||
}
|
||||
|
||||
// Params defines the set of IBC light client parameters.
|
||||
message Params {
|
||||
// allowed_clients defines the list of allowed client state types.
|
||||
repeated string allowed_clients = 1 [(gogoproto.moretags) = "yaml:\"allowed_clients\""];
|
||||
}
|
||||
|
||||
@ -9,13 +9,17 @@ import "gogoproto/gogo.proto";
|
||||
// GenesisState defines the ibc client submodule's genesis state.
|
||||
message GenesisState {
|
||||
// client states with their corresponding identifiers
|
||||
repeated IdentifiedClientState clients = 1 [(gogoproto.nullable) = false];
|
||||
repeated IdentifiedClientState clients = 1 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.castrepeated) = "IdentifiedClientStates"
|
||||
];
|
||||
// consensus states from each client
|
||||
repeated ClientConsensusStates clients_consensus = 2 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.castrepeated) = "ClientsConsensusStates",
|
||||
(gogoproto.moretags) = "yaml:\"clients_consensus\""
|
||||
];
|
||||
Params params = 3 [ (gogoproto.nullable) = false];
|
||||
// create localhost on initialization
|
||||
bool create_localhost = 3 [(gogoproto.moretags) = "yaml:\"create_localhost\""];
|
||||
bool create_localhost = 4 [(gogoproto.moretags) = "yaml:\"create_localhost\""];
|
||||
}
|
||||
|
||||
@ -33,6 +33,11 @@ service Query {
|
||||
rpc ConsensusStates(QueryConsensusStatesRequest) returns (QueryConsensusStatesResponse) {
|
||||
option (google.api.http).get = "/ibc/core/client/v1beta1/consensus_states/{client_id}";
|
||||
}
|
||||
|
||||
// ClientParams queries all parameters of the ibc client.
|
||||
rpc ClientParams(QueryClientParamsRequest) returns (QueryClientParamsResponse) {
|
||||
option (google.api.http).get = "/ibc/client/v1beta1/params";
|
||||
}
|
||||
}
|
||||
|
||||
// QueryClientStateRequest is the request type for the Query/ClientState RPC
|
||||
@ -65,7 +70,10 @@ message QueryClientStatesRequest {
|
||||
// method.
|
||||
message QueryClientStatesResponse {
|
||||
// list of stored ClientStates of the chain.
|
||||
repeated IdentifiedClientState client_states = 1;
|
||||
repeated IdentifiedClientState client_states = 1 [
|
||||
(gogoproto.nullable) = false,
|
||||
(gogoproto.castrepeated) = "IdentifiedClientStates"
|
||||
];
|
||||
// pagination response
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
||||
@ -113,3 +121,12 @@ message QueryConsensusStatesResponse {
|
||||
// pagination response
|
||||
cosmos.base.query.v1beta1.PageResponse pagination = 2;
|
||||
}
|
||||
|
||||
// QueryClientParamsRequest is the request type for the Query/ClientParams RPC method.
|
||||
message QueryClientParamsRequest {}
|
||||
|
||||
// QueryClientParamsResponse is the response type for the Query/ClientParams RPC method.
|
||||
message QueryClientParamsResponse {
|
||||
// params defines the parameters of the module.
|
||||
Params params = 1;
|
||||
}
|
||||
|
||||
93
proto/ibc/core/client/v1/tx.proto
Normal file
93
proto/ibc/core/client/v1/tx.proto
Normal file
@ -0,0 +1,93 @@
|
||||
syntax = "proto3";
|
||||
package ibc.core.client.v1;
|
||||
|
||||
option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types";
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "google/protobuf/any.proto";
|
||||
import "ibc/core/client/v1/client.proto";
|
||||
|
||||
// Msg defines the ibc/client Msg service.
|
||||
service Msg {
|
||||
// CreateClient defines a rpc handler method for MsgCreateClient.
|
||||
rpc CreateClient(MsgCreateClient) returns (MsgCreateClientResponse);
|
||||
|
||||
// UpdateClient defines a rpc handler method for MsgUpdateClient.
|
||||
rpc UpdateClient(MsgUpdateClient) returns (MsgUpdateClientResponse);
|
||||
|
||||
// UpgradeClient defines a rpc handler method for MsgUpgradeClient.
|
||||
rpc UpgradeClient(MsgUpgradeClient) returns (MsgUpgradeClientResponse);
|
||||
|
||||
// SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour.
|
||||
rpc SubmitMisbehaviour(MsgSubmitMisbehaviour) returns (MsgSubmitMisbehaviourResponse);
|
||||
}
|
||||
|
||||
// MsgCreateClient defines a message to create an IBC client
|
||||
message MsgCreateClient {
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
// client unique identifier
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
// light client state
|
||||
google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""];
|
||||
// consensus state associated with the client that corresponds to a given
|
||||
// height.
|
||||
google.protobuf.Any consensus_state = 3 [(gogoproto.moretags) = "yaml:\"consensus_state\""];
|
||||
// signer address
|
||||
string signer = 4;
|
||||
}
|
||||
|
||||
// MsgCreateClientResponse defines the Msg/CreateClient response type.
|
||||
message MsgCreateClientResponse { }
|
||||
|
||||
// MsgUpdateClient defines an sdk.Msg to update a IBC client state using
|
||||
// the given header.
|
||||
message MsgUpdateClient {
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
// client unique identifier
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
// header to update the light client
|
||||
google.protobuf.Any header = 2;
|
||||
// signer address
|
||||
string signer = 3;
|
||||
}
|
||||
|
||||
// MsgUpdateClientResponse defines the Msg/UpdateClient response type.
|
||||
message MsgUpdateClientResponse { }
|
||||
|
||||
// MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client state
|
||||
message MsgUpgradeClient {
|
||||
// client unique identifier
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
// upgraded client state
|
||||
google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""];
|
||||
// height at which old chain halts and upgrades (i.e last block executed)
|
||||
Height upgrade_height = 3 [(gogoproto.moretags) = "yaml:\"upgrade_height\""];
|
||||
// proof that old chain committed to new client
|
||||
bytes proof_upgrade = 4 [(gogoproto.moretags) = "yaml:\"proof_upgrade\""];
|
||||
// signer address
|
||||
string signer = 5;
|
||||
}
|
||||
|
||||
// MsgUpgradeClientResponse defines the Msg/UpgradeClient response type.
|
||||
message MsgUpgradeClientResponse { }
|
||||
|
||||
// MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for
|
||||
// light client misbehaviour.
|
||||
message MsgSubmitMisbehaviour {
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
// client unique identifier
|
||||
string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
|
||||
// misbehaviour used for freezing the light client
|
||||
google.protobuf.Any misbehaviour = 2;
|
||||
// signer address
|
||||
string signer = 3;
|
||||
}
|
||||
|
||||
// MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response type.
|
||||
message MsgSubmitMisbehaviourResponse { }
|
||||
@ -279,7 +279,7 @@ func NewSimApp(
|
||||
|
||||
// Create IBC Keeper
|
||||
app.IBCKeeper = ibckeeper.NewKeeper(
|
||||
appCodec, keys[ibchost.StoreKey], app.StakingKeeper, scopedIBCKeeper,
|
||||
appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), app.StakingKeeper, scopedIBCKeeper,
|
||||
)
|
||||
|
||||
// register the proposal types
|
||||
@ -609,6 +609,7 @@ func initParamsKeeper(appCodec codec.BinaryMarshaler, legacyAmino *codec.LegacyA
|
||||
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable())
|
||||
paramsKeeper.Subspace(crisistypes.ModuleName)
|
||||
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
|
||||
paramsKeeper.Subspace(ibchost.ModuleName)
|
||||
|
||||
return paramsKeeper
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ func GetQueryCmd() *cobra.Command {
|
||||
queryCmd.AddCommand(
|
||||
GetCmdQueryDenomTrace(),
|
||||
GetCmdQueryDenomTraces(),
|
||||
GetCmdParams(),
|
||||
)
|
||||
|
||||
return queryCmd
|
||||
|
||||
@ -86,8 +86,8 @@ func GetCmdQueryDenomTraces() *cobra.Command {
|
||||
return cmd
|
||||
}
|
||||
|
||||
// QueryParamsCmd returns the command handler for ibc-transfer parameter querying.
|
||||
func QueryParamsCmd() *cobra.Command {
|
||||
// GetCmdParams returns the command handler for ibc-transfer parameter querying.
|
||||
func GetCmdParams() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "params",
|
||||
Short: "Query the current ibc-transfer parameters",
|
||||
|
||||
@ -9,6 +9,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer/types"
|
||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types"
|
||||
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||
)
|
||||
|
||||
@ -31,7 +32,7 @@ func (suite *TransferTestSuite) SetupTest() {
|
||||
// constructs a send from chainA to chainB on the established channel/connection
|
||||
// and sends the same coin back from chainB to chainA.
|
||||
func (suite *TransferTestSuite) TestHandleMsgTransfer() {
|
||||
clientA, clientB, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB := suite.coordinator.CreateTransferChannels(suite.chainA, suite.chainB, connA, connB, channeltypes.UNORDERED)
|
||||
originalBalance := suite.chainA.App.BankKeeper.GetBalance(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), sdk.DefaultBondDenom)
|
||||
timeoutHeight := clienttypes.NewHeight(0, 110)
|
||||
|
||||
@ -8,6 +8,7 @@ import (
|
||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types"
|
||||
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types"
|
||||
host "github.com/cosmos/cosmos-sdk/x/ibc/core/24-host"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||
)
|
||||
|
||||
@ -28,28 +29,28 @@ func (suite *KeeperTestSuite) TestSendTransfer() {
|
||||
}{
|
||||
{"successful transfer from source chain",
|
||||
func() {
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB = suite.coordinator.CreateTransferChannels(suite.chainA, suite.chainB, connA, connB, channeltypes.UNORDERED)
|
||||
amount = sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100))
|
||||
}, true, true},
|
||||
{"successful transfer with coin from counterparty chain",
|
||||
func() {
|
||||
// send coin from chainA back to chainB
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB = suite.coordinator.CreateTransferChannels(suite.chainA, suite.chainB, connA, connB, channeltypes.UNORDERED)
|
||||
amount = types.GetTransferCoin(channelA.PortID, channelA.ID, sdk.DefaultBondDenom, 100)
|
||||
}, false, true},
|
||||
{"source channel not found",
|
||||
func() {
|
||||
// channel references wrong ID
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB = suite.coordinator.CreateTransferChannels(suite.chainA, suite.chainB, connA, connB, channeltypes.UNORDERED)
|
||||
channelA.ID = ibctesting.InvalidID
|
||||
amount = sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100))
|
||||
}, true, false},
|
||||
{"next seq send not found",
|
||||
func() {
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA = connA.NextTestChannel(ibctesting.TransferPort)
|
||||
channelB = connB.NextTestChannel(ibctesting.TransferPort)
|
||||
// manually create channel so next seq send is never set
|
||||
@ -66,20 +67,20 @@ func (suite *KeeperTestSuite) TestSendTransfer() {
|
||||
// - source chain
|
||||
{"send coin failed",
|
||||
func() {
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB = suite.coordinator.CreateTransferChannels(suite.chainA, suite.chainB, connA, connB, channeltypes.UNORDERED)
|
||||
amount = sdk.NewCoin("randomdenom", sdk.NewInt(100))
|
||||
}, true, false},
|
||||
// - receiving chain
|
||||
{"send from module account failed",
|
||||
func() {
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB = suite.coordinator.CreateTransferChannels(suite.chainA, suite.chainB, connA, connB, channeltypes.UNORDERED)
|
||||
amount = types.GetTransferCoin(channelA.PortID, channelA.ID, " randomdenom", 100)
|
||||
}, false, false},
|
||||
{"channel capability not found",
|
||||
func() {
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB = suite.coordinator.CreateTransferChannels(suite.chainA, suite.chainB, connA, connB, channeltypes.UNORDERED)
|
||||
cap := suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||
|
||||
@ -177,7 +178,7 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() {
|
||||
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
||||
suite.SetupTest() // reset
|
||||
|
||||
clientA, clientB, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB = suite.coordinator.CreateTransferChannels(suite.chainA, suite.chainB, connA, connB, channeltypes.UNORDERED)
|
||||
receiver = suite.chainB.SenderAccount.GetAddress().String() // must be explicitly changed in malleate
|
||||
|
||||
@ -365,7 +366,7 @@ func (suite *KeeperTestSuite) TestOnTimeoutPacket() {
|
||||
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
||||
suite.SetupTest() // reset
|
||||
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB = suite.coordinator.CreateTransferChannels(suite.chainA, suite.chainB, connA, connB, channeltypes.UNORDERED)
|
||||
amount = sdk.NewInt(100) // must be explicitly changed
|
||||
sender = suite.chainA.SenderAccount.GetAddress().String()
|
||||
|
||||
@ -5,6 +5,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer/types"
|
||||
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types"
|
||||
host "github.com/cosmos/cosmos-sdk/x/ibc/core/24-host"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||
)
|
||||
|
||||
@ -54,7 +55,7 @@ func (suite *TransferTestSuite) TestOnChanOpenInit() {
|
||||
suite.Run(tc.name, func() {
|
||||
suite.SetupTest() // reset
|
||||
|
||||
_, _, connA, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
testChannel = connA.NextTestChannel(ibctesting.TransferPort)
|
||||
counterparty := channeltypes.NewCounterparty(testChannel.PortID, testChannel.ID)
|
||||
channel = &channeltypes.Channel{
|
||||
@ -142,7 +143,7 @@ func (suite *TransferTestSuite) TestOnChanOpenTry() {
|
||||
suite.Run(tc.name, func() {
|
||||
suite.SetupTest() // reset
|
||||
|
||||
_, _, connA, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
testChannel = connA.NextTestChannel(ibctesting.TransferPort)
|
||||
counterparty := channeltypes.NewCounterparty(testChannel.PortID, testChannel.ID)
|
||||
channel = &channeltypes.Channel{
|
||||
@ -208,7 +209,7 @@ func (suite *TransferTestSuite) TestOnChanOpenAck() {
|
||||
suite.Run(tc.name, func() {
|
||||
suite.SetupTest() // reset
|
||||
|
||||
_, _, connA, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
testChannel = connA.NextTestChannel(ibctesting.TransferPort)
|
||||
counterpartyVersion = types.Version
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ func GetQueryCmd() *cobra.Command {
|
||||
GetCmdQueryConsensusState(),
|
||||
GetCmdQueryHeader(),
|
||||
GetCmdNodeConsensusState(),
|
||||
GetCmdParams(),
|
||||
)
|
||||
|
||||
return queryCmd
|
||||
|
||||
@ -250,3 +250,30 @@ func GetCmdNodeConsensusState() *cobra.Command {
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
// GetCmdParams returns the command handler for ibc client parameter querying.
|
||||
func GetCmdParams() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "params",
|
||||
Short: "Query the current ibc client parameters",
|
||||
Long: "Query the current ibc client parameters",
|
||||
Args: cobra.NoArgs,
|
||||
Example: fmt.Sprintf("%s query %s %s params", version.AppName, host.ModuleName, types.SubModuleName),
|
||||
RunE: func(cmd *cobra.Command, _ []string) error {
|
||||
clientCtx := client.GetClientContextFromCmd(cmd)
|
||||
clientCtx, err := client.ReadQueryCommandFlags(clientCtx, cmd.Flags())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
queryClient := types.NewQueryClient(clientCtx)
|
||||
|
||||
res, _ := queryClient.ClientParams(context.Background(), &types.QueryClientParamsRequest{})
|
||||
return clientCtx.PrintOutput(res.Params)
|
||||
},
|
||||
}
|
||||
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@ -13,12 +13,18 @@ import (
|
||||
// InitGenesis initializes the ibc client submodule's state from a provided genesis
|
||||
// state.
|
||||
func InitGenesis(ctx sdk.Context, k keeper.Keeper, gs types.GenesisState) {
|
||||
k.SetParams(ctx, gs.Params)
|
||||
|
||||
for _, client := range gs.Clients {
|
||||
cs, ok := client.ClientState.GetCachedValue().(exported.ClientState)
|
||||
if !ok {
|
||||
panic("invalid client state")
|
||||
}
|
||||
|
||||
if !gs.Params.IsAllowedClient(cs.ClientType()) {
|
||||
panic(fmt.Sprintf("client state type %s is not registered on the allowlist", cs.ClientType()))
|
||||
}
|
||||
|
||||
k.SetClientState(ctx, client.ClientId, cs)
|
||||
}
|
||||
|
||||
@ -49,6 +55,10 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, gs types.GenesisState) {
|
||||
ctx.ChainID(), types.NewHeight(version, uint64(ctx.BlockHeight())),
|
||||
)
|
||||
|
||||
if err := clientState.Validate(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if err := k.CreateClient(ctx, exported.Localhost, clientState, nil); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -61,6 +71,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
|
||||
return types.GenesisState{
|
||||
Clients: k.GetAllGenesisClients(ctx),
|
||||
ClientsConsensus: k.GetAllConsensusStates(ctx),
|
||||
Params: k.GetParams(ctx),
|
||||
CreateLocalhost: false,
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,6 +17,14 @@ import (
|
||||
func (k Keeper) CreateClient(
|
||||
ctx sdk.Context, clientID string, clientState exported.ClientState, consensusState exported.ConsensusState,
|
||||
) error {
|
||||
params := k.GetParams(ctx)
|
||||
if !params.IsAllowedClient(clientState.ClientType()) {
|
||||
return sdkerrors.Wrapf(
|
||||
types.ErrInvalidClientType,
|
||||
"client state type %s is not registered in the allowlist", clientState.ClientType(),
|
||||
)
|
||||
}
|
||||
|
||||
_, found := k.GetClientState(ctx, clientID)
|
||||
if found {
|
||||
return sdkerrors.Wrapf(types.ErrClientExists, "cannot create client with ID %s", clientID)
|
||||
|
||||
@ -261,7 +261,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
@ -286,7 +286,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
@ -313,7 +313,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
@ -345,7 +345,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
upgradedClient = ibctmtypes.NewClientState("wrongchainID", ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, true, true)
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
@ -359,7 +359,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
clientA, _ = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _ = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
tc.setup()
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package keeper
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
@ -58,7 +59,7 @@ func (q Keeper) ClientStates(c context.Context, req *types.QueryClientStatesRequ
|
||||
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
|
||||
clientStates := []*types.IdentifiedClientState{}
|
||||
clientStates := types.IdentifiedClientStates{}
|
||||
store := prefix.NewStore(ctx.KVStore(q.storeKey), host.KeyClientStorePrefix)
|
||||
|
||||
pageRes, err := query.Paginate(store, req.Pagination, func(key, value []byte) error {
|
||||
@ -78,7 +79,7 @@ func (q Keeper) ClientStates(c context.Context, req *types.QueryClientStatesRequ
|
||||
}
|
||||
|
||||
identifiedClient := types.NewIdentifiedClientState(clientID, clientState)
|
||||
clientStates = append(clientStates, &identifiedClient)
|
||||
clientStates = append(clientStates, identifiedClient)
|
||||
return nil
|
||||
})
|
||||
|
||||
@ -86,6 +87,8 @@ func (q Keeper) ClientStates(c context.Context, req *types.QueryClientStatesRequ
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sort.Sort(clientStates)
|
||||
|
||||
return &types.QueryClientStatesResponse{
|
||||
ClientStates: clientStates,
|
||||
Pagination: pageRes,
|
||||
@ -178,3 +181,13 @@ func (q Keeper) ConsensusStates(c context.Context, req *types.QueryConsensusStat
|
||||
Pagination: pageRes,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ClientParams implements the Query/ClientParams gRPC method
|
||||
func (q Keeper) ClientParams(c context.Context, _ *types.QueryClientParamsRequest) (*types.QueryClientParamsResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
params := q.GetParams(ctx)
|
||||
|
||||
return &types.QueryClientParamsResponse{
|
||||
Params: ¶ms,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ func (suite *KeeperTestSuite) TestQueryClientState() {
|
||||
func (suite *KeeperTestSuite) TestQueryClientStates() {
|
||||
var (
|
||||
req *types.QueryClientStatesRequest
|
||||
expClientStates = []*types.IdentifiedClientState(nil)
|
||||
expClientStates = types.IdentifiedClientStates{}
|
||||
)
|
||||
|
||||
testCases := []struct {
|
||||
@ -112,8 +112,8 @@ func (suite *KeeperTestSuite) TestQueryClientStates() {
|
||||
{
|
||||
"success",
|
||||
func() {
|
||||
clientA1, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA2, _ := suite.coordinator.CreateClient(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA1, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
clientA2, _ := suite.coordinator.CreateClient(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
clientStateA1 := suite.chainA.GetClientState(clientA1)
|
||||
clientStateA2 := suite.chainA.GetClientState(clientA2)
|
||||
@ -122,7 +122,7 @@ func (suite *KeeperTestSuite) TestQueryClientStates() {
|
||||
idcs2 := types.NewIdentifiedClientState(clientA2, clientStateA2)
|
||||
|
||||
// order is sorted by client id, localhost is last
|
||||
expClientStates = []*types.IdentifiedClientState{&idcs, &idcs2}
|
||||
expClientStates = types.IdentifiedClientStates{idcs, idcs2}.Sort()
|
||||
req = &types.QueryClientStatesRequest{
|
||||
Pagination: &query.PageRequest{
|
||||
Limit: 7,
|
||||
@ -144,7 +144,7 @@ func (suite *KeeperTestSuite) TestQueryClientStates() {
|
||||
// always add localhost which is created by default in init genesis
|
||||
localhostClientState := suite.chainA.GetClientState(exported.Localhost)
|
||||
identifiedLocalhost := types.NewIdentifiedClientState(exported.Localhost, localhostClientState)
|
||||
expClientStates = append(expClientStates, &identifiedLocalhost)
|
||||
expClientStates = append(expClientStates, identifiedLocalhost)
|
||||
|
||||
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
|
||||
|
||||
@ -153,12 +153,7 @@ func (suite *KeeperTestSuite) TestQueryClientStates() {
|
||||
if tc.expPass {
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().NotNil(res)
|
||||
suite.Require().Equal(len(expClientStates), len(res.ClientStates))
|
||||
for i := range expClientStates {
|
||||
suite.Require().Equal(expClientStates[i].ClientId, res.ClientStates[i].ClientId)
|
||||
suite.Require().NotNil(res.ClientStates[i].ClientState)
|
||||
suite.Require().Equal(expClientStates[i].ClientState, res.ClientStates[i].ClientState)
|
||||
}
|
||||
suite.Require().Equal(expClientStates.Sort(), res.ClientStates)
|
||||
} else {
|
||||
suite.Require().Error(err)
|
||||
}
|
||||
@ -364,3 +359,10 @@ func (suite *KeeperTestSuite) TestQueryConsensusStates() {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestQueryParams() {
|
||||
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
|
||||
expParams := types.DefaultParams()
|
||||
res, _ := suite.queryClient.ClientParams(ctx, &types.QueryClientParamsRequest{})
|
||||
suite.Require().Equal(&expParams, res.Params)
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ import (
|
||||
host "github.com/cosmos/cosmos-sdk/x/ibc/core/24-host"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/light-clients/07-tendermint/types"
|
||||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
|
||||
)
|
||||
|
||||
@ -26,14 +27,21 @@ import (
|
||||
type Keeper struct {
|
||||
storeKey sdk.StoreKey
|
||||
cdc codec.BinaryMarshaler
|
||||
paramSpace paramtypes.Subspace
|
||||
stakingKeeper types.StakingKeeper
|
||||
}
|
||||
|
||||
// NewKeeper creates a new NewKeeper instance
|
||||
func NewKeeper(cdc codec.BinaryMarshaler, key sdk.StoreKey, sk types.StakingKeeper) Keeper {
|
||||
func NewKeeper(cdc codec.BinaryMarshaler, key sdk.StoreKey, paramSpace paramtypes.Subspace, sk types.StakingKeeper) Keeper {
|
||||
// set KeyTable if it has not already been set
|
||||
if !paramSpace.HasKeyTable() {
|
||||
paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable())
|
||||
}
|
||||
|
||||
return Keeper{
|
||||
storeKey: key,
|
||||
cdc: cdc,
|
||||
paramSpace: paramSpace,
|
||||
stakingKeeper: sk,
|
||||
}
|
||||
}
|
||||
@ -107,12 +115,14 @@ func (k Keeper) IterateConsensusStates(ctx sdk.Context, cb func(clientID string,
|
||||
}
|
||||
|
||||
// GetAllGenesisClients returns all the clients in state with their client ids returned as IdentifiedClientState
|
||||
func (k Keeper) GetAllGenesisClients(ctx sdk.Context) (genClients []types.IdentifiedClientState) {
|
||||
func (k Keeper) GetAllGenesisClients(ctx sdk.Context) types.IdentifiedClientStates {
|
||||
var genClients types.IdentifiedClientStates
|
||||
k.IterateClients(ctx, func(clientID string, cs exported.ClientState) bool {
|
||||
genClients = append(genClients, types.NewIdentifiedClientState(clientID, cs))
|
||||
return false
|
||||
})
|
||||
return
|
||||
|
||||
return genClients.Sort()
|
||||
}
|
||||
|
||||
// GetAllConsensusStates returns all stored client consensus states.
|
||||
|
||||
@ -243,30 +243,6 @@ func (suite *KeeperTestSuite) TestValidateSelfClient() {
|
||||
}
|
||||
}
|
||||
|
||||
func (suite KeeperTestSuite) TestGetAllClients() {
|
||||
clientIDs := []string{
|
||||
testClientID2, testClientID3, testClientID,
|
||||
}
|
||||
expClients := []exported.ClientState{
|
||||
ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.ZeroHeight(), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.ZeroHeight(), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.ZeroHeight(), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
}
|
||||
|
||||
for i := range expClients {
|
||||
suite.chainA.App.IBCKeeper.ClientKeeper.SetClientState(suite.chainA.GetContext(), clientIDs[i], expClients[i])
|
||||
}
|
||||
|
||||
// add localhost client
|
||||
localHostClient, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), exported.Localhost)
|
||||
suite.Require().True(found)
|
||||
expClients = append(expClients, localHostClient)
|
||||
|
||||
clients := suite.chainA.App.IBCKeeper.ClientKeeper.GetAllClients(suite.chainA.GetContext())
|
||||
suite.Require().Len(clients, len(expClients))
|
||||
suite.Require().Equal(expClients, clients)
|
||||
}
|
||||
|
||||
func (suite KeeperTestSuite) TestGetAllGenesisClients() {
|
||||
clientIDs := []string{
|
||||
testClientID2, testClientID3, testClientID,
|
||||
@ -277,7 +253,7 @@ func (suite KeeperTestSuite) TestGetAllGenesisClients() {
|
||||
ibctmtypes.NewClientState(testChainID, ibctmtypes.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, types.ZeroHeight(), ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
}
|
||||
|
||||
expGenClients := make([]types.IdentifiedClientState, len(expClients))
|
||||
expGenClients := make(types.IdentifiedClientStates, len(expClients))
|
||||
|
||||
for i := range expClients {
|
||||
suite.chainA.App.IBCKeeper.ClientKeeper.SetClientState(suite.chainA.GetContext(), clientIDs[i], expClients[i])
|
||||
@ -291,7 +267,7 @@ func (suite KeeperTestSuite) TestGetAllGenesisClients() {
|
||||
|
||||
genClients := suite.chainA.App.IBCKeeper.ClientKeeper.GetAllGenesisClients(suite.chainA.GetContext())
|
||||
|
||||
suite.Require().Equal(expGenClients, genClients)
|
||||
suite.Require().Equal(expGenClients.Sort(), genClients)
|
||||
}
|
||||
|
||||
func (suite KeeperTestSuite) TestGetConsensusState() {
|
||||
@ -347,7 +323,7 @@ func (suite KeeperTestSuite) TestConsensusStateHelpers() {
|
||||
// 2 clients in total are created on chainA. The first client is updated so it contains an initial consensus state
|
||||
// and a consensus state at the update height.
|
||||
func (suite KeeperTestSuite) TestGetAllConsensusStates() {
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
clientState := suite.chainA.GetClientState(clientA)
|
||||
expConsensusHeight0 := clientState.GetLatestHeight()
|
||||
@ -355,7 +331,7 @@ func (suite KeeperTestSuite) TestGetAllConsensusStates() {
|
||||
suite.Require().True(ok)
|
||||
|
||||
// update client to create a second consensus state
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
clientState = suite.chainA.GetClientState(clientA)
|
||||
@ -370,7 +346,7 @@ func (suite KeeperTestSuite) TestGetAllConsensusStates() {
|
||||
}
|
||||
|
||||
// create second client on chainA
|
||||
clientA2, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA2, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
clientState = suite.chainA.GetClientState(clientA2)
|
||||
|
||||
expConsensusHeight2 := clientState.GetLatestHeight()
|
||||
|
||||
23
x/ibc/core/02-client/keeper/params.go
Normal file
23
x/ibc/core/02-client/keeper/params.go
Normal file
@ -0,0 +1,23 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types"
|
||||
)
|
||||
|
||||
// GetAllowedClients retrieves the receive enabled boolean from the paramstore
|
||||
func (k Keeper) GetAllowedClients(ctx sdk.Context) []string {
|
||||
var res []string
|
||||
k.paramSpace.Get(ctx, types.KeyAllowedClients, &res)
|
||||
return res
|
||||
}
|
||||
|
||||
// GetParams returns the total set of ibc-transfer parameters.
|
||||
func (k Keeper) GetParams(ctx sdk.Context) types.Params {
|
||||
return types.NewParams(k.GetAllowedClients(ctx)...)
|
||||
}
|
||||
|
||||
// SetParams sets the total set of ibc-transfer parameters.
|
||||
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
|
||||
k.paramSpace.SetParamSet(ctx, ¶ms)
|
||||
}
|
||||
17
x/ibc/core/02-client/keeper/params_test.go
Normal file
17
x/ibc/core/02-client/keeper/params_test.go
Normal file
@ -0,0 +1,17 @@
|
||||
package keeper_test
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types"
|
||||
)
|
||||
|
||||
func (suite *KeeperTestSuite) TestParams() {
|
||||
expParams := types.DefaultParams()
|
||||
|
||||
params := suite.chainA.App.IBCKeeper.ClientKeeper.GetParams(suite.chainA.GetContext())
|
||||
suite.Require().Equal(expParams, params)
|
||||
|
||||
expParams.AllowedClients = []string{}
|
||||
suite.chainA.App.IBCKeeper.ClientKeeper.SetParams(suite.chainA.GetContext(), expParams)
|
||||
params = suite.chainA.App.IBCKeeper.ClientKeeper.GetParams(suite.chainA.GetContext())
|
||||
suite.Require().Empty(expParams.AllowedClients)
|
||||
}
|
||||
@ -21,7 +21,7 @@ func (suite *KeeperTestSuite) TestClientUpdateProposal() {
|
||||
}{
|
||||
{
|
||||
"valid update client proposal", func() {
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
clientState := suite.chainA.GetClientState(clientA)
|
||||
|
||||
tmClientState, ok := clientState.(*ibctmtypes.ClientState)
|
||||
@ -58,14 +58,14 @@ func (suite *KeeperTestSuite) TestClientUpdateProposal() {
|
||||
},
|
||||
{
|
||||
"cannot unpack header, header is nil", func() {
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
content = &clienttypes.ClientUpdateProposal{ibctesting.Title, ibctesting.Description, clientA, nil}
|
||||
}, false,
|
||||
},
|
||||
{
|
||||
"update fails", func() {
|
||||
header := &ibctmtypes.Header{}
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
content, err = clienttypes.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, clientA, header)
|
||||
suite.Require().NoError(err)
|
||||
}, false,
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||
client "github.com/cosmos/cosmos-sdk/x/ibc/core/02-client"
|
||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/light-clients/07-tendermint/types"
|
||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||
)
|
||||
@ -23,7 +24,7 @@ func (suite *ClientTestSuite) TestNewClientUpdateProposalHandler() {
|
||||
}{
|
||||
{
|
||||
"valid update client proposal", func() {
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
clientState := suite.chainA.GetClientState(clientA)
|
||||
|
||||
tmClientState, ok := clientState.(*ibctmtypes.ClientState)
|
||||
|
||||
@ -2,6 +2,7 @@ package types
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
|
||||
@ -37,6 +38,26 @@ func (ics IdentifiedClientState) UnpackInterfaces(unpacker codectypes.AnyUnpacke
|
||||
return unpacker.UnpackAny(ics.ClientState, new(exported.ClientState))
|
||||
}
|
||||
|
||||
var _ sort.Interface = IdentifiedClientStates{}
|
||||
|
||||
// IdentifiedClientStates defines a slice of ClientConsensusStates that supports the sort interface
|
||||
type IdentifiedClientStates []IdentifiedClientState
|
||||
|
||||
// Len implements sort.Interface
|
||||
func (ics IdentifiedClientStates) Len() int { return len(ics) }
|
||||
|
||||
// Less implements sort.Interface
|
||||
func (ics IdentifiedClientStates) Less(i, j int) bool { return ics[i].ClientId < ics[j].ClientId }
|
||||
|
||||
// Swap implements sort.Interface
|
||||
func (ics IdentifiedClientStates) Swap(i, j int) { ics[i], ics[j] = ics[j], ics[i] }
|
||||
|
||||
// Sort is a helper function to sort the set of IdentifiedClientStates in place
|
||||
func (ics IdentifiedClientStates) Sort() IdentifiedClientStates {
|
||||
sort.Sort(ics)
|
||||
return ics
|
||||
}
|
||||
|
||||
// NewConsensusStateWithHeight creates a new ConsensusStateWithHeight instance
|
||||
func NewConsensusStateWithHeight(height Height, consensusState exported.ConsensusState) ConsensusStateWithHeight {
|
||||
msg, ok := consensusState.(proto.Message)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,6 +2,7 @@ package types_test
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||
)
|
||||
|
||||
@ -22,7 +23,7 @@ func (suite *TypesTestSuite) TestMarshalConsensusStateWithHeight() {
|
||||
},
|
||||
{
|
||||
"tendermint client", func() {
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
clientState := suite.chainA.GetClientState(clientA)
|
||||
consensusState, ok := suite.chainA.GetConsensusState(clientA, clientState.GetLatestHeight())
|
||||
suite.Require().True(ok)
|
||||
|
||||
@ -66,11 +66,13 @@ func (ccs ClientConsensusStates) UnpackInterfaces(unpacker codectypes.AnyUnpacke
|
||||
|
||||
// NewGenesisState creates a GenesisState instance.
|
||||
func NewGenesisState(
|
||||
clients []IdentifiedClientState, clientsConsensus ClientsConsensusStates, createLocalhost bool,
|
||||
clients []IdentifiedClientState, clientsConsensus ClientsConsensusStates,
|
||||
params Params, createLocalhost bool,
|
||||
) GenesisState {
|
||||
return GenesisState{
|
||||
Clients: clients,
|
||||
ClientsConsensus: clientsConsensus,
|
||||
Params: params,
|
||||
CreateLocalhost: createLocalhost,
|
||||
}
|
||||
}
|
||||
@ -80,6 +82,7 @@ func DefaultGenesisState() GenesisState {
|
||||
return GenesisState{
|
||||
Clients: []IdentifiedClientState{},
|
||||
ClientsConsensus: ClientsConsensusStates{},
|
||||
Params: DefaultParams(),
|
||||
CreateLocalhost: false,
|
||||
}
|
||||
}
|
||||
@ -133,5 +136,13 @@ func (gs GenesisState) Validate() error {
|
||||
}
|
||||
}
|
||||
|
||||
if err := gs.Params.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if gs.CreateLocalhost && !gs.Params.IsAllowedClient(exported.Localhost) {
|
||||
return fmt.Errorf("localhost client is not registered on the allowlist")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -26,11 +26,12 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
// GenesisState defines the ibc client submodule's genesis state.
|
||||
type GenesisState struct {
|
||||
// client states with their corresponding identifiers
|
||||
Clients []IdentifiedClientState `protobuf:"bytes,1,rep,name=clients,proto3" json:"clients"`
|
||||
Clients IdentifiedClientStates `protobuf:"bytes,1,rep,name=clients,proto3,castrepeated=IdentifiedClientStates" json:"clients"`
|
||||
// consensus states from each client
|
||||
ClientsConsensus ClientsConsensusStates `protobuf:"bytes,2,rep,name=clients_consensus,json=clientsConsensus,proto3,castrepeated=ClientsConsensusStates" json:"clients_consensus" yaml:"clients_consensus"`
|
||||
Params Params `protobuf:"bytes,3,opt,name=params,proto3" json:"params"`
|
||||
// create localhost on initialization
|
||||
CreateLocalhost bool `protobuf:"varint,3,opt,name=create_localhost,json=createLocalhost,proto3" json:"create_localhost,omitempty" yaml:"create_localhost"`
|
||||
CreateLocalhost bool `protobuf:"varint,4,opt,name=create_localhost,json=createLocalhost,proto3" json:"create_localhost,omitempty" yaml:"create_localhost"`
|
||||
}
|
||||
|
||||
func (m *GenesisState) Reset() { *m = GenesisState{} }
|
||||
@ -66,7 +67,7 @@ func (m *GenesisState) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_GenesisState proto.InternalMessageInfo
|
||||
|
||||
func (m *GenesisState) GetClients() []IdentifiedClientState {
|
||||
func (m *GenesisState) GetClients() IdentifiedClientStates {
|
||||
if m != nil {
|
||||
return m.Clients
|
||||
}
|
||||
@ -80,6 +81,13 @@ func (m *GenesisState) GetClientsConsensus() ClientsConsensusStates {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GenesisState) GetParams() Params {
|
||||
if m != nil {
|
||||
return m.Params
|
||||
}
|
||||
return Params{}
|
||||
}
|
||||
|
||||
func (m *GenesisState) GetCreateLocalhost() bool {
|
||||
if m != nil {
|
||||
return m.CreateLocalhost
|
||||
@ -94,28 +102,30 @@ func init() {
|
||||
func init() { proto.RegisterFile("ibc/core/client/v1/genesis.proto", fileDescriptor_bcd0c0f1f2e6a91a) }
|
||||
|
||||
var fileDescriptor_bcd0c0f1f2e6a91a = []byte{
|
||||
// 328 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc8, 0x4c, 0x4a, 0xd6,
|
||||
0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xce, 0xc9, 0x4c, 0xcd, 0x2b, 0xd1, 0x2f, 0x33, 0xd4, 0x4f,
|
||||
0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xca, 0x4c,
|
||||
0x4a, 0xd6, 0x03, 0xa9, 0xd0, 0x83, 0xa8, 0xd0, 0x2b, 0x33, 0x94, 0x92, 0xc7, 0xa2, 0x0b, 0x2a,
|
||||
0x0b, 0xd6, 0x24, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x66, 0xea, 0x83, 0x58, 0x10, 0x51, 0xa5,
|
||||
0x6d, 0x4c, 0x5c, 0x3c, 0xee, 0x10, 0xc3, 0x83, 0x4b, 0x12, 0x4b, 0x52, 0x85, 0x3c, 0xb9, 0xd8,
|
||||
0x21, 0xda, 0x8a, 0x25, 0x18, 0x15, 0x98, 0x35, 0xb8, 0x8d, 0x34, 0xf5, 0x30, 0x6d, 0xd3, 0xf3,
|
||||
0x4c, 0x49, 0xcd, 0x2b, 0xc9, 0x4c, 0xcb, 0x4c, 0x4d, 0x71, 0x06, 0x8b, 0x81, 0xf5, 0x3a, 0xb1,
|
||||
0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0xd3, 0x2f, 0x34, 0x89, 0x91, 0x4b, 0x10, 0xca, 0x8e, 0x4f,
|
||||
0xce, 0xcf, 0x2b, 0x4e, 0xcd, 0x2b, 0x2e, 0x2d, 0x96, 0x60, 0xc2, 0x6d, 0x2a, 0xc4, 0x2c, 0x67,
|
||||
0x98, 0x52, 0xb0, 0xa1, 0xc5, 0x4e, 0x56, 0x20, 0x53, 0x3f, 0xdd, 0x93, 0x97, 0xa8, 0x4c, 0xcc,
|
||||
0xcd, 0xb1, 0x52, 0xc2, 0x30, 0x51, 0x69, 0xd5, 0x7d, 0x79, 0x31, 0x88, 0xd6, 0x62, 0x34, 0xbd,
|
||||
0x41, 0x02, 0xc9, 0x68, 0xe2, 0x42, 0x6e, 0x5c, 0x02, 0xc9, 0x45, 0xa9, 0x89, 0x25, 0xa9, 0xf1,
|
||||
0x39, 0xf9, 0xc9, 0x89, 0x39, 0x19, 0xf9, 0xc5, 0x25, 0x12, 0xcc, 0x0a, 0x8c, 0x1a, 0x1c, 0x4e,
|
||||
0xd2, 0x9f, 0xee, 0xc9, 0x8b, 0x43, 0xed, 0x40, 0x53, 0xa1, 0x14, 0xc4, 0x0f, 0x11, 0xf2, 0x81,
|
||||
0x89, 0x38, 0x05, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c,
|
||||
0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x79, 0x7a,
|
||||
0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x72, 0x7e, 0x71, 0x6e, 0x7e, 0x31,
|
||||
0x94, 0xd2, 0x2d, 0x4e, 0xc9, 0xd6, 0xaf, 0xd0, 0x87, 0x47, 0x94, 0x81, 0x91, 0x2e, 0x34, 0xae,
|
||||
0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x51, 0x62, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff,
|
||||
0x5b, 0xe3, 0x61, 0x24, 0x01, 0x02, 0x00, 0x00,
|
||||
// 362 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xc1, 0x4e, 0xea, 0x40,
|
||||
0x14, 0x86, 0xdb, 0x0b, 0xe1, 0xde, 0x94, 0x9b, 0x88, 0x8d, 0xd1, 0x06, 0x93, 0xb6, 0xe9, 0x0a,
|
||||
0x17, 0xcc, 0x08, 0x2e, 0x34, 0x2c, 0x4b, 0xa2, 0x31, 0x71, 0xa1, 0x75, 0xe7, 0x86, 0xb4, 0xc3,
|
||||
0x58, 0x26, 0xb6, 0x1d, 0xd2, 0x33, 0x10, 0x79, 0x05, 0x57, 0xc6, 0xc7, 0xf0, 0x49, 0x58, 0xb2,
|
||||
0x74, 0x85, 0x06, 0xde, 0x80, 0x27, 0x30, 0xed, 0x14, 0x17, 0x80, 0xab, 0x39, 0xf9, 0xe7, 0xff,
|
||||
0xfe, 0xff, 0x24, 0x47, 0xb3, 0x59, 0x40, 0x30, 0xe1, 0x29, 0xc5, 0x24, 0x62, 0x34, 0x11, 0x78,
|
||||
0xdc, 0xc2, 0x21, 0x4d, 0x28, 0x30, 0x40, 0xc3, 0x94, 0x0b, 0xae, 0xeb, 0x2c, 0x20, 0x28, 0x73,
|
||||
0x20, 0xe9, 0x40, 0xe3, 0x56, 0xdd, 0xda, 0x41, 0x15, 0xbf, 0x39, 0x54, 0x3f, 0x08, 0x79, 0xc8,
|
||||
0xf3, 0x11, 0x67, 0x93, 0x54, 0x9d, 0x97, 0x92, 0xf6, 0xff, 0x4a, 0x86, 0xdf, 0x0b, 0x5f, 0x50,
|
||||
0x9d, 0x68, 0x7f, 0x25, 0x06, 0x86, 0x6a, 0x97, 0x1a, 0xd5, 0xf6, 0x09, 0xda, 0x6e, 0x43, 0xd7,
|
||||
0x7d, 0x9a, 0x08, 0xf6, 0xc8, 0x68, 0xbf, 0x9b, 0x6b, 0x39, 0xeb, 0x9a, 0xd3, 0xb9, 0xa5, 0xbc,
|
||||
0x7f, 0x5a, 0x87, 0x3b, 0xbf, 0xc1, 0x5b, 0x27, 0xeb, 0x6f, 0xaa, 0xb6, 0x5f, 0xcc, 0x3d, 0xc2,
|
||||
0x13, 0xa0, 0x09, 0x8c, 0xc0, 0xf8, 0xf3, 0x7b, 0x9f, 0x8c, 0xe9, 0xae, 0xad, 0x32, 0xcf, 0xed,
|
||||
0x64, 0x7d, 0xab, 0xb9, 0x65, 0x4c, 0xfc, 0x38, 0xea, 0x38, 0x5b, 0x89, 0x4e, 0xb6, 0x8b, 0x44,
|
||||
0x61, 0x83, 0xf5, 0x6a, 0x64, 0x43, 0xd7, 0x2f, 0xb4, 0xca, 0xd0, 0x4f, 0xfd, 0x18, 0x8c, 0x92,
|
||||
0xad, 0x36, 0xaa, 0xed, 0xfa, 0xae, 0x45, 0x6e, 0x73, 0x87, 0x5b, 0xce, 0x9a, 0xbd, 0xc2, 0xaf,
|
||||
0x5f, 0x6a, 0x35, 0x92, 0x52, 0x5f, 0xd0, 0x5e, 0xc4, 0x89, 0x1f, 0x0d, 0x38, 0x08, 0xa3, 0x6c,
|
||||
0xab, 0x8d, 0x7f, 0xee, 0xf1, 0x6a, 0x6e, 0x1d, 0x15, 0xdb, 0x6d, 0x38, 0x1c, 0x6f, 0x4f, 0x4a,
|
||||
0x37, 0x6b, 0xc5, 0xbd, 0x9b, 0x2e, 0x4c, 0x75, 0xb6, 0x30, 0xd5, 0xaf, 0x85, 0xa9, 0xbe, 0x2e,
|
||||
0x4d, 0x65, 0xb6, 0x34, 0x95, 0x8f, 0xa5, 0xa9, 0x3c, 0x9c, 0x87, 0x4c, 0x0c, 0x46, 0x01, 0x22,
|
||||
0x3c, 0xc6, 0x84, 0x43, 0xcc, 0xa1, 0x78, 0x9a, 0xd0, 0x7f, 0xc2, 0xcf, 0xf8, 0xe7, 0xf8, 0xa7,
|
||||
0xed, 0x66, 0x71, 0x7f, 0x31, 0x19, 0x52, 0x08, 0x2a, 0xf9, 0x99, 0xcf, 0xbe, 0x03, 0x00, 0x00,
|
||||
0xff, 0xff, 0x8d, 0xa4, 0x74, 0xd6, 0x55, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
|
||||
@ -146,8 +156,18 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
dAtA[i] = 0
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x18
|
||||
dAtA[i] = 0x20
|
||||
}
|
||||
{
|
||||
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
if len(m.ClientsConsensus) > 0 {
|
||||
for iNdEx := len(m.ClientsConsensus) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
@ -208,6 +228,8 @@ func (m *GenesisState) Size() (n int) {
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
}
|
||||
l = m.Params.Size()
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
if m.CreateLocalhost {
|
||||
n += 2
|
||||
}
|
||||
@ -318,6 +340,39 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field CreateLocalhost", wireType)
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ var clientHeight = types.NewHeight(0, 10)
|
||||
func (suite *TypesTestSuite) TestMarshalGenesisState() {
|
||||
cdc := suite.chainA.App.AppCodec()
|
||||
clientA, _, _, _, _, _ := suite.coordinator.Setup(suite.chainA, suite.chainB, channeltypes.ORDERED)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
|
||||
genesis := client.ExportGenesis(suite.chainA.GetContext(), suite.chainA.App.IBCKeeper.ClientKeeper)
|
||||
|
||||
@ -65,7 +65,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
expPass: true,
|
||||
},
|
||||
{
|
||||
name: "valid genesis",
|
||||
name: "valid custom genesis",
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
@ -88,7 +88,8 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
},
|
||||
),
|
||||
},
|
||||
true,
|
||||
types.NewParams(exported.Tendermint),
|
||||
false,
|
||||
),
|
||||
expPass: true,
|
||||
},
|
||||
@ -116,7 +117,8 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
},
|
||||
),
|
||||
},
|
||||
true,
|
||||
types.NewParams(exported.Tendermint),
|
||||
false,
|
||||
),
|
||||
expPass: false,
|
||||
},
|
||||
@ -130,12 +132,13 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
types.NewIdentifiedClientState(exported.Localhost, localhosttypes.NewClientState("chaindID", types.ZeroHeight())),
|
||||
},
|
||||
nil,
|
||||
true,
|
||||
types.NewParams(exported.Tendermint),
|
||||
false,
|
||||
),
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "invalid consensus state",
|
||||
name: "invalid consensus state client id",
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
@ -158,12 +161,13 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
},
|
||||
),
|
||||
},
|
||||
true,
|
||||
types.NewParams(exported.Tendermint),
|
||||
false,
|
||||
),
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "invalid consensus state",
|
||||
name: "invalid consensus state height",
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
@ -186,6 +190,123 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
|
||||
},
|
||||
),
|
||||
},
|
||||
types.NewParams(exported.Tendermint),
|
||||
false,
|
||||
),
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "invalid consensus state",
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctmtypes.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
),
|
||||
types.NewIdentifiedClientState(
|
||||
exported.Localhost, localhosttypes.NewClientState("chaindID", clientHeight),
|
||||
),
|
||||
},
|
||||
[]types.ClientConsensusStates{
|
||||
types.NewClientConsensusStates(
|
||||
clientID,
|
||||
[]types.ConsensusStateWithHeight{
|
||||
types.NewConsensusStateWithHeight(
|
||||
types.NewHeight(0, 1),
|
||||
ibctmtypes.NewConsensusState(
|
||||
time.Time{}, commitmenttypes.NewMerkleRoot(header.Header.GetAppHash()), header.Header.NextValidatorsHash,
|
||||
),
|
||||
),
|
||||
},
|
||||
),
|
||||
},
|
||||
types.NewParams(exported.Tendermint),
|
||||
false,
|
||||
),
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "invalid params",
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
),
|
||||
types.NewIdentifiedClientState(
|
||||
exported.Localhost, localhosttypes.NewClientState("chainID", clientHeight),
|
||||
),
|
||||
},
|
||||
[]types.ClientConsensusStates{
|
||||
types.NewClientConsensusStates(
|
||||
clientID,
|
||||
[]types.ConsensusStateWithHeight{
|
||||
types.NewConsensusStateWithHeight(
|
||||
header.GetHeight().(types.Height),
|
||||
ibctmtypes.NewConsensusState(
|
||||
header.GetTime(), commitmenttypes.NewMerkleRoot(header.Header.GetAppHash()), header.Header.NextValidatorsHash,
|
||||
),
|
||||
),
|
||||
},
|
||||
),
|
||||
},
|
||||
types.NewParams(" "),
|
||||
false,
|
||||
),
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "invalid param",
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
),
|
||||
types.NewIdentifiedClientState(
|
||||
exported.Localhost, localhosttypes.NewClientState("chainID", clientHeight),
|
||||
),
|
||||
},
|
||||
[]types.ClientConsensusStates{
|
||||
types.NewClientConsensusStates(
|
||||
clientID,
|
||||
[]types.ConsensusStateWithHeight{
|
||||
types.NewConsensusStateWithHeight(
|
||||
header.GetHeight().(types.Height),
|
||||
ibctmtypes.NewConsensusState(
|
||||
header.GetTime(), commitmenttypes.NewMerkleRoot(header.Header.GetAppHash()), header.Header.NextValidatorsHash,
|
||||
),
|
||||
),
|
||||
},
|
||||
),
|
||||
},
|
||||
types.NewParams(" "),
|
||||
true,
|
||||
),
|
||||
expPass: false,
|
||||
},
|
||||
{
|
||||
name: "localhost client not registered on allowlist",
|
||||
genState: types.NewGenesisState(
|
||||
[]types.IdentifiedClientState{
|
||||
types.NewIdentifiedClientState(
|
||||
clientID, ibctmtypes.NewClientState(chainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
|
||||
),
|
||||
types.NewIdentifiedClientState(
|
||||
exported.Localhost, localhosttypes.NewClientState("chainID", clientHeight),
|
||||
),
|
||||
},
|
||||
[]types.ClientConsensusStates{
|
||||
types.NewClientConsensusStates(
|
||||
clientID,
|
||||
[]types.ConsensusStateWithHeight{
|
||||
types.NewConsensusStateWithHeight(
|
||||
header.GetHeight().(types.Height),
|
||||
ibctmtypes.NewConsensusState(
|
||||
header.GetTime(), commitmenttypes.NewMerkleRoot(header.Header.GetAppHash()), header.Header.NextValidatorsHash,
|
||||
),
|
||||
),
|
||||
},
|
||||
),
|
||||
},
|
||||
types.NewParams(exported.Tendermint),
|
||||
true,
|
||||
),
|
||||
expPass: false,
|
||||
|
||||
71
x/ibc/core/02-client/types/params.go
Normal file
71
x/ibc/core/02-client/types/params.go
Normal file
@ -0,0 +1,71 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
)
|
||||
|
||||
var (
|
||||
// DefaultAllowedClients are "06-solomachine" and "07-tendermint"
|
||||
DefaultAllowedClients = []string{exported.Solomachine, exported.Tendermint}
|
||||
|
||||
// KeyAllowedClients is store's key for AllowedClients Params
|
||||
KeyAllowedClients = []byte("AllowedClients")
|
||||
)
|
||||
|
||||
// ParamKeyTable type declaration for parameters
|
||||
func ParamKeyTable() paramtypes.KeyTable {
|
||||
return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
|
||||
}
|
||||
|
||||
// NewParams creates a new parameter configuration for the ibc transfer module
|
||||
func NewParams(allowedClients ...string) Params {
|
||||
return Params{
|
||||
AllowedClients: allowedClients,
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultParams is the default parameter configuration for the ibc-transfer module
|
||||
func DefaultParams() Params {
|
||||
return NewParams(DefaultAllowedClients...)
|
||||
}
|
||||
|
||||
// Validate all ibc-transfer module parameters
|
||||
func (p Params) Validate() error {
|
||||
return validateClients(p.AllowedClients)
|
||||
}
|
||||
|
||||
// ParamSetPairs implements params.ParamSet
|
||||
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
|
||||
return paramtypes.ParamSetPairs{
|
||||
paramtypes.NewParamSetPair(KeyAllowedClients, p.AllowedClients, validateClients),
|
||||
}
|
||||
}
|
||||
|
||||
// IsAllowedClient checks if the given client type is registered on the allowlist.
|
||||
func (p Params) IsAllowedClient(clientType string) bool {
|
||||
for _, allowedClient := range p.AllowedClients {
|
||||
if allowedClient == clientType {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func validateClients(i interface{}) error {
|
||||
clients, ok := i.([]string)
|
||||
if !ok {
|
||||
return fmt.Errorf("invalid parameter type: %T", i)
|
||||
}
|
||||
|
||||
for i, clientType := range clients {
|
||||
if strings.TrimSpace(clientType) == "" {
|
||||
return fmt.Errorf("client type %d cannot be blank", i)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
29
x/ibc/core/02-client/types/params_test.go
Normal file
29
x/ibc/core/02-client/types/params_test.go
Normal file
@ -0,0 +1,29 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestValidateParams(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
params Params
|
||||
expPass bool
|
||||
}{
|
||||
{"default params", DefaultParams(), true},
|
||||
{"custom params", NewParams(exported.Tendermint), true},
|
||||
{"blank client", NewParams(" "), false},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
err := tc.params.Validate()
|
||||
if tc.expPass {
|
||||
require.NoError(t, err, tc.name)
|
||||
} else {
|
||||
require.Error(t, err, tc.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -195,7 +195,7 @@ func (m *QueryClientStatesRequest) GetPagination() *query.PageRequest {
|
||||
// method.
|
||||
type QueryClientStatesResponse struct {
|
||||
// list of stored ClientStates of the chain.
|
||||
ClientStates []*IdentifiedClientState `protobuf:"bytes,1,rep,name=client_states,json=clientStates,proto3" json:"client_states,omitempty"`
|
||||
ClientStates IdentifiedClientStates `protobuf:"bytes,1,rep,name=client_states,json=clientStates,proto3,castrepeated=IdentifiedClientStates" json:"client_states"`
|
||||
// pagination response
|
||||
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
|
||||
}
|
||||
@ -233,7 +233,7 @@ func (m *QueryClientStatesResponse) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_QueryClientStatesResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *QueryClientStatesResponse) GetClientStates() []*IdentifiedClientState {
|
||||
func (m *QueryClientStatesResponse) GetClientStates() IdentifiedClientStates {
|
||||
if m != nil {
|
||||
return m.ClientStates
|
||||
}
|
||||
@ -500,6 +500,89 @@ func (m *QueryConsensusStatesResponse) GetPagination() *query.PageResponse {
|
||||
return nil
|
||||
}
|
||||
|
||||
// QueryClientParamsRequest is the request type for the Query/ClientParams RPC method.
|
||||
type QueryClientParamsRequest struct {
|
||||
}
|
||||
|
||||
func (m *QueryClientParamsRequest) Reset() { *m = QueryClientParamsRequest{} }
|
||||
func (m *QueryClientParamsRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryClientParamsRequest) ProtoMessage() {}
|
||||
func (*QueryClientParamsRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_dc42cdfd1d52d76e, []int{8}
|
||||
}
|
||||
func (m *QueryClientParamsRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *QueryClientParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_QueryClientParamsRequest.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *QueryClientParamsRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_QueryClientParamsRequest.Merge(m, src)
|
||||
}
|
||||
func (m *QueryClientParamsRequest) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *QueryClientParamsRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_QueryClientParamsRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_QueryClientParamsRequest proto.InternalMessageInfo
|
||||
|
||||
// QueryClientParamsResponse is the response type for the Query/ClientParams RPC method.
|
||||
type QueryClientParamsResponse struct {
|
||||
// params defines the parameters of the module.
|
||||
Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"`
|
||||
}
|
||||
|
||||
func (m *QueryClientParamsResponse) Reset() { *m = QueryClientParamsResponse{} }
|
||||
func (m *QueryClientParamsResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryClientParamsResponse) ProtoMessage() {}
|
||||
func (*QueryClientParamsResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_dc42cdfd1d52d76e, []int{9}
|
||||
}
|
||||
func (m *QueryClientParamsResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *QueryClientParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_QueryClientParamsResponse.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *QueryClientParamsResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_QueryClientParamsResponse.Merge(m, src)
|
||||
}
|
||||
func (m *QueryClientParamsResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *QueryClientParamsResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_QueryClientParamsResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_QueryClientParamsResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *QueryClientParamsResponse) GetParams() *Params {
|
||||
if m != nil {
|
||||
return m.Params
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*QueryClientStateRequest)(nil), "ibc.core.client.v1.QueryClientStateRequest")
|
||||
proto.RegisterType((*QueryClientStateResponse)(nil), "ibc.core.client.v1.QueryClientStateResponse")
|
||||
@ -509,59 +592,66 @@ func init() {
|
||||
proto.RegisterType((*QueryConsensusStateResponse)(nil), "ibc.core.client.v1.QueryConsensusStateResponse")
|
||||
proto.RegisterType((*QueryConsensusStatesRequest)(nil), "ibc.core.client.v1.QueryConsensusStatesRequest")
|
||||
proto.RegisterType((*QueryConsensusStatesResponse)(nil), "ibc.core.client.v1.QueryConsensusStatesResponse")
|
||||
proto.RegisterType((*QueryClientParamsRequest)(nil), "ibc.core.client.v1.QueryClientParamsRequest")
|
||||
proto.RegisterType((*QueryClientParamsResponse)(nil), "ibc.core.client.v1.QueryClientParamsResponse")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("ibc/core/client/v1/query.proto", fileDescriptor_dc42cdfd1d52d76e) }
|
||||
|
||||
var fileDescriptor_dc42cdfd1d52d76e = []byte{
|
||||
// 746 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4d, 0x6b, 0x13, 0x4f,
|
||||
0x18, 0xcf, 0xf4, 0xe5, 0x4f, 0x3b, 0x49, 0xdb, 0x3f, 0x43, 0xc1, 0x74, 0x5b, 0xb6, 0x21, 0x62,
|
||||
0x8d, 0xda, 0xce, 0x34, 0xf1, 0xa5, 0x20, 0xf4, 0x60, 0x0b, 0xd5, 0x5e, 0x8a, 0x5d, 0x0f, 0x82,
|
||||
0x20, 0x65, 0x77, 0x33, 0xd9, 0x2c, 0xb6, 0x3b, 0x69, 0x66, 0x12, 0x2c, 0xa5, 0x97, 0x7e, 0x02,
|
||||
0xc1, 0xa3, 0x57, 0x8f, 0xe2, 0x45, 0xc1, 0x6f, 0x20, 0x3d, 0x16, 0xbc, 0x78, 0x12, 0x6d, 0xc5,
|
||||
0xcf, 0x21, 0x3b, 0x33, 0xdb, 0xec, 0x36, 0x5b, 0x5c, 0x8a, 0x9e, 0xb2, 0xfb, 0xbc, 0xfe, 0x9e,
|
||||
0xdf, 0xef, 0xd9, 0x87, 0x40, 0xd3, 0x77, 0x5c, 0xe2, 0xb2, 0x36, 0x25, 0xee, 0xb6, 0x4f, 0x03,
|
||||
0x41, 0xba, 0x55, 0xb2, 0xdb, 0xa1, 0xed, 0x3d, 0xdc, 0x6a, 0x33, 0xc1, 0x10, 0xf2, 0x1d, 0x17,
|
||||
0x87, 0x7e, 0xac, 0xfc, 0xb8, 0x5b, 0x35, 0x6e, 0xba, 0x8c, 0xef, 0x30, 0x4e, 0x1c, 0x9b, 0x53,
|
||||
0x15, 0x4c, 0xba, 0x55, 0x87, 0x0a, 0xbb, 0x4a, 0x5a, 0xb6, 0xe7, 0x07, 0xb6, 0xf0, 0x59, 0xa0,
|
||||
0xf2, 0x8d, 0xd9, 0x94, 0xfa, 0xba, 0x92, 0x0a, 0x98, 0xf2, 0x18, 0xf3, 0xb6, 0x29, 0x91, 0x6f,
|
||||
0x4e, 0xa7, 0x41, 0xec, 0x40, 0xf7, 0x36, 0x66, 0xb4, 0xcb, 0x6e, 0xf9, 0xc4, 0x0e, 0x02, 0x26,
|
||||
0x64, 0x61, 0xae, 0xbd, 0x93, 0x1e, 0xf3, 0x98, 0x7c, 0x24, 0xe1, 0x93, 0xb2, 0x96, 0xef, 0xc1,
|
||||
0x2b, 0x9b, 0x21, 0xa2, 0x55, 0xd9, 0xe3, 0x89, 0xb0, 0x05, 0xb5, 0xe8, 0x6e, 0x87, 0x72, 0x81,
|
||||
0xa6, 0xe1, 0xa8, 0xea, 0xbc, 0xe5, 0xd7, 0x8b, 0xa0, 0x04, 0x2a, 0xa3, 0xd6, 0x88, 0x32, 0xac,
|
||||
0xd7, 0xcb, 0xef, 0x01, 0x2c, 0xf6, 0x27, 0xf2, 0x16, 0x0b, 0x38, 0x45, 0x4b, 0xb0, 0xa0, 0x33,
|
||||
0x79, 0x68, 0x97, 0xc9, 0xf9, 0xda, 0x24, 0x56, 0xf8, 0x70, 0x04, 0x1d, 0x3f, 0x08, 0xf6, 0xac,
|
||||
0xbc, 0xdb, 0x2b, 0x80, 0x26, 0xe1, 0x70, 0xab, 0xcd, 0x58, 0xa3, 0x38, 0x50, 0x02, 0x95, 0x82,
|
||||
0xa5, 0x5e, 0xd0, 0x2a, 0x2c, 0xc8, 0x87, 0xad, 0x26, 0xf5, 0xbd, 0xa6, 0x28, 0x0e, 0xca, 0x72,
|
||||
0x06, 0xee, 0xa7, 0x1a, 0x3f, 0x92, 0x11, 0x2b, 0x43, 0x47, 0xdf, 0x66, 0x73, 0x56, 0x5e, 0x66,
|
||||
0x29, 0x53, 0xd9, 0xe9, 0xc7, 0xcb, 0xa3, 0x49, 0xd7, 0x20, 0xec, 0x09, 0xa1, 0xd1, 0xce, 0x61,
|
||||
0xa5, 0x1a, 0x0e, 0x55, 0xc3, 0x4a, 0x62, 0xad, 0x1a, 0x7e, 0x6c, 0x7b, 0x11, 0x4b, 0x56, 0x2c,
|
||||
0xb3, 0xfc, 0x11, 0xc0, 0xa9, 0x94, 0x26, 0x9a, 0x95, 0x0d, 0x38, 0x16, 0x67, 0x85, 0x17, 0x41,
|
||||
0x69, 0xb0, 0x92, 0xaf, 0xdd, 0x48, 0x9b, 0x63, 0xbd, 0x4e, 0x03, 0xe1, 0x37, 0x7c, 0x5a, 0x8f,
|
||||
0xf3, 0x5b, 0x88, 0x71, 0xc5, 0xd1, 0xc3, 0x04, 0xea, 0x01, 0x89, 0xfa, 0xfa, 0x1f, 0x51, 0x2b,
|
||||
0x30, 0x09, 0xd8, 0xef, 0x00, 0x34, 0x14, 0xec, 0xd0, 0x15, 0xf0, 0x0e, 0xcf, 0xbc, 0x07, 0xe8,
|
||||
0x1a, 0x1c, 0xef, 0xd2, 0x36, 0xf7, 0x59, 0xb0, 0x15, 0x74, 0x76, 0x1c, 0xda, 0x96, 0x40, 0x86,
|
||||
0xac, 0x31, 0x6d, 0xdd, 0x90, 0xc6, 0x78, 0x58, 0x4c, 0xc4, 0x5e, 0x98, 0x12, 0x09, 0x5d, 0x85,
|
||||
0x63, 0xdb, 0xe1, 0x6c, 0x22, 0x8a, 0x1a, 0x2a, 0x81, 0xca, 0x88, 0x55, 0x50, 0x46, 0xad, 0xe4,
|
||||
0x27, 0x00, 0xa7, 0x53, 0xe1, 0x6a, 0x9e, 0x97, 0xe1, 0x84, 0x1b, 0x79, 0x32, 0x2c, 0xe0, 0xb8,
|
||||
0x9b, 0x28, 0xf3, 0x2f, 0x77, 0xf0, 0x30, 0x1d, 0x39, 0xcf, 0xc4, 0xf4, 0x5a, 0x8a, 0xdc, 0x97,
|
||||
0x59, 0xd2, 0xcf, 0x00, 0xce, 0xa4, 0x83, 0xd0, 0xfc, 0x3d, 0x87, 0xff, 0x9f, 0xe3, 0x2f, 0x5a,
|
||||
0xd5, 0xf9, 0xb4, 0x71, 0x93, 0x65, 0x9e, 0xfa, 0xa2, 0x99, 0x20, 0x60, 0x22, 0x49, 0xef, 0xdf,
|
||||
0x5b, 0xdb, 0xda, 0xaf, 0x61, 0x38, 0x2c, 0x07, 0x41, 0x6f, 0x01, 0xcc, 0xc7, 0xbe, 0x13, 0x74,
|
||||
0x2b, 0x0d, 0xe7, 0x05, 0x67, 0xce, 0x98, 0xcf, 0x16, 0xac, 0x00, 0x94, 0xef, 0x1f, 0x7e, 0xf9,
|
||||
0xf9, 0x7a, 0xe0, 0x0e, 0xaa, 0x91, 0xfe, 0x43, 0xad, 0x4e, 0x7a, 0xe2, 0x1b, 0x27, 0xfb, 0x67,
|
||||
0x82, 0x1e, 0xa0, 0x37, 0x00, 0x16, 0xe2, 0x97, 0x01, 0x65, 0x6a, 0x1d, 0x6d, 0x87, 0xb1, 0x90,
|
||||
0x31, 0x5a, 0x23, 0xc5, 0x12, 0x69, 0x05, 0xcd, 0x65, 0x43, 0x8a, 0x7e, 0x00, 0x38, 0x9e, 0xd4,
|
||||
0x12, 0xe1, 0x8b, 0x3b, 0xa6, 0x5d, 0x0a, 0x83, 0x64, 0x8e, 0xd7, 0x18, 0x03, 0x89, 0xb1, 0x89,
|
||||
0x1a, 0x17, 0x63, 0x3c, 0xb7, 0x89, 0x71, 0x42, 0x89, 0x3e, 0x1e, 0x64, 0x3f, 0x79, 0x82, 0x0e,
|
||||
0x88, 0xfa, 0x48, 0x7b, 0x76, 0xf5, 0x7e, 0x80, 0x3e, 0x00, 0x38, 0x71, 0x6e, 0xed, 0x51, 0x56,
|
||||
0xd0, 0x67, 0x3a, 0x2c, 0x66, 0x4f, 0xd0, 0x63, 0x2e, 0xcb, 0x31, 0x97, 0xd0, 0xdd, 0x4b, 0x8d,
|
||||
0xb9, 0xb2, 0x79, 0x74, 0x62, 0x82, 0xe3, 0x13, 0x13, 0x7c, 0x3f, 0x31, 0xc1, 0xab, 0x53, 0x33,
|
||||
0x77, 0x7c, 0x6a, 0xe6, 0xbe, 0x9e, 0x9a, 0xb9, 0x67, 0x4b, 0x9e, 0x2f, 0x9a, 0x1d, 0x07, 0xbb,
|
||||
0x6c, 0x87, 0xe8, 0x3f, 0x19, 0xea, 0x67, 0x81, 0xd7, 0x5f, 0x90, 0x97, 0xbd, 0x76, 0x8b, 0xb5,
|
||||
0x05, 0xdd, 0x51, 0xec, 0xb5, 0x28, 0x77, 0xfe, 0x93, 0x27, 0xf0, 0xf6, 0xef, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0x71, 0x1f, 0x83, 0xc2, 0xcf, 0x08, 0x00, 0x00,
|
||||
// 823 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4d, 0x4f, 0xdb, 0x48,
|
||||
0x18, 0xce, 0xf0, 0x25, 0x98, 0x04, 0x58, 0x8d, 0xd0, 0x6e, 0x30, 0xc8, 0x44, 0x5e, 0x2d, 0x9b,
|
||||
0xdd, 0x85, 0x19, 0x92, 0xdd, 0x2d, 0x52, 0x25, 0x0e, 0x05, 0x89, 0x96, 0x4b, 0x0b, 0xee, 0xa1,
|
||||
0x52, 0xa5, 0x0a, 0xd9, 0xce, 0xc4, 0xb1, 0x4a, 0x3c, 0x21, 0xe3, 0x44, 0x45, 0x88, 0x0b, 0x7f,
|
||||
0xa0, 0x95, 0x7a, 0xec, 0xb5, 0xa7, 0xaa, 0xea, 0xa5, 0x87, 0xfe, 0x83, 0x8a, 0x23, 0x52, 0x7b,
|
||||
0xe8, 0xa9, 0x1f, 0xd0, 0x1f, 0xd1, 0x63, 0xe5, 0x99, 0x31, 0xb1, 0x89, 0x11, 0x16, 0x6a, 0x4f,
|
||||
0xb1, 0xdf, 0xaf, 0x79, 0x9e, 0xe7, 0x7d, 0xdf, 0x71, 0xa0, 0xee, 0xd9, 0x0e, 0x71, 0x58, 0x9b,
|
||||
0x12, 0x67, 0xc7, 0xa3, 0x7e, 0x40, 0xba, 0x15, 0xb2, 0xdb, 0xa1, 0xed, 0x3d, 0xdc, 0x6a, 0xb3,
|
||||
0x80, 0x21, 0xe4, 0xd9, 0x0e, 0x0e, 0xfd, 0x58, 0xfa, 0x71, 0xb7, 0xa2, 0xfd, 0xed, 0x30, 0xde,
|
||||
0x64, 0x9c, 0xd8, 0x16, 0xa7, 0x32, 0x98, 0x74, 0x2b, 0x36, 0x0d, 0xac, 0x0a, 0x69, 0x59, 0xae,
|
||||
0xe7, 0x5b, 0x81, 0xc7, 0x7c, 0x99, 0xaf, 0xcd, 0xa5, 0xd4, 0x57, 0x95, 0x64, 0xc0, 0xb4, 0xcb,
|
||||
0x98, 0xbb, 0x43, 0x89, 0x78, 0xb3, 0x3b, 0x75, 0x62, 0xf9, 0xea, 0x6c, 0x6d, 0x56, 0xb9, 0xac,
|
||||
0x96, 0x47, 0x2c, 0xdf, 0x67, 0x81, 0x28, 0xcc, 0x95, 0x77, 0xca, 0x65, 0x2e, 0x13, 0x8f, 0x24,
|
||||
0x7c, 0x92, 0x56, 0xe3, 0x1a, 0xfc, 0x6d, 0x2b, 0x44, 0xb4, 0x26, 0xce, 0xb8, 0x1b, 0x58, 0x01,
|
||||
0x35, 0xe9, 0x6e, 0x87, 0xf2, 0x00, 0xcd, 0xc0, 0x31, 0x79, 0xf2, 0xb6, 0x57, 0x2b, 0x82, 0x12,
|
||||
0x28, 0x8f, 0x99, 0xa3, 0xd2, 0xb0, 0x51, 0x33, 0x5e, 0x01, 0x58, 0xec, 0x4f, 0xe4, 0x2d, 0xe6,
|
||||
0x73, 0x8a, 0x96, 0x61, 0x41, 0x65, 0xf2, 0xd0, 0x2e, 0x92, 0xf3, 0xd5, 0x29, 0x2c, 0xf1, 0xe1,
|
||||
0x08, 0x3a, 0xbe, 0xe1, 0xef, 0x99, 0x79, 0xa7, 0x57, 0x00, 0x4d, 0xc1, 0xe1, 0x56, 0x9b, 0xb1,
|
||||
0x7a, 0x71, 0xa0, 0x04, 0xca, 0x05, 0x53, 0xbe, 0xa0, 0x35, 0x58, 0x10, 0x0f, 0xdb, 0x0d, 0xea,
|
||||
0xb9, 0x8d, 0xa0, 0x38, 0x28, 0xca, 0x69, 0xb8, 0x5f, 0x6a, 0x7c, 0x4b, 0x44, 0xac, 0x0e, 0x1d,
|
||||
0x7d, 0x9c, 0xcb, 0x99, 0x79, 0x91, 0x25, 0x4d, 0x86, 0xdd, 0x8f, 0x97, 0x47, 0x4c, 0xd7, 0x21,
|
||||
0xec, 0x35, 0x42, 0xa1, 0x9d, 0xc7, 0xb2, 0x6b, 0x38, 0xec, 0x1a, 0x96, 0x2d, 0x56, 0x5d, 0xc3,
|
||||
0x9b, 0x96, 0x1b, 0xa9, 0x64, 0xc6, 0x32, 0x8d, 0xf7, 0x00, 0x4e, 0xa7, 0x1c, 0xa2, 0x54, 0xf1,
|
||||
0xe1, 0x78, 0x5c, 0x15, 0x5e, 0x04, 0xa5, 0xc1, 0x72, 0xbe, 0xfa, 0x57, 0x1a, 0x8f, 0x8d, 0x1a,
|
||||
0xf5, 0x03, 0xaf, 0xee, 0xd1, 0x5a, 0xac, 0xd4, 0xaa, 0x1e, 0xd2, 0x7a, 0xf1, 0x69, 0xee, 0xd7,
|
||||
0x54, 0x37, 0x37, 0x0b, 0x31, 0x2d, 0x39, 0xba, 0x99, 0x60, 0x35, 0x20, 0x58, 0xfd, 0x79, 0x29,
|
||||
0x2b, 0x09, 0x36, 0x41, 0xeb, 0x25, 0x80, 0x9a, 0xa4, 0x15, 0xba, 0x7c, 0xde, 0xe1, 0x99, 0xe7,
|
||||
0x04, 0xfd, 0x01, 0x27, 0xba, 0xb4, 0xcd, 0x3d, 0xe6, 0x6f, 0xfb, 0x9d, 0xa6, 0x4d, 0xdb, 0x02,
|
||||
0xc8, 0x90, 0x39, 0xae, 0xac, 0xb7, 0x85, 0x31, 0x1e, 0x16, 0x6b, 0x72, 0x2f, 0x4c, 0x36, 0x11,
|
||||
0xfd, 0x0e, 0xc7, 0x77, 0x42, 0x6e, 0x41, 0x14, 0x35, 0x54, 0x02, 0xe5, 0x51, 0xb3, 0x20, 0x8d,
|
||||
0xaa, 0xd3, 0x6f, 0x00, 0x9c, 0x49, 0x85, 0xab, 0xfa, 0xb0, 0x02, 0x27, 0x9d, 0xc8, 0x93, 0x61,
|
||||
0x40, 0x27, 0x9c, 0x44, 0x99, 0x9f, 0x39, 0xa3, 0x87, 0xe9, 0xc8, 0x79, 0x26, 0xa5, 0xd7, 0x53,
|
||||
0xda, 0x7d, 0x95, 0x21, 0x7e, 0x0b, 0xe0, 0x6c, 0x3a, 0x08, 0xa5, 0xdf, 0x03, 0xf8, 0xcb, 0x39,
|
||||
0xfd, 0xa2, 0x51, 0x5e, 0x48, 0xa3, 0x9b, 0x2c, 0x73, 0xcf, 0x0b, 0x1a, 0x09, 0x01, 0x26, 0x93,
|
||||
0xf2, 0xfe, 0xc0, 0xb1, 0xd5, 0x12, 0x1b, 0xbf, 0x69, 0xb5, 0xad, 0x66, 0xa4, 0xa4, 0x71, 0x27,
|
||||
0xb1, 0xa8, 0x91, 0x4f, 0x11, 0xac, 0xc2, 0x91, 0x96, 0xb0, 0xa8, 0xb9, 0x48, 0xed, 0xa2, 0xca,
|
||||
0x51, 0x91, 0xd5, 0x6f, 0x23, 0x70, 0x58, 0x54, 0x44, 0xcf, 0x01, 0xcc, 0xc7, 0xb6, 0x12, 0xfd,
|
||||
0x93, 0x96, 0x7d, 0xc1, 0x9d, 0xab, 0x2d, 0x64, 0x0b, 0x96, 0x40, 0x8d, 0xeb, 0x87, 0xef, 0xbe,
|
||||
0x3e, 0x1d, 0xf8, 0x0f, 0x55, 0x49, 0xff, 0x57, 0x43, 0x7e, 0x5f, 0x12, 0x17, 0x0e, 0xd9, 0x3f,
|
||||
0x9b, 0x9e, 0x03, 0xf4, 0x0c, 0xc0, 0x42, 0xfc, 0xf2, 0x40, 0x99, 0x8e, 0x8e, 0x04, 0xd4, 0x16,
|
||||
0x33, 0x46, 0x2b, 0xa4, 0x58, 0x20, 0x2d, 0xa3, 0xf9, 0x6c, 0x48, 0xd1, 0x17, 0x00, 0x27, 0x92,
|
||||
0x83, 0x83, 0xf0, 0xc5, 0x27, 0xa6, 0x5d, 0x4b, 0x1a, 0xc9, 0x1c, 0xaf, 0x30, 0xfa, 0x02, 0x63,
|
||||
0x03, 0xd5, 0x2f, 0xc6, 0x78, 0x6e, 0xec, 0xe3, 0x82, 0x12, 0x75, 0x53, 0x91, 0xfd, 0xe4, 0x7d,
|
||||
0x77, 0x40, 0xe4, 0x8d, 0xd0, 0xb3, 0xcb, 0xf7, 0x03, 0xf4, 0x1a, 0xc0, 0xc9, 0x73, 0x3b, 0x86,
|
||||
0xb2, 0x82, 0x3e, 0xeb, 0xc3, 0x52, 0xf6, 0x04, 0x45, 0x73, 0x45, 0xd0, 0x5c, 0x46, 0xff, 0x5f,
|
||||
0x89, 0x26, 0x7a, 0x7c, 0x36, 0x37, 0x72, 0x03, 0x2e, 0x9d, 0x9b, 0xc4, 0xe2, 0x5d, 0x3a, 0x37,
|
||||
0xc9, 0x55, 0x34, 0x0c, 0x01, 0x76, 0x16, 0x69, 0x12, 0x6c, 0x12, 0xa7, 0x5c, 0xbd, 0xd5, 0xad,
|
||||
0xa3, 0x13, 0x1d, 0x1c, 0x9f, 0xe8, 0xe0, 0xf3, 0x89, 0x0e, 0x9e, 0x9c, 0xea, 0xb9, 0xe3, 0x53,
|
||||
0x3d, 0xf7, 0xe1, 0x54, 0xcf, 0xdd, 0x5f, 0x76, 0xbd, 0xa0, 0xd1, 0xb1, 0xb1, 0xc3, 0x9a, 0x44,
|
||||
0xfd, 0x07, 0x93, 0x3f, 0x8b, 0xbc, 0xf6, 0x90, 0x3c, 0xea, 0x09, 0xb0, 0x54, 0x5d, 0x54, 0xb5,
|
||||
0x83, 0xbd, 0x16, 0xe5, 0xf6, 0x88, 0xf8, 0x02, 0xfc, 0xfb, 0x3d, 0x00, 0x00, 0xff, 0xff, 0xca,
|
||||
0xdc, 0xd5, 0x38, 0xee, 0x09, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -586,6 +676,8 @@ type QueryClient interface {
|
||||
// ConsensusStates queries all the consensus state associated with a given
|
||||
// client.
|
||||
ConsensusStates(ctx context.Context, in *QueryConsensusStatesRequest, opts ...grpc.CallOption) (*QueryConsensusStatesResponse, error)
|
||||
// ClientParams queries all parameters of the ibc client.
|
||||
ClientParams(ctx context.Context, in *QueryClientParamsRequest, opts ...grpc.CallOption) (*QueryClientParamsResponse, error)
|
||||
}
|
||||
|
||||
type queryClient struct {
|
||||
@ -632,6 +724,15 @@ func (c *queryClient) ConsensusStates(ctx context.Context, in *QueryConsensusSta
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) ClientParams(ctx context.Context, in *QueryClientParamsRequest, opts ...grpc.CallOption) (*QueryClientParamsResponse, error) {
|
||||
out := new(QueryClientParamsResponse)
|
||||
err := c.cc.Invoke(ctx, "/ibc.core.client.v1.Query/ClientParams", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// QueryServer is the server API for Query service.
|
||||
type QueryServer interface {
|
||||
// ClientState queries an IBC light client.
|
||||
@ -644,6 +745,8 @@ type QueryServer interface {
|
||||
// ConsensusStates queries all the consensus state associated with a given
|
||||
// client.
|
||||
ConsensusStates(context.Context, *QueryConsensusStatesRequest) (*QueryConsensusStatesResponse, error)
|
||||
// ClientParams queries all parameters of the ibc client.
|
||||
ClientParams(context.Context, *QueryClientParamsRequest) (*QueryClientParamsResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
|
||||
@ -662,6 +765,9 @@ func (*UnimplementedQueryServer) ConsensusState(ctx context.Context, req *QueryC
|
||||
func (*UnimplementedQueryServer) ConsensusStates(ctx context.Context, req *QueryConsensusStatesRequest) (*QueryConsensusStatesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ConsensusStates not implemented")
|
||||
}
|
||||
func (*UnimplementedQueryServer) ClientParams(ctx context.Context, req *QueryClientParamsRequest) (*QueryClientParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ClientParams not implemented")
|
||||
}
|
||||
|
||||
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
|
||||
s.RegisterService(&_Query_serviceDesc, srv)
|
||||
@ -739,6 +845,24 @@ func _Query_ConsensusStates_Handler(srv interface{}, ctx context.Context, dec fu
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_ClientParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryClientParamsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).ClientParams(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ibc.core.client.v1.Query/ClientParams",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).ClientParams(ctx, req.(*QueryClientParamsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Query_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "ibc.core.client.v1.Query",
|
||||
HandlerType: (*QueryServer)(nil),
|
||||
@ -759,6 +883,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "ConsensusStates",
|
||||
Handler: _Query_ConsensusStates_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ClientParams",
|
||||
Handler: _Query_ClientParams_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "ibc/core/client/v1/query.proto",
|
||||
@ -1123,6 +1251,64 @@ func (m *QueryConsensusStatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, e
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *QueryClientParamsRequest) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *QueryClientParamsRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *QueryClientParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *QueryClientParamsResponse) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *QueryClientParamsResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *QueryClientParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Params != nil {
|
||||
{
|
||||
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintQuery(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovQuery(v)
|
||||
base := offset
|
||||
@ -1275,6 +1461,28 @@ func (m *QueryConsensusStatesResponse) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *QueryClientParamsRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *QueryClientParamsResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.Params != nil {
|
||||
l = m.Params.Size()
|
||||
n += 1 + l + sovQuery(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovQuery(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
@ -1669,7 +1877,7 @@ func (m *QueryClientStatesResponse) Unmarshal(dAtA []byte) error {
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.ClientStates = append(m.ClientStates, &IdentifiedClientState{})
|
||||
m.ClientStates = append(m.ClientStates, IdentifiedClientState{})
|
||||
if err := m.ClientStates[len(m.ClientStates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -2277,6 +2485,148 @@ func (m *QueryConsensusStatesResponse) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *QueryClientParamsRequest) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: QueryClientParamsRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: QueryClientParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipQuery(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *QueryClientParamsResponse) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: QueryClientParamsResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: QueryClientParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Params == nil {
|
||||
m.Params = &Params{}
|
||||
}
|
||||
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipQuery(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipQuery(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
||||
@ -309,6 +309,24 @@ func local_request_Query_ConsensusStates_0(ctx context.Context, marshaler runtim
|
||||
|
||||
}
|
||||
|
||||
func request_Query_ClientParams_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryClientParamsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
msg, err := client.ClientParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_ClientParams_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryClientParamsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
msg, err := server.ClientParams(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
|
||||
// UnaryRPC :call QueryServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
@ -395,6 +413,26 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_ClientParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_ClientParams_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_ClientParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -516,6 +554,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_ClientParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Query_ClientParams_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_ClientParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -527,6 +585,8 @@ var (
|
||||
pattern_Query_ConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8, 1, 0, 4, 1, 5, 9}, []string{"ibc", "core", "client", "v1beta1", "consensus_states", "client_id", "version", "version_number", "height", "version_height"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_ConsensusStates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"ibc", "core", "client", "v1beta1", "consensus_states", "client_id"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_ClientParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ibc", "client", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
)
|
||||
|
||||
var (
|
||||
@ -537,4 +597,6 @@ var (
|
||||
forward_Query_ConsensusState_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_ConsensusStates_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_ClientParams_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
|
||||
2128
x/ibc/core/02-client/types/tx.pb.go
Normal file
2128
x/ibc/core/02-client/types/tx.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -47,7 +47,7 @@ func (suite *KeeperTestSuite) TestQueryConnection() {
|
||||
{
|
||||
"success",
|
||||
func() {
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA := suite.chainA.GetFirstTestConnection(clientA, clientB)
|
||||
connB := suite.chainB.GetFirstTestConnection(clientB, clientA)
|
||||
|
||||
@ -111,11 +111,11 @@ func (suite *KeeperTestSuite) TestQueryConnections() {
|
||||
{
|
||||
"success",
|
||||
func() {
|
||||
clientA, clientB, connA0, connB0 := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB, connA0, connB0 := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA1, connB1, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
clientA1, clientB1, connA2, connB2 := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA1, clientB1, connA2, connB2 := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
counterparty1 := types.NewCounterparty(clientB, connB0.ID, suite.chainB.GetPrefix())
|
||||
counterparty2 := types.NewCounterparty(clientB, connB1.ID, suite.chainB.GetPrefix())
|
||||
@ -197,7 +197,7 @@ func (suite *KeeperTestSuite) TestQueryClientConnections() {
|
||||
{
|
||||
"success",
|
||||
func() {
|
||||
clientA, clientB, connA0, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB, connA0, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA1, _ := suite.coordinator.CreateConnection(suite.chainA, suite.chainB, clientA, clientB)
|
||||
expPaths = []string{connA0.ID, connA1.ID}
|
||||
suite.chainA.App.IBCKeeper.ConnectionKeeper.SetClientConnectionPaths(suite.chainA.GetContext(), clientA, expPaths)
|
||||
@ -282,7 +282,7 @@ func (suite *KeeperTestSuite) TestQueryConnectionClientState() {
|
||||
{
|
||||
"success",
|
||||
func() {
|
||||
clientA, _, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
expClientState := suite.chainA.GetClientState(clientA)
|
||||
expIdentifiedClientState = clienttypes.NewIdentifiedClientState(clientA, expClientState)
|
||||
@ -371,7 +371,7 @@ func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() {
|
||||
{
|
||||
"success",
|
||||
func() {
|
||||
clientA, _, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
clientState := suite.chainA.GetClientState(clientA)
|
||||
expConsensusState, _ = suite.chainA.GetConsensusState(clientA, clientState.GetLatestHeight())
|
||||
|
||||
@ -27,26 +27,26 @@ func (suite *KeeperTestSuite) TestConnOpenInit() {
|
||||
expPass bool
|
||||
}{
|
||||
{"success", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
}, true},
|
||||
{"success with empty counterparty identifier", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
emptyConnBID = true
|
||||
}, true},
|
||||
{"success with non empty version", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
version = types.ExportedVersionsToProto(types.GetCompatibleVersions())[0]
|
||||
}, true},
|
||||
{"connection already exists", func() {
|
||||
clientA, clientB, _, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB, _, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
}, false},
|
||||
{"invalid version", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
version = &types.Version{}
|
||||
}, false},
|
||||
{"couldn't add connection to client", func() {
|
||||
// swap client identifiers to result in client that does not exist
|
||||
clientB, clientA = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientB, clientA = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
}, false},
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
expPass bool
|
||||
}{
|
||||
{"success", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -102,7 +102,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
counterpartyClient = suite.chainA.GetClientState(clientA)
|
||||
}, true},
|
||||
{"success with empty counterpartyChosenConnectionID", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -114,17 +114,17 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
|
||||
suite.chainA.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainA.GetContext(), connA.ID, connection)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err = suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, ibctesting.Tendermint)
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// retrieve client state of chainA to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainA.GetClientState(clientA)
|
||||
}, true},
|
||||
{"counterpartyChosenConnectionID does not match desiredConnectionID", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -136,17 +136,17 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
|
||||
suite.chainA.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainA.GetContext(), connA.ID, connection)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err = suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, ibctesting.Tendermint)
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// retrieve client state of chainA to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainA.GetClientState(clientA)
|
||||
}, false},
|
||||
{"invalid counterparty client", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -161,7 +161,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
suite.chainA.App.IBCKeeper.ClientKeeper.SetClientState(suite.chainA.GetContext(), clientA, tmClient)
|
||||
}, false},
|
||||
{"consensus height >= latest height", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -171,7 +171,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
consensusHeight = clienttypes.GetSelfHeight(suite.chainB.GetContext())
|
||||
}, false},
|
||||
{"self consensus state not found", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -181,7 +181,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
consensusHeight = clienttypes.NewHeight(0, 1)
|
||||
}, false},
|
||||
{"counterparty versions is empty", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -191,7 +191,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
versions = nil
|
||||
}, false},
|
||||
{"counterparty versions don't have a match", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -202,14 +202,14 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
versions = []exported.Version{version}
|
||||
}, false},
|
||||
{"connection state verification failed", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
// chainA connection not created
|
||||
|
||||
// retrieve client state of chainA to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainA.GetClientState(clientA)
|
||||
}, false},
|
||||
{"client state verification failed", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -222,7 +222,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
tmClient.LatestHeight = tmClient.LatestHeight.Increment()
|
||||
}, false},
|
||||
{"consensus state verification failed", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
// retrieve client state of chainA to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainA.GetClientState(clientA)
|
||||
@ -241,7 +241,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
suite.Require().NoError(err)
|
||||
}, false},
|
||||
{"invalid previous connection is in TRYOPEN", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
// open init chainA
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
@ -251,14 +251,14 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
err = suite.coordinator.ConnOpenTry(suite.chainB, suite.chainA, connB, connA)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, ibctesting.Tendermint)
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// retrieve client state of chainA to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainA.GetClientState(clientA)
|
||||
}, false},
|
||||
{"invalid previous connection has invalid versions", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
// open init chainA
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
@ -277,7 +277,7 @@ func (suite *KeeperTestSuite) TestConnOpenTry() {
|
||||
|
||||
suite.chainB.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainB.GetContext(), connB.ID, connection)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, ibctesting.Tendermint)
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// retrieve client state of chainA to pass as counterpartyClient
|
||||
@ -353,7 +353,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
expPass bool
|
||||
}{
|
||||
{"success", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -364,7 +364,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
counterpartyClient = suite.chainB.GetClientState(clientB)
|
||||
}, true},
|
||||
{"success with empty stored counterparty connection ID", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -381,10 +381,10 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
|
||||
suite.chainA.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainA.GetContext(), connA.ID, connection)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, ibctesting.Tendermint)
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err = suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// retrieve client state of chainB to pass as counterpartyClient
|
||||
@ -392,7 +392,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
}, true},
|
||||
{"success from tryopen", func() {
|
||||
// chainA is in TRYOPEN, chainB is in TRYOPEN
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connB, connA, err := suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -404,16 +404,16 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
connection.State = types.TRYOPEN
|
||||
suite.chainB.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainB.GetContext(), connB.ID, connection)
|
||||
// update clientB so state change is committed
|
||||
suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, exported.Tendermint)
|
||||
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
|
||||
// retrieve client state of chainB to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainB.GetClientState(clientB)
|
||||
}, true},
|
||||
{"success from tryopen with empty stored connection id", func() {
|
||||
// chainA is in TRYOPEN, chainB is in TRYOPEN
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connB, connA, err := suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -435,15 +435,15 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
suite.chainA.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainA.GetContext(), connA.ID, connection)
|
||||
|
||||
// update clientB so state change is committed
|
||||
suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, exported.Tendermint)
|
||||
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
|
||||
// retrieve client state of chainB to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainB.GetClientState(clientB)
|
||||
}, true},
|
||||
{"invalid counterparty client", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -461,7 +461,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
suite.Require().NoError(err)
|
||||
}, false},
|
||||
{"consensus height >= latest height", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -475,13 +475,13 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
}, false},
|
||||
{"connection not found", func() {
|
||||
// connections are never created
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
// retrieve client state of chainB to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainB.GetClientState(clientB)
|
||||
}, false},
|
||||
{"invalid counterparty connection ID", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -499,15 +499,15 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
|
||||
suite.chainA.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainA.GetContext(), connA.ID, connection)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err = suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, ibctesting.Tendermint)
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
}, false},
|
||||
{"connection state is not INIT", func() {
|
||||
// connection state is already OPEN on chainA
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -522,7 +522,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
}, false},
|
||||
{"connection is in INIT but the proposed version is invalid", func() {
|
||||
// chainA is in INIT, chainB is in TRYOPEN
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -536,7 +536,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
}, false},
|
||||
{"connection is in TRYOPEN but the set version in the connection is invalid", func() {
|
||||
// chainA is in TRYOPEN, chainB is in TRYOPEN
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connB, connA, err := suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -549,8 +549,8 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
suite.chainB.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainB.GetContext(), connB.ID, connection)
|
||||
|
||||
// update clientB so state change is committed
|
||||
suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, exported.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
|
||||
// retrieve client state of chainB to pass as counterpartyClient
|
||||
counterpartyClient = suite.chainB.GetClientState(clientB)
|
||||
@ -558,7 +558,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
version = types.NewVersion("2.0", nil)
|
||||
}, false},
|
||||
{"incompatible IBC versions", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -572,7 +572,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
version = types.NewVersion("2.0", nil)
|
||||
}, false},
|
||||
{"empty version", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -585,7 +585,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
version = &types.Version{}
|
||||
}, false},
|
||||
{"feature set verification failed - unsupported feature", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -598,7 +598,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
version = types.NewVersion(types.DefaultIBCVersionIdentifier, []string{"ORDER_ORDERED", "ORDER_UNORDERED", "ORDER_DAG"})
|
||||
}, false},
|
||||
{"self consensus state not found", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -612,7 +612,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
}, false},
|
||||
{"connection state verification failed", func() {
|
||||
// chainB connection is not in INIT
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
_, _, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -620,7 +620,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
counterpartyClient = suite.chainB.GetClientState(clientB)
|
||||
}, false},
|
||||
{"client state verification failed", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -636,7 +636,7 @@ func (suite *KeeperTestSuite) TestConnOpenAck() {
|
||||
suite.Require().NoError(err)
|
||||
}, false},
|
||||
{"consensus state verification failed", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -717,7 +717,7 @@ func (suite *KeeperTestSuite) TestConnOpenConfirm() {
|
||||
expPass bool
|
||||
}{
|
||||
{"success", func() {
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -729,15 +729,15 @@ func (suite *KeeperTestSuite) TestConnOpenConfirm() {
|
||||
}, true},
|
||||
{"connection not found", func() {
|
||||
// connections are never created
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
}, false},
|
||||
{"chain B's connection state is not TRYOPEN", func() {
|
||||
// connections are OPEN
|
||||
clientA, clientB, _, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB, _, _ = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
}, false},
|
||||
{"connection state verification failed", func() {
|
||||
// chainA is in INIT
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -779,7 +779,7 @@ func (suite *KeeperTestSuite) TestConnOpenConfirm() {
|
||||
// package.
|
||||
func (suite *KeeperTestSuite) TestConsensusParamsValidation() {
|
||||
// invalid client state in ConnOpenTry
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -804,7 +804,7 @@ func (suite *KeeperTestSuite) TestConsensusParamsValidation() {
|
||||
suite.SetupTest() // reset
|
||||
|
||||
// invalid client state in ConnOpenAck
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA, connB, err = suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import (
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/03-connection/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||
)
|
||||
|
||||
@ -31,7 +32,7 @@ func TestKeeperTestSuite(t *testing.T) {
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestSetAndGetConnection() {
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA := suite.chainA.GetFirstTestConnection(clientA, clientB)
|
||||
_, existed := suite.chainA.App.IBCKeeper.ConnectionKeeper.GetConnection(suite.chainA.GetContext(), connA.ID)
|
||||
suite.Require().False(existed)
|
||||
@ -42,7 +43,7 @@ func (suite *KeeperTestSuite) TestSetAndGetConnection() {
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestSetAndGetClientConnectionPaths() {
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
_, existed := suite.chainA.App.IBCKeeper.ConnectionKeeper.GetClientConnectionPaths(suite.chainA.GetContext(), clientA)
|
||||
suite.False(existed)
|
||||
|
||||
@ -55,7 +56,7 @@ func (suite *KeeperTestSuite) TestSetAndGetClientConnectionPaths() {
|
||||
|
||||
// create 2 connections: A0 - B0, A1 - B1
|
||||
func (suite KeeperTestSuite) TestGetAllConnections() {
|
||||
clientA, clientB, connA0, connB0 := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB, connA0, connB0 := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA1, connB1 := suite.coordinator.CreateConnection(suite.chainA, suite.chainB, clientA, clientB)
|
||||
|
||||
counterpartyB0 := types.NewCounterparty(clientB, connB0.ID, suite.chainB.GetPrefix()) // connection B0
|
||||
@ -77,8 +78,8 @@ func (suite KeeperTestSuite) TestGetAllConnections() {
|
||||
// the test creates 2 clients clientA0 and clientA1. clientA0 has a single
|
||||
// connection and clientA1 has 2 connections.
|
||||
func (suite KeeperTestSuite) TestGetAllClientConnectionPaths() {
|
||||
clientA0, _, connA0, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA1, clientB1, connA1, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA0, _, connA0, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
clientA1, clientB1, connA1, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connA2, _ := suite.coordinator.CreateConnection(suite.chainA, suite.chainB, clientA1, clientB1)
|
||||
|
||||
expPaths := []types.ConnectionPaths{
|
||||
@ -102,7 +103,7 @@ func (suite *KeeperTestSuite) TestGetTimestampAtHeight() {
|
||||
expPass bool
|
||||
}{
|
||||
{"verification success", func() {
|
||||
_, _, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
connection = suite.chainA.GetConnection(connA)
|
||||
}, true},
|
||||
{"consensus state not found", func() {
|
||||
|
||||
@ -38,7 +38,7 @@ func (suite *KeeperTestSuite) TestVerifyClientState() {
|
||||
suite.Run(tc.msg, func() {
|
||||
suite.SetupTest() // reset
|
||||
|
||||
_, clientB, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, clientB, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
counterpartyClient, clientProof := suite.chainB.QueryClientStateProof(clientB)
|
||||
proofHeight := clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()-1))
|
||||
@ -83,20 +83,20 @@ func (suite *KeeperTestSuite) TestVerifyClientConsensusState() {
|
||||
expPass bool
|
||||
}{
|
||||
{"verification success", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
}, true},
|
||||
{"client state not found", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
changeClientID = true
|
||||
}, false},
|
||||
{"consensus state not found", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
heightDiff = 5
|
||||
}, false},
|
||||
{"verification failed", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
clientB := connB.ClientID
|
||||
clientState := suite.chainB.GetClientState(clientB)
|
||||
|
||||
@ -170,7 +170,7 @@ func (suite *KeeperTestSuite) TestVerifyConnectionState() {
|
||||
suite.Run(tc.msg, func() {
|
||||
suite.SetupTest() // reset
|
||||
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
connection := suite.chainA.GetConnection(connA)
|
||||
if tc.changeClientID {
|
||||
@ -402,7 +402,7 @@ func (suite *KeeperTestSuite) TestVerifyPacketReceiptAbsence() {
|
||||
} else {
|
||||
// need to update height to prove absence
|
||||
suite.coordinator.CommitBlock(suite.chainA, suite.chainB)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
}
|
||||
|
||||
packetReceiptKey := host.PacketReceiptKey(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
|
||||
|
||||
@ -62,7 +62,7 @@ func (suite *KeeperTestSuite) TestQueryChannel() {
|
||||
{
|
||||
"success",
|
||||
func() {
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
// init channel
|
||||
channelA, _, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
@ -377,7 +377,7 @@ func (suite *KeeperTestSuite) TestQueryChannelClientState() {
|
||||
{
|
||||
"success",
|
||||
func() {
|
||||
clientA, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
// init channel
|
||||
channelA, _, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
@ -505,7 +505,7 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() {
|
||||
{
|
||||
"success",
|
||||
func() {
|
||||
clientA, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
// init channel
|
||||
channelA, _, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -32,7 +32,7 @@ func (suite *KeeperTestSuite) TestChanOpenInit() {
|
||||
|
||||
testCases := []testCase{
|
||||
{"success", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
features = []string{"ORDER_ORDERED", "ORDER_UNORDERED"}
|
||||
suite.chainA.CreatePortCapability(connA.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainA.GetPortCapability(connA.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
@ -46,12 +46,12 @@ func (suite *KeeperTestSuite) TestChanOpenInit() {
|
||||
suite.Require().NotNil(connB)
|
||||
}, false},
|
||||
{"capability is incorrect", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
features = []string{"ORDER_ORDERED", "ORDER_UNORDERED"}
|
||||
portCap = capabilitytypes.NewCapability(3)
|
||||
}, false},
|
||||
{"connection version not negotiated", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
// modify connA versions
|
||||
conn := suite.chainA.GetConnection(connA)
|
||||
@ -68,7 +68,7 @@ func (suite *KeeperTestSuite) TestChanOpenInit() {
|
||||
portCap = suite.chainA.GetPortCapability(connA.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
}, false},
|
||||
{"connection does not support ORDERED channels", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
// modify connA versions to only support UNORDERED channels
|
||||
conn := suite.chainA.GetConnection(connA)
|
||||
@ -145,21 +145,21 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
||||
|
||||
testCases := []testCase{
|
||||
{"success", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
|
||||
suite.chainB.CreatePortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
}, true},
|
||||
{"success with crossing hello", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
suite.coordinator.ChanOpenInitOnBothChains(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
|
||||
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
}, true},
|
||||
{"success with empty counterparty chosen channel id", func() {
|
||||
var clientA, clientB string
|
||||
clientA, clientB, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, _, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -168,17 +168,17 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
||||
channel.Counterparty.ChannelId = ""
|
||||
suite.chainA.App.IBCKeeper.ChannelKeeper.SetChannel(suite.chainA.GetContext(), channelA.PortID, channelA.ID, channel)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err = suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, ibctesting.Tendermint)
|
||||
err = suite.coordinator.UpdateClient(suite.chainB, suite.chainA, clientB, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
suite.chainB.CreatePortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
}, true},
|
||||
{"previous channel with invalid state", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
// make previous channel have wrong ordering
|
||||
suite.coordinator.ChanOpenInit(suite.chainB, suite.chainA, connB, connA, ibctesting.MockPort, ibctesting.MockPort, types.UNORDERED)
|
||||
@ -193,7 +193,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
||||
portCap = suite.chainB.GetPortCapability(connB.FirstOrNextTestChannel(ibctesting.MockPort).PortID)
|
||||
}, false},
|
||||
{"connection is not OPEN", func() {
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
// pass capability check
|
||||
suite.chainB.CreatePortCapability(connB.FirstOrNextTestChannel(ibctesting.MockPort).PortID)
|
||||
portCap = suite.chainB.GetPortCapability(connB.FirstOrNextTestChannel(ibctesting.MockPort).PortID)
|
||||
@ -203,7 +203,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
||||
suite.Require().NoError(err)
|
||||
}, false},
|
||||
{"consensus state not found", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
|
||||
suite.chainB.CreatePortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
@ -212,7 +212,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
||||
heightDiff = 3 // consensus state doesn't exist at this height
|
||||
}, false},
|
||||
{"counterparty chosen channel id does not match desired channel id", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, _, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -226,17 +226,17 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
||||
}, false},
|
||||
{"channel verification failed", func() {
|
||||
// not creating a channel on chainA will result in an invalid proof of existence
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
}, false},
|
||||
{"port capability not found", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
|
||||
portCap = capabilitytypes.NewCapability(3)
|
||||
}, false},
|
||||
{"connection version not negotiated", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
|
||||
// modify connB versions
|
||||
@ -253,7 +253,7 @@ func (suite *KeeperTestSuite) TestChanOpenTry() {
|
||||
portCap = suite.chainB.GetPortCapability(connB.NextTestChannel(ibctesting.MockPort).PortID)
|
||||
}, false},
|
||||
{"connection does not support ORDERED channels", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
|
||||
// modify connA versions to only support UNORDERED channels
|
||||
@ -329,7 +329,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
|
||||
|
||||
testCases := []testCase{
|
||||
{"success", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -339,7 +339,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
|
||||
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||
}, true},
|
||||
{"success with empty stored counterparty channel ID", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -365,7 +365,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
|
||||
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||
}, false},
|
||||
{"connection not found", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -380,7 +380,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
|
||||
suite.chainA.App.IBCKeeper.ChannelKeeper.SetChannel(suite.chainA.GetContext(), channelA.PortID, channelA.ID, channel)
|
||||
}, false},
|
||||
{"connection is not OPEN", func() {
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
var err error
|
||||
connA, connB, err = suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
@ -394,7 +394,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
|
||||
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||
}, false},
|
||||
{"consensus state not found", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -406,7 +406,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
|
||||
heightDiff = 3 // consensus state doesn't exist at this height
|
||||
}, false},
|
||||
{"invalid counterparty channel identifier", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -419,7 +419,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
|
||||
}, false},
|
||||
{"channel verification failed", func() {
|
||||
// chainB is INIT, chainA in TRYOPEN
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelB, channelA, err := suite.coordinator.ChanOpenInit(suite.chainB, suite.chainA, connB, connA, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -429,7 +429,7 @@ func (suite *KeeperTestSuite) TestChanOpenAck() {
|
||||
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||
}, false},
|
||||
{"channel capability not found", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -484,7 +484,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
|
||||
)
|
||||
testCases := []testCase{
|
||||
{"success", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -504,7 +504,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
|
||||
channelCap = suite.chainB.GetChannelCapability(channelB.PortID, channelB.ID)
|
||||
}, false},
|
||||
{"connection not found", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -522,7 +522,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
|
||||
suite.chainB.App.IBCKeeper.ChannelKeeper.SetChannel(suite.chainB.GetContext(), channelB.PortID, channelB.ID, channel)
|
||||
}, false},
|
||||
{"connection is not OPEN", func() {
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
var err error
|
||||
connA, connB, err = suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)
|
||||
@ -532,7 +532,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
|
||||
channelCap = suite.chainB.GetChannelCapability(channelB.PortID, channelB.ID)
|
||||
}, false},
|
||||
{"consensus state not found", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -548,7 +548,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
|
||||
}, false},
|
||||
{"channel verification failed", func() {
|
||||
// chainA is INIT, chainB in TRYOPEN
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -558,7 +558,7 @@ func (suite *KeeperTestSuite) TestChanOpenConfirm() {
|
||||
channelCap = suite.chainB.GetChannelCapability(channelB.PortID, channelB.ID)
|
||||
}, false},
|
||||
{"channel capability not found", func() {
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB = suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA, channelB, err := suite.coordinator.ChanOpenInit(suite.chainA, suite.chainB, connA, connB, ibctesting.MockPort, ibctesting.MockPort, types.ORDERED)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@ -645,7 +645,7 @@ func (suite *KeeperTestSuite) TestChanCloseInit() {
|
||||
suite.chainA.App.IBCKeeper.ChannelKeeper.SetChannel(suite.chainA.GetContext(), channelA.PortID, channelA.ID, channel)
|
||||
}, false},
|
||||
{"connection is not OPEN", func() {
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
var err error
|
||||
connA, connB, err = suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
@ -734,7 +734,7 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() {
|
||||
suite.chainB.App.IBCKeeper.ChannelKeeper.SetChannel(suite.chainB.GetContext(), channelB.PortID, channelB.ID, channel)
|
||||
}, false},
|
||||
{"connection is not OPEN", func() {
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
var err error
|
||||
connB, connA, err = suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||
)
|
||||
|
||||
@ -39,7 +40,7 @@ func (suite *KeeperTestSuite) SetupTest() {
|
||||
// and existence of a channel in INIT on chainA.
|
||||
func (suite *KeeperTestSuite) TestSetChannel() {
|
||||
// create client and connections on both chains
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
// check for channel to be created on chainB
|
||||
channelA := connA.NextTestChannel(ibctesting.MockPort)
|
||||
|
||||
@ -130,7 +130,7 @@ func (suite *KeeperTestSuite) TestSendPacket() {
|
||||
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||
}, false},
|
||||
{"next sequence send not found", func() {
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA := connA.NextTestChannel(ibctesting.TransferPort)
|
||||
channelB := connB.NextTestChannel(ibctesting.TransferPort)
|
||||
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp)
|
||||
@ -276,7 +276,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() {
|
||||
channelCap = suite.chainB.GetChannelCapability(channelB.PortID, channelB.ID)
|
||||
}, false},
|
||||
{"connection not OPEN", func() {
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
// connection on chainB is in INIT
|
||||
connB, connA, err := suite.coordinator.ConnOpenInit(suite.chainB, suite.chainA, clientB, clientA)
|
||||
suite.Require().NoError(err)
|
||||
@ -304,7 +304,7 @@ func (suite *KeeperTestSuite) TestRecvPacket() {
|
||||
channelCap = suite.chainB.GetChannelCapability(channelB.PortID, channelB.ID)
|
||||
}, false},
|
||||
{"next receive sequence is not found", func() {
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA := connA.NextTestChannel(ibctesting.TransferPort)
|
||||
channelB := connB.NextTestChannel(ibctesting.TransferPort)
|
||||
|
||||
@ -548,7 +548,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() {
|
||||
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||
}, false},
|
||||
{"connection not OPEN", func() {
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, clientB := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
// connection on chainA is in INIT
|
||||
connA, connB, err := suite.coordinator.ConnOpenInit(suite.chainA, suite.chainB, clientA, clientB)
|
||||
suite.Require().NoError(err)
|
||||
@ -581,7 +581,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() {
|
||||
channelCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||
}, false},
|
||||
{"next ack sequence not found", func() {
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
_, _, connA, connB := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
channelA := connA.NextTestChannel(ibctesting.TransferPort)
|
||||
channelB := connB.NextTestChannel(ibctesting.TransferPort)
|
||||
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp)
|
||||
|
||||
@ -29,7 +29,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
|
||||
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
|
||||
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||
// need to update chainA's client representing chainB to prove missing ack
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
}, true},
|
||||
{"success: UNORDERED", func() {
|
||||
ordered = false
|
||||
@ -38,7 +38,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
|
||||
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), disabledTimeoutTimestamp)
|
||||
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||
// need to update chainA's client representing chainB to prove missing ack
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
}, true},
|
||||
{"channel not found", func() {
|
||||
// use wrong channel naming
|
||||
@ -77,7 +77,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
|
||||
clientA, clientB, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, types.ORDERED)
|
||||
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, disabledTimeoutTimestamp)
|
||||
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
}, false},
|
||||
{"packet already received ", func() {
|
||||
ordered = true
|
||||
@ -86,12 +86,12 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
|
||||
clientA, clientB, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, types.ORDERED)
|
||||
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
|
||||
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
}, false},
|
||||
{"packet hasn't been sent", func() {
|
||||
clientA, _, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, types.ORDERED)
|
||||
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, timeoutHeight, uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
}, false},
|
||||
{"next seq receive verification failed", func() {
|
||||
// set ordered to false resulting in wrong proof provided
|
||||
@ -100,7 +100,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
|
||||
clientA, clientB, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, types.ORDERED)
|
||||
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), disabledTimeoutTimestamp)
|
||||
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
}, false},
|
||||
{"packet ack verification failed", func() {
|
||||
// set ordered to true resulting in wrong proof provided
|
||||
@ -109,7 +109,7 @@ func (suite *KeeperTestSuite) TestTimeoutPacket() {
|
||||
clientA, clientB, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, types.UNORDERED)
|
||||
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), disabledTimeoutTimestamp)
|
||||
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
}, false},
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
|
||||
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
|
||||
// need to update chainA's client representing chainB to prove missing ack
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
|
||||
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||
}, true},
|
||||
@ -224,7 +224,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
|
||||
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
|
||||
// need to update chainA's client representing chainB to prove missing ack
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
|
||||
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||
}, true},
|
||||
@ -273,7 +273,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
|
||||
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
|
||||
// need to update chainA's client representing chainB to prove missing ack
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
|
||||
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||
}, false},
|
||||
@ -291,7 +291,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
|
||||
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
|
||||
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||
}, false},
|
||||
{"packet ack verification failed", func() {
|
||||
@ -301,7 +301,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
|
||||
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, clienttypes.GetSelfHeight(suite.chainB.GetContext()), disabledTimeoutTimestamp)
|
||||
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
chanCap = suite.chainA.GetChannelCapability(channelA.PortID, channelA.ID)
|
||||
}, false},
|
||||
{"channel capability not found", func() {
|
||||
@ -311,7 +311,7 @@ func (suite *KeeperTestSuite) TestTimeoutOnClose() {
|
||||
suite.coordinator.SendPacket(suite.chainA, suite.chainB, packet, clientB)
|
||||
suite.coordinator.SetChannelClosed(suite.chainB, suite.chainA, channelB)
|
||||
// need to update chainA's client representing chainB to prove missing ack
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
|
||||
chanCap = capabilitytypes.NewCapability(100)
|
||||
}, false},
|
||||
|
||||
@ -12,9 +12,15 @@ const (
|
||||
// TypeClientMisbehaviour is the shared evidence misbehaviour type
|
||||
TypeClientMisbehaviour string = "client_misbehaviour"
|
||||
|
||||
// Solomachine is used to indicate that the light client is a solo machine.
|
||||
Solomachine string = "06-solomachine"
|
||||
|
||||
// Tendermint is used to indicate that the client uses the Tendermint Consensus Algorithm.
|
||||
Tendermint string = "07-tendermint"
|
||||
|
||||
// Localhost is the client type for a localhost client. It is also used as the clientID
|
||||
// for the localhost client.
|
||||
Localhost string = "localhost"
|
||||
Localhost string = "09-localhost"
|
||||
)
|
||||
|
||||
// ClientState defines the required common functions for light clients.
|
||||
|
||||
@ -96,6 +96,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
|
||||
},
|
||||
),
|
||||
},
|
||||
clienttypes.NewParams(exported.Tendermint, exported.Localhost),
|
||||
true,
|
||||
),
|
||||
ConnectionGenesis: connectiontypes.NewGenesisState(
|
||||
@ -150,6 +151,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
|
||||
),
|
||||
},
|
||||
nil,
|
||||
clienttypes.NewParams(exported.Tendermint),
|
||||
false,
|
||||
),
|
||||
ConnectionGenesis: connectiontypes.DefaultGenesisState(),
|
||||
@ -233,6 +235,7 @@ func (suite *IBCTestSuite) TestInitGenesis() {
|
||||
},
|
||||
),
|
||||
},
|
||||
clienttypes.NewParams(exported.Tendermint, exported.Localhost),
|
||||
true,
|
||||
),
|
||||
ConnectionGenesis: connectiontypes.NewGenesisState(
|
||||
@ -295,8 +298,8 @@ func (suite *IBCTestSuite) TestExportGenesis() {
|
||||
// creates clients
|
||||
suite.coordinator.Setup(suite.chainA, suite.chainB, channeltypes.UNORDERED)
|
||||
// create extra clients
|
||||
suite.coordinator.CreateClient(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
suite.coordinator.CreateClient(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
suite.coordinator.CreateClient(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
suite.coordinator.CreateClient(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -28,6 +28,11 @@ func (q Keeper) ConsensusStates(c context.Context, req *clienttypes.QueryConsens
|
||||
return q.ClientKeeper.ConsensusStates(c, req)
|
||||
}
|
||||
|
||||
// ClientParams implements the IBC QueryServer interface
|
||||
func (q Keeper) ClientParams(c context.Context, req *clienttypes.QueryClientParamsRequest) (*clienttypes.QueryClientParamsResponse, error) {
|
||||
return q.ClientKeeper.ClientParams(c, req)
|
||||
}
|
||||
|
||||
// Connection implements the IBC QueryServer interface
|
||||
func (q Keeper) Connection(c context.Context, req *connectiontypes.QueryConnectionRequest) (*connectiontypes.QueryConnectionResponse, error) {
|
||||
return q.ConnectionKeeper.Connection(c, req)
|
||||
|
||||
@ -11,6 +11,7 @@ import (
|
||||
portkeeper "github.com/cosmos/cosmos-sdk/x/ibc/core/05-port/keeper"
|
||||
porttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/05-port/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/types"
|
||||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
)
|
||||
|
||||
var _ types.QueryServer = (*Keeper)(nil)
|
||||
@ -31,9 +32,10 @@ type Keeper struct {
|
||||
|
||||
// NewKeeper creates a new ibc Keeper
|
||||
func NewKeeper(
|
||||
cdc codec.BinaryMarshaler, key sdk.StoreKey, stakingKeeper clienttypes.StakingKeeper, scopedKeeper capabilitykeeper.ScopedKeeper,
|
||||
cdc codec.BinaryMarshaler, key sdk.StoreKey, paramSpace paramtypes.Subspace,
|
||||
stakingKeeper clienttypes.StakingKeeper, scopedKeeper capabilitykeeper.ScopedKeeper,
|
||||
) *Keeper {
|
||||
clientKeeper := clientkeeper.NewKeeper(cdc, key, stakingKeeper)
|
||||
clientKeeper := clientkeeper.NewKeeper(cdc, key, paramSpace, stakingKeeper)
|
||||
connectionKeeper := connectionkeeper.NewKeeper(cdc, key, clientKeeper)
|
||||
portKeeper := portkeeper.NewKeeper(scopedKeeper)
|
||||
channelKeeper := channelkeeper.NewKeeper(cdc, key, clientKeeper, connectionKeeper, portKeeper, scopedKeeper)
|
||||
|
||||
@ -331,7 +331,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutPacket() {
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// need to update chainA client to prove missing ack
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
|
||||
packetKey = host.NextSequenceRecvKey(packet.GetDestPort(), packet.GetDestChannel())
|
||||
}, true},
|
||||
@ -344,7 +344,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutPacket() {
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// need to update chainA client to prove missing ack
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
|
||||
packetKey = host.PacketReceiptKey(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
|
||||
}, true},
|
||||
@ -362,7 +362,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutPacket() {
|
||||
suite.Require().NoError(err)
|
||||
}
|
||||
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
packetKey = host.PacketReceiptKey(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
|
||||
}, true},
|
||||
{"success: ORDERED timeout out of order packet", func() {
|
||||
@ -378,7 +378,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutPacket() {
|
||||
suite.Require().NoError(err)
|
||||
}
|
||||
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
packetKey = host.NextSequenceRecvKey(packet.GetDestPort(), packet.GetDestChannel())
|
||||
|
||||
}, true},
|
||||
@ -458,7 +458,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutOnClosePacket() {
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// need to update chainA client to prove missing ack
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
|
||||
packetKey = host.NextSequenceRecvKey(packet.GetDestPort(), packet.GetDestChannel())
|
||||
|
||||
@ -479,7 +479,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutOnClosePacket() {
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// need to update chainA client to prove missing ack
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
|
||||
packetKey = host.PacketReceiptKey(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
|
||||
|
||||
@ -505,7 +505,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutOnClosePacket() {
|
||||
suite.Require().NoError(err)
|
||||
}
|
||||
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
packetKey = host.PacketReceiptKey(packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
|
||||
|
||||
// close counterparty channel
|
||||
@ -529,7 +529,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutOnClosePacket() {
|
||||
suite.Require().NoError(err)
|
||||
}
|
||||
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
packetKey = host.NextSequenceRecvKey(packet.GetDestPort(), packet.GetDestChannel())
|
||||
|
||||
// close counterparty channel
|
||||
@ -568,7 +568,7 @@ func (suite *KeeperTestSuite) TestHandleTimeoutOnClosePacket() {
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// need to update chainA client to prove missing ack
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
|
||||
packetKey = host.NextSequenceRecvKey(packet.GetDestPort(), packet.GetDestChannel())
|
||||
}, false},
|
||||
@ -639,7 +639,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
@ -689,7 +689,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
msg, err = clienttypes.NewMsgUpgradeClient(clientA, upgradedClient, upgradeHeight, nil, suite.chainA.SenderAccount.GetAddress())
|
||||
@ -701,7 +701,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
clientA, _ = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _ = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
tc.setup()
|
||||
|
||||
|
||||
21
x/ibc/core/spec/07_params.md
Normal file
21
x/ibc/core/spec/07_params.md
Normal file
@ -0,0 +1,21 @@
|
||||
<!--
|
||||
order: 7
|
||||
-->
|
||||
|
||||
# Parameters
|
||||
|
||||
## Clients
|
||||
|
||||
The ibc clients contain the following parameters:
|
||||
|
||||
| Key | Type | Default Value |
|
||||
|------------------|------|---------------|
|
||||
| `AllowedClients` | []string | `"06-solomachine","07-tendermint"` |
|
||||
|
||||
### AllowedClients
|
||||
|
||||
The allowed clients parameter defines an allowlist of client types supported by the chain. A client
|
||||
that is not registered on this list will fail upon creation or on genesis validation. Note that,
|
||||
since the client type is an arbitrary string, chains they must not register two light clients which
|
||||
return the same value for the `ClientType()` function, otherwise the allowlist check can be
|
||||
bypassed.
|
||||
@ -23,3 +23,4 @@ For the general specification please refer to the [Interchain Standards](https:/
|
||||
4. **[Messages](04_messages.md)**
|
||||
5. **[Callbacks](05_callbacks.md)**
|
||||
6. **[Events](06_events.md)**
|
||||
7. **[Params](07_params.md)**
|
||||
|
||||
@ -16,9 +16,6 @@ import (
|
||||
|
||||
var _ exported.ClientState = (*ClientState)(nil)
|
||||
|
||||
// SoloMachine is used to indicate that the light client is a solo machine.
|
||||
const SoloMachine string = "Solo Machine"
|
||||
|
||||
// NewClientState creates a new ClientState instance.
|
||||
func NewClientState(latestSequence uint64, consensusState *ConsensusState, allowUpdateAfterProposal bool) *ClientState {
|
||||
return &ClientState{
|
||||
@ -31,7 +28,7 @@ func NewClientState(latestSequence uint64, consensusState *ConsensusState, allow
|
||||
|
||||
// ClientType is Solo Machine.
|
||||
func (cs ClientState) ClientType() string {
|
||||
return SoloMachine
|
||||
return exported.Solomachine
|
||||
}
|
||||
|
||||
// GetLatestHeight returns the latest sequence number.
|
||||
|
||||
@ -82,7 +82,7 @@ func (suite *SoloMachineTestSuite) TestClientStateValidateBasic() {
|
||||
|
||||
func (suite *SoloMachineTestSuite) TestVerifyClientState() {
|
||||
// create client for tendermint so we can use client state for verification
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
clientState := suite.chainA.GetClientState(clientA)
|
||||
path := suite.solomachine.GetClientStatePath(counterpartyClientIdentifier)
|
||||
|
||||
@ -208,7 +208,7 @@ func (suite *SoloMachineTestSuite) TestVerifyClientState() {
|
||||
|
||||
func (suite *SoloMachineTestSuite) TestVerifyClientConsensusState() {
|
||||
// create client for tendermint so we can use consensus state for verification
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
clientState := suite.chainA.GetClientState(clientA)
|
||||
consensusState, found := suite.chainA.GetConsensusState(clientA, clientState.GetLatestHeight())
|
||||
suite.Require().True(found)
|
||||
|
||||
@ -13,7 +13,7 @@ var _ exported.ConsensusState = ConsensusState{}
|
||||
|
||||
// ClientType returns Solo Machine type.
|
||||
func (ConsensusState) ClientType() string {
|
||||
return SoloMachine
|
||||
return exported.Solomachine
|
||||
}
|
||||
|
||||
// GetTimestamp returns zero.
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package types_test
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/06-solomachine/types"
|
||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||
)
|
||||
@ -8,7 +9,7 @@ import (
|
||||
func (suite *SoloMachineTestSuite) TestConsensusState() {
|
||||
consensusState := suite.solomachine.ConsensusState()
|
||||
|
||||
suite.Require().Equal(types.SoloMachine, consensusState.ClientType())
|
||||
suite.Require().Equal(exported.Solomachine, consensusState.ClientType())
|
||||
suite.Require().Equal(suite.solomachine.Time, consensusState.GetTimestamp())
|
||||
suite.Require().Nil(consensusState.GetRoot())
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ var _ exported.Header = Header{}
|
||||
|
||||
// ClientType defines that the Header is a Solo Machine.
|
||||
func (Header) ClientType() string {
|
||||
return SoloMachine
|
||||
return exported.Solomachine
|
||||
}
|
||||
|
||||
// GetHeight returns the current sequence number as the height.
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package types_test
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/06-solomachine/types"
|
||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||
)
|
||||
@ -78,7 +79,7 @@ func (suite *SoloMachineTestSuite) TestHeaderValidateBasic() {
|
||||
},
|
||||
}
|
||||
|
||||
suite.Require().Equal(types.SoloMachine, header.ClientType())
|
||||
suite.Require().Equal(exported.Solomachine, header.ClientType())
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
|
||||
@ -17,7 +17,7 @@ var (
|
||||
|
||||
// ClientType is a Solo Machine light client.
|
||||
func (misbehaviour Misbehaviour) ClientType() string {
|
||||
return SoloMachine
|
||||
return exported.Solomachine
|
||||
}
|
||||
|
||||
// GetClientID returns the ID of the client that committed a misbehaviour.
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package types_test
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/06-solomachine/types"
|
||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||
)
|
||||
@ -8,7 +9,7 @@ import (
|
||||
func (suite *SoloMachineTestSuite) TestMisbehaviour() {
|
||||
misbehaviour := suite.solomachine.CreateMisbehaviour()
|
||||
|
||||
suite.Require().Equal(types.SoloMachine, misbehaviour.ClientType())
|
||||
suite.Require().Equal(exported.Solomachine, misbehaviour.ClientType())
|
||||
suite.Require().Equal(suite.solomachine.ClientID, misbehaviour.GetClientID())
|
||||
suite.Require().Equal(uint64(0), misbehaviour.GetHeight().GetVersionNumber())
|
||||
suite.Require().Equal(suite.solomachine.Sequence, misbehaviour.GetHeight().GetVersionHeight())
|
||||
|
||||
@ -41,7 +41,7 @@ func (suite *SoloMachineTestSuite) SetupTest() {
|
||||
suite.solomachine = ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachinesingle", "testing", 1)
|
||||
suite.solomachineMulti = ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "solomachinemulti", "testing", 4)
|
||||
|
||||
suite.store = suite.chainA.App.IBCKeeper.ClientKeeper.ClientStore(suite.chainA.GetContext(), types.SoloMachine)
|
||||
suite.store = suite.chainA.App.IBCKeeper.ClientKeeper.ClientStore(suite.chainA.GetContext(), exported.Solomachine)
|
||||
}
|
||||
|
||||
func TestSoloMachineTestSuite(t *testing.T) {
|
||||
|
||||
@ -22,9 +22,6 @@ import (
|
||||
|
||||
var _ exported.ClientState = (*ClientState)(nil)
|
||||
|
||||
// Tendermint is used to indicate that the client uses the Tendermint Consensus Algorithm.
|
||||
const Tendermint string = "Tendermint"
|
||||
|
||||
// NewClientState creates a new ClientState instance
|
||||
func NewClientState(
|
||||
chainID string, trustLevel Fraction,
|
||||
@ -55,7 +52,7 @@ func (cs ClientState) GetChainID() string {
|
||||
|
||||
// ClientType is tendermint.
|
||||
func (cs ClientState) ClientType() string {
|
||||
return Tendermint
|
||||
return exported.Tendermint
|
||||
}
|
||||
|
||||
// GetLatestHeight returns latest block height.
|
||||
|
||||
@ -554,7 +554,7 @@ func (suite *TendermintTestSuite) TestVerifyPacketReceiptAbsence() {
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// need to update chainA's client representing chainB to prove missing ack
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
|
||||
var ok bool
|
||||
clientStateI := suite.chainA.GetClientState(clientA)
|
||||
@ -645,7 +645,7 @@ func (suite *TendermintTestSuite) TestVerifyNextSeqRecv() {
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// need to update chainA's client representing chainB
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
|
||||
var ok bool
|
||||
clientStateI := suite.chainA.GetClientState(clientA)
|
||||
|
||||
@ -26,7 +26,7 @@ func NewConsensusState(
|
||||
|
||||
// ClientType returns Tendermint
|
||||
func (ConsensusState) ClientType() string {
|
||||
return Tendermint
|
||||
return exported.Tendermint
|
||||
}
|
||||
|
||||
// GetRoot returns the commitment Root for the specific
|
||||
|
||||
@ -4,6 +4,7 @@ import (
|
||||
"time"
|
||||
|
||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/23-commitment/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/07-tendermint/types"
|
||||
)
|
||||
|
||||
@ -54,13 +55,15 @@ func (suite *TendermintTestSuite) TestConsensusStateValidateBasic() {
|
||||
for i, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
suite.Require().Equal(tc.consensusState.ClientType(), types.Tendermint)
|
||||
// check just to increase coverage
|
||||
suite.Require().Equal(exported.Tendermint, tc.consensusState.ClientType())
|
||||
suite.Require().Equal(tc.consensusState.GetRoot(), tc.consensusState.Root)
|
||||
|
||||
err := tc.consensusState.ValidateBasic()
|
||||
if tc.expectPass {
|
||||
suite.Require().NoError(tc.consensusState.ValidateBasic(), "valid test case %d failed: %s", i, tc.msg)
|
||||
suite.Require().NoError(err, "valid test case %d failed: %s", i, tc.msg)
|
||||
} else {
|
||||
suite.Require().Error(tc.consensusState.ValidateBasic(), "invalid test case %d passed: %s", i, tc.msg)
|
||||
suite.Require().Error(err, "invalid test case %d passed: %s", i, tc.msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ func (h Header) ConsensusState() *ConsensusState {
|
||||
|
||||
// ClientType defines that the Header is a Tendermint consensus algorithm
|
||||
func (h Header) ClientType() string {
|
||||
return Tendermint
|
||||
return exported.Tendermint
|
||||
}
|
||||
|
||||
// GetHeight returns the current height. It returns 0 if the tendermint
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
tmprotocrypto "github.com/tendermint/tendermint/proto/tendermint/crypto"
|
||||
|
||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/07-tendermint/types"
|
||||
)
|
||||
|
||||
@ -63,7 +64,7 @@ func (suite *TendermintTestSuite) TestHeaderValidateBasic() {
|
||||
}, false},
|
||||
}
|
||||
|
||||
suite.Require().Equal(types.Tendermint, suite.header.ClientType())
|
||||
suite.Require().Equal(exported.Tendermint, suite.header.ClientType())
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
@ -27,12 +27,11 @@ func NewMisbehaviour(clientID, chainID string, header1, header2 *Header) *Misbeh
|
||||
Header1: header1,
|
||||
Header2: header2,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ClientType is Tendermint light client
|
||||
func (misbehaviour Misbehaviour) ClientType() string {
|
||||
return Tendermint
|
||||
return exported.Tendermint
|
||||
}
|
||||
|
||||
// GetClientID returns the ID of the client that committed a misbehaviour.
|
||||
|
||||
@ -8,6 +8,7 @@ import (
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/07-tendermint/types"
|
||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||
ibctestingmock "github.com/cosmos/cosmos-sdk/x/ibc/testing/mock"
|
||||
@ -24,7 +25,7 @@ func (suite *TendermintTestSuite) TestMisbehaviour() {
|
||||
ClientId: clientID,
|
||||
}
|
||||
|
||||
suite.Require().Equal(types.Tendermint, misbehaviour.ClientType())
|
||||
suite.Require().Equal(exported.Tendermint, misbehaviour.ClientType())
|
||||
suite.Require().Equal(clientID, misbehaviour.GetClientID())
|
||||
suite.Require().Equal(height, misbehaviour.GetHeight())
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package types_test
|
||||
|
||||
import (
|
||||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/light-clients/07-tendermint/types"
|
||||
ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing"
|
||||
)
|
||||
@ -12,7 +13,7 @@ var (
|
||||
|
||||
// sanity checks
|
||||
func (suite *TendermintTestSuite) TestCheckProposedHeaderAndUpdateStateBasic() {
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
clientState := suite.chainA.GetClientState(clientA).(*types.ClientState)
|
||||
clientStore := suite.chainA.App.IBCKeeper.ClientKeeper.ClientStore(suite.chainA.GetContext(), clientA)
|
||||
|
||||
@ -201,7 +202,7 @@ func (suite *TendermintTestSuite) TestCheckProposedHeaderAndUpdateState() {
|
||||
suite.SetupTest() // reset
|
||||
|
||||
// construct client state based on test case parameters
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _ := suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
clientState := suite.chainA.GetClientState(clientA).(*types.ClientState)
|
||||
clientState.AllowUpdateAfterExpiry = tc.AllowUpdateAfterExpiry
|
||||
clientState.AllowUpdateAfterMisbehaviour = tc.AllowUpdateAfterMisbehaviour
|
||||
@ -319,7 +320,7 @@ func (suite *TendermintTestSuite) TestCheckProposedHeader() {
|
||||
suite.Run(tc.name, func() {
|
||||
suite.SetupTest() // reset
|
||||
|
||||
clientA, _ = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _ = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
clientState = suite.chainA.GetClientState(clientA).(*types.ClientState)
|
||||
clientState.AllowUpdateAfterExpiry = true
|
||||
clientState.AllowUpdateAfterMisbehaviour = false
|
||||
|
||||
@ -37,7 +37,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
@ -63,7 +63,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, ubdPeriod, ubdPeriod+trustingPeriod, maxClockDrift+5, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, true, false)
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
@ -93,7 +93,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
@ -119,7 +119,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
upgradedClient = types.NewClientState("wrongchainID", types.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, newClientHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, true, true)
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
@ -141,7 +141,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
upgradedClient = types.NewClientState("newChainId", types.DefaultTrustLevel, ubdPeriod, ubdPeriod+trustingPeriod, maxClockDrift+5, upgradeHeight, ibctesting.DefaultConsensusParams, commitmenttypes.GetSDKSpecs(), upgradePath, true, false)
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
@ -198,7 +198,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
@ -228,7 +228,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
@ -258,7 +258,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
@ -283,7 +283,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
cs, found := suite.chainA.App.IBCKeeper.ClientKeeper.GetClientState(suite.chainA.GetContext(), clientA)
|
||||
@ -304,7 +304,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
// commit upgrade store changes and update clients
|
||||
|
||||
suite.coordinator.CommitBlock(suite.chainB)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, ibctesting.Tendermint)
|
||||
err := suite.coordinator.UpdateClient(suite.chainA, suite.chainB, clientA, exported.Tendermint)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// expire chainB's client
|
||||
@ -325,7 +325,7 @@ func (suite *TendermintTestSuite) TestVerifyUpgrade() {
|
||||
// reset suite
|
||||
suite.SetupTest()
|
||||
|
||||
clientA, _ = suite.coordinator.SetupClients(suite.chainA, suite.chainB, ibctesting.Tendermint)
|
||||
clientA, _ = suite.coordinator.SetupClients(suite.chainA, suite.chainB, exported.Tendermint)
|
||||
|
||||
tc.setup()
|
||||
|
||||
|
||||
@ -33,7 +33,6 @@ import (
|
||||
host "github.com/cosmos/cosmos-sdk/x/ibc/core/24-host"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/core/types"
|
||||
solomachinetypes "github.com/cosmos/cosmos-sdk/x/ibc/light-clients/06-solomachine/types"
|
||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/light-clients/07-tendermint/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/testing/mock"
|
||||
"github.com/cosmos/cosmos-sdk/x/staking/teststaking"
|
||||
@ -41,10 +40,6 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// client types
|
||||
Tendermint = ibctmtypes.Tendermint
|
||||
SoloMachine = solomachinetypes.SoloMachine
|
||||
|
||||
// Default params constants used to create a TM client
|
||||
TrustingPeriod time.Duration = time.Hour * 24 * 7 * 2
|
||||
UnbondingPeriod time.Duration = time.Hour * 24 * 7 * 3
|
||||
@ -432,7 +427,7 @@ func (chain *TestChain) ConstructMsgCreateClient(counterparty *TestChain, client
|
||||
)
|
||||
|
||||
switch clientType {
|
||||
case Tendermint:
|
||||
case exported.Tendermint:
|
||||
height := counterparty.LastHeader.GetHeight().(clienttypes.Height)
|
||||
clientState = ibctmtypes.NewClientState(
|
||||
counterparty.ChainID, DefaultTrustLevel, TrustingPeriod, UnbondingPeriod, MaxClockDrift,
|
||||
@ -440,7 +435,7 @@ func (chain *TestChain) ConstructMsgCreateClient(counterparty *TestChain, client
|
||||
UpgradePath, false, false,
|
||||
)
|
||||
consensusState = counterparty.LastHeader.ConsensusState()
|
||||
case SoloMachine:
|
||||
case exported.Solomachine:
|
||||
solo := NewSolomachine(chain.t, chain.Codec, clientID, "", 1)
|
||||
clientState = solo.ClientState()
|
||||
consensusState = solo.ConsensusState()
|
||||
@ -459,7 +454,7 @@ func (chain *TestChain) ConstructMsgCreateClient(counterparty *TestChain, client
|
||||
// client will be created on the (target) chain.
|
||||
func (chain *TestChain) CreateTMClient(counterparty *TestChain, clientID string) error {
|
||||
// construct MsgCreateClient using counterparty
|
||||
msg := chain.ConstructMsgCreateClient(counterparty, clientID, Tendermint)
|
||||
msg := chain.ConstructMsgCreateClient(counterparty, clientID, exported.Tendermint)
|
||||
return chain.sendMsgs(msg)
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ func NewCoordinator(t *testing.T, n int) *Coordinator {
|
||||
func (coord *Coordinator) Setup(
|
||||
chainA, chainB *TestChain, order channeltypes.Order,
|
||||
) (string, string, *TestConnection, *TestConnection, TestChannel, TestChannel) {
|
||||
clientA, clientB, connA, connB := coord.SetupClientConnections(chainA, chainB, Tendermint)
|
||||
clientA, clientB, connA, connB := coord.SetupClientConnections(chainA, chainB, exported.Tendermint)
|
||||
|
||||
// channels can also be referenced through the returned connections
|
||||
channelA, channelB := coord.CreateMockChannels(chainA, chainB, connA, connB, order)
|
||||
@ -98,7 +98,7 @@ func (coord *Coordinator) CreateClient(
|
||||
clientID = source.NewClientID(counterparty.ChainID)
|
||||
|
||||
switch clientType {
|
||||
case Tendermint:
|
||||
case exported.Tendermint:
|
||||
err = source.CreateTMClient(counterparty, clientID)
|
||||
|
||||
default:
|
||||
@ -123,7 +123,7 @@ func (coord *Coordinator) UpdateClient(
|
||||
coord.CommitBlock(source, counterparty)
|
||||
|
||||
switch clientType {
|
||||
case Tendermint:
|
||||
case exported.Tendermint:
|
||||
err = source.UpdateTMClient(counterparty, clientID)
|
||||
|
||||
default:
|
||||
@ -226,7 +226,7 @@ func (coord *Coordinator) SendPacket(
|
||||
// update source client on counterparty connection
|
||||
return coord.UpdateClient(
|
||||
counterparty, source,
|
||||
counterpartyClientID, Tendermint,
|
||||
counterpartyClientID, exported.Tendermint,
|
||||
)
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ func (coord *Coordinator) WriteAcknowledgement(
|
||||
// update source client on counterparty connection
|
||||
return coord.UpdateClient(
|
||||
counterparty, source,
|
||||
counterpartyClientID, Tendermint,
|
||||
counterpartyClientID, exported.Tendermint,
|
||||
)
|
||||
}
|
||||
|
||||
@ -327,7 +327,7 @@ func (coord *Coordinator) SendMsgs(source, counterparty *TestChain, counterparty
|
||||
// update source client on counterparty connection
|
||||
return coord.UpdateClient(
|
||||
counterparty, source,
|
||||
counterpartyClientID, Tendermint,
|
||||
counterpartyClientID, exported.Tendermint,
|
||||
)
|
||||
}
|
||||
|
||||
@ -386,7 +386,7 @@ func (coord *Coordinator) ConnOpenInit(
|
||||
// update source client on counterparty connection
|
||||
if err := coord.UpdateClient(
|
||||
counterparty, source,
|
||||
counterpartyClientID, Tendermint,
|
||||
counterpartyClientID, exported.Tendermint,
|
||||
); err != nil {
|
||||
return sourceConnection, counterpartyConnection, err
|
||||
}
|
||||
@ -409,7 +409,7 @@ func (coord *Coordinator) ConnOpenTry(
|
||||
// update source client on counterparty connection
|
||||
return coord.UpdateClient(
|
||||
counterparty, source,
|
||||
counterpartyConnection.ClientID, Tendermint,
|
||||
counterpartyConnection.ClientID, exported.Tendermint,
|
||||
)
|
||||
}
|
||||
|
||||
@ -428,7 +428,7 @@ func (coord *Coordinator) ConnOpenAck(
|
||||
// update source client on counterparty connection
|
||||
return coord.UpdateClient(
|
||||
counterparty, source,
|
||||
counterpartyConnection.ClientID, Tendermint,
|
||||
counterpartyConnection.ClientID, exported.Tendermint,
|
||||
)
|
||||
}
|
||||
|
||||
@ -446,7 +446,7 @@ func (coord *Coordinator) ConnOpenConfirm(
|
||||
// update source client on counterparty connection
|
||||
return coord.UpdateClient(
|
||||
counterparty, source,
|
||||
counterpartyConnection.ClientID, Tendermint,
|
||||
counterpartyConnection.ClientID, exported.Tendermint,
|
||||
)
|
||||
}
|
||||
|
||||
@ -478,7 +478,7 @@ func (coord *Coordinator) ChanOpenInit(
|
||||
// update source client on counterparty connection
|
||||
if err := coord.UpdateClient(
|
||||
counterparty, source,
|
||||
counterpartyConnection.ClientID, Tendermint,
|
||||
counterpartyConnection.ClientID, exported.Tendermint,
|
||||
); err != nil {
|
||||
return sourceChannel, counterpartyChannel, err
|
||||
}
|
||||
@ -518,7 +518,7 @@ func (coord *Coordinator) ChanOpenInitOnBothChains(
|
||||
// update counterparty client on source connection
|
||||
if err := coord.UpdateClient(
|
||||
source, counterparty,
|
||||
connection.ClientID, Tendermint,
|
||||
connection.ClientID, exported.Tendermint,
|
||||
); err != nil {
|
||||
return sourceChannel, counterpartyChannel, err
|
||||
}
|
||||
@ -526,7 +526,7 @@ func (coord *Coordinator) ChanOpenInitOnBothChains(
|
||||
// update source client on counterparty connection
|
||||
if err := coord.UpdateClient(
|
||||
counterparty, source,
|
||||
counterpartyConnection.ClientID, Tendermint,
|
||||
counterpartyConnection.ClientID, exported.Tendermint,
|
||||
); err != nil {
|
||||
return sourceChannel, counterpartyChannel, err
|
||||
}
|
||||
@ -552,7 +552,7 @@ func (coord *Coordinator) ChanOpenTry(
|
||||
// update source client on counterparty connection
|
||||
return coord.UpdateClient(
|
||||
counterparty, source,
|
||||
connection.CounterpartyClientID, Tendermint,
|
||||
connection.CounterpartyClientID, exported.Tendermint,
|
||||
)
|
||||
}
|
||||
|
||||
@ -571,7 +571,7 @@ func (coord *Coordinator) ChanOpenAck(
|
||||
// update source client on counterparty connection
|
||||
return coord.UpdateClient(
|
||||
counterparty, source,
|
||||
sourceChannel.CounterpartyClientID, Tendermint,
|
||||
sourceChannel.CounterpartyClientID, exported.Tendermint,
|
||||
)
|
||||
}
|
||||
|
||||
@ -590,7 +590,7 @@ func (coord *Coordinator) ChanOpenConfirm(
|
||||
// update source client on counterparty connection
|
||||
return coord.UpdateClient(
|
||||
counterparty, source,
|
||||
sourceChannel.CounterpartyClientID, Tendermint,
|
||||
sourceChannel.CounterpartyClientID, exported.Tendermint,
|
||||
)
|
||||
}
|
||||
|
||||
@ -611,7 +611,7 @@ func (coord *Coordinator) ChanCloseInit(
|
||||
// update source client on counterparty connection
|
||||
return coord.UpdateClient(
|
||||
counterparty, source,
|
||||
channel.CounterpartyClientID, Tendermint,
|
||||
channel.CounterpartyClientID, exported.Tendermint,
|
||||
)
|
||||
}
|
||||
|
||||
@ -630,6 +630,6 @@ func (coord *Coordinator) SetChannelClosed(
|
||||
// update source client on counterparty connection
|
||||
return coord.UpdateClient(
|
||||
counterparty, source,
|
||||
testChannel.CounterpartyClientID, Tendermint,
|
||||
testChannel.CounterpartyClientID, exported.Tendermint,
|
||||
)
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user