Documentation ¶
Index ¶
- Constants
- Variables
- func CancelChannelUpgrade(chain, cp *ProvableChain, settlementInterval time.Duration) error
- func CreateChannel(pathName string, src, dst *ProvableChain, to time.Duration) error
- func CreateClients(pathName string, src, dst *ProvableChain, srcHeight, dstHeight exported.Height) error
- func CreateConnection(pathName string, src, dst *ProvableChain, to time.Duration) error
- func ExecuteChannelUpgrade(pathName string, src, dst *ProvableChain, interval time.Duration, ...) error
- func FindPacketAcknowledgementFromEventsBySequence(events []abci.Event, seq uint64) (*packetAcknowledgement, error)
- func FindPacketFromEventsBySequence(events []abci.Event, eventType string, seq uint64) (*channeltypes.Packet, error)
- func GetChainLogger(chain ChainInfo) *log.RelayLogger
- func GetChainPairLogger(src, dst ChainInfo) *log.RelayLogger
- func GetChannelLogger(c Chain) *log.RelayLogger
- func GetChannelPairLogger(src, dst Chain) *log.RelayLogger
- func GetClientPairLogger(src, dst Chain) *log.RelayLogger
- func GetConnectionPairLogger(src, dst Chain) *log.RelayLogger
- func GetPacketAcknowledgementsFromEvents(events []abci.Event) ([]packetAcknowledgement, error)
- func GetPacketsFromEvents(events []abci.Event, eventType string) ([]channeltypes.Packet, error)
- func InitChannelUpgrade(chain, cp *ProvableChain, upgradeFields chantypes.UpgradeFields, ...) error
- func MakeCodec() codec.ProtoCodecMarshaler
- func OrderFromString(order string) chantypes.Order
- func QueryChannelPair(srcCtx, dstCtx QueryContext, src, dst interface{ ... }, prove bool) (srcChan, dstChan *chantypes.QueryChannelResponse, err error)
- func QueryChannelUpgradeError(ctx QueryContext, chain interface{ ... }, prove bool) (*chantypes.QueryUpgradeErrorResponse, error)
- func QueryChannelUpgradePair(srcCtx, dstCtx QueryContext, src, dst interface{ ... }, prove bool) (srcChanUpg, dstChanUpg *chantypes.QueryUpgradeResponse, err error)
- func QueryClientConsensusStatePair(srcCtx, dstCtx QueryContext, src, dst interface{ ... }, ...) (srcCsRes, dstCsRes *clienttypes.QueryConsensusStateResponse, err error)
- func QueryClientStatePair(srcCtx, dstCtx QueryContext, src, dst interface{ ... }, prove bool) (srcCsRes, dstCsRes *clienttypes.QueryClientStateResponse, err error)
- func QueryConnectionPair(srcCtx, dstCtx QueryContext, src, dst interface{ ... }, prove bool) (srcConn, dstConn *conntypes.QueryConnectionResponse, err error)
- func SendTransferMsg(src, dst *ProvableChain, amount sdk.Coin, dstAddr string, ...) error
- func SetCoreConfig(c ConfigI)
- func StartService(ctx context.Context, st StrategyI, src, dst *ProvableChain, ...) error
- func SyncChainConfigFromEvents(pathName string, msgIDs []MsgID, chain *ProvableChain) error
- func SyncChainConfigsFromEvents(pathName string, msgIDsSrc, msgIDsDst []MsgID, src, dst *ProvableChain) error
- func UpdateClients(src, dst *ProvableChain) error
- type Chain
- type ChainConfig
- type ChainInfo
- type ChainInfoICS02Querier
- type ChainInfoLightClient
- type ChainLightClient
- type ChainProverConfig
- type ConfigI
- type EventAcknowledgePacket
- type EventGenerateChannelIdentifier
- type EventGenerateClientIdentifier
- type EventGenerateConnectionIdentifier
- type EventRecvPacket
- type EventSendPacket
- type EventUnknown
- type EventUpgradeChannel
- type EventWriteAcknowledgement
- type FinalityAware
- type FinalityAwareChain
- type Header
- type IBCQuerier
- type ICS02Querier
- type ICS03Querier
- type ICS04Querier
- type ICS20Querier
- type LightClient
- type LightClientICS04Querier
- type MsgEventListener
- type MsgEventLog
- type MsgID
- type MsgResult
- type NaiveStrategy
- func (st *NaiveStrategy) GetType() string
- func (st *NaiveStrategy) RelayAcknowledgements(src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders, ...) (*RelayMsgs, error)
- func (st *NaiveStrategy) RelayPackets(src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders, ...) (*RelayMsgs, error)
- func (st *NaiveStrategy) Send(src, dst Chain, msgs *RelayMsgs)
- func (st *NaiveStrategy) SetupRelay(ctx context.Context, src, dst *ProvableChain) error
- func (st *NaiveStrategy) UnrelayedAcknowledgements(src, dst *ProvableChain, sh SyncHeaders, includeRelayedButUnfinalized bool) (*RelayPackets, error)
- func (st *NaiveStrategy) UnrelayedPackets(src, dst *ProvableChain, sh SyncHeaders, includeRelayedButUnfinalized bool) (*RelayPackets, error)
- func (st *NaiveStrategy) UpdateClients(src, dst *ProvableChain, ...) (*RelayMsgs, error)
- type OptimizeRelay
- type PacketInfo
- type PacketInfoList
- type Path
- type PathConfigKey
- type PathEnd
- func (pe *PathEnd) ChanAck(dst *PathEnd, dstChanState *chantypes.QueryChannelResponse, ...) sdk.Msg
- func (pe *PathEnd) ChanCloseConfirm(dstChanState *chantypes.QueryChannelResponse, signer sdk.AccAddress) sdk.Msg
- func (pe *PathEnd) ChanCloseInit(signer sdk.AccAddress) sdk.Msg
- func (pe *PathEnd) ChanConfirm(dstChanState *chantypes.QueryChannelResponse, signer sdk.AccAddress) sdk.Msg
- func (pe *PathEnd) ChanInit(dst *PathEnd, signer sdk.AccAddress) sdk.Msg
- func (pe *PathEnd) ChanTry(dst *PathEnd, dstChanState *chantypes.QueryChannelResponse, ...) sdk.Msg
- func (pe *PathEnd) ChanUpgradeAck(counterpartyChan *chantypes.QueryChannelResponse, ...) sdk.Msg
- func (pe *PathEnd) ChanUpgradeCancel(counterpartyChanUpgErr *chantypes.QueryUpgradeErrorResponse, ...) sdk.Msg
- func (pe *PathEnd) ChanUpgradeConfirm(counterpartyChan *chantypes.QueryChannelResponse, ...) sdk.Msg
- func (pe *PathEnd) ChanUpgradeInit(upgradeFields chantypes.UpgradeFields, signer sdk.AccAddress) sdk.Msg
- func (pe *PathEnd) ChanUpgradeOpen(counterpartyChan *chantypes.QueryChannelResponse, signer sdk.AccAddress) sdk.Msg
- func (pe *PathEnd) ChanUpgradeTimeout(counterpartyChan *chantypes.QueryChannelResponse, signer sdk.AccAddress) sdk.Msg
- func (pe *PathEnd) ChanUpgradeTry(newConnectionID string, counterpartyChan *chantypes.QueryChannelResponse, ...) sdk.Msg
- func (pe *PathEnd) ConnAck(dst *PathEnd, dstClientState *clienttypes.QueryClientStateResponse, ...) sdk.Msg
- func (pe *PathEnd) ConnConfirm(dstConnState *conntypes.QueryConnectionResponse, signer sdk.AccAddress) sdk.Msg
- func (pe *PathEnd) ConnInit(dst *PathEnd, signer sdk.AccAddress) sdk.Msg
- func (pe *PathEnd) ConnTry(dst *PathEnd, dstClientState *clienttypes.QueryClientStateResponse, ...) sdk.Msg
- func (pe *PathEnd) GetOrder() chantypes.Order
- func (pe *PathEnd) MsgTransfer(dst *PathEnd, amount sdk.Coin, dstAddr string, signer sdk.AccAddress, ...) sdk.Msg
- func (pe *PathEnd) NewPacket(dst *PathEnd, sequence uint64, packetData []byte, ...) chantypes.Packet
- func (pe PathEnd) String() string
- func (pe *PathEnd) UpdateClient(dstHeader Header, signer sdk.AccAddress) sdk.Msg
- func (pe *PathEnd) UpdateClients(dstHeaders []Header, signer sdk.AccAddress) []sdk.Msg
- func (pe *PathEnd) Validate() error
- func (pe *PathEnd) Vchan() error
- func (pe *PathEnd) Vclient() error
- func (pe *PathEnd) Vconn() error
- func (pe *PathEnd) Vport() error
- func (pe *PathEnd) Vversion() error
- type Paths
- type ProvableChain
- type Prover
- type ProverConfig
- type QueryContext
- type RelayMsgs
- type RelayPackets
- type RelayService
- type StateProver
- type StrategyCfg
- type StrategyI
- type SyncHeaders
- type UpgradeAction
- type UpgradeState
Constants ¶
const ( // TODO make it to be configurable DefaultDelayPeriod uint64 = 0 )
Variables ¶
var (
DefaultChainPrefix = commitmenttypes.NewMerklePrefix([]byte("ibc"))
)
Functions ¶
func CancelChannelUpgrade ¶ added in v0.5.8
func CancelChannelUpgrade(chain, cp *ProvableChain, settlementInterval time.Duration) error
CancelChannelUpgrade executes chanUpgradeCancel on `chain`.
func CreateChannel ¶
func CreateChannel(pathName string, src, dst *ProvableChain, to time.Duration) error
CreateChannel runs the channel creation messages on timeout until they pass TODO: add max retries or something to this function
func CreateClients ¶
func CreateClients(pathName string, src, dst *ProvableChain, srcHeight, dstHeight exported.Height) error
func CreateConnection ¶
func CreateConnection(pathName string, src, dst *ProvableChain, to time.Duration) error
func ExecuteChannelUpgrade ¶ added in v0.5.8
func ExecuteChannelUpgrade(pathName string, src, dst *ProvableChain, interval time.Duration, targetSrcState, targetDstState UpgradeState) error
ExecuteChannelUpgrade carries out channel upgrade handshake until both chains transition to the OPEN state. This function repeatedly checks the states of both chains and decides the next action.
func GetChainLogger ¶ added in v0.4.9
func GetChainLogger(chain ChainInfo) *log.RelayLogger
func GetChainPairLogger ¶ added in v0.4.7
func GetChainPairLogger(src, dst ChainInfo) *log.RelayLogger
func GetChannelLogger ¶ added in v0.4.7
func GetChannelLogger(c Chain) *log.RelayLogger
func GetChannelPairLogger ¶ added in v0.4.7
func GetChannelPairLogger(src, dst Chain) *log.RelayLogger
func GetClientPairLogger ¶ added in v0.4.7
func GetClientPairLogger(src, dst Chain) *log.RelayLogger
func GetConnectionPairLogger ¶ added in v0.4.7
func GetConnectionPairLogger(src, dst Chain) *log.RelayLogger
func GetPacketsFromEvents ¶
func InitChannelUpgrade ¶ added in v0.5.8
func InitChannelUpgrade(chain, cp *ProvableChain, upgradeFields chantypes.UpgradeFields, permitUnsafe bool) error
InitChannelUpgrade builds `MsgChannelUpgradeInit` based on the specified UpgradeFields and sends it to the specified chain.
func MakeCodec ¶ added in v0.1.1
func MakeCodec() codec.ProtoCodecMarshaler
func OrderFromString ¶
OrderFromString parses a string into a channel order byte
func QueryChannelPair ¶
func QueryChannelPair(srcCtx, dstCtx QueryContext, src, dst interface { Chain StateProver }, prove bool) (srcChan, dstChan *chantypes.QueryChannelResponse, err error)
QueryChannelPair returns a pair of channel responses
func QueryChannelUpgradeError ¶ added in v0.5.8
func QueryChannelUpgradeError(ctx QueryContext, chain interface { Chain StateProver }, prove bool) (*chantypes.QueryUpgradeErrorResponse, error)
func QueryChannelUpgradePair ¶ added in v0.5.8
func QueryChannelUpgradePair(srcCtx, dstCtx QueryContext, src, dst interface { Chain StateProver }, prove bool) (srcChanUpg, dstChanUpg *chantypes.QueryUpgradeResponse, err error)
func QueryClientConsensusStatePair ¶
func QueryClientConsensusStatePair( srcCtx, dstCtx QueryContext, src, dst interface { Chain StateProver }, srcClientConsH, dstClientConsH ibcexported.Height, prove bool, ) (srcCsRes, dstCsRes *clienttypes.QueryConsensusStateResponse, err error)
QueryClientConsensusStatePair allows for the querying of multiple client states at the same time
func QueryClientStatePair ¶
func QueryClientStatePair( srcCtx, dstCtx QueryContext, src, dst interface { Chain StateProver }, prove bool, ) (srcCsRes, dstCsRes *clienttypes.QueryClientStateResponse, err error)
QueryClientStatePair returns a pair of connection responses
func QueryConnectionPair ¶
func QueryConnectionPair( srcCtx, dstCtx QueryContext, src, dst interface { Chain StateProver }, prove bool, ) (srcConn, dstConn *conntypes.QueryConnectionResponse, err error)
QueryConnectionPair returns a pair of connection responses
func SendTransferMsg ¶
func SetCoreConfig ¶ added in v0.4.23
func SetCoreConfig(c ConfigI)
func StartService ¶ added in v0.1.1
func StartService( ctx context.Context, st StrategyI, src, dst *ProvableChain, relayInterval, srcRelayOptimizeInterval time.Duration, srcRelayOptimizeCount uint64, dstRelayOptimizaInterval time.Duration, dstRelayOptimizeCount uint64, ) error
StartService starts a relay service
func SyncChainConfigFromEvents ¶ added in v0.4.23
func SyncChainConfigFromEvents(pathName string, msgIDs []MsgID, chain *ProvableChain) error
func SyncChainConfigsFromEvents ¶ added in v0.4.23
func SyncChainConfigsFromEvents(pathName string, msgIDsSrc, msgIDsDst []MsgID, src, dst *ProvableChain) error
func UpdateClients ¶ added in v0.1.1
func UpdateClients(src, dst *ProvableChain) error
Types ¶
type Chain ¶ added in v0.3.1
type Chain interface { // GetAddress returns the address of relayer GetAddress() (sdk.AccAddress, error) // Codec returns the codec Codec() codec.ProtoCodecMarshaler // Path returns the path Path() *PathEnd // Init initializes the chain Init(homePath string, timeout time.Duration, codec codec.ProtoCodecMarshaler, debug bool) error // SetRelayInfo sets source's path and counterparty's info to the chain SetRelayInfo(path *PathEnd, counterparty *ProvableChain, counterpartyPath *PathEnd) error // SetupForRelay performs chain-specific setup before starting the relay SetupForRelay(ctx context.Context) error // SendMsgs sends msgs to the chain and waits for them to be included in blocks. // This function returns err=nil only if all the msgs executed successfully at the blocks. // It should be noted that the block is not finalized at that point and can be reverted afterwards. SendMsgs(msgs []sdk.Msg) ([]MsgID, error) // GetMsgResult returns the execution result of `sdk.Msg` specified by `MsgID` // If the msg is not included in any block, this function waits for inclusion. GetMsgResult(id MsgID) (MsgResult, error) // RegisterMsgEventListener registers a given EventListener to the chain RegisterMsgEventListener(MsgEventListener) ChainInfo IBCQuerier ICS20Querier }
Chain represents a chain that supports sending transactions and querying the state
type ChainConfig ¶ added in v0.3.1
ChainConfig defines a chain configuration and its builder
type ChainInfo ¶ added in v0.3.1
type ChainInfo interface { // ChainID returns ID of the chain ChainID() string // LatestHeight returns the latest height of the chain // // NOTE: The returned height does not have to be finalized. // If a finalized height/header is required, the `Prover`'s `GetLatestFinalizedHeader` function should be called instead. LatestHeight() (ibcexported.Height, error) // Timestamp returns the block timestamp Timestamp(ibcexported.Height) (time.Time, error) // AverageBlockTime returns the average time required for each new block to be committed AverageBlockTime() time.Duration }
ChainInfo is an interface to the chain's general information
type ChainInfoICS02Querier ¶ added in v0.3.1
type ChainInfoICS02Querier interface { ChainInfo ICS02Querier }
ChainInfoICS02Querier is ChainInfo + ICS02Querier
type ChainInfoLightClient ¶ added in v0.3.1
type ChainInfoLightClient interface { ChainInfo LightClient }
ChainInfoLightClient = ChainInfo + LightClient
type ChainLightClient ¶ added in v0.4.17
type ChainLightClient interface { Chain LightClient }
ChainLightClient = Chain + LightClient
type ChainProverConfig ¶ added in v0.1.1
type ChainProverConfig struct { Chain json.RawMessage `json:"chain" yaml:"chain"` // NOTE: it's any type as json format Prover json.RawMessage `json:"prover" yaml:"prover"` // contains filtered or unexported fields }
ChainProverConfig defines the top level configuration for a chain instance
func NewChainProverConfig ¶ added in v0.1.1
func NewChainProverConfig(m codec.JSONCodec, chain ChainConfig, client ProverConfig) (*ChainProverConfig, error)
NewChainProverConfig returns a new config instance
func (ChainProverConfig) Build ¶ added in v0.1.1
func (cc ChainProverConfig) Build() (*ProvableChain, error)
Build returns a new ProvableChain instance
func (ChainProverConfig) GetChainConfig ¶ added in v0.1.1
func (cc ChainProverConfig) GetChainConfig() (ChainConfig, error)
GetChainConfig returns the cached ChainConfig instance
func (ChainProverConfig) GetProverConfig ¶ added in v0.1.1
func (cc ChainProverConfig) GetProverConfig() (ProverConfig, error)
GetProverConfig returns the cached ChainProverConfig instance
type ConfigI ¶ added in v0.4.23
type ConfigI interface {
UpdatePathConfig(pathName string, chainID string, kv map[PathConfigKey]string) error
}
type EventAcknowledgePacket ¶ added in v0.4.9
type EventAcknowledgePacket struct { Sequence uint64 SrcPort string SrcChannel string TimeoutHeight clienttypes.Height TimeoutTimestamp time.Time // contains filtered or unexported fields }
EventAcknowledgePacket is an implementation of `MsgEventLog` that represents the information of a `acknowledgePacket` operation.
type EventGenerateChannelIdentifier ¶ added in v0.4.9
type EventGenerateChannelIdentifier struct { ID string // contains filtered or unexported fields }
EventGenerateChannelIdentifier is an implementation of `MsgEventLog` that represents the channel id generated by `chanOpenInit` or `chanOpenTry` operation.
type EventGenerateClientIdentifier ¶ added in v0.4.9
type EventGenerateClientIdentifier struct { ID string // contains filtered or unexported fields }
EventGenerateClientIdentifier is an implementation of `MsgEventLog` that represents the client id generated by `createClient` operation.
type EventGenerateConnectionIdentifier ¶ added in v0.4.9
type EventGenerateConnectionIdentifier struct { ID string // contains filtered or unexported fields }
EventGenerateConnectionIdentifier is an implementation of `MsgEventLog` that represents the connection id generated by `connOpenInit` or `connOpenTry` operation.
type EventRecvPacket ¶ added in v0.4.9
type EventRecvPacket struct { Sequence uint64 DstPort string DstChannel string TimeoutHeight clienttypes.Height TimeoutTimestamp time.Time Data []byte // contains filtered or unexported fields }
EventRecvPacket is an implementation of `MsgEventLog` that represents the information of a `recvPacket` operation.
type EventSendPacket ¶ added in v0.4.9
type EventSendPacket struct { Sequence uint64 SrcPort string SrcChannel string TimeoutHeight clienttypes.Height TimeoutTimestamp time.Time Data []byte // contains filtered or unexported fields }
EventSendPacket is an implementation of `MsgEventLog` that represents the information of a `sendPacket` operation.
type EventUnknown ¶ added in v0.4.9
type EventUnknown struct { Value any // contains filtered or unexported fields }
EventUnknown is an implementation of `MsgEventLog` that represents another event.
type EventUpgradeChannel ¶ added in v0.5.8
type EventUpgradeChannel struct { PortID string ChannelID string UpgradeSequence uint64 // contains filtered or unexported fields }
EventUpgradeChannel is an implementation of `MsgEventLog` that notifies the completion of a channel upgrade
type EventWriteAcknowledgement ¶ added in v0.4.9
type EventWriteAcknowledgement struct { Sequence uint64 DstPort string DstChannel string Acknowledgement []byte // contains filtered or unexported fields }
EventWriteAcknowledgement is an implementation of `MsgEventLog` that represents the information of a `writeAcknowledgement` operation.
type FinalityAware ¶ added in v0.4.17
type FinalityAware interface { // GetLatestFinalizedHeader returns the latest finalized header on this chain // The returned header is expected to be the latest one of headers that can be verified by the light client GetLatestFinalizedHeader() (latestFinalizedHeader Header, err error) }
FinalityAware provides the capability to determine the finality of the chain
type FinalityAwareChain ¶ added in v0.4.17
type FinalityAwareChain interface { FinalityAware Chain }
FinalityAwareChain is FinalityAware + Chain
type Header ¶ added in v0.3.1
type Header interface { exported.ClientMessage GetHeight() exported.Height }
type IBCQuerier ¶ added in v0.3.1
type IBCQuerier interface { ICS02Querier ICS03Querier ICS04Querier }
IBCQuerier is an interface to the state of IBC
type ICS02Querier ¶ added in v0.3.1
type ICS02Querier interface { // QueryClientConsensusState retrevies the latest consensus state for a client in state at a given height QueryClientConsensusState(ctx QueryContext, dstClientConsHeight ibcexported.Height) (*clienttypes.QueryConsensusStateResponse, error) // QueryClientState returns the client state of dst chain // height represents the height of dst chain QueryClientState(ctx QueryContext) (*clienttypes.QueryClientStateResponse, error) }
ICS02Querier is an interface to the state of ICS-02
type ICS03Querier ¶ added in v0.3.1
type ICS03Querier interface { // QueryConnection returns the remote end of a given connection QueryConnection(ctx QueryContext, connectionID string) (*conntypes.QueryConnectionResponse, error) }
ICS03Querier is an interface to the state of ICS-03
type ICS04Querier ¶ added in v0.3.1
type ICS04Querier interface { // QueryChannel returns the channel associated with a channelID QueryChannel(ctx QueryContext) (chanRes *chantypes.QueryChannelResponse, err error) // QueryUnreceivedPackets returns a list of unrelayed packet commitments QueryUnreceivedPackets(ctx QueryContext, seqs []uint64) ([]uint64, error) // QueryUnfinalizedRelayedPackets returns packets and heights that are sent but not received at the latest finalized block on the counterparty chain QueryUnfinalizedRelayPackets(ctx QueryContext, counterparty LightClientICS04Querier) (PacketInfoList, error) // QueryUnreceivedAcknowledgements returns a list of unrelayed packet acks QueryUnreceivedAcknowledgements(ctx QueryContext, seqs []uint64) ([]uint64, error) // QueryUnfinalizedRelayedAcknowledgements returns acks and heights that are sent but not received at the latest finalized block on the counterpartychain QueryUnfinalizedRelayAcknowledgements(ctx QueryContext, counterparty LightClientICS04Querier) (PacketInfoList, error) // QueryChannelUpgrade returns the channel upgrade associated with a channelID QueryChannelUpgrade(ctx QueryContext) (*chantypes.QueryUpgradeResponse, error) // QueryChannelUpgradeError returns the channel upgrade error receipt associated with a channelID at the height of `ctx`. // WARN: This error receipt may not be used to cancel upgrade in FLUSHCOMPLETE state because of upgrade sequence mismatch. QueryChannelUpgradeError(ctx QueryContext) (*chantypes.QueryUpgradeErrorResponse, error) // QueryCanTransitionToFlushComplete returns the channel can transition to FLUSHCOMPLETE state. // Basically it requires that there remains no inflight packets. // Maybe additional condition for transition is required by the IBC/APP module. QueryCanTransitionToFlushComplete(ctx QueryContext) (bool, error) }
ICS04Querier is an interface to the state of ICS-04
type ICS20Querier ¶ added in v0.3.1
type ICS20Querier interface { // QueryBalance returns the amount of coins in the relayer account QueryBalance(ctx QueryContext, address sdk.AccAddress) (sdk.Coins, error) // QueryDenomTraces returns all the denom traces from a given chain QueryDenomTraces(ctx QueryContext, offset, limit uint64) (*transfertypes.QueryDenomTracesResponse, error) }
ICS20Querier is an interface to the state of ICS-20
type LightClient ¶ added in v0.3.1
type LightClient interface { FinalityAware // CreateInitialLightClientState returns a pair of ClientState and ConsensusState based on the state of the self chain at `height`. // These states will be submitted to the counterparty chain as MsgCreateClient. // If `height` is nil, the latest finalized height is selected automatically. CreateInitialLightClientState(height exported.Height) (exported.ClientState, exported.ConsensusState, error) // SetupHeadersForUpdate returns the finalized header and any intermediate headers needed to apply it to the client on the counterpaty chain // The order of the returned header slice should be as: [<intermediate headers>..., <update header>] // if the header slice's length == 0 and err == nil, the relayer should skips the update-client SetupHeadersForUpdate(counterparty FinalityAwareChain, latestFinalizedHeader Header) ([]Header, error) // CheckRefreshRequired returns if the on-chain light client needs to be updated. // For example, this requirement arises due to the trusting period mechanism. CheckRefreshRequired(counterparty ChainInfoICS02Querier) (bool, error) }
LightClient provides functions for creating and updating on-chain light clients on the counterparty chain
type LightClientICS04Querier ¶ added in v0.4.2
type LightClientICS04Querier interface { LightClient ICS04Querier }
type MsgEventListener ¶ added in v0.1.2
type MsgEventListener interface { // OnSentMsg is a callback functoin that is called when a msg send to the chain OnSentMsg(msgs []sdk.Msg) error }
MsgEventListener is a listener that listens a msg send to the chain
type MsgEventLog ¶ added in v0.4.9
type MsgEventLog interface {
// contains filtered or unexported methods
}
MsgEventLog represents an event emitted by `sdk.Msg` that has been sent to a chain by `Chain::SendMsgs`.
type MsgID ¶ added in v0.4.9
MsgID represents an identifier of `sdk.Msg` that has been sent to a chain by `Chain::SendMsgs`.
type MsgResult ¶ added in v0.4.9
type MsgResult interface { // BlockHeight returns the height that the message is included. BlockHeight() clienttypes.Height // Status returns true if the execution of the message is successful. // If it fails, this function returns false with the second return value that provides additional information. Status() (bool, string) // Events returns events emitted by the message. Events() []MsgEventLog }
MsgResult represents a execution result of `sdk.Msg` that has been sent to a chain by `Chain::SendMsgs`.
func GetFinalizedMsgResult ¶ added in v0.4.9
func GetFinalizedMsgResult(chain ProvableChain, msgID MsgID) (MsgResult, error)
GetFinalizedMsgResult is an utility function that waits for the finalization of the message execution and then returns the result.
type NaiveStrategy ¶
type NaiveStrategy struct { Ordered bool MaxTxSize uint64 // maximum permitted size of the msgs in a bundled relay transaction MaxMsgLength uint64 // maximum amount of messages in a bundled relay transaction // contains filtered or unexported fields }
NaiveStrategy is an implementation of Strategy.
func NewNaiveStrategy ¶
func NewNaiveStrategy(srcNoAck, dstNoAck bool) *NaiveStrategy
func (*NaiveStrategy) GetType ¶
func (st *NaiveStrategy) GetType() string
GetType implements Strategy
func (*NaiveStrategy) RelayAcknowledgements ¶
func (st *NaiveStrategy) RelayAcknowledgements(src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders, doExecuteAckSrc, doExecuteAckDst bool) (*RelayMsgs, error)
func (*NaiveStrategy) RelayPackets ¶
func (st *NaiveStrategy) RelayPackets(src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders, doExecuteRelaySrc, doExecuteRelayDst bool) (*RelayMsgs, error)
func (*NaiveStrategy) Send ¶ added in v0.4.15
func (st *NaiveStrategy) Send(src, dst Chain, msgs *RelayMsgs)
func (*NaiveStrategy) SetupRelay ¶ added in v0.1.2
func (st *NaiveStrategy) SetupRelay(ctx context.Context, src, dst *ProvableChain) error
func (*NaiveStrategy) UnrelayedAcknowledgements ¶
func (st *NaiveStrategy) UnrelayedAcknowledgements(src, dst *ProvableChain, sh SyncHeaders, includeRelayedButUnfinalized bool) (*RelayPackets, error)
func (*NaiveStrategy) UnrelayedPackets ¶ added in v0.4.2
func (st *NaiveStrategy) UnrelayedPackets(src, dst *ProvableChain, sh SyncHeaders, includeRelayedButUnfinalized bool) (*RelayPackets, error)
func (*NaiveStrategy) UpdateClients ¶ added in v0.4.15
func (st *NaiveStrategy) UpdateClients(src, dst *ProvableChain, doExecuteRelaySrc, doExecuteRelayDst, doExecuteAckSrc, doExecuteAckDst bool, sh SyncHeaders, doRefresh bool) (*RelayMsgs, error)
type OptimizeRelay ¶ added in v0.4.25
type OptimizeRelay struct {
// contains filtered or unexported fields
}
type PacketInfo ¶ added in v0.4.2
type PacketInfo struct { chantypes.Packet Acknowledgement []byte `json:"acknowledgement"` EventHeight clienttypes.Height `json:"event_height"` }
PacketInfo represents the packet information that is acquired from a SendPacket event or a pair of RecvPacket/WriteAcknowledgement events. In the former case, the `Acknowledgement` field becomes nil. In the latter case, `EventHeight` represents the height in which the underlying `RecvPacket` event occurs.
type PacketInfoList ¶ added in v0.4.2
type PacketInfoList []*PacketInfo
PacketInfoList represents a list of PacketInfo that is sorted in the order in which underlying events (SendPacket and RecvPacket) occur.
func (PacketInfoList) ExtractSequenceList ¶ added in v0.4.2
func (ps PacketInfoList) ExtractSequenceList() []uint64
func (PacketInfoList) Filter ¶ added in v0.4.2
func (ps PacketInfoList) Filter(seqs []uint64) PacketInfoList
func (PacketInfoList) Subtract ¶ added in v0.4.6
func (ps PacketInfoList) Subtract(seqs []uint64) PacketInfoList
type Path ¶
type Path struct { Src *PathEnd `yaml:"src" json:"src"` Dst *PathEnd `yaml:"dst" json:"dst"` Strategy *StrategyCfg `yaml:"strategy" json:"strategy"` }
Path represents a pair of chains and the identifiers needed to relay over them
func (*Path) ValidateStrategy ¶ added in v0.4.4
ValidateStrategy validates that the strategy of path `p` is valid
type PathConfigKey ¶ added in v0.5.8
type PathConfigKey string
const ( PathConfigClientID PathConfigKey = "client-id" PathConfigConnectionID PathConfigKey = "connection-id" PathConfigChannelID PathConfigKey = "channel-id" PathConfigOrder PathConfigKey = "order" PathConfigVersion PathConfigKey = "version" )
type PathEnd ¶
type PathEnd struct { ChainID string `yaml:"chain-id,omitempty" json:"chain-id,omitempty"` ClientID string `yaml:"client-id,omitempty" json:"client-id,omitempty"` ConnectionID string `yaml:"connection-id,omitempty" json:"connection-id,omitempty"` ChannelID string `yaml:"channel-id,omitempty" json:"channel-id,omitempty"` PortID string `yaml:"port-id,omitempty" json:"port-id,omitempty"` Order string `yaml:"order,omitempty" json:"order,omitempty"` Version string `yaml:"version,omitempty" json:"version,omitempty"` }
PathEnd represents the local connection identifers for a relay path The path is set on the chain before performing operations
func (*PathEnd) ChanAck ¶
func (pe *PathEnd) ChanAck(dst *PathEnd, dstChanState *chantypes.QueryChannelResponse, signer sdk.AccAddress) sdk.Msg
ChanAck creates a MsgChannelOpenAck
func (*PathEnd) ChanCloseConfirm ¶
func (pe *PathEnd) ChanCloseConfirm(dstChanState *chantypes.QueryChannelResponse, signer sdk.AccAddress) sdk.Msg
ChanCloseConfirm creates a MsgChannelCloseConfirm
func (*PathEnd) ChanCloseInit ¶
func (pe *PathEnd) ChanCloseInit(signer sdk.AccAddress) sdk.Msg
ChanCloseInit creates a MsgChannelCloseInit
func (*PathEnd) ChanConfirm ¶
func (pe *PathEnd) ChanConfirm(dstChanState *chantypes.QueryChannelResponse, signer sdk.AccAddress) sdk.Msg
ChanConfirm creates a MsgChannelOpenConfirm
func (*PathEnd) ChanTry ¶
func (pe *PathEnd) ChanTry(dst *PathEnd, dstChanState *chantypes.QueryChannelResponse, signer sdk.AccAddress) sdk.Msg
ChanTry creates a MsgChannelOpenTry
func (*PathEnd) ChanUpgradeAck ¶ added in v0.5.8
func (pe *PathEnd) ChanUpgradeAck( counterpartyChan *chantypes.QueryChannelResponse, counterpartyUpg *chantypes.QueryUpgradeResponse, signer sdk.AccAddress, ) sdk.Msg
ChanUpgradeAck creates a MsgChannelUpgradeAck
func (*PathEnd) ChanUpgradeCancel ¶ added in v0.5.8
func (pe *PathEnd) ChanUpgradeCancel( counterpartyChanUpgErr *chantypes.QueryUpgradeErrorResponse, signer sdk.AccAddress, ) sdk.Msg
ChanUpgradeCancel creates a MsgChannelUpgradeCancel
func (*PathEnd) ChanUpgradeConfirm ¶ added in v0.5.8
func (pe *PathEnd) ChanUpgradeConfirm( counterpartyChan *chantypes.QueryChannelResponse, counterpartyUpg *chantypes.QueryUpgradeResponse, signer sdk.AccAddress, ) sdk.Msg
ChanUpgradeConfirm creates a MsgChannelUpgradeConfirm
func (*PathEnd) ChanUpgradeInit ¶ added in v0.5.8
func (pe *PathEnd) ChanUpgradeInit(upgradeFields chantypes.UpgradeFields, signer sdk.AccAddress) sdk.Msg
ChanUpgradeInit creates a MsgChannelUpgradeInit
func (*PathEnd) ChanUpgradeOpen ¶ added in v0.5.8
func (pe *PathEnd) ChanUpgradeOpen( counterpartyChan *chantypes.QueryChannelResponse, signer sdk.AccAddress, ) sdk.Msg
ChanUpgradeOpen creates a MsgChannelUpgradeOpen
func (*PathEnd) ChanUpgradeTimeout ¶ added in v0.5.8
func (pe *PathEnd) ChanUpgradeTimeout( counterpartyChan *chantypes.QueryChannelResponse, signer sdk.AccAddress, ) sdk.Msg
ChanUpgradeTimeout creates a MsgChannelUpgradeTimeout
func (*PathEnd) ChanUpgradeTry ¶ added in v0.5.8
func (pe *PathEnd) ChanUpgradeTry( newConnectionID string, counterpartyChan *chantypes.QueryChannelResponse, counterpartyUpg *chantypes.QueryUpgradeResponse, signer sdk.AccAddress, ) sdk.Msg
ChanUpgradeTry creates a MsgChannelUpgradeTry
func (*PathEnd) ConnAck ¶
func (pe *PathEnd) ConnAck( dst *PathEnd, dstClientState *clienttypes.QueryClientStateResponse, dstConnState *conntypes.QueryConnectionResponse, dstConsState *clienttypes.QueryConsensusStateResponse, hostConsensusStateProof []byte, signer sdk.AccAddress, ) sdk.Msg
ConnAck creates a MsgConnectionOpenAck NOTE: ADD NOTE ABOUT PROOF HEIGHT CHANGE HERE
func (*PathEnd) ConnConfirm ¶
func (pe *PathEnd) ConnConfirm(dstConnState *conntypes.QueryConnectionResponse, signer sdk.AccAddress) sdk.Msg
ConnConfirm creates a MsgConnectionOpenAck NOTE: ADD NOTE ABOUT PROOF HEIGHT CHANGE HERE
func (*PathEnd) ConnTry ¶
func (pe *PathEnd) ConnTry( dst *PathEnd, dstClientState *clienttypes.QueryClientStateResponse, dstConnState *conntypes.QueryConnectionResponse, dstConsState *clienttypes.QueryConsensusStateResponse, hostConsensusStateProof []byte, signer sdk.AccAddress, ) sdk.Msg
ConnTry creates a MsgConnectionOpenTry NOTE: ADD NOTE ABOUT PROOF HEIGHT CHANGE HERE
func (*PathEnd) MsgTransfer ¶
func (pe *PathEnd) MsgTransfer(dst *PathEnd, amount sdk.Coin, dstAddr string, signer sdk.AccAddress, timeoutHeight, timeoutTimestamp uint64, memo string) sdk.Msg
MsgTransfer creates a new transfer message
func (*PathEnd) NewPacket ¶
func (pe *PathEnd) NewPacket(dst *PathEnd, sequence uint64, packetData []byte, timeoutHeight, timeoutStamp uint64) chantypes.Packet
NewPacket returns a new packet from src to dist w
func (*PathEnd) UpdateClient ¶
UpdateClient creates an sdk.Msg to update the client on src with data pulled from dst
func (*PathEnd) UpdateClients ¶ added in v0.3.1
func (*PathEnd) Validate ¶
Validate returns errors about invalid identifiers as well as unset path variables for the appropriate type
type Paths ¶
Paths represent connection paths between chains
func (Paths) AddForce ¶
AddForce ignores existing paths and overwrites an existing path with that name
type ProvableChain ¶ added in v0.1.1
ProvableChain represents a chain that is supported by the relayer
func NewProvableChain ¶ added in v0.1.1
func NewProvableChain(chain Chain, prover Prover) *ProvableChain
NewProvableChain returns a new ProvableChain instance
func (*ProvableChain) Init ¶ added in v0.1.2
func (pc *ProvableChain) Init(homePath string, timeout time.Duration, codec codec.ProtoCodecMarshaler, debug bool) error
func (*ProvableChain) SetRelayInfo ¶ added in v0.1.2
func (pc *ProvableChain) SetRelayInfo(path *PathEnd, counterparty *ProvableChain, counterpartyPath *PathEnd) error
func (*ProvableChain) SetupForRelay ¶ added in v0.1.2
func (pc *ProvableChain) SetupForRelay(ctx context.Context) error
type Prover ¶ added in v0.3.1
type Prover interface { // Init initializes the chain Init(homePath string, timeout time.Duration, codec codec.ProtoCodecMarshaler, debug bool) error // SetRelayInfo sets source's path and counterparty's info to the chain SetRelayInfo(path *PathEnd, counterparty *ProvableChain, counterpartyPath *PathEnd) error // SetupForRelay performs chain-specific setup before starting the relay SetupForRelay(ctx context.Context) error LightClient StateProver }
Prover represents a prover that supports generating a commitment proof
type ProverConfig ¶ added in v0.3.1
ProverConfig defines a prover configuration and its builder
type QueryContext ¶ added in v0.3.1
type QueryContext interface { // Context returns `context.Context“ Context() context.Context // Height returns a height of the target chain for querying a state Height() ibcexported.Height }
QueryContext is a context that contains a height of the target chain for querying states
func NewQueryContext ¶ added in v0.3.1
func NewQueryContext(ctx context.Context, height ibcexported.Height) QueryContext
NewQueryContext returns a new context for querying states
type RelayMsgs ¶
type RelayMsgs struct { Src []sdk.Msg `json:"src"` Dst []sdk.Msg `json:"dst"` MaxTxSize uint64 `json:"max_tx_size"` // maximum permitted size of the msgs in a bundled relay transaction MaxMsgLength uint64 `json:"max_msg_length"` // maximum amount of messages in a bundled relay transaction Last bool `json:"last"` Succeeded bool `json:"success"` SrcMsgIDs []MsgID `json:"src_msg_ids"` DstMsgIDs []MsgID `json:"dst_msg_ids"` }
RelayMsgs contains the msgs that need to be sent to both a src and dst chain after a given relay round. MaxTxSize and MaxMsgLength are ignored if they are set to zero.
func NewRelayMsgs ¶
func NewRelayMsgs() *RelayMsgs
NewRelayMsgs returns an initialized version of relay messages
type RelayPackets ¶ added in v0.4.2
type RelayPackets struct { Src PacketInfoList `json:"src"` Dst PacketInfoList `json:"dst"` }
RelayPackets represents unrelayed packets on src and dst
type RelayService ¶ added in v0.1.1
type RelayService struct {
// contains filtered or unexported fields
}
func NewRelayService ¶ added in v0.1.1
func NewRelayService( st StrategyI, src, dst *ProvableChain, sh SyncHeaders, interval, srcOptimizeInterval time.Duration, srcOptimizeCount uint64, dstOptimizeInterval time.Duration, dstOptimizeCount uint64, ) *RelayService
NewRelayService returns a new service
type StateProver ¶ added in v0.4.2
type StateProver interface { // ProveState returns a proof of an IBC state specified by `path` and `value` ProveState(ctx QueryContext, path string, value []byte) (proof []byte, proofHeight clienttypes.Height, err error) // ProveHostConsensusState returns an existence proof of the consensus state at `height` // This proof would be ignored in ibc-go, but it is required to `getSelfConsensusState` of ibc-solidity. ProveHostConsensusState(ctx QueryContext, height exported.Height, consensusState exported.ConsensusState) (proof []byte, err error) }
StateProver provides a generic way to generate existence proof of IBC states (e.g. ClientState, Connection, PacketCommitment, etc.)
type StrategyCfg ¶
type StrategyCfg struct { Type string `json:"type" yaml:"type"` // If set, executions of acknowledgePacket are always skipped on the src chain. // Also `UnrelayedAcknowledgements` returns zero packets for the src chain. SrcNoack bool `json:"src-noack" yaml:"src-noack"` // If set, executions of acknowledgePacket are always skipped on the dst chain // Also `UnrelayedAcknowledgements` returns zero packets for the dst chain. DstNoack bool `json:"dst-noack" yaml:"dst-noack"` }
StrategyCfg defines which relaying strategy to take for a given path
type StrategyI ¶
type StrategyI interface { // GetType returns the type of the strategy GetType() string // SetupRelay performs chain-specific setup for `src` and `dst` before starting the relay SetupRelay(ctx context.Context, src, dst *ProvableChain) error // UnrelayedPackets returns packets to execute RecvPacket to on `src` and `dst`. // `includeRelayedButUnfinalized` decides if the result includes packets of which recvPacket has been executed but not finalized UnrelayedPackets(src, dst *ProvableChain, sh SyncHeaders, includeRelayedButUnfinalized bool) (*RelayPackets, error) // RelayPackets executes RecvPacket to the packets contained in `rp` on both chains (`src` and `dst`). RelayPackets(src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders, doExecuteRelaySrc, doExecuteRelayDst bool) (*RelayMsgs, error) // UnrelayedAcknowledgements returns packets to execute AcknowledgePacket to on `src` and `dst`. // `includeRelayedButUnfinalized` decides if the result includes packets of which acknowledgePacket has been executed but not finalized UnrelayedAcknowledgements(src, dst *ProvableChain, sh SyncHeaders, includeRelayedButUnfinalized bool) (*RelayPackets, error) // RelayAcknowledgements executes AcknowledgePacket to the packets contained in `rp` on both chains (`src` and `dst`). RelayAcknowledgements(src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders, doExecuteAckSrc, doExecuteAckDst bool) (*RelayMsgs, error) // UpdateClients executes UpdateClient only if needed UpdateClients(src, dst *ProvableChain, doExecuteRelaySrc, doExecuteRelayDst, doExecuteAckSrc, doExecuteAckDst bool, sh SyncHeaders, doRefresh bool) (*RelayMsgs, error) // Send executes submission of msgs to src/dst chains Send(src, dst Chain, msgs *RelayMsgs) }
StrategyI defines
func GetStrategy ¶
func GetStrategy(cfg StrategyCfg) (StrategyI, error)
type SyncHeaders ¶ added in v0.3.1
type SyncHeaders interface { // Updates updates the headers on both chains Updates(src, dst ChainInfoLightClient) error // GetLatestFinalizedHeader returns the latest finalized header of the chain GetLatestFinalizedHeader(chainID string) Header // GetQueryContext builds a query context based on the latest finalized header GetQueryContext(chainID string) QueryContext // SetupHeadersForUpdate returns `src` chain's headers needed to update the client on `dst` chain SetupHeadersForUpdate(src, dst ChainLightClient) ([]Header, error) // SetupBothHeadersForUpdate returns both `src` and `dst` chain's headers needed to update the clients on each chain SetupBothHeadersForUpdate(src, dst ChainLightClient) (srcHeaders []Header, dstHeaders []Header, err error) }
SyncHeaders manages the latest finalized headers on both `src` and `dst` chains It also provides the helper functions to update the clients on the chains
func NewSyncHeaders ¶
func NewSyncHeaders(src, dst ChainInfoLightClient) (SyncHeaders, error)
NewSyncHeaders returns a new instance of SyncHeaders that can be easily kept "reasonably up to date"
type UpgradeAction ¶ added in v0.5.8
type UpgradeAction int
const ( UPGRADE_ACTION_NONE UpgradeAction = iota UPGRADE_ACTION_TRY UPGRADE_ACTION_ACK UPGRADE_ACTION_CONFIRM UPGRADE_ACTION_OPEN UPGRADE_ACTION_CANCEL UPGRADE_ACTION_CANCEL_FLUSHCOMPLETE UPGRADE_ACTION_TIMEOUT )
func (UpgradeAction) String ¶ added in v0.5.8
func (action UpgradeAction) String() string
type UpgradeState ¶ added in v0.5.8
type UpgradeState int
const ( UPGRADE_STATE_UNINIT UpgradeState = iota UPGRADE_STATE_INIT UPGRADE_STATE_FLUSHING UPGRADE_STATE_FLUSHCOMPLETE )
func NewUpgradeState ¶ added in v0.5.8
func NewUpgradeState(chanState chantypes.State, upgradeExists bool) (UpgradeState, error)
func (UpgradeState) String ¶ added in v0.5.8
func (state UpgradeState) String() string