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, seq uint64) (*channeltypes.Packet, error)
- func GetPacketAcknowledgementsFromEvents(events []abci.Event) ([]packetAcknowledgement, error)
- func GetPacketsFromEvents(events []abci.Event) ([]channeltypes.Packet, error)
- func MakeCodec() codec.ProtoCodecMarshaler
- func OrderFromString(order string) chantypes.Order
- func QueryChannelPair(src, dst IBCProvableQuerierI, srcH, dstH int64) (srcChan, dstChan *chantypes.QueryChannelResponse, err error)
- func QueryClientConsensusStatePair(src, dst IBCProvableQuerierI, srch, dsth int64, ...) (srcCsRes, dstCsRes *clienttypes.QueryConsensusStateResponse, err error)
- func QueryClientStatePair(src, dst IBCProvableQuerierI, srch, dsth int64) (srcCsRes, dstCsRes *clienttypes.QueryClientStateResponse, err error)
- func QueryConnectionPair(src, dst IBCProvableQuerierI, srcH, dstH int64) (srcConn, dstConn *conntypes.QueryConnectionResponse, err error)
- func RandLowerCaseLetterString(length int) string
- func SendTransferMsg(src, dst *ProvableChain, amount sdk.Coin, dstAddr fmt.Stringer, ...) error
- func StartService(ctx context.Context, st StrategyI, src, dst *ProvableChain, ...) error
- func UpdateClients(src, dst *ProvableChain) error
- type ChainConfigI
- type ChainI
- type ChainProverConfig
- type HeaderI
- type IBCProvableQuerierI
- type IBCQuerierI
- type LightClientI
- type LightClientIBCQueryierI
- type MsgEventListener
- type NaiveStrategy
- func (st NaiveStrategy) GetType() string
- func (st NaiveStrategy) RelayAcknowledgements(src, dst *ProvableChain, sp *RelaySequences, sh SyncHeadersI) error
- func (st NaiveStrategy) RelayPackets(src, dst *ProvableChain, sp *RelaySequences, sh SyncHeadersI) error
- func (st NaiveStrategy) SetupRelay(ctx context.Context, src, dst *ProvableChain) error
- func (st NaiveStrategy) UnrelayedAcknowledgements(src, dst *ProvableChain, sh SyncHeadersI) (*RelaySequences, error)
- func (st NaiveStrategy) UnrelayedSequences(src, dst *ProvableChain, sh SyncHeadersI) (*RelaySequences, error)
- 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) GetStrategy() (StrategyI, error)
- 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)
- type PathAction
- 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) CreateClient(dstHeader *tmclient.Header, trustingPeriod, unbondingPeriod time.Duration, ...) 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 ibcexported.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
- func (pe *PathEnd) XferPacket(amount sdk.Coin, sender, receiver string) []byte
- type PathStatus
- type PathWithStatus
- type Paths
- type ProvableChain
- type ProverConfigI
- type ProverI
- type RelayMsgs
- type RelaySequences
- type RelayService
- type StrategyCfg
- type StrategyI
- type SyncHeadersI
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 GetPacketsFromEvents ¶
func GetPacketsFromEvents(events []abci.Event) ([]channeltypes.Packet, error)
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(src, dst IBCProvableQuerierI, srcH, dstH int64) (srcChan, dstChan *chantypes.QueryChannelResponse, err error)
QueryChannelPair returns a pair of channel responses
func QueryClientConsensusStatePair ¶
func QueryClientConsensusStatePair( src, dst IBCProvableQuerierI, srch, dsth int64, srcClientConsH, dstClientConsH ibcexported.Height) (srcCsRes, dstCsRes *clienttypes.QueryConsensusStateResponse, err error)
QueryClientConsensusStatePair allows for the querying of multiple client states at the same time
func QueryClientStatePair ¶
func QueryClientStatePair( src, dst IBCProvableQuerierI, srch, dsth int64) (srcCsRes, dstCsRes *clienttypes.QueryClientStateResponse, err error)
QueryClientStatePair returns a pair of connection responses
func QueryConnectionPair ¶
func QueryConnectionPair( src, dst IBCProvableQuerierI, srcH, dstH int64) (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 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 ChainConfigI ¶
ChainConfigI defines a chain configuration and its builder
type ChainI ¶
type ChainI interface { // ChainID returns ID of the chain ChainID() string // GetLatestHeight gets the chain for the latest height and returns it GetLatestHeight() (int64, error) // GetAddress returns the address of relayer GetAddress() (sdk.AccAddress, error) // Codec returns the codec Codec() codec.ProtoCodecMarshaler // SetRelayInfo sets source's path and counterparty's info to the chain SetRelayInfo(path *PathEnd, counterparty *ProvableChain, counterpartyPath *PathEnd) error // Path returns the path Path() *PathEnd // SendMsgs sends msgs to the chain SendMsgs(msgs []sdk.Msg) ([]byte, error) // Send sends msgs to the chain and logging a result of it // It returns a boolean value whether the result is success Send(msgs []sdk.Msg) bool // Init initializes the chain Init(homePath string, timeout time.Duration, codec codec.ProtoCodecMarshaler, debug bool) error // SetupForRelay performs chain-specific setup before starting the relay SetupForRelay(ctx context.Context) error // RegisterMsgEventListener registers a given EventListener to the chain RegisterMsgEventListener(MsgEventListener) IBCQuerierI }
ChainI represents a chain that supports sending transactions and querying the state
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 ChainConfigI, client ProverConfigI) (*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() (ChainConfigI, error)
GetChainConfig returns the cached ChainConfig instance
func (ChainProverConfig) GetProverConfig ¶ added in v0.1.1
func (cc ChainProverConfig) GetProverConfig() (ProverConfigI, error)
GetProverConfig returns the cached ChainProverConfig instance
type HeaderI ¶
func UpdatesWithHeaders ¶
func UpdatesWithHeaders(src, dst LightClientI) (srch, dsth HeaderI, err error)
UpdatesWithHeaders calls UpdateLightWithHeader on the passed chains concurrently
type IBCProvableQuerierI ¶ added in v0.1.1
type IBCProvableQuerierI interface { // QueryClientConsensusState returns the ClientConsensusState and its proof QueryClientConsensusStateWithProof(height int64, dstClientConsHeight ibcexported.Height) (*clienttypes.QueryConsensusStateResponse, error) // QueryClientStateWithProof returns the ClientState and its proof QueryClientStateWithProof(height int64) (*clienttypes.QueryClientStateResponse, error) // QueryConnectionWithProof returns the Connection and its proof QueryConnectionWithProof(height int64) (*conntypes.QueryConnectionResponse, error) // QueryChannelWithProof returns the Channel and its proof QueryChannelWithProof(height int64) (chanRes *chantypes.QueryChannelResponse, err error) // QueryPacketCommitmentWithProof returns the packet commitment and its proof QueryPacketCommitmentWithProof(height int64, seq uint64) (comRes *chantypes.QueryPacketCommitmentResponse, err error) // QueryPacketAcknowledgementCommitmentWithProof returns the packet acknowledgement commitment and its proof QueryPacketAcknowledgementCommitmentWithProof(height int64, seq uint64) (ackRes *chantypes.QueryPacketAcknowledgementResponse, err error) }
IBCProvableQuerierI is an interface to the state of IBC and its proof.
type IBCQuerierI ¶ added in v0.1.1
type IBCQuerierI interface { // QueryClientConsensusState retrevies the latest consensus state for a client in state at a given height QueryClientConsensusState(height int64, dstClientConsHeight ibcexported.Height) (*clienttypes.QueryConsensusStateResponse, error) // QueryClientState returns the client state of dst chain // height represents the height of dst chain QueryClientState(height int64) (*clienttypes.QueryClientStateResponse, error) // QueryConnection returns the remote end of a given connection QueryConnection(height int64) (*conntypes.QueryConnectionResponse, error) // QueryChannel returns the channel associated with a channelID QueryChannel(height int64) (chanRes *chantypes.QueryChannelResponse, err error) // QueryPacketCommitment returns the packet commitment corresponding to a given sequence QueryPacketCommitment(height int64, seq uint64) (comRes *chantypes.QueryPacketCommitmentResponse, err error) // QueryPacketAcknowledgementCommitment returns the acknowledgement corresponding to a given sequence QueryPacketAcknowledgementCommitment(height int64, seq uint64) (ackRes *chantypes.QueryPacketAcknowledgementResponse, err error) // QueryPacketCommitments returns an array of packet commitments QueryPacketCommitments(offset, limit uint64, height int64) (comRes *chantypes.QueryPacketCommitmentsResponse, err error) // QueryUnrecievedPackets returns a list of unrelayed packet commitments QueryUnrecievedPackets(height int64, seqs []uint64) ([]uint64, error) // QueryPacketAcknowledgementCommitments returns an array of packet acks QueryPacketAcknowledgementCommitments(offset, limit uint64, height int64) (comRes *chantypes.QueryPacketAcknowledgementsResponse, err error) // QueryUnrecievedAcknowledgements returns a list of unrelayed packet acks QueryUnrecievedAcknowledgements(height int64, seqs []uint64) ([]uint64, error) // QueryPacket returns the packet corresponding to a sequence QueryPacket(height int64, sequence uint64) (*chantypes.Packet, error) // QueryPacketAcknowledgement returns the acknowledgement corresponding to a sequence QueryPacketAcknowledgement(height int64, sequence uint64) ([]byte, error) // QueryBalance returns the amount of coins in the relayer account QueryBalance(address sdk.AccAddress) (sdk.Coins, error) // QueryDenomTraces returns all the denom traces from a given chain QueryDenomTraces(offset, limit uint64, height int64) (*transfertypes.QueryDenomTracesResponse, error) }
IBCQuerierI is an interface to the state of IBC
type LightClientI ¶ added in v0.1.1
type LightClientI interface { // GetChainID returns the chain ID GetChainID() string // QueryLatestHeader returns the latest header from the chain QueryLatestHeader() (out HeaderI, err error) // GetLatestLightHeight returns the latest height on the light client GetLatestLightHeight() (int64, error) // CreateMsgCreateClient creates a CreateClientMsg to this chain CreateMsgCreateClient(clientID string, dstHeader HeaderI, signer sdk.AccAddress) (*clienttypes.MsgCreateClient, error) // SetupHeader creates a new header based on a given header SetupHeader(dst LightClientIBCQueryierI, baseSrcHeader HeaderI) (HeaderI, error) // UpdateLightWithHeader updates a header on the light client and returns the header and height corresponding to the chain UpdateLightWithHeader() (header HeaderI, provableHeight int64, queryableHeight int64, err error) }
LightClientI is an interface to the light client
type LightClientIBCQueryierI ¶ added in v0.1.1
type LightClientIBCQueryierI interface { LightClientI IBCQuerierI }
LightClientIBCQueryierI is LightClientI + IBCQuerierI
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 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 }
NaiveStrategy is an implementation of Strategy.
func NewNaiveStrategy ¶
func NewNaiveStrategy() *NaiveStrategy
func (NaiveStrategy) RelayAcknowledgements ¶
func (st NaiveStrategy) RelayAcknowledgements(src, dst *ProvableChain, sp *RelaySequences, sh SyncHeadersI) error
func (NaiveStrategy) RelayPackets ¶
func (st NaiveStrategy) RelayPackets(src, dst *ProvableChain, sp *RelaySequences, sh SyncHeadersI) 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 SyncHeadersI) (*RelaySequences, error)
func (NaiveStrategy) UnrelayedSequences ¶
func (st NaiveStrategy) UnrelayedSequences(src, dst *ProvableChain, sh SyncHeadersI) (*RelaySequences, error)
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) GetStrategy ¶
GetStrategy the strategy defined in the relay messages
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
type PathAction ¶
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) CreateClient ¶
func (pe *PathEnd) CreateClient( dstHeader *tmclient.Header, trustingPeriod, unbondingPeriod time.Duration, consensusParams *abci.ConsensusParams, signer sdk.AccAddress) sdk.Msg
CreateClient creates an sdk.Msg to update the client on src with consensus state from dst
func (*PathEnd) MsgTransfer ¶
func (pe *PathEnd) MsgTransfer(dst *PathEnd, amount sdk.Coin, dstAddr string, signer sdk.AccAddress, timeoutHeight, timeoutTimestamp uint64) 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 ¶
func (pe *PathEnd) UpdateClient(dstHeader ibcexported.Header, signer sdk.AccAddress) sdk.Msg
UpdateClient creates an sdk.Msg to update the client on src with data pulled from dst
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 ChainI, prover ProverI) *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 ProverConfigI ¶ added in v0.1.1
ProverConfigI defines a prover configuration and its builder
type ProverI ¶ added in v0.1.1
type ProverI 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 LightClientI IBCProvableQuerierI }
ProverI represents a prover that supports generating a commitment proof
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 RelaySequences ¶
RelaySequences 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 SyncHeadersI, interval time.Duration) *RelayService
NewRelayService returns a new service
type StrategyCfg ¶
type StrategyCfg struct {
Type string `json:"type" yaml:"type"`
}
StrategyCfg defines which relaying strategy to take for a given path
type StrategyI ¶
type StrategyI interface { GetType() string SetupRelay(ctx context.Context, src, dst *ProvableChain) error UnrelayedSequences(src, dst *ProvableChain, sh SyncHeadersI) (*RelaySequences, error) RelayPackets(src, dst *ProvableChain, sp *RelaySequences, sh SyncHeadersI) error UnrelayedAcknowledgements(src, dst *ProvableChain, sh SyncHeadersI) (*RelaySequences, error) RelayAcknowledgements(src, dst *ProvableChain, sp *RelaySequences, sh SyncHeadersI) error }
StrategyI defines
func GetStrategy ¶
func GetStrategy(cfg StrategyCfg) (StrategyI, error)
type SyncHeadersI ¶
type SyncHeadersI interface { // GetProvableHeight returns the provable height of chain GetProvableHeight(chainID string) int64 // GetQueryableHeight returns the queryable height of chain GetQueryableHeight(chainID string) int64 // GetHeader returns the latest header of light client GetHeader(src, dst LightClientIBCQueryierI) (HeaderI, error) // GetHeaders returns the latest headers for both src and dst client. GetHeaders(src, dst LightClientIBCQueryierI) (srcHeader HeaderI, dstHeader HeaderI, err error) // Updates updates the header of light client Updates(src LightClientI, dst LightClientI) error }
func NewSyncHeaders ¶
func NewSyncHeaders(src, dst LightClientI) (SyncHeadersI, error)
NewSyncHeaders returns a new instance of SyncHeadersI that can be easily kept "reasonably up to date"