Documentation ¶
Index ¶
- Constants
- Variables
- func GetMockAckCanaryCapabilityName(packet channeltypes.Packet) string
- func GetMockRecvCanaryCapabilityName(packet channeltypes.Packet) string
- func GetMockTimeoutCanaryCapabilityName(packet channeltypes.Packet) string
- type AppModule
- func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock)
- func (AppModule) ConsensusVersion() uint64
- func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate
- func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
- func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
- func (am AppModule) NegotiateAppVersion(ctx sdk.Context, order channeltypes.Order, connectionID string, portID string, ...) (string, error)
- func (am AppModule) NewHandler() sdk.Handler
- func (am AppModule) NewQuerierHandler() sdk.Querier
- func (am AppModule) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, _ []byte, _ sdk.AccAddress) error
- func (am AppModule) OnChanCloseConfirm(sdk.Context, string, string) error
- func (am AppModule) OnChanCloseInit(sdk.Context, string, string) error
- func (am AppModule) OnChanOpenAck(sdk.Context, string, string, string, string) error
- func (am AppModule) OnChanOpenConfirm(sdk.Context, string, string) error
- func (am AppModule) OnChanOpenInit(ctx sdk.Context, _ channeltypes.Order, _ []string, portID string, ...) (string, error)
- func (am AppModule) OnChanOpenTry(ctx sdk.Context, _ channeltypes.Order, _ []string, portID string, ...) (string, error)
- func (am AppModule) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) exported.Acknowledgement
- func (am AppModule) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, _ sdk.AccAddress) error
- func (AppModule) QuerierRoute() string
- func (AppModule) RegisterInvariants(ir sdk.InvariantRegistry)
- func (am AppModule) RegisterServices(module.Configurator)
- func (am AppModule) Route() string
- type AppModuleBasic
- func (AppModuleBasic) DefaultGenesis() json.RawMessage
- func (AppModuleBasic) GetQueryCmd(codec *codec.Codec) *cobra.Command
- func (AppModuleBasic) GetTxCmd(proxy *codec.Codec) *cobra.Command
- func (AppModuleBasic) Name() string
- func (a AppModuleBasic) RegisterCodec(c *codec.Codec)
- func (a AppModuleBasic) RegisterGRPCGatewayRoutes(_ context.CLIContext, _ *runtime.ServeMux)
- func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
- func (AppModuleBasic) RegisterRESTRoutes(clientCtx context.CLIContext, rtr *mux.Router)
- func (AppModuleBasic) ValidateGenesis(json.RawMessage) error
- type IBCModule
- func (im IBCModule) NegotiateAppVersion(ctx sdk.Context, order channeltypes.Order, connectionID string, portID string, ...) (version string, err error)
- func (im IBCModule) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, acknowledgement []byte, ...) error
- func (im IBCModule) OnChanCloseConfirm(ctx sdk.Context, portID, channelID string) error
- func (im IBCModule) OnChanCloseInit(ctx sdk.Context, portID, channelID string) error
- func (im IBCModule) OnChanOpenAck(ctx sdk.Context, portID string, channelID string, counterpartyChannelID string, ...) error
- func (im IBCModule) OnChanOpenConfirm(ctx sdk.Context, portID, channelID string) error
- func (im IBCModule) OnChanOpenInit(ctx sdk.Context, order channeltypes.Order, connectionHops []string, ...) (string, error)
- func (im IBCModule) OnChanOpenTry(ctx sdk.Context, order channeltypes.Order, connectionHops []string, ...) (string, error)
- func (im IBCModule) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) exported.Acknowledgement
- func (im IBCModule) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) error
- type MockEmptyAcknowledgement
- type MockIBCApp
- type PV
- type PortKeeper
Constants ¶
const ( ModuleName = "mock" Version = "mock-version" )
Variables ¶
var ( MockAcknowledgement = channeltypes.NewResultAcknowledgement([]byte("mock acknowledgement")) MockFailAcknowledgement = channeltypes.NewErrorAcknowledgement("mock failed acknowledgement") MockPacketData = []byte("mock packet data") MockFailPacketData = []byte("mock failed packet data") MockAsyncPacketData = []byte("mock async packet data") MockRecvCanaryCapabilityName = "mock receive canary capability name" MockAckCanaryCapabilityName = "mock acknowledgement canary capability name" MockTimeoutCanaryCapabilityName = "mock timeout canary capability name" )
Functions ¶
func GetMockAckCanaryCapabilityName ¶ added in v1.6.7
func GetMockAckCanaryCapabilityName(packet channeltypes.Packet) string
GetMockAckCanaryCapabilityName generates a capability name for OnAcknowledgementPacket functionality.
func GetMockRecvCanaryCapabilityName ¶ added in v1.6.7
func GetMockRecvCanaryCapabilityName(packet channeltypes.Packet) string
GetMockRecvCanaryCapabilityName generates a capability name for testing OnRecvPacket functionality.
func GetMockTimeoutCanaryCapabilityName ¶ added in v1.6.7
func GetMockTimeoutCanaryCapabilityName(packet channeltypes.Packet) string
GetMockTimeoutCanaryCapabilityName generates a capability name for OnTimeoutacket functionality.
Types ¶
type AppModule ¶
type AppModule struct { AppModuleBasic // contains filtered or unexported fields }
AppModule represents the AppModule for the mock module.
func NewAppModule ¶
func NewAppModule(sk capabilitykeeper.ScopedKeeper, pk PortKeeper) AppModule
NewAppModule returns a mock AppModule instance.
func (AppModule) BeginBlock ¶
func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock)
BeginBlock implements the AppModule interface
func (AppModule) ConsensusVersion ¶
ConsensusVersion implements AppModule/ConsensusVersion.
func (AppModule) EndBlock ¶
func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate
EndBlock implements the AppModule interface
func (AppModule) ExportGenesis ¶
func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
ExportGenesis implements the AppModule interface.
func (AppModule) InitGenesis ¶
func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
InitGenesis implements the AppModule interface.
func (AppModule) NegotiateAppVersion ¶
func (am AppModule) NegotiateAppVersion( ctx sdk.Context, order channeltypes.Order, connectionID string, portID string, counterparty channeltypes.Counterparty, proposedVersion string, ) (string, error)
NegotiateAppVersion implements the IBCModule interface.
func (AppModule) NewHandler ¶
func (AppModule) NewQuerierHandler ¶
func (AppModule) OnAcknowledgementPacket ¶
func (am AppModule) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, _ []byte, _ sdk.AccAddress) error
OnAcknowledgementPacket implements the IBCModule interface.
func (AppModule) OnChanCloseConfirm ¶
OnChanCloseConfirm implements the IBCModule interface.
func (AppModule) OnChanCloseInit ¶
OnChanCloseInit implements the IBCModule interface.
func (AppModule) OnChanOpenAck ¶
OnChanOpenAck implements the IBCModule interface.
func (AppModule) OnChanOpenConfirm ¶
OnChanOpenConfirm implements the IBCModule interface.
func (AppModule) OnChanOpenInit ¶
func (am AppModule) OnChanOpenInit( ctx sdk.Context, _ channeltypes.Order, _ []string, portID string, channelID string, chanCap *capabilitytypes.Capability, _ channeltypes.Counterparty, v string, ) (string, error)
OnChanOpenInit implements the IBCModule interface.
func (AppModule) OnChanOpenTry ¶
func (am AppModule) OnChanOpenTry( ctx sdk.Context, _ channeltypes.Order, _ []string, portID string, channelID string, chanCap *capabilitytypes.Capability, _ channeltypes.Counterparty, _, _ string, ) (string, error)
OnChanOpenTry implements the IBCModule interface.
func (AppModule) OnRecvPacket ¶
func (am AppModule) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) exported.Acknowledgement
OnRecvPacket implements the IBCModule interface.
func (AppModule) OnTimeoutPacket ¶
func (am AppModule) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, _ sdk.AccAddress) error
OnTimeoutPacket implements the IBCModule interface.
func (AppModule) QuerierRoute ¶
QuerierRoute implements the AppModule interface.
func (AppModule) RegisterInvariants ¶
func (AppModule) RegisterInvariants(ir sdk.InvariantRegistry)
RegisterInvariants implements the AppModule interface.
func (AppModule) RegisterServices ¶
func (am AppModule) RegisterServices(module.Configurator)
RegisterServices implements the AppModule interface.
type AppModuleBasic ¶
type AppModuleBasic struct{}
AppModuleBasic is the mock AppModuleBasic.
func (AppModuleBasic) DefaultGenesis ¶
func (AppModuleBasic) DefaultGenesis() json.RawMessage
DefaultGenesis implements AppModuleBasic interface.
func (AppModuleBasic) GetQueryCmd ¶
func (AppModuleBasic) GetQueryCmd(codec *codec.Codec) *cobra.Command
GetQueryCmd implements AppModuleBasic interface.
func (AppModuleBasic) GetTxCmd ¶
func (AppModuleBasic) GetTxCmd(proxy *codec.Codec) *cobra.Command
GetTxCmd implements AppModuleBasic interface.
func (AppModuleBasic) Name ¶
func (AppModuleBasic) Name() string
Name implements AppModuleBasic interface.
func (AppModuleBasic) RegisterCodec ¶
func (a AppModuleBasic) RegisterCodec(c *codec.Codec)
func (AppModuleBasic) RegisterGRPCGatewayRoutes ¶
func (a AppModuleBasic) RegisterGRPCGatewayRoutes(_ context.CLIContext, _ *runtime.ServeMux)
RegisterGRPCGatewayRoutes implements AppModuleBasic interface.
func (AppModuleBasic) RegisterInterfaces ¶
func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry)
RegisterInterfaces implements AppModuleBasic interface.
func (AppModuleBasic) RegisterRESTRoutes ¶
func (AppModuleBasic) RegisterRESTRoutes(clientCtx context.CLIContext, rtr *mux.Router)
RegisterRESTRoutes implements AppModuleBasic interface.
func (AppModuleBasic) ValidateGenesis ¶
func (AppModuleBasic) ValidateGenesis(json.RawMessage) error
ValidateGenesis implements the AppModuleBasic interface.
type IBCModule ¶ added in v1.6.7
type IBCModule struct { IBCApp *MockIBCApp // base application of an IBC middleware stack // contains filtered or unexported fields }
IBCModule implements the ICS26 callbacks for testing/mock.
func NewIBCModule ¶ added in v1.6.7
func NewIBCModule(appModule *AppModule, app *MockIBCApp) IBCModule
NewIBCModule creates a new IBCModule given the underlying mock IBC application and scopedKeeper.
func (IBCModule) NegotiateAppVersion ¶ added in v1.6.7
func (im IBCModule) NegotiateAppVersion(ctx sdk.Context, order channeltypes.Order, connectionID string, portID string, counterparty channeltypes.Counterparty, proposedVersion string) (version string, err error)
func (IBCModule) OnAcknowledgementPacket ¶ added in v1.6.7
func (im IBCModule) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress) error
OnAcknowledgementPacket implements the IBCModule interface.
func (IBCModule) OnChanCloseConfirm ¶ added in v1.6.7
OnChanCloseConfirm implements the IBCModule interface.
func (IBCModule) OnChanCloseInit ¶ added in v1.6.7
OnChanCloseInit implements the IBCModule interface.
func (IBCModule) OnChanOpenAck ¶ added in v1.6.7
func (im IBCModule) OnChanOpenAck(ctx sdk.Context, portID string, channelID string, counterpartyChannelID string, counterpartyVersion string) error
OnChanOpenAck implements the IBCModule interface.
func (IBCModule) OnChanOpenConfirm ¶ added in v1.6.7
OnChanOpenConfirm implements the IBCModule interface.
func (IBCModule) OnChanOpenInit ¶ added in v1.6.7
func (im IBCModule) OnChanOpenInit( ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, chanCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string, ) (string, error)
OnChanOpenInit implements the IBCModule interface.
func (IBCModule) OnChanOpenTry ¶ added in v1.6.7
func (im IBCModule) OnChanOpenTry(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version, counterpartyVersion string) (string, error)
OnChanOpenTry implements the IBCModule interface.
func (IBCModule) OnRecvPacket ¶ added in v1.6.7
func (im IBCModule) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) exported.Acknowledgement
OnRecvPacket implements the IBCModule interface.
func (IBCModule) OnTimeoutPacket ¶ added in v1.6.7
func (im IBCModule) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) error
OnTimeoutPacket implements the IBCModule interface.
type MockEmptyAcknowledgement ¶ added in v1.6.7
type MockEmptyAcknowledgement struct {
Response []byte
}
MockEmptyAcknowledgement implements the exported.Acknowledgement interface and always returns an empty byte string as Response
func NewMockEmptyAcknowledgement ¶ added in v1.6.7
func NewMockEmptyAcknowledgement() MockEmptyAcknowledgement
NewMockEmptyAcknowledgement returns a new instance of MockEmptyAcknowledgement
func (MockEmptyAcknowledgement) Acknowledgement ¶ added in v1.6.7
func (ack MockEmptyAcknowledgement) Acknowledgement() []byte
Acknowledgement implements the Acknowledgement interface
func (MockEmptyAcknowledgement) Success ¶ added in v1.6.7
func (ack MockEmptyAcknowledgement) Success() bool
Success implements the Acknowledgement interface
type MockIBCApp ¶ added in v1.6.7
type MockIBCApp struct { PortID string ScopedKeeper capabilitykeeper.ScopedKeeper OnChanOpenInit func( ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string, ) (string, error) OnChanOpenTry func( ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID, channelID string, channelCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, counterpartyVersion string, ) (version string, err error) OnChanOpenAck func( ctx sdk.Context, portID, channelID string, counterpartyChannelID string, counterpartyVersion string, ) error OnChanOpenConfirm func( ctx sdk.Context, portID, channelID string, ) error OnChanCloseInit func( ctx sdk.Context, portID, channelID string, ) error OnChanCloseConfirm func( ctx sdk.Context, portID, channelID string, ) error // OnRecvPacket must return an acknowledgement that implements the Acknowledgement interface. // In the case of an asynchronous acknowledgement, nil should be returned. // If the acknowledgement returned is successful, the state changes on callback are written, // otherwise the application state changes are discarded. In either case the packet is received // and the acknowledgement is written (in synchronous cases). OnRecvPacket func( ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress, ) exported.Acknowledgement OnAcknowledgementPacket func( ctx sdk.Context, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress, ) error OnTimeoutPacket func( ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress, ) error }
MockIBCApp contains IBC application module callbacks as defined in 05-port.
func NewMockIBCApp ¶ added in v1.6.7
func NewMockIBCApp(portID string, scopedKeeper capabilitykeeper.ScopedKeeper) *MockIBCApp
NewMockIBCApp returns a MockIBCApp. An empty PortID indicates the mock app doesn't bind/claim ports.
type PV ¶
type PV struct {
PrivKey ed25519.PrivKeyEd25519
}
MockPV implements PrivValidator without any safety or persistence. Only use it for testing.
func (PV) SignProposal ¶
SignProposal implements PrivValidator interface
type PortKeeper ¶
type PortKeeper interface { BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability IsBound(ctx sdk.Context, portID string) bool }
Expected Interface PortKeeper defines the expected IBC port keeper