cosmos-sdk: github.com/cosmos/cosmos-sdk/x/ibc/04-channel/keeper Index | Files

package keeper

import "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/keeper"

Index

Package Files

grpc_query.go handshake.go keeper.go packet.go timeout.go

type Keeper Uses

type Keeper struct {
    // implements gRPC QueryServer interface
    types.QueryServer
    // contains filtered or unexported fields
}

Keeper defines the IBC channel keeper

func NewKeeper Uses

func NewKeeper(
    cdc codec.BinaryMarshaler, key sdk.StoreKey,
    clientKeeper types.ClientKeeper, connectionKeeper types.ConnectionKeeper,
    portKeeper types.PortKeeper, scopedKeeper capabilitykeeper.ScopedKeeper,
) Keeper

NewKeeper creates a new IBC channel Keeper instance

func (Keeper) AcknowledgePacket Uses

func (k Keeper) AcknowledgePacket(
    ctx sdk.Context,
    packet exported.PacketI,
    acknowledgement []byte,
    proof []byte,
    proofHeight uint64,
) error

AcknowledgePacket is called by a module to process the acknowledgement of a packet previously sent by the calling module on a channel to a counterparty module on the counterparty chain. Its intended usage is within the ante handler. A subsequent call to AcknowledgementExecuted will clean up the packet commitment, which is no longer necessary since the packet has been received and acted upon.

func (Keeper) AcknowledgementExecuted Uses

func (k Keeper) AcknowledgementExecuted(
    ctx sdk.Context,
    chanCap *capabilitytypes.Capability,
    packet exported.PacketI,
) error

AcknowledgementExecuted deletes the packet commitment from this chain. It is assumed that the acknowledgement verification has already occurred.

CONTRACT: this function must be called in the IBC handler

func (Keeper) ChanCloseConfirm Uses

func (k Keeper) ChanCloseConfirm(
    ctx sdk.Context,
    portID,
    channelID string,
    chanCap *capabilitytypes.Capability,
    proofInit []byte,
    proofHeight uint64,
) error

ChanCloseConfirm is called by the counterparty module to close their end of the channel, since the other end has been closed.

func (Keeper) ChanCloseInit Uses

func (k Keeper) ChanCloseInit(
    ctx sdk.Context,
    portID,
    channelID string,
    chanCap *capabilitytypes.Capability,
) error

ChanCloseInit is called by either module to close their end of the channel. Once closed, channels cannot be reopened.

func (Keeper) ChanOpenAck Uses

func (k Keeper) ChanOpenAck(
    ctx sdk.Context,
    portID,
    channelID string,
    chanCap *capabilitytypes.Capability,
    counterpartyVersion string,
    proofTry []byte,
    proofHeight uint64,
) error

ChanOpenAck is called by the handshake-originating module to acknowledge the acceptance of the initial request by the counterparty module on the other chain.

func (Keeper) ChanOpenConfirm Uses

func (k Keeper) ChanOpenConfirm(
    ctx sdk.Context,
    portID,
    channelID string,
    chanCap *capabilitytypes.Capability,
    proofAck []byte,
    proofHeight uint64,
) error

ChanOpenConfirm is called by the counterparty module to close their end of the

channel, since the other end has been closed.

func (Keeper) ChanOpenInit Uses

func (k Keeper) ChanOpenInit(
    ctx sdk.Context,
    order types.Order,
    connectionHops []string,
    portID,
    channelID string,
    portCap *capabilitytypes.Capability,
    counterparty types.Counterparty,
    version string,
) (*capabilitytypes.Capability, error)

ChanOpenInit is called by a module to initiate a channel opening handshake with a module on another chain.

func (Keeper) ChanOpenTry Uses

func (k Keeper) ChanOpenTry(
    ctx sdk.Context,
    order types.Order,
    connectionHops []string,
    portID,
    channelID string,
    portCap *capabilitytypes.Capability,
    counterparty types.Counterparty,
    version,
    counterpartyVersion string,
    proofInit []byte,
    proofHeight uint64,
) (*capabilitytypes.Capability, error)

ChanOpenTry is called by a module to accept the first step of a channel opening handshake initiated by a module on another chain.

func (Keeper) Channel Uses

