pub struct ForeignClient<DstChain, SrcChain> where
    DstChain: ChainHandle,
    SrcChain: ChainHandle
{ pub id: ClientId, pub dst_chain: DstChain, pub src_chain: SrcChain, }

Fields

id: ClientId

The identifier of this client. The host chain determines this id upon client creation, so we may be using the default value temporarily.

dst_chain: DstChain

A handle to the chain hosting this client, i.e., destination chain.

src_chain: SrcChain

A handle to the chain whose headers this client is verifying, aka the source chain.

Implementations

Creates a new foreign client on dst_chain. Blocks until the client is created, or an error occurs. Post-condition: dst_chain hosts an IBC client for src_chain.

Queries host_chain to verify that a client with identifier client_id exists. If the client does not exist, returns an error. If the client exists, cross-checks that the identifier for the target chain of this client (i.e., the chain whose headers this client is verifying) is consistent with expected_target_chain, and if so, return a new ForeignClient representing this client.

Returns a handle to the chain hosting this client.

Returns a handle to the chain whose headers this client is sourcing (the source chain).

Lower-level interface for preparing a message to create a client.

Returns the identifier of the newly created client.

Wrapper for build_update_client_with_trusted.

Returns a vector with a message for updating the client to height target_height. If the client already stores a consensus state for this height, returns an empty vector.

Attempts to update a client using header from the latest height of its source chain.

Retrieves the client update event that was emitted when a consensus state at the specified height was created on chain. It is possible that the event cannot be retrieved if the information is not yet available on the full node. To handle this the query is retried a few times.

Checks for evidence of misbehaviour. The check starts with and update_event emitted by chain B (dst_chain) for a client update with a header from chain A (src_chain). The algorithm goes backwards through the headers until it gets to the first misbehaviour.

The following cases are covered: 1 - fork: Assumes at least one consensus state before the fork point exists. Let existing consensus states on chain B be: [Sn,.., Sf, Sf-1, S0] with Sf-1 being the most recent state before fork. Chain A is queried for a header Hf' at Sf.height and if it is different than the Hf in the event for the client update (the one that has generated Sf on chain), then the two headers are included in the evidence and submitted. Note that in this case the headers are different but have the same height.

2 - BFT time violation for unavailable header (a.k.a. Future Lunatic Attack or FLA): Some header with a height that is higher than the latest height on A has been accepted and a consensus state was created on B. Note that this implies that the timestamp of this header must be within the clock_drift of the client. Assume the client on B has been updated with h2(not present on/ produced by chain A) and it has a timestamp of t2 that is at most clock_drift in the future. Then the latest header from A is fetched, let it be h1, with a timestamp of t1. If t1 >= t2 then evidence of misbehavior is submitted to A.

3 - BFT time violation for existing headers (TODO): Ensure that consensus state times are monotonically increasing with height.

Other notes:

  • the algorithm builds misbehavior at each consensus height, starting with the highest height assuming the previous one is trusted. It submits the first constructed evidence (the one with the highest height)
  • a lot of the logic here is derived from the behavior of the only implemented client (ics07-tendermint) and might not be general enough.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Used in Output messages. Provides a concise description of a ForeignClient, using the format: {CHAIN-ID} -> {CHAIN-ID}:{CLIENT} where the first chain identifier is for the source chain, and the second chain identifier is the destination (which hosts the client) chain.

Formats the value using the given formatter. Read more

Get the source chain ID. Read more

Get the destination chain ID. Read more

Get the client ID of the destination chain that corresponds to the source chain. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Borrow this concrete type as a &dyn Any

Borrow this concrete type as a &mut dyn Any

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Attaches the provided Context to this type, returning a WithContext wrapper. Read more

Attaches the current Context to this type, returning a WithContext wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Wrap the input message T in a tonic::Request

Set the foreground color generically Read more

Set the background color generically. Read more

Change the foreground color to black

Change the background color to black

Change the foreground color to red

Change the background color to red

Change the foreground color to green

Change the background color to green

Change the foreground color to yellow

Change the background color to yellow

Change the foreground color to blue

Change the background color to blue

Change the foreground color to magenta

Change the background color to magenta

Change the foreground color to purple

Change the background color to purple

Change the foreground color to cyan

Change the background color to cyan

Change the foreground color to white

Change the background color to white

Change the foreground color to the terminal default

Change the background color to the terminal default

Change the foreground color to bright black

Change the background color to bright black

Change the foreground color to bright red

Change the background color to bright red

Change the foreground color to bright green

Change the background color to bright green

Change the foreground color to bright yellow

Change the background color to bright yellow

Change the foreground color to bright blue

Change the background color to bright blue

Change the foreground color to bright magenta

Change the background color to bright magenta

Change the foreground color to bright purple

Change the background color to bright purple

Change the foreground color to bright cyan

Change the background color to bright cyan

Change the foreground color to bright white

Change the background color to bright white

Make the text bold

Make the text dim

Make the text italicized

Make the text italicized

Make the text blink

Make the text blink (but fast!)

Swap the foreground and background colors

Hide the text

Cross out the text

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more

Set the foreground color to a specific RGB value.

Set the background color to a specific RGB value.

Sets the foreground color to an RGB value.

Sets the background color to an RGB value.

Apply a runtime-determined style

Should always be Self

Add a header to a Section and indent the body Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more