Documentation ¶
Index ¶
- Variables
- func CreateMnemonic() (string, error)
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(s int) (string, error)
- func InjectTrustedFields(srcChain, dstChain *Chain, srcHeader *tmclient.Header) (*tmclient.Header, error)
- func InjectTrustedFieldsHeaders(src, dst *Chain, srch, dsth *tmclient.Header) (srcho *tmclient.Header, dstho *tmclient.Header, err error)
- func MustGetHeight(h clientExported.Height) uint64
- func OrderFromString(order string) chanTypes.Order
- func ParseEvents(e string) ([]string, error)
- func PathsSet(chains ...*Chain) bool
- func QueryChannelPair(src, dst *Chain, srcH, dstH int64) (srcChan, dstChan *chanTypes.QueryChannelResponse, err error)
- func QueryClientConsensusStatePair(src, dst *Chain, srch, dsth, srcClientConsH, dstClientConsH int64) (srcCsRes, dstCsRes *clientTypes.QueryConsensusStateResponse, err error)
- func QueryClientStatePair(src, dst *Chain, srch, dsth int64) (srcCsRes, dstCsRes *clientTypes.QueryClientStateResponse, err error)
- func QueryConnectionPair(src, dst *Chain, srcH, dstH int64) (srcConn, dstConn *connTypes.QueryConnectionResponse, err error)
- func QueryLatestHeights(src, dst *Chain) (srch, dsth int64, err error)
- func RandLowerCaseLetterString(length int) string
- func RunStrategy(src, dst *Chain, strategy Strategy, ordered bool) (func(), error)
- func UpdatesWithHeaders(src, dst *Chain) (srch, dsth *tmclient.Header, err error)
- func ValidatePaths(src, dst *Chain) error
- type Chain
- func (c *Chain) AddPath(clientID, connectionID, channelID, port, order string) error
- func (c *Chain) CLIContext(height int64) sdkCtx.Context
- func (c *Chain) CloseChannel(dst *Chain, to time.Duration) error
- func (c *Chain) CloseChannelStep(dst *Chain) (*RelayMsgs, error)
- func (c *Chain) CreateChannel(dst *Chain, ordered bool, to time.Duration) error
- func (c *Chain) CreateChannelStep(dst *Chain, ordering chanTypes.Order) (*RelayMsgs, error)
- func (c *Chain) CreateClients(dst *Chain) (err error)
- func (c *Chain) CreateConnection(dst *Chain, to time.Duration) error
- func (c *Chain) CreateConnectionStep(dst *Chain) (*RelayMsgs, error)
- func (c *Chain) CreateTestKey() error
- func (c *Chain) DeleteLightDB() error
- func (c *Chain) ErrCantSetPath(err error) error
- func (c *Chain) ErrPathNotSet() error
- func (c *Chain) Error(err error)
- func (c *Chain) FaucetHandler(fromKey sdk.AccAddress, amounts sdk.Coins) func(w http.ResponseWriter, r *http.Request)
- func (c *Chain) ForceInitLight() error
- func (c *Chain) GetAddress() (sdk.AccAddress, error)
- func (c *Chain) GetLatestLightHeader() (*tmclient.Header, error)
- func (c *Chain) GetLatestLightHeight() (int64, error)
- func (c *Chain) GetLightSignedHeaderAtHeight(height int64) (*tmclient.Header, error)
- func (c *Chain) GetRPCPort() string
- func (c *Chain) GetTimeout() time.Duration
- func (c *Chain) GetTrustingPeriod() time.Duration
- func (c *Chain) Init(homePath string, timeout time.Duration, debug bool) error
- func (c *Chain) KeyExists(name string) bool
- func (c *Chain) LightClient(db dbm.DB) (*light.Client, error)
- func (c *Chain) LightClientWithTrust(db dbm.DB, to light.TrustOptions) (*light.Client, error)
- func (c *Chain) LightClientWithoutTrust(db dbm.DB) (*light.Client, error)
- func (c *Chain) LightHTTP() lightp.Provider
- func (c *Chain) ListenRPCEmitJSON(tx, block, data bool) func()
- func (c *Chain) Log(s string)
- func (c *Chain) LogFailedTx(res *sdk.TxResponse, err error, msgs []sdk.Msg)
- func (c *Chain) LogSuccessTx(res *sdk.TxResponse, msgs []sdk.Msg)
- func (c *Chain) MustGetAddress() sdk.AccAddress
- func (c *Chain) NewLightDB() (db *dbm.GoLevelDB, df func(), err error)
- func (c *Chain) PathSet() bool
- func (c *Chain) Print(toPrint interface{}, text, indent bool) error
- func (c *Chain) QueryABCI(req abci.RequestQuery) (res abci.ResponseQuery, err error)
- func (c *Chain) QueryBalance(keyName string) (sdk.Coins, error)
- func (c *Chain) QueryChannel(height int64) (chanRes *chanTypes.QueryChannelResponse, err error)
- func (c *Chain) QueryChannelClient() (*chanTypes.QueryChannelClientStateResponse, error)
- func (c *Chain) QueryChannels(offset, limit uint64) (*chanTypes.QueryChannelsResponse, error)
- func (c *Chain) QueryClientConsensusState(height, dstClientConsHeight int64) (*clientTypes.QueryConsensusStateResponse, error)
- func (c *Chain) QueryClientState(height int64) (*clientTypes.QueryClientStateResponse, error)
- func (c *Chain) QueryClients(offset, limit uint64) (*clientTypes.QueryClientStatesResponse, error)
- func (c *Chain) QueryConnection(height int64) (*connTypes.QueryConnectionResponse, error)
- func (c *Chain) QueryConnectionChannels(connectionID string, offset, limit uint64) (*chanTypes.QueryConnectionChannelsResponse, error)
- func (c *Chain) QueryConnections(offset, limit uint64) (conns *connTypes.QueryConnectionsResponse, err error)
- func (c *Chain) QueryConnectionsUsingClient(height int64) (clientConns *connTypes.QueryClientConnectionsResponse, err error)
- func (c *Chain) QueryConsensusState(height int64) (*tmclient.ConsensusState, int64, error)
- func (c *Chain) QueryDenomTrace(denom string) (*xferTypes.QueryDenomTraceResponse, error)
- func (c *Chain) QueryDenomTraces(offset, limit uint64) (*xferTypes.QueryDenomTracesResponse, error)
- func (c *Chain) QueryHeaderAtHeight(height int64) (*tmclient.Header, error)
- func (c *Chain) QueryHistoricalInfo(height clientTypes.Height) (*stakingTypes.QueryHistoricalInfoResponse, error)
- func (c *Chain) QueryLatestHeader() (out *tmclient.Header, err error)
- func (c *Chain) QueryLatestHeight() (int64, error)
- func (c *Chain) QueryNextSeqRecv(height int64) (recvRes *chanTypes.QueryNextSequenceReceiveResponse, err error)
- func (c *Chain) QueryPacketCommitment(height int64, seq uint64) (comRes *chanTypes.QueryPacketCommitmentResponse, err error)
- func (c *Chain) QueryPacketCommitments(offset, limit, height uint64) (comRes *chanTypes.QueryPacketCommitmentsResponse, err error)
- func (c *Chain) QueryTx(hashHex string) (*ctypes.ResultTx, error)
- func (c *Chain) QueryTxs(height uint64, page, limit int, events []string) ([]*ctypes.ResultTx, error)
- func (c *Chain) QueryUnbondingPeriod() (time.Duration, error)
- func (c *Chain) QueryUnrecievedPackets(height uint64, seqs []uint64) ([]uint64, error)
- func (c *Chain) QueryUnrelayedAcks(height uint64, seqs []uint64) ([]uint64, error)
- func (c *Chain) QueryValsetAtHeight(height clientTypes.Height) (*tmproto.ValidatorSet, error)
- func (c *Chain) QueryWithData(p string, d []byte) (byt []byte, i int64, err error)
- func (c *Chain) SendAndPrint(txs []sdk.Msg, text, indent bool) (err error)
- func (c *Chain) SendMsg(datagram sdk.Msg) (*sdk.TxResponse, error)
- func (c *Chain) SendMsgWithKey(msg sdk.Msg, keyName string) (res *sdk.TxResponse, err error)
- func (c *Chain) SendMsgs(msgs []sdk.Msg) (res *sdk.TxResponse, err error)
- func (c *Chain) SendTransferMsg(dst *Chain, amount sdk.Coin, dstAddr fmt.Stringer) error
- func (c *Chain) SetPath(p *PathEnd) error
- func (c *Chain) Start() error
- func (c *Chain) StatusErr() error
- func (c *Chain) String() string
- func (c *Chain) Subscribe(query string) (<-chan ctypes.ResultEvent, context.CancelFunc, error)
- func (c *Chain) TrustOptions(height int64, hash []byte) light.TrustOptions
- func (c *Chain) TxFactory(height int64) tx.Factory
- func (c *Chain) Update(key, value string) (out *Chain, err error)
- func (c *Chain) UpdateClients(dst *Chain) (err error)
- func (c *Chain) UpdateLightWithHeader() (*tmclient.Header, error)
- func (c *Chain) UseSDKContext()
- func (c *Chain) ValidateTxResult(resTx *ctypes.ResultTx) (err error)
- func (c *Chain) VerifyProof(queryPath string, resp abci.ResponseQuery) error
- func (c *Chain) WaitForNBlocks(n int64) error
- type Chains
- type FaucetRequest
- type NaiveStrategy
- func (nrs *NaiveStrategy) GetType() string
- func (nrs *NaiveStrategy) HandleEvents(src, dst *Chain, sh *SyncHeaders, events map[string][]string)
- func (nrs *NaiveStrategy) RelayPacketsOrderedChan(src, dst *Chain, sp *RelaySequences, sh *SyncHeaders) error
- func (nrs *NaiveStrategy) RelayPacketsUnorderedChan(src, dst *Chain, sp *RelaySequences, sh *SyncHeaders) error
- func (nrs *NaiveStrategy) UnrelayedSequencesOrdered(src, dst *Chain, sh *SyncHeaders) (*RelaySequences, error)
- func (nrs *NaiveStrategy) UnrelayedSequencesUnordered(src, dst *Chain, sh *SyncHeaders) (*RelaySequences, error)
- type Path
- type PathEnd
- func (pe *PathEnd) ChanAck(dstChanState *chanTypes.QueryChannelResponse, signer sdk.AccAddress) 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) 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 exported.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) XferPacket(amount sdk.Coin, sender, receiver string) []byte
- type Paths
- type RelayMsgs
- type RelaySequences
- type Strategy
- type StrategyCfg
- type SyncHeaders
- func (uh *SyncHeaders) GetHeader(chainID string) *tmclient.Header
- func (uh *SyncHeaders) GetHeight(chainID string) uint64
- func (uh *SyncHeaders) GetTrustedHeaders(src, dst *Chain) (srcTh, dstTh *tmclient.Header, err error)
- func (uh *SyncHeaders) GetUpdateHeader(srcChain, dstChain *Chain) (*tmclient.Header, error)
- func (uh *SyncHeaders) Update(c *Chain) error
- func (uh *SyncHeaders) UpdateWithTrustedHeaders(src, dst *Chain) (srcTh, dstTh *tmclient.Header, err error)
- func (uh *SyncHeaders) Updates(c ...*Chain) error
Constants ¶
This section is empty.
Variables ¶
var ErrLightNotInitialized = errors.New("light client is not initialized")
ErrLightNotInitialized returns the canonical error for a an uninitialized light client
Functions ¶
func GenerateRandomBytes ¶
GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomString ¶
GenerateRandomString returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func InjectTrustedFields ¶
func InjectTrustedFields(srcChain, dstChain *Chain, srcHeader *tmclient.Header) (*tmclient.Header, error)
InjectTrustedFields injects the necessary trusted fields for a srcHeader coming from a srcChain destined for an IBC client stored on the dstChain TrustedHeight is the latest height of the IBC client on dstChain TrustedValidators is the validator set of srcChain at the TrustedHeight InjectTrustedFields returns a copy of the header with TrustedFields modified
func InjectTrustedFieldsHeaders ¶
func InjectTrustedFieldsHeaders( src, dst *Chain, srch, dsth *tmclient.Header) (srcho *tmclient.Header, dstho *tmclient.Header, err error)
InjectTrustedFieldsHeaders takes the headers and enriches them
func MustGetHeight ¶
func MustGetHeight(h clientExported.Height) uint64
MustGetHeight takes the height inteface and returns the actual height
func OrderFromString ¶
OrderFromString parses a string into a channel order byte
func ParseEvents ¶
ParseEvents takes events in the query format and reutrns
func QueryChannelPair ¶
func QueryChannelPair(src, dst *Chain, srcH, dstH int64) (srcChan, dstChan *chanTypes.QueryChannelResponse, err error)
QueryChannelPair returns a pair of channel responses
func QueryClientConsensusStatePair ¶
func QueryClientConsensusStatePair( src, dst *Chain, srch, dsth, srcClientConsH, dstClientConsH int64) (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 *Chain, srch, dsth int64) (srcCsRes, dstCsRes *clientTypes.QueryClientStateResponse, err error)
QueryClientStatePair returns a pair of connection responses
func QueryConnectionPair ¶
func QueryConnectionPair( src, dst *Chain, srcH, dstH int64) (srcConn, dstConn *connTypes.QueryConnectionResponse, err error)
QueryConnectionPair returns a pair of connection responses
func QueryLatestHeights ¶
QueryLatestHeights returns the heights of multiple chains at once
func RandLowerCaseLetterString ¶
RandLowerCaseLetterString returns a lowercase letter string of given length
func RunStrategy ¶
RunStrategy runs a given strategy
func UpdatesWithHeaders ¶
UpdatesWithHeaders calls UpdateLightWithHeader on the passed chains concurrently
func ValidatePaths ¶
ValidatePaths takes two chains and validates their paths
Types ¶
type Chain ¶
type Chain struct { Key string `yaml:"key" json:"key"` ChainID string `yaml:"chain-id" json:"chain-id"` RPCAddr string `yaml:"rpc-addr" json:"rpc-addr"` AccountPrefix string `yaml:"account-prefix" json:"account-prefix"` GasAdjustment float64 `yaml:"gas-adjustment" json:"gas-adjustment"` TrustingPeriod string `yaml:"trusting-period" json:"trusting-period"` // TODO: make these private HomePath string `yaml:"-" json:"-"` PathEnd *PathEnd `yaml:"-" json:"-"` Keybase keys.Keyring `yaml:"-" json:"-"` Client rpcclient.Client `yaml:"-" json:"-"` Cdc codec.JSONMarshaler `yaml:"-" json:"-"` Amino *codec.LegacyAmino `yaml:"-" json:"-"` // contains filtered or unexported fields }
Chain represents the necessary data for connecting to and indentifying a chain and its counterparites
func (*Chain) AddPath ¶
AddPath takes the elements of a path and validates then, setting that path to the chain
func (*Chain) CLIContext ¶
CLIContext returns an instance of client.Context derived from Chain
func (*Chain) CloseChannel ¶
CloseChannel runs the channel closing messages on timeout until they pass TODO: add max retries or something to this function
func (*Chain) CloseChannelStep ¶
CloseChannelStep returns the next set of messages for closing a channel with given identifiers between chains src and dst. If the closing handshake hasn't started, then CloseChannelStep will begin the handshake on the src chain
func (*Chain) CreateChannel ¶
CreateChannel runs the channel creation messages on timeout until they pass TODO: add max retries or something to this function
func (*Chain) CreateChannelStep ¶
CreateChannelStep returns the next set of messages for creating a channel with given identifiers between chains src and dst. If the handshake hasn't started, then CreateChannelStep will begin the handshake on the src chain
func (*Chain) CreateClients ¶
CreateClients creates clients for src on dst and dst on src given the configured paths
func (*Chain) CreateConnection ¶
CreateConnection runs the connection creation messages on timeout until they pass TODO: add max retries or something to this function
func (*Chain) CreateConnectionStep ¶
CreateConnectionStep returns the next set of messags for creating a channel with the given identifier between chains src and dst. If handshake hasn't started, CreateConnetionStep will start the handshake on src
func (*Chain) CreateTestKey ¶
CreateTestKey creates a key for test chain
func (*Chain) DeleteLightDB ¶
DeleteLightDB removes the light client database on disk, forcing re-initialization
func (*Chain) ErrCantSetPath ¶
ErrCantSetPath returns an error if the path doesn't set properly
func (*Chain) ErrPathNotSet ¶
ErrPathNotSet returns information what identifiers are needed to relay
func (*Chain) FaucetHandler ¶
func (c *Chain) FaucetHandler(fromKey sdk.AccAddress, amounts sdk.Coins) func(w http.ResponseWriter, r *http.Request)
FaucetHandler listens for addresses
func (*Chain) ForceInitLight ¶
ForceInitLight forces initialization of the light client from the configured node
func (*Chain) GetAddress ¶
func (c *Chain) GetAddress() (sdk.AccAddress, error)
GetAddress returns the sdk.AccAddress associated with the configred key
func (*Chain) GetLatestLightHeader ¶
GetLatestLightHeader returns the header to be used for client creation
func (*Chain) GetLatestLightHeight ¶
GetLatestLightHeight uses the CLI utilities to pull the latest height from a given chain
func (*Chain) GetLightSignedHeaderAtHeight ¶
GetLightSignedHeaderAtHeight returns a signed header at a particular height.
func (*Chain) GetRPCPort ¶
GetRPCPort returns the port configured for the chain
func (*Chain) GetTimeout ¶
GetTimeout returns the chain's configured timeout
func (*Chain) GetTrustingPeriod ¶
GetTrustingPeriod returns the trusting period for the chain
func (*Chain) Init ¶
Init initializes the pieces of a chain that aren't set when it parses a config NOTE: All validation of the chain should happen here.
func (*Chain) LightClient ¶
LightClient initializes the light client for a given chain from the trusted store in the database this should be call for all other light client usage
func (*Chain) LightClientWithTrust ¶
LightClientWithTrust takes a header from the chain and attempts to add that header to the light database.
func (*Chain) LightClientWithoutTrust ¶
LightClientWithoutTrust querys the latest header from the chain and initializes a new light client database using that header. This should only be called when first initializing the light client
func (*Chain) ListenRPCEmitJSON ¶
ListenRPCEmitJSON listens for tx and block events from a chain and outputs them as JSON to stdout
func (*Chain) LogFailedTx ¶
LogFailedTx takes the transaction and the messages to create it and logs the appropriate data
func (*Chain) LogSuccessTx ¶
func (c *Chain) LogSuccessTx(res *sdk.TxResponse, msgs []sdk.Msg)
LogSuccessTx take the transaction and the messages to create it and logs the appropriate data
func (*Chain) MustGetAddress ¶
func (c *Chain) MustGetAddress() sdk.AccAddress
MustGetAddress used for brevity
func (*Chain) NewLightDB ¶
NewLightDB returns a new instance of the lightclient database connection CONTRACT: must close the database connection when done with it (defer df())
func (*Chain) Print ¶
Print fmt.Printlns the json or yaml representation of whatever is passed in CONTRACT: The cmd calling this function needs to have the "json" and "indent" flags set TODO: better "text" printing here would be a nice to have
func (*Chain) QueryABCI ¶
func (c *Chain) QueryABCI(req abci.RequestQuery) (res abci.ResponseQuery, err error)
QueryABCI is an affordance for querying the ABCI server associated with a chain Similar to cliCtx.QueryABCI
func (*Chain) QueryBalance ¶
QueryBalance returns the amount of coins in the relayer account
func (*Chain) QueryChannel ¶
func (c *Chain) QueryChannel(height int64) (chanRes *chanTypes.QueryChannelResponse, err error)
QueryChannel returns the channel associated with a channelID
func (*Chain) QueryChannelClient ¶
func (c *Chain) QueryChannelClient() (*chanTypes.QueryChannelClientStateResponse, error)
QueryChannelClient returns the client state of the client supporting a given channel
func (*Chain) QueryChannels ¶
func (c *Chain) QueryChannels(offset, limit uint64) (*chanTypes.QueryChannelsResponse, error)
QueryChannels returns all the channels that are registered on a chain
func (*Chain) QueryClientConsensusState ¶
func (c *Chain) QueryClientConsensusState( height, dstClientConsHeight int64) (*clientTypes.QueryConsensusStateResponse, error)
QueryClientConsensusState retrevies the latest consensus state for a client in state at a given height
func (*Chain) QueryClientState ¶
func (c *Chain) QueryClientState(height int64) (*clientTypes.QueryClientStateResponse, error)
QueryClientState retrevies the latest consensus state for a client in state at a given height
func (*Chain) QueryClients ¶
func (c *Chain) QueryClients(offset, limit uint64) (*clientTypes.QueryClientStatesResponse, error)
QueryClients queries all the clients!
func (*Chain) QueryConnection ¶
func (c *Chain) QueryConnection(height int64) (*connTypes.QueryConnectionResponse, error)
QueryConnection returns the remote end of a given connection
func (*Chain) QueryConnectionChannels ¶
func (c *Chain) QueryConnectionChannels( connectionID string, offset, limit uint64) (*chanTypes.QueryConnectionChannelsResponse, error)
QueryConnectionChannels queries the channels associated with a connection
func (*Chain) QueryConnections ¶
func (c *Chain) QueryConnections( offset, limit uint64) (conns *connTypes.QueryConnectionsResponse, err error)
QueryConnections gets any connections on a chain
func (*Chain) QueryConnectionsUsingClient ¶
func (c *Chain) QueryConnectionsUsingClient( height int64) (clientConns *connTypes.QueryClientConnectionsResponse, err error)
QueryConnectionsUsingClient gets any connections that exist between chain and counterparty
func (*Chain) QueryConsensusState ¶
QueryConsensusState returns a consensus state for a given chain to be used as a client in another chain, fetches latest height when passed 0 as arg
func (*Chain) QueryDenomTrace ¶
func (c *Chain) QueryDenomTrace(denom string) (*xferTypes.QueryDenomTraceResponse, error)
QueryDenomTrace takes a denom from IBC and queries the information about it
func (*Chain) QueryDenomTraces ¶
func (c *Chain) QueryDenomTraces(offset, limit uint64) (*xferTypes.QueryDenomTracesResponse, error)
QueryDenomTraces returns all the denom traces from a given chain
func (*Chain) QueryHeaderAtHeight ¶
QueryHeaderAtHeight returns the header at a given height
func (*Chain) QueryHistoricalInfo ¶
func (c *Chain) QueryHistoricalInfo(height clientTypes.Height) (*stakingTypes.QueryHistoricalInfoResponse, error)
QueryHistoricalInfo returns historical header data
func (*Chain) QueryLatestHeader ¶
QueryLatestHeader returns the latest header from the chain
func (*Chain) QueryLatestHeight ¶
QueryLatestHeight queries the chain for the latest height and returns it
func (*Chain) QueryNextSeqRecv ¶
func (c *Chain) QueryNextSeqRecv(height int64) (recvRes *chanTypes.QueryNextSequenceReceiveResponse, err error)
QueryNextSeqRecv returns the next seqRecv for a configured channel
func (*Chain) QueryPacketCommitment ¶
func (c *Chain) QueryPacketCommitment( height int64, seq uint64) (comRes *chanTypes.QueryPacketCommitmentResponse, err error)
QueryPacketCommitment returns the packet commitment proof at a given height
func (*Chain) QueryPacketCommitments ¶
func (c *Chain) QueryPacketCommitments( offset, limit, height uint64) (comRes *chanTypes.QueryPacketCommitmentsResponse, err error)
QueryPacketCommitments returns an array of packet commitment proofs
func (*Chain) QueryTxs ¶
func (c *Chain) QueryTxs(height uint64, page, limit int, events []string) ([]*ctypes.ResultTx, error)
QueryTxs returns an array of transactions given a tag
func (*Chain) QueryUnbondingPeriod ¶
QueryUnbondingPeriod returns the unbonding period of the chain
func (*Chain) QueryUnrecievedPackets ¶
QueryUnrecievedPackets returns a list of unrelayed packet commitments
func (*Chain) QueryUnrelayedAcks ¶
QueryUnrelayedAcks returns a list of unrelayed packet acks
func (*Chain) QueryValsetAtHeight ¶
func (c *Chain) QueryValsetAtHeight(height clientTypes.Height) (*tmproto.ValidatorSet, error)
QueryValsetAtHeight returns the validator set at a given height
func (*Chain) QueryWithData ¶
QueryWithData satisfies auth.NodeQuerier interface and used for fetching account details
func (*Chain) SendAndPrint ¶
SendAndPrint sends a transaction and prints according to the passed args
func (*Chain) SendMsgWithKey ¶
SendMsgWithKey allows the user to specify which relayer key will sign the message
func (*Chain) SendTransferMsg ¶
SendTransferMsg initiates an ibs20 transfer from src to dst with the specified args
func (*Chain) Subscribe ¶
func (c *Chain) Subscribe(query string) (<-chan ctypes.ResultEvent, context.CancelFunc, error)
Subscribe returns channel of events given a query
func (*Chain) TrustOptions ¶
func (c *Chain) TrustOptions(height int64, hash []byte) light.TrustOptions
TrustOptions returns light.TrustOptions given a height and hash
func (*Chain) UpdateClients ¶
UpdateClients updates clients for src on dst and dst on src given the configured paths
func (*Chain) UpdateLightWithHeader ¶
UpdateLightWithHeader calls client.Update and then .
func (*Chain) UseSDKContext ¶
func (c *Chain) UseSDKContext()
UseSDKContext uses a custom Bech32 account prefix and returns a restore func
func (*Chain) ValidateTxResult ¶
ValidateTxResult takes a transaction and validates the proof against a stored root of trust
func (*Chain) VerifyProof ¶
func (c *Chain) VerifyProof(queryPath string, resp abci.ResponseQuery) error
VerifyProof performs response proof verification.
func (*Chain) WaitForNBlocks ¶
WaitForNBlocks blocks until the next block on a given chain
type Chains ¶
type Chains []*Chain
Chains is a collection of Chain
type FaucetRequest ¶
FaucetRequest represents a request to the facuet
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 (*NaiveStrategy) GetType ¶
func (nrs *NaiveStrategy) GetType() string
GetType implements Strategy
func (*NaiveStrategy) HandleEvents ¶
func (nrs *NaiveStrategy) HandleEvents(src, dst *Chain, sh *SyncHeaders, events map[string][]string)
HandleEvents defines how the relayer will handle block and transaction events as they are emitted
func (*NaiveStrategy) RelayPacketsOrderedChan ¶
func (nrs *NaiveStrategy) RelayPacketsOrderedChan(src, dst *Chain, sp *RelaySequences, sh *SyncHeaders) error
RelayPacketsOrderedChan creates transactions to clear both queues CONTRACT: the SyncHeaders passed in here must be up to date or being kept updated
func (*NaiveStrategy) RelayPacketsUnorderedChan ¶
func (nrs *NaiveStrategy) RelayPacketsUnorderedChan(src, dst *Chain, sp *RelaySequences, sh *SyncHeaders) error
RelayPacketsUnorderedChan creates transactions to relay un-relayed messages
func (*NaiveStrategy) UnrelayedSequencesOrdered ¶
func (nrs *NaiveStrategy) UnrelayedSequencesOrdered(src, dst *Chain, sh *SyncHeaders) (*RelaySequences, error)
UnrelayedSequencesOrdered returns the unrelayed sequence numbers between two chains
func (*NaiveStrategy) UnrelayedSequencesUnordered ¶
func (nrs *NaiveStrategy) UnrelayedSequencesUnordered(src, dst *Chain, sh *SyncHeaders) (*RelaySequences, error)
UnrelayedSequencesUnordered returns the unrelayed sequence numbers between two chains
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) GetStrategy ¶
GetStrategy the strategy defined in the relay messages
func (*Path) MustGetStrategy ¶
MustGetStrategy returns the strategy and panics on error
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(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, 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 ¶
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 Paths ¶
Paths represent connection paths between chains
func (Paths) AddForce ¶
AddForce ignores existing paths and overwrites an existing path with that name
type RelayMsgs ¶
type RelayMsgs struct { Src []sdk.Msg Dst []sdk.Msg 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 }
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 Strategy ¶
type Strategy interface { GetType() string HandleEvents(src, dst *Chain, sh *SyncHeaders, events map[string][]string) UnrelayedSequencesUnordered(src, dst *Chain, sh *SyncHeaders) (*RelaySequences, error) UnrelayedSequencesOrdered(src, dst *Chain, sh *SyncHeaders) (*RelaySequences, error) RelayPacketsOrderedChan(src, dst *Chain, sp *RelaySequences, sh *SyncHeaders) error RelayPacketsUnorderedChan(src, dst *Chain, sp *RelaySequences, sh *SyncHeaders) error }
Strategy defines
type StrategyCfg ¶
type StrategyCfg struct {
Type string `json:"type" yaml:"type"`
}
StrategyCfg defines which relaying strategy to take for a given path
func NewNaiveStrategy ¶
func NewNaiveStrategy() *StrategyCfg
NewNaiveStrategy returns the proper config for the NaiveStrategy
type SyncHeaders ¶
SyncHeaders is an instance of map[string]*tmclient.Header that can be kept "reasonably up to date" using it's Update method
func NewSyncHeaders ¶
func NewSyncHeaders(src, dst *Chain) (*SyncHeaders, error)
NewSyncHeaders returns a new instance of map[string]*tmclient.Header that can be easily kept "reasonably up to date"
func (*SyncHeaders) GetHeader ¶
func (uh *SyncHeaders) GetHeader(chainID string) *tmclient.Header
GetHeader returns the latest header for a given chainID
func (*SyncHeaders) GetHeight ¶
func (uh *SyncHeaders) GetHeight(chainID string) uint64
GetHeight returns the latest height for a given chainID
func (*SyncHeaders) GetTrustedHeaders ¶
func (uh *SyncHeaders) GetTrustedHeaders(src, dst *Chain) (srcTh, dstTh *tmclient.Header, err error)
GetTrustedHeaders returns the trusted headers for the current headers stored in SyncHeaders
func (*SyncHeaders) GetUpdateHeader ¶
func (uh *SyncHeaders) GetUpdateHeader(srcChain, dstChain *Chain) (*tmclient.Header, error)
GetUpdateHeader returns a header to be used to UpdateClient of dstChain stored on srcChain
func (*SyncHeaders) Update ¶
func (uh *SyncHeaders) Update(c *Chain) error
Update the header for a given chain
func (*SyncHeaders) UpdateWithTrustedHeaders ¶
func (uh *SyncHeaders) UpdateWithTrustedHeaders(src, dst *Chain) (srcTh, dstTh *tmclient.Header, err error)
UpdateWithTrustedHeaders updates the latest headers in SyncHeaders
func (*SyncHeaders) Updates ¶
func (uh *SyncHeaders) Updates(c ...*Chain) error
Updates updates the headers for a given set of chains