func (q Keeper) Channel(c context.Context, req *types.QueryChannelRequest) (*types.QueryChannelResponse, error)

Channel implements the Query/Channel gRPC method

func (Keeper) ChannelClientState Uses

func (q Keeper) ChannelClientState(c context.Context, req *types.QueryChannelClientStateRequest) (*types.QueryChannelClientStateResponse, error)

ChannelClientState implements the Query/ChannelClientState gRPC method

func (Keeper) ChannelConsensusState Uses

func (q Keeper) ChannelConsensusState(c context.Context, req *types.QueryChannelConsensusStateRequest) (*types.QueryChannelConsensusStateResponse, error)

ChannelConsensusState implements the Query/ChannelConsensusState gRPC method

func (Keeper) Channels Uses

func (q Keeper) Channels(c context.Context, req *types.QueryChannelsRequest) (*types.QueryChannelsResponse, error)

Channels implements the Query/Channels gRPC method

func (Keeper) ConnectionChannels Uses

func (q Keeper) ConnectionChannels(c context.Context, req *types.QueryConnectionChannelsRequest) (*types.QueryConnectionChannelsResponse, error)

ConnectionChannels implements the Query/ConnectionChannels gRPC method

func (Keeper) CounterpartyHops Uses

func (k Keeper) CounterpartyHops(ctx sdk.Context, ch types.Channel) ([]string, bool)

CounterpartyHops returns the connection hops of the counterparty channel. The counterparty hops are stored in the inverse order as the channel's.

func (Keeper) GetAllChannels Uses

func (k Keeper) GetAllChannels(ctx sdk.Context) (channels []types.IdentifiedChannel)

GetAllChannels returns all stored Channel objects.

func (Keeper) GetAllPacketAckSeqs Uses

func (k Keeper) GetAllPacketAckSeqs(ctx sdk.Context) (seqs []types.PacketSequence)

GetAllPacketAckSeqs returns all stored next acknowledgements sequences.

func (Keeper) GetAllPacketAcks Uses

func (k Keeper) GetAllPacketAcks(ctx sdk.Context) (acks []types.PacketAckCommitment)

GetAllPacketAcks returns all stored PacketAcknowledgements objects.

func (Keeper) GetAllPacketCommitments Uses

func (k Keeper) GetAllPacketCommitments(ctx sdk.Context) (commitments []types.PacketAckCommitment)

GetAllPacketCommitments returns all stored PacketCommitments objects.

func (Keeper) GetAllPacketCommitmentsAtChannel Uses

func (k Keeper) GetAllPacketCommitmentsAtChannel(ctx sdk.Context, portID, channelID string) (commitments []types.PacketAckCommitment)

GetAllPacketCommitmentsAtChannel returns all stored PacketCommitments objects for a specified port ID and channel ID.

func (Keeper) GetAllPacketRecvSeqs Uses

func (k Keeper) GetAllPacketRecvSeqs(ctx sdk.Context) (seqs []types.PacketSequence)

GetAllPacketRecvSeqs returns all stored next recv sequences.

func (Keeper) GetAllPacketSendSeqs Uses

func (k Keeper) GetAllPacketSendSeqs(ctx sdk.Context) (seqs []types.PacketSequence)

GetAllPacketSendSeqs returns all stored next send sequences.

func (Keeper) GetChannel Uses

func (k Keeper) GetChannel(ctx sdk.Context, portID, channelID string) (types.Channel, bool)

GetChannel returns a channel with a particular identifier binded to a specific port

func (Keeper) GetNextSequenceAck Uses

func (k Keeper) GetNextSequenceAck(ctx sdk.Context, portID, channelID string) (uint64, bool)

GetNextSequenceAck gets a channel's next ack sequence from the store

func (Keeper) GetNextSequenceRecv Uses

func (k Keeper) GetNextSequenceRecv(ctx sdk.Context, portID, channelID string) (uint64, bool)

GetNextSequenceRecv gets a channel's next receive sequence from the store

func (Keeper) GetNextSequenceSend Uses

func (k Keeper) GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool)

GetNextSequenceSend gets a channel's next send sequence from the store

func (Keeper) GetPacketAcknowledgement Uses

func (k Keeper) GetPacketAcknowledgement(ctx sdk.Context, portID, channelID string, sequence uint64) ([]byte, bool)

