keeper

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QuerierChannels

func QuerierChannels(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error)

QuerierChannels defines the sdk.Querier to query all the channels.

func QuerierConnectionChannels

func QuerierConnectionChannels(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error)

QuerierConnectionChannels defines the sdk.Querier to query all the channels for a connection.

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper defines the IBC channel keeper

func NewKeeper

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

NewKeeper creates a new IBC channel Keeper instance

func (Keeper) AcknowledgePacket

func (k Keeper) AcknowledgePacket(
	ctx sdk.Context,
	packet exported.PacketI,
	acknowledgement []byte,
	proof commitmentexported.Proof,
	proofHeight uint64,
) (exported.PacketI, 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. acknowledgePacket also cleans up the packet commitment, which is no longer necessary since the packet has been received and acted upon.

func (Keeper) ChanCloseConfirm

func (k Keeper) ChanCloseConfirm(
	ctx sdk.Context,
	portID,
	channelID string,
	chanCap *capability.Capability,
	proofInit commitmentexported.Proof,
	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

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

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

func (Keeper) ChanOpenAck

func (k Keeper) ChanOpenAck(
	ctx sdk.Context,
	portID,
	channelID string,
	chanCap *capability.Capability,
	counterpartyVersion string,
	proofTry commitmentexported.Proof,
	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

func (k Keeper) ChanOpenConfirm(
	ctx sdk.Context,
	portID,
	channelID string,
	chanCap *capability.Capability,
	proofAck commitmentexported.Proof,
	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

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

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

func (Keeper) ChanOpenTry

func (k Keeper) ChanOpenTry(
	ctx sdk.Context,
	order types.Order,
	connectionHops []string,
	portID,
	channelID string,
	portCap *capability.Capability,
	counterparty types.Counterparty,
	version,
	counterpartyVersion string,
	proofInit commitmentexported.Proof,
	proofHeight uint64,
) (*capability.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) CleanupPacket

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

CleanupPacket is called by a module to remove a received packet commitment from storage. The receiving end must have already processed the packet (whether regularly or past timeout).

In the ORDERED channel case, CleanupPacket cleans-up a packet on an ordered channel by proving that the packet has been received on the other end.

In the UNORDERED channel case, CleanupPacket cleans-up a packet on an unordered channel by proving that the associated acknowledgement has been written.

func (Keeper) CounterpartyHops

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

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

GetAllChannels returns all stored Channel objects.

func (Keeper) GetAllPacketAcks

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

GetAllPacketAcks returns all stored PacketAcknowledgements objects.

func (Keeper) GetAllPacketCommitments

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

GetAllPacketCommitments returns all stored PacketCommitments objects.

func (Keeper) GetAllPacketRecvSeqs

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

GetAllPacketRecvSeqs returns all stored next recv sequences.

func (Keeper) GetAllPacketSendSeqs

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

GetAllPacketSendSeqs returns all stored next send sequences.

func (Keeper) GetChannel

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) GetNextSequenceRecv

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

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

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

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

GetPacketCommitment gets the packet commitment hash from the store

func (Keeper) IterateChannels

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

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

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 aknowledgement, cb will be called. If the cb returns true, the iterator will close and stop.

func (Keeper) IteratePacketSequence

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

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

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) LookupModuleByChannel

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

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

func (Keeper) PacketExecuted

func (k Keeper) PacketExecuted(
	ctx sdk.Context,
	chanCap *capability.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: each packet handler function should call WriteAcknowledgement at the end of the execution

func (Keeper) RecvPacket

func (k Keeper) RecvPacket(
	ctx sdk.Context,
	packet exported.PacketI,
	proof commitmentexported.Proof,
	proofHeight uint64,
) (exported.PacketI, 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

func (k Keeper) SendPacket(
	ctx sdk.Context,
	channelCap *capability.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

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

SetChannel sets a channel to the store

func (Keeper) SetNextSequenceRecv

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

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

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

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

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

TimeoutExecuted deletes the commitment send from this chain after it verifies timeout

func (Keeper) TimeoutOnClose

func (k Keeper) TimeoutOnClose(
	ctx sdk.Context,
	packet types.Packet,
	proof,
	proofClosed commitmentexported.Proof,
	proofHeight,
	nextSequenceRecv uint64,
) (exported.PacketI, 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

func (k Keeper) TimeoutPacket(
	ctx sdk.Context,
	packet exported.PacketI,
	proof commitmentexported.Proof,
	proofHeight,
	nextSequenceRecv uint64,
) (exported.PacketI, 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL