Documentation ¶
Index ¶
- Constants
- func CreateChannel(src, dst *ProvableChain, ordered bool, to time.Duration) error
- func CreateClients(src, dst *ProvableChain) error
- func CreateConnection(src, dst *ProvableChain, to 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 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 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 RandLowerCaseLetterString(length int) string
- func SendCheckMsgs(chain Chain, msgs []types.Msg) bool
- func SendTransferMsg(src, dst *ProvableChain, amount sdk.Coin, dstAddr string, ...) error
- func StartService(ctx context.Context, st StrategyI, src, dst *ProvableChain, ...) error
- func UpdateClients(src, dst *ProvableChain) error
- type Chain
- type ChainConfig
- type ChainICS02QuerierLightClient
- type ChainInfo
- type ChainInfoICS02Querier
- type ChainInfoLightClient
- type ChainProverConfig
- type EventAcknowledgePacket
- type EventGenerateChannelIdentifier
- type EventGenerateClientIdentifier
- type EventGenerateConnectionIdentifier
- type EventRecvPacket
- type EventSendPacket
- type EventUnknown
- type EventWriteAcknowledgement
- type Header
- type IBCQuerier
- type ICS02Querier
- type ICS03Querier
- type ICS04Querier
- type ICS20Querier
- type IsMsgID
- 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) error
- func (st *NaiveStrategy) RelayPackets(src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders) error
- 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)
- type PacketInfo
- type PacketInfoList
- type Path
- func (p *Path) End(chainID string) *PathEnd
- func (p *Path) GenDstChanID()
- func (p *Path) GenDstClientID()
- func (p *Path) GenDstConnID()
- func (p *Path) GenSrcChanID()
- func (p *Path) GenSrcClientID()
- func (p *Path) GenSrcConnID()
- func (p *Path) MustYAML() string
- func (p *Path) Ordered() bool
- func (p *Path) QueryPathStatus(src, dst *ProvableChain) *PathWithStatus
- func (p *Path) String() string
- func (p *Path) Validate() (err error)
- func (p *Path) ValidateStrategy() error
- 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) 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 PathStatus
- type PathWithStatus
- type Paths
- type ProvableChain
- type Prover
- type ProverConfig
- type QueryContext
- type RelayMsgs
- type RelayPackets
- type RelayService
- type StateProver
- type StrategyCfg
- type StrategyI
- type SyncHeaders
Constants ¶
const ( // TODO make it to be configurable DefaultDelayPeriod uint64 = 0 )
Variables ¶
This section is empty.
Functions ¶
func CreateChannel ¶
func CreateChannel(src, dst *ProvableChain, ordered bool, 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(src, dst *ProvableChain) error
func CreateConnection ¶
func CreateConnection(src, dst *ProvableChain, to time.Duration) error
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 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 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 RandLowerCaseLetterString ¶
RandLowerCaseLetterString returns a lowercase letter string of given length
func SendCheckMsgs ¶ added in v0.4.9
SendCheckMsgs is an utility function that executes `Chain::SendMsgs` and checks the execution results of all the messages.
func SendTransferMsg ¶
func StartService ¶ added in v0.1.1
func StartService(ctx context.Context, st StrategyI, src, dst *ProvableChain, relayInterval time.Duration) error
StartService starts a relay service
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 ChainICS02QuerierLightClient ¶ added in v0.3.1
type ChainICS02QuerierLightClient interface { ChainInfoLightClient ICS02Querier }
ChainICS02QuerierLightClient = ChainInfoLightClient + ICS02Querier
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 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 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 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 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) (*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) }
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 IsMsgID ¶ added in v0.4.9
type IsMsgID struct{}
IsMsgID must be embedded in implementation of the `MsgID` interface. This struct is exported, so each chain module can implement the `MsgID` interface.
type LightClient ¶ added in v0.3.1
type LightClient interface { // CreateMsgCreateClient creates a CreateClientMsg to this chain CreateMsgCreateClient(clientID string, dstHeader Header, signer sdk.AccAddress) (*clienttypes.MsgCreateClient, error) // 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) // 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(dstChain ChainInfoICS02Querier, latestFinalizedHeader Header) ([]Header, 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) error
func (*NaiveStrategy) RelayPackets ¶
func (st *NaiveStrategy) RelayPackets(src, dst *ProvableChain, rp *RelayPackets, sh SyncHeaders) error
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)
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 GenPath ¶
GenPath generates a path with random client, connection and channel identifiers given chainIDs and portIDs
func (*Path) GenDstChanID ¶
func (p *Path) GenDstChanID()
GenDstChanID generates the specififed identifier
func (*Path) GenDstClientID ¶
func (p *Path) GenDstClientID()
GenDstClientID generates the specififed identifier
func (*Path) GenDstConnID ¶
func (p *Path) GenDstConnID()
GenDstConnID generates the specififed identifier
func (*Path) GenSrcChanID ¶
func (p *Path) GenSrcChanID()
GenSrcChanID generates the specififed identifier
func (*Path) GenSrcClientID ¶
func (p *Path) GenSrcClientID()
GenSrcClientID generates the specififed identifier
func (*Path) GenSrcConnID ¶
func (p *Path) GenSrcConnID()
GenSrcConnID generates the specififed identifier
func (*Path) QueryPathStatus ¶
func (p *Path) QueryPathStatus(src, dst *ProvableChain) *PathWithStatus
QueryPathStatus returns an instance of the path struct with some attached data about the current status of the path
func (*Path) ValidateStrategy ¶ added in v0.4.4
ValidateStrategy validates that the strategy of path `p` is valid
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) ConnAck ¶
func (pe *PathEnd) ConnAck( dst *PathEnd, dstClientState *clienttypes.QueryClientStateResponse, dstConnState *conntypes.QueryConnectionResponse, dstConsState *clienttypes.QueryConsensusStateResponse, 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, 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 PathStatus ¶
type PathStatus struct { Chains bool `yaml:"chains" json:"chains"` Clients bool `yaml:"clients" json:"clients"` Connection bool `yaml:"connection" json:"connection"` Channel bool `yaml:"channel" json:"channel"` }
PathStatus holds the status of the primatives in the path
type PathWithStatus ¶
type PathWithStatus struct { Path *Path `yaml:"path" json:"chains"` Status PathStatus `yaml:"status" json:"status"` }
PathWithStatus is used for showing the status of the path
func (*PathWithStatus) PrintString ¶
func (ps *PathWithStatus) PrintString(name string) string
PrintString prints a string representations of the path status
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"` }
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 time.Duration) *RelayService
NewRelayService returns a new service
type StateProver ¶ added in v0.4.2
type StateProver interface {
ProveState(ctx QueryContext, path string, value []byte) (proof []byte, proofHeight clienttypes.Height, 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) 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) error }
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 ChainICS02QuerierLightClient) ([]Header, error) // SetupBothHeadersForUpdate returns both `src` and `dst` chain's headers needed to update the clients on each chain SetupBothHeadersForUpdate(src, dst ChainICS02QuerierLightClient) (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"