GetPacketAcknowledgement gets the packet ack hash from the store

func (Keeper) GetPacketCommitment Uses

func (k Keeper) GetPacketCommitment(ctx sdk.Context, portID, channelID string, sequence uint64) []byte

GetPacketCommitment gets the packet commitment hash from the store

func (Keeper) HasPacketCommitment Uses

func (k Keeper) HasPacketCommitment(ctx sdk.Context, portID, channelID string, sequence uint64) bool

HasPacketCommitment returns true if the packet commitment exists

func (Keeper) IterateChannels Uses

func (k Keeper) IterateChannels(ctx sdk.Context, cb func(types.IdentifiedChannel) bool)

IterateChannels provides an iterator over all Channel objects. For each Channel, cb will be called. If the cb returns true, the iterator will close and stop.

func (Keeper) IteratePacketAcknowledgement Uses

func (k Keeper) IteratePacketAcknowledgement(ctx sdk.Context, cb func(portID, channelID string, sequence uint64, hash []byte) bool)

IteratePacketAcknowledgement provides an iterator over all PacketAcknowledgement objects. For each aknowledgement, cb will be called. If the cb returns true, the iterator will close and stop.

func (Keeper) IteratePacketCommitment Uses

func (k Keeper) IteratePacketCommitment(ctx sdk.Context, cb func(portID, channelID string, sequence uint64, hash []byte) bool)

IteratePacketCommitment provides an iterator over all PacketCommitment objects. For each packet commitment, cb will be called. If the cb returns true, the iterator will close and stop.

func (Keeper) IteratePacketCommitmentAtChannel Uses

func (k Keeper) IteratePacketCommitmentAtChannel(ctx sdk.Context, portID, channelID string, cb func(_, _ string, sequence uint64, hash []byte) bool)

IteratePacketCommitmentAtChannel provides an iterator over all PacketCommmitment objects at a specified channel. For each packet commitment, cb will be called. If the cb returns true, the iterator will close and stop.

func (Keeper) IteratePacketSequence Uses

func (k Keeper) IteratePacketSequence(ctx sdk.Context, iterator db.Iterator, cb func(portID, channelID string, sequence uint64) bool)

IteratePacketSequence provides an iterator over all send, receive or ack sequences. For each sequence, cb will be called. If the cb returns true, the iterator will close and stop.

func (Keeper) Logger Uses

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) LookupModuleByChannel Uses

func (k Keeper) LookupModuleByChannel(ctx sdk.Context, portID, channelID string) (string, *capabilitytypes.Capability, error)

LookupModuleByChannel will return the IBCModule along with the capability associated with a given channel defined by its portID and channelID

func (Keeper) NextSequenceReceive Uses

func (q Keeper) NextSequenceReceive(c context.Context, req *types.QueryNextSequenceReceiveRequest) (*types.QueryNextSequenceReceiveResponse, error)

NextSequenceReceive implements the Query/NextSequenceReceive gRPC method

func (Keeper) PacketAcknowledgement Uses

func (q Keeper) PacketAcknowledgement(c context.Context, req *types.QueryPacketAcknowledgementRequest) (*types.QueryPacketAcknowledgementResponse, error)

PacketAcknowledgement implements the Query/PacketAcknowledgement gRPC method

func (Keeper) PacketCommitment Uses

func (q Keeper) PacketCommitment(c context.Context, req *types.QueryPacketCommitmentRequest) (*types.QueryPacketCommitmentResponse, error)

PacketCommitment implements the Query/PacketCommitment gRPC method

func (Keeper) PacketCommitments Uses

func (q Keeper) PacketCommitments(c context.Context, req *types.QueryPacketCommitmentsRequest) (*types.QueryPacketCommitmentsResponse, error)

PacketCommitments implements the Query/PacketCommitments gRPC method

func (Keeper) PacketExecuted Uses

func (k Keeper) PacketExecuted(
    ctx sdk.Context,
    chanCap *capabilitytypes.Capability,
    packet exported.PacketI,
    acknowledgement []byte,
) error

PacketExecuted writes the packet execution acknowledgement to the state, which will be verified by the counterparty chain using AcknowledgePacket.

CONTRACT: this function must be called in the IBC handler

func (Keeper) RecvPacket Uses

func (k Keeper) RecvPacket(
    ctx sdk.Context,
    packet exported.PacketI,
    proof []byte,
    proofHeight uint64,
) error

RecvPacket is called by a module in order to receive & process an IBC packet sent on the corresponding channel end on the counterparty chain.

func (Keeper) SendPacket Uses

func (k Keeper) SendPacket(
    ctx sdk.Context,
    channelCap *capabilitytypes.Capability,
    packet exported.PacketI,
) error

SendPacket is called by a module in order to send an IBC packet on a channel end owned by the calling module to the corresponding module on the counterparty chain.

func (Keeper) SetChannel Uses

func (k Keeper) SetChannel(ctx sdk.Context, portID, channelID string, channel types.Channel)

SetChannel sets a channel to the store

func (Keeper) SetNextSequenceAck Uses

func (k Keeper) SetNextSequenceAck(ctx sdk.Context, portID, channelID string, sequence uint64)

SetNextSequenceAck sets a channel's next ack sequence to the store

func (Keeper) SetNextSequenceRecv Uses

func (k Keeper) SetNextSequenceRecv(ctx sdk.Context, portID, channelID string, sequence uint64)

SetNextSequenceRecv sets a channel's next receive sequence to the store

func (Keeper) SetNextSequenceSend Uses

func (k Keeper) SetNextSequenceSend(ctx sdk.Context, portID, channelID string, sequence uint64)

SetNextSequenceSend sets a channel's next send sequence to the store

func (Keeper) SetPacketAcknowledgement Uses

func (k Keeper) SetPacketAcknowledgement(ctx sdk.Context, portID, channelID string, sequence uint64, ackHash []byte)

SetPacketAcknowledgement sets the packet ack hash to the store

func (Keeper) SetPacketCommitment Uses

func (k Keeper) SetPacketCommitment(ctx sdk.Context, portID, channelID string, sequence uint64, commitmentHash []byte)

SetPacketCommitment sets the packet commitment hash to the store

func (Keeper) TimeoutExecuted Uses

func (k Keeper) TimeoutExecuted(
    ctx sdk.Context,
    chanCap *capabilitytypes.Capability,
    packet exported.PacketI,
) error

TimeoutExecuted deletes the commitment send from this chain after it verifies timeout. If the timed-out packet came from an ORDERED channel then this channel will be closed.

CONTRACT: this function must be called in the IBC handler

func (Keeper) TimeoutOnClose Uses

func (k Keeper) TimeoutOnClose(
    ctx sdk.Context,
    chanCap *capabilitytypes.Capability,
    packet exported.PacketI,
    proof,
    proofClosed []byte,
    proofHeight,
    nextSequenceRecv uint64,
) error

TimeoutOnClose is called by a module in order to prove that the channel to which an unreceived packet was addressed has been closed, so the packet will never be received (even if the timeoutHeight has not yet been reached).

func (Keeper) TimeoutPacket Uses

func (k Keeper) TimeoutPacket(
    ctx sdk.Context,
    packet exported.PacketI,
    proof []byte,
    proofHeight,
    nextSequenceRecv uint64,
) error

TimeoutPacket is called by a module which originally attempted to send a packet to a counterparty module, where the timeout height has passed on the counterparty chain without the packet being committed, to prove that the packet can no longer be executed and to allow the calling module to safely perform appropriate state transitions. Its intended usage is within the ante handler.

func (Keeper) UnrelayedPackets Uses

func (q Keeper) UnrelayedPackets(c context.Context, req *types.QueryUnrelayedPacketsRequest) (*types.QueryUnrelayedPacketsResponse, error)

UnrelayedPackets implements the Query/UnrelayedPackets gRPC method. Given a list of counterparty packet commitments, the querier checks if the packet sequence has an acknowledgement stored. If req.Acknowledgements is true then all unrelayed acknowledgements are returned (ack exists), otherwise all unrelayed packet commitments are returned (ack does not exist).

NOTE: The querier makes the assumption that the provided list of packet commitments is correct and will not function properly if the list is not up to date. Ideally the query height should equal the latest height on the counterparty's client which represents this chain.

Package keeper imports 23 packages (graph) and is imported by 2 packages. Updated 2020-08-13. Refresh now. Tools for package owners.