remove alias.go from 02-client (#6542)
This commit is contained in:
parent
c0e48e1c43
commit
43b4f2f120
|
@ -49,6 +49,7 @@ import (
|
||||||
ibctransferkeeper "github.com/cosmos/cosmos-sdk/x/ibc-transfer/keeper"
|
ibctransferkeeper "github.com/cosmos/cosmos-sdk/x/ibc-transfer/keeper"
|
||||||
ibctransfertypes "github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
|
ibctransfertypes "github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
|
||||||
ibcclient "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
|
ibcclient "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
|
||||||
|
ibcclienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
port "github.com/cosmos/cosmos-sdk/x/ibc/05-port"
|
port "github.com/cosmos/cosmos-sdk/x/ibc/05-port"
|
||||||
ibchost "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
ibchost "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
|
||||||
ibckeeper "github.com/cosmos/cosmos-sdk/x/ibc/keeper"
|
ibckeeper "github.com/cosmos/cosmos-sdk/x/ibc/keeper"
|
||||||
|
@ -288,7 +289,7 @@ func NewSimApp(
|
||||||
appCodec, keys[evidencetypes.StoreKey], &app.StakingKeeper, app.SlashingKeeper,
|
appCodec, keys[evidencetypes.StoreKey], &app.StakingKeeper, app.SlashingKeeper,
|
||||||
)
|
)
|
||||||
evidenceRouter := evidencetypes.NewRouter().
|
evidenceRouter := evidencetypes.NewRouter().
|
||||||
AddRoute(ibcclient.RouterKey, ibcclient.HandlerClientMisbehaviour(app.IBCKeeper.ClientKeeper))
|
AddRoute(ibcclienttypes.RouterKey, ibcclient.HandlerClientMisbehaviour(app.IBCKeeper.ClientKeeper))
|
||||||
|
|
||||||
evidenceKeeper.SetRouter(evidenceRouter)
|
evidenceKeeper.SetRouter(evidenceRouter)
|
||||||
app.EvidenceKeeper = *evidenceKeeper
|
app.EvidenceKeeper = *evidenceKeeper
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
package client
|
|
||||||
|
|
||||||
// autogenerated code using github.com/rigelrozanski/multitool
|
|
||||||
// aliases generated for the following subdirectories:
|
|
||||||
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/02-client/types
|
|
||||||
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper"
|
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
AttributeKeyClientID = types.AttributeKeyClientID
|
|
||||||
AttributeKeyClientType = types.AttributeKeyClientType
|
|
||||||
SubModuleName = types.SubModuleName
|
|
||||||
RouterKey = types.RouterKey
|
|
||||||
QuerierRoute = types.QuerierRoute
|
|
||||||
QueryAllClients = types.QueryAllClients
|
|
||||||
QueryClientState = types.QueryClientState
|
|
||||||
QueryConsensusState = types.QueryConsensusState
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
// functions aliases
|
|
||||||
RegisterCodec = types.RegisterCodec
|
|
||||||
NewClientConsensusStates = types.NewClientConsensusStates
|
|
||||||
NewGenesisState = types.NewGenesisState
|
|
||||||
DefaultGenesisState = types.DefaultGenesisState
|
|
||||||
NewQueryAllClientsParams = types.NewQueryAllClientsParams
|
|
||||||
NewClientStateResponse = types.NewClientStateResponse
|
|
||||||
NewConsensusStateResponse = types.NewConsensusStateResponse
|
|
||||||
NewKeeper = keeper.NewKeeper
|
|
||||||
QuerierClients = keeper.QuerierClients
|
|
||||||
|
|
||||||
// variable aliases
|
|
||||||
SubModuleCdc = types.SubModuleCdc
|
|
||||||
ErrClientExists = types.ErrClientExists
|
|
||||||
ErrClientNotFound = types.ErrClientNotFound
|
|
||||||
ErrClientFrozen = types.ErrClientFrozen
|
|
||||||
ErrConsensusStateNotFound = types.ErrConsensusStateNotFound
|
|
||||||
ErrInvalidConsensus = types.ErrInvalidConsensus
|
|
||||||
ErrClientTypeNotFound = types.ErrClientTypeNotFound
|
|
||||||
ErrInvalidClientType = types.ErrInvalidClientType
|
|
||||||
ErrRootNotFound = types.ErrRootNotFound
|
|
||||||
ErrInvalidHeader = types.ErrInvalidHeader
|
|
||||||
ErrInvalidEvidence = types.ErrInvalidEvidence
|
|
||||||
ErrFailedClientConsensusStateVerification = types.ErrFailedClientConsensusStateVerification
|
|
||||||
ErrFailedConnectionStateVerification = types.ErrFailedConnectionStateVerification
|
|
||||||
ErrFailedChannelStateVerification = types.ErrFailedChannelStateVerification
|
|
||||||
ErrFailedPacketCommitmentVerification = types.ErrFailedPacketCommitmentVerification
|
|
||||||
ErrFailedPacketAckVerification = types.ErrFailedPacketAckVerification
|
|
||||||
ErrFailedPacketAckAbsenceVerification = types.ErrFailedPacketAckAbsenceVerification
|
|
||||||
ErrFailedNextSeqRecvVerification = types.ErrFailedNextSeqRecvVerification
|
|
||||||
ErrSelfConsensusStateNotFound = types.ErrSelfConsensusStateNotFound
|
|
||||||
EventTypeCreateClient = types.EventTypeCreateClient
|
|
||||||
EventTypeUpdateClient = types.EventTypeUpdateClient
|
|
||||||
EventTypeSubmitMisbehaviour = types.EventTypeSubmitMisbehaviour
|
|
||||||
AttributeValueCategory = types.AttributeValueCategory
|
|
||||||
)
|
|
||||||
|
|
||||||
type (
|
|
||||||
StakingKeeper = types.StakingKeeper
|
|
||||||
ConsensusStates = types.ClientConsensusStates
|
|
||||||
GenesisState = types.GenesisState
|
|
||||||
QueryAllClientsParams = types.QueryAllClientsParams
|
|
||||||
StateResponse = types.StateResponse
|
|
||||||
ConsensusStateResponse = types.ConsensusStateResponse
|
|
||||||
Keeper = keeper.Keeper
|
|
||||||
)
|
|
|
@ -3,12 +3,14 @@ package client
|
||||||
import (
|
import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
|
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InitGenesis initializes the ibc client submodule's state from a provided genesis
|
// InitGenesis initializes the ibc client submodule's state from a provided genesis
|
||||||
// state.
|
// state.
|
||||||
func InitGenesis(ctx sdk.Context, k Keeper, gs GenesisState) {
|
func InitGenesis(ctx sdk.Context, k keeper.Keeper, gs types.GenesisState) {
|
||||||
for _, client := range gs.Clients {
|
for _, client := range gs.Clients {
|
||||||
k.SetClientState(ctx, client)
|
k.SetClientState(ctx, client)
|
||||||
k.SetClientType(ctx, client.GetID(), client.ClientType())
|
k.SetClientType(ctx, client.GetID(), client.ClientType())
|
||||||
|
@ -39,8 +41,8 @@ func InitGenesis(ctx sdk.Context, k Keeper, gs GenesisState) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExportGenesis returns the ibc client submodule's exported genesis.
|
// ExportGenesis returns the ibc client submodule's exported genesis.
|
||||||
func ExportGenesis(ctx sdk.Context, k Keeper) GenesisState {
|
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState {
|
||||||
return GenesisState{
|
return types.GenesisState{
|
||||||
Clients: k.GetAllClients(ctx),
|
Clients: k.GetAllClients(ctx),
|
||||||
ClientsConsensus: k.GetAllConsensusStates(ctx),
|
ClientsConsensus: k.GetAllConsensusStates(ctx),
|
||||||
CreateLocalhost: true,
|
CreateLocalhost: true,
|
||||||
|
|
|
@ -8,13 +8,14 @@ import (
|
||||||
evidenceexported "github.com/cosmos/cosmos-sdk/x/evidence/exported"
|
evidenceexported "github.com/cosmos/cosmos-sdk/x/evidence/exported"
|
||||||
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
|
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||||
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
|
localhosttypes "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HandleMsgCreateClient defines the sdk.Handler for MsgCreateClient
|
// HandleMsgCreateClient defines the sdk.Handler for MsgCreateClient
|
||||||
func HandleMsgCreateClient(ctx sdk.Context, k Keeper, msg exported.MsgCreateClient) (*sdk.Result, error) {
|
func HandleMsgCreateClient(ctx sdk.Context, k keeper.Keeper, msg exported.MsgCreateClient) (*sdk.Result, error) {
|
||||||
clientType := exported.ClientTypeFromString(msg.GetClientType())
|
clientType := exported.ClientTypeFromString(msg.GetClientType())
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -26,7 +27,7 @@ func HandleMsgCreateClient(ctx sdk.Context, k Keeper, msg exported.MsgCreateClie
|
||||||
case exported.Tendermint:
|
case exported.Tendermint:
|
||||||
tmMsg, ok := msg.(ibctmtypes.MsgCreateClient)
|
tmMsg, ok := msg.(ibctmtypes.MsgCreateClient)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, sdkerrors.Wrap(ErrInvalidClientType, "Msg is not a Tendermint CreateClient msg")
|
return nil, sdkerrors.Wrap(types.ErrInvalidClientType, "Msg is not a Tendermint CreateClient msg")
|
||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ func HandleMsgCreateClient(ctx sdk.Context, k Keeper, msg exported.MsgCreateClie
|
||||||
clientState = localhosttypes.NewClientState(ctx.ChainID(), ctx.BlockHeight())
|
clientState = localhosttypes.NewClientState(ctx.ChainID(), ctx.BlockHeight())
|
||||||
consensusHeight = uint64(ctx.BlockHeight())
|
consensusHeight = uint64(ctx.BlockHeight())
|
||||||
default:
|
default:
|
||||||
return nil, sdkerrors.Wrap(ErrInvalidClientType, msg.GetClientType())
|
return nil, sdkerrors.Wrap(types.ErrInvalidClientType, msg.GetClientType())
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := k.CreateClient(
|
_, err := k.CreateClient(
|
||||||
|
@ -52,14 +53,14 @@ func HandleMsgCreateClient(ctx sdk.Context, k Keeper, msg exported.MsgCreateClie
|
||||||
|
|
||||||
ctx.EventManager().EmitEvents(sdk.Events{
|
ctx.EventManager().EmitEvents(sdk.Events{
|
||||||
sdk.NewEvent(
|
sdk.NewEvent(
|
||||||
EventTypeCreateClient,
|
types.EventTypeCreateClient,
|
||||||
sdk.NewAttribute(AttributeKeyClientID, msg.GetClientID()),
|
sdk.NewAttribute(types.AttributeKeyClientID, msg.GetClientID()),
|
||||||
sdk.NewAttribute(AttributeKeyClientType, msg.GetClientType()),
|
sdk.NewAttribute(types.AttributeKeyClientType, msg.GetClientType()),
|
||||||
sdk.NewAttribute(types.AttributeKeyConsensusHeight, fmt.Sprintf("%d", consensusHeight)),
|
sdk.NewAttribute(types.AttributeKeyConsensusHeight, fmt.Sprintf("%d", consensusHeight)),
|
||||||
),
|
),
|
||||||
sdk.NewEvent(
|
sdk.NewEvent(
|
||||||
sdk.EventTypeMessage,
|
sdk.EventTypeMessage,
|
||||||
sdk.NewAttribute(sdk.AttributeKeyModule, AttributeValueCategory),
|
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ func HandleMsgCreateClient(ctx sdk.Context, k Keeper, msg exported.MsgCreateClie
|
||||||
}
|
}
|
||||||
|
|
||||||
// HandleMsgUpdateClient defines the sdk.Handler for MsgUpdateClient
|
// HandleMsgUpdateClient defines the sdk.Handler for MsgUpdateClient
|
||||||
func HandleMsgUpdateClient(ctx sdk.Context, k Keeper, msg exported.MsgUpdateClient) (*sdk.Result, error) {
|
func HandleMsgUpdateClient(ctx sdk.Context, k keeper.Keeper, msg exported.MsgUpdateClient) (*sdk.Result, error) {
|
||||||
_, err := k.UpdateClient(ctx, msg.GetClientID(), msg.GetHeader())
|
_, err := k.UpdateClient(ctx, msg.GetClientID(), msg.GetHeader())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -82,7 +83,7 @@ func HandleMsgUpdateClient(ctx sdk.Context, k Keeper, msg exported.MsgUpdateClie
|
||||||
|
|
||||||
// HandlerClientMisbehaviour defines the Evidence module handler for submitting a
|
// HandlerClientMisbehaviour defines the Evidence module handler for submitting a
|
||||||
// light client misbehaviour.
|
// light client misbehaviour.
|
||||||
func HandlerClientMisbehaviour(k Keeper) evidencetypes.Handler {
|
func HandlerClientMisbehaviour(k keeper.Keeper) evidencetypes.Handler {
|
||||||
return func(ctx sdk.Context, evidence evidenceexported.Evidence) error {
|
return func(ctx sdk.Context, evidence evidenceexported.Evidence) error {
|
||||||
misbehaviour, ok := evidence.(exported.Misbehaviour)
|
misbehaviour, ok := evidence.(exported.Misbehaviour)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
@ -7,11 +7,12 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/client"
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/client/cli"
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/client/cli"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/client/rest"
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/client/rest"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Name returns the IBC client name
|
// Name returns the IBC client name
|
||||||
func Name() string {
|
func Name() string {
|
||||||
return SubModuleName
|
return types.SubModuleName
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterRESTRoutes registers the REST routes for the IBC client
|
// RegisterRESTRoutes registers the REST routes for the IBC client
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||||
client "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
|
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||||
|
@ -72,7 +72,7 @@ func (k Keeper) SendPacket(
|
||||||
|
|
||||||
clientState, found := k.clientKeeper.GetClientState(ctx, connectionEnd.GetClientID())
|
clientState, found := k.clientKeeper.GetClientState(ctx, connectionEnd.GetClientID())
|
||||||
if !found {
|
if !found {
|
||||||
return client.ErrConsensusStateNotFound
|
return clienttypes.ErrConsensusStateNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if packet timeouted on the receiving chain
|
// check if packet timeouted on the receiving chain
|
||||||
|
|
|
@ -2,8 +2,8 @@ package ante
|
||||||
|
|
||||||
import (
|
import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
client "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
|
|
||||||
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
||||||
|
clientkeeper "github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper"
|
||||||
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
|
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -11,12 +11,12 @@ import (
|
||||||
// including MsgPacket, MsgAcknowledgement, MsgTimeout.
|
// including MsgPacket, MsgAcknowledgement, MsgTimeout.
|
||||||
// MsgUpdateClients are also handled here to perform atomic multimsg transaction
|
// MsgUpdateClients are also handled here to perform atomic multimsg transaction
|
||||||
type ProofVerificationDecorator struct {
|
type ProofVerificationDecorator struct {
|
||||||
clientKeeper client.Keeper
|
clientKeeper clientkeeper.Keeper
|
||||||
channelKeeper channel.Keeper
|
channelKeeper channel.Keeper
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewProofVerificationDecorator constructs new ProofverificationDecorator
|
// NewProofVerificationDecorator constructs new ProofverificationDecorator
|
||||||
func NewProofVerificationDecorator(clientKeeper client.Keeper, channelKeeper channel.Keeper) ProofVerificationDecorator {
|
func NewProofVerificationDecorator(clientKeeper clientkeeper.Keeper, channelKeeper channel.Keeper) ProofVerificationDecorator {
|
||||||
return ProofVerificationDecorator{
|
return ProofVerificationDecorator{
|
||||||
clientKeeper: clientKeeper,
|
clientKeeper: clientKeeper,
|
||||||
channelKeeper: channelKeeper,
|
channelKeeper: channelKeeper,
|
||||||
|
|
|
@ -3,8 +3,8 @@ package ibc_test
|
||||||
import (
|
import (
|
||||||
lite "github.com/tendermint/tendermint/lite2"
|
lite "github.com/tendermint/tendermint/lite2"
|
||||||
|
|
||||||
client "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
|
|
||||||
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
||||||
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
||||||
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
|
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
|
||||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||||
|
@ -28,13 +28,13 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
|
||||||
{
|
{
|
||||||
name: "valid genesis",
|
name: "valid genesis",
|
||||||
genState: types.GenesisState{
|
genState: types.GenesisState{
|
||||||
ClientGenesis: client.NewGenesisState(
|
ClientGenesis: clienttypes.NewGenesisState(
|
||||||
[]exported.ClientState{
|
[]exported.ClientState{
|
||||||
ibctmtypes.NewClientState(clientID, lite.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, suite.header, commitmenttypes.GetSDKSpecs()),
|
ibctmtypes.NewClientState(clientID, lite.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, suite.header, commitmenttypes.GetSDKSpecs()),
|
||||||
localhosttypes.NewClientState("chaindID", 10),
|
localhosttypes.NewClientState("chaindID", 10),
|
||||||
},
|
},
|
||||||
[]client.ConsensusStates{
|
[]clienttypes.ClientConsensusStates{
|
||||||
client.NewClientConsensusStates(
|
clienttypes.NewClientConsensusStates(
|
||||||
clientID,
|
clientID,
|
||||||
[]exported.ConsensusState{
|
[]exported.ConsensusState{
|
||||||
ibctmtypes.NewConsensusState(
|
ibctmtypes.NewConsensusState(
|
||||||
|
@ -84,7 +84,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
|
||||||
{
|
{
|
||||||
name: "invalid client genesis",
|
name: "invalid client genesis",
|
||||||
genState: types.GenesisState{
|
genState: types.GenesisState{
|
||||||
ClientGenesis: client.NewGenesisState(
|
ClientGenesis: clienttypes.NewGenesisState(
|
||||||
[]exported.ClientState{
|
[]exported.ClientState{
|
||||||
ibctmtypes.NewClientState(clientID, lite.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, suite.header, commitmenttypes.GetSDKSpecs()),
|
ibctmtypes.NewClientState(clientID, lite.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, suite.header, commitmenttypes.GetSDKSpecs()),
|
||||||
localhosttypes.NewClientState("(chaindID)", 0),
|
localhosttypes.NewClientState("(chaindID)", 0),
|
||||||
|
@ -99,7 +99,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
|
||||||
{
|
{
|
||||||
name: "invalid connection genesis",
|
name: "invalid connection genesis",
|
||||||
genState: types.GenesisState{
|
genState: types.GenesisState{
|
||||||
ClientGenesis: client.DefaultGenesisState(),
|
ClientGenesis: clienttypes.DefaultGenesisState(),
|
||||||
ConnectionGenesis: connection.NewGenesisState(
|
ConnectionGenesis: connection.NewGenesisState(
|
||||||
[]connection.End{
|
[]connection.End{
|
||||||
connection.NewConnectionEnd(connection.INIT, connectionID, "(CLIENTIDONE)", connection.NewCounterparty(clientID, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))), []string{"1.0.0"}),
|
connection.NewConnectionEnd(connection.INIT, connectionID, "(CLIENTIDONE)", connection.NewCounterparty(clientID, connectionID2, commitmenttypes.NewMerklePrefix([]byte("prefix"))), []string{"1.0.0"}),
|
||||||
|
@ -114,7 +114,7 @@ func (suite *IBCTestSuite) TestValidateGenesis() {
|
||||||
{
|
{
|
||||||
name: "invalid channel genesis",
|
name: "invalid channel genesis",
|
||||||
genState: types.GenesisState{
|
genState: types.GenesisState{
|
||||||
ClientGenesis: client.DefaultGenesisState(),
|
ClientGenesis: clienttypes.DefaultGenesisState(),
|
||||||
ConnectionGenesis: connection.DefaultGenesisState(),
|
ConnectionGenesis: connection.DefaultGenesisState(),
|
||||||
ChannelGenesis: channel.GenesisState{
|
ChannelGenesis: channel.GenesisState{
|
||||||
Acknowledgements: []channel.PacketAckCommitment{
|
Acknowledgements: []channel.PacketAckCommitment{
|
||||||
|
|
|
@ -4,7 +4,8 @@ import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
||||||
client "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
|
clientkeeper "github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper"
|
||||||
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
||||||
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
|
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
|
||||||
port "github.com/cosmos/cosmos-sdk/x/ibc/05-port"
|
port "github.com/cosmos/cosmos-sdk/x/ibc/05-port"
|
||||||
|
@ -15,7 +16,7 @@ type Keeper struct {
|
||||||
aminoCdc *codec.Codec
|
aminoCdc *codec.Codec
|
||||||
cdc codec.Marshaler
|
cdc codec.Marshaler
|
||||||
|
|
||||||
ClientKeeper client.Keeper
|
ClientKeeper clientkeeper.Keeper
|
||||||
ConnectionKeeper connection.Keeper
|
ConnectionKeeper connection.Keeper
|
||||||
ChannelKeeper channel.Keeper
|
ChannelKeeper channel.Keeper
|
||||||
PortKeeper port.Keeper
|
PortKeeper port.Keeper
|
||||||
|
@ -24,9 +25,9 @@ type Keeper struct {
|
||||||
|
|
||||||
// NewKeeper creates a new ibc Keeper
|
// NewKeeper creates a new ibc Keeper
|
||||||
func NewKeeper(
|
func NewKeeper(
|
||||||
aminoCdc *codec.Codec, cdc codec.Marshaler, key sdk.StoreKey, stakingKeeper client.StakingKeeper, scopedKeeper capabilitykeeper.ScopedKeeper,
|
aminoCdc *codec.Codec, cdc codec.Marshaler, key sdk.StoreKey, stakingKeeper clienttypes.StakingKeeper, scopedKeeper capabilitykeeper.ScopedKeeper,
|
||||||
) *Keeper {
|
) *Keeper {
|
||||||
clientKeeper := client.NewKeeper(aminoCdc, key, stakingKeeper)
|
clientKeeper := clientkeeper.NewKeeper(aminoCdc, key, stakingKeeper)
|
||||||
connectionKeeper := connection.NewKeeper(aminoCdc, cdc, key, clientKeeper)
|
connectionKeeper := connection.NewKeeper(aminoCdc, cdc, key, clientKeeper)
|
||||||
portKeeper := port.NewKeeper(scopedKeeper)
|
portKeeper := port.NewKeeper(scopedKeeper)
|
||||||
channelKeeper := channel.NewKeeper(cdc, key, clientKeeper, connectionKeeper, portKeeper, scopedKeeper)
|
channelKeeper := channel.NewKeeper(cdc, key, clientKeeper, connectionKeeper, portKeeper, scopedKeeper)
|
||||||
|
|
|
@ -5,7 +5,8 @@ import (
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
client "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
|
clientkeeper "github.com/cosmos/cosmos-sdk/x/ibc/02-client/keeper"
|
||||||
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
||||||
channelkeeper "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/keeper"
|
channelkeeper "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/keeper"
|
||||||
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||||
|
@ -20,12 +21,12 @@ func NewQuerier(k Keeper) sdk.Querier {
|
||||||
)
|
)
|
||||||
|
|
||||||
switch path[0] {
|
switch path[0] {
|
||||||
case client.SubModuleName:
|
case clienttypes.SubModuleName:
|
||||||
switch path[1] {
|
switch path[1] {
|
||||||
case client.QueryAllClients:
|
case clienttypes.QueryAllClients:
|
||||||
res, err = client.QuerierClients(ctx, req, k.ClientKeeper)
|
res, err = clientkeeper.QuerierClients(ctx, req, k.ClientKeeper)
|
||||||
default:
|
default:
|
||||||
err = sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown IBC %s query endpoint", client.SubModuleName)
|
err = sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown IBC %s query endpoint", clienttypes.SubModuleName)
|
||||||
}
|
}
|
||||||
case connection.SubModuleName:
|
case connection.SubModuleName:
|
||||||
switch path[1] {
|
switch path[1] {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package types
|
||||||
import (
|
import (
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||||
client "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
||||||
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
|
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
|
||||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||||
|
@ -14,7 +14,7 @@ import (
|
||||||
// RegisterCodec registers the necessary x/ibc interfaces and concrete types
|
// RegisterCodec registers the necessary x/ibc interfaces and concrete types
|
||||||
// on the provided Amino codec. These types are used for Amino JSON serialization.
|
// on the provided Amino codec. These types are used for Amino JSON serialization.
|
||||||
func RegisterCodec(cdc *codec.Codec) {
|
func RegisterCodec(cdc *codec.Codec) {
|
||||||
client.RegisterCodec(cdc)
|
clienttypes.RegisterCodec(cdc)
|
||||||
connection.RegisterCodec(cdc)
|
connection.RegisterCodec(cdc)
|
||||||
channel.RegisterCodec(cdc)
|
channel.RegisterCodec(cdc)
|
||||||
ibctmtypes.RegisterCodec(cdc)
|
ibctmtypes.RegisterCodec(cdc)
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
package types
|
package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
client "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
|
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||||
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
|
||||||
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
|
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GenesisState defines the ibc module's genesis state.
|
// GenesisState defines the ibc module's genesis state.
|
||||||
type GenesisState struct {
|
type GenesisState struct {
|
||||||
ClientGenesis client.GenesisState `json:"client_genesis" yaml:"client_genesis"`
|
ClientGenesis clienttypes.GenesisState `json:"client_genesis" yaml:"client_genesis"`
|
||||||
ConnectionGenesis connection.GenesisState `json:"connection_genesis" yaml:"connection_genesis"`
|
ConnectionGenesis connection.GenesisState `json:"connection_genesis" yaml:"connection_genesis"`
|
||||||
ChannelGenesis channel.GenesisState `json:"channel_genesis" yaml:"channel_genesis"`
|
ChannelGenesis channel.GenesisState `json:"channel_genesis" yaml:"channel_genesis"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultGenesisState returns the ibc module's default genesis state.
|
// DefaultGenesisState returns the ibc module's default genesis state.
|
||||||
func DefaultGenesisState() GenesisState {
|
func DefaultGenesisState() GenesisState {
|
||||||
return GenesisState{
|
return GenesisState{
|
||||||
ClientGenesis: client.DefaultGenesisState(),
|
ClientGenesis: clienttypes.DefaultGenesisState(),
|
||||||
ConnectionGenesis: connection.DefaultGenesisState(),
|
ConnectionGenesis: connection.DefaultGenesisState(),
|
||||||
ChannelGenesis: channel.DefaultGenesisState(),
|
ChannelGenesis: channel.DefaultGenesisState(),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue