Struct ClientState

Source
pub struct ClientState(/* private fields */);
Expand description

Newtype wrapper around the ClientState type, imported from the ibc-client-tendermint-types crate. This wrapper exists so that we can bypass Rust’s orphan rules and implement traits from ibc::core::client::context on the ClientState type.

Implementations§

Trait Implementations§

Source§

impl ClientStateCommon for ClientState

Source§

fn verify_consensus_state( &self, consensus_state: Any, host_timestamp: &Timestamp, ) -> Result<(), ClientError>

Performs basic validation on the consensus_state. Read more
Source§

fn client_type(&self) -> ClientType

Type of client associated with this state (eg. Tendermint)
Source§

fn latest_height(&self) -> Height

The latest height the client was updated to
Source§

fn validate_proof_height(&self, proof_height: Height) -> Result<(), ClientError>

Validate that the client is at a sufficient height
Source§

fn verify_upgrade_client( &self, upgraded_client_state: Any, upgraded_consensus_state: Any, proof_upgrade_client: CommitmentProofBytes, proof_upgrade_consensus_state: CommitmentProofBytes, root: &CommitmentRoot, ) -> Result<(), ClientError>

Verify the upgraded client and consensus states and validate proofs against the given root. Read more
Source§

fn serialize_path(&self, path: Path) -> Result<PathBytes, ClientError>

Serializes a given path object into a raw path bytes. Read more
Source§

fn verify_membership_raw( &self, prefix: &CommitmentPrefix, proof: &CommitmentProofBytes, root: &CommitmentRoot, path: PathBytes, value: Vec<u8>, ) -> Result<(), ClientError>

Verifies a proof of the existence of a value at a given raw path bytes.
Source§

fn verify_non_membership_raw( &self, prefix: &CommitmentPrefix, proof: &CommitmentProofBytes, root: &CommitmentRoot, path: PathBytes, ) -> Result<(), ClientError>

Verifies the absence of a given proof at a given raw path bytes.
Source§

fn verify_membership( &self, prefix: &CommitmentPrefix, proof: &CommitmentProofBytes, root: &CommitmentRoot, path: Path, value: Vec<u8>, ) -> Result<(), ClientError>

Verifies a proof of the existence of a value at a given path object.
Source§

fn verify_non_membership( &self, prefix: &CommitmentPrefix, proof: &CommitmentProofBytes, root: &CommitmentRoot, path: Path, ) -> Result<(), ClientError>

Verifies the absence of a given proof at a given path object.
Source§

impl<E> ClientStateExecution<E> for ClientState

Source§

fn initialise( &self, ctx: &mut E, client_id: &ClientId, consensus_state: Any, ) -> Result<(), ClientError>

Initialises the client with the initial client and consensus states. Read more
Source§

fn update_state( &self, ctx: &mut E, client_id: &ClientId, header: Any, ) -> Result<Vec<Height>, ClientError>

Updates and stores as necessary any associated information for an IBC client, such as the ClientState and corresponding ConsensusState. Upon successful update, a list of consensus heights is returned. It assumes the client_message has already been verified. Read more
Source§

fn update_state_on_misbehaviour( &self, ctx: &mut E, client_id: &ClientId, client_message: Any, ) -> Result<(), ClientError>

update_state_on_misbehaviour should perform appropriate state changes on a client state given that misbehaviour has been detected and verified
Source§

fn update_state_on_upgrade( &self, ctx: &mut E, client_id: &ClientId, upgraded_client_state: Any, upgraded_consensus_state: Any, ) -> Result<Height, ClientError>

Update the client state and consensus state in the store with the upgraded ones.
Source§

fn update_on_recovery( &self, ctx: &mut E, subject_client_id: &ClientId, substitute_client_state: Any, substitute_consensus_state: Any, ) -> Result<(), ClientError>

Update the subject client using the substitute_client_state in response to a successful client recovery.
Source§

impl<V> ClientStateValidation<V> for ClientState

Source§

fn verify_client_message( &self, ctx: &V, client_id: &ClientId, client_message: Any, ) -> Result<(), ClientError>

The default verification logic exposed by ibc-rs simply delegates to a standalone verify_client_message function. This is to make it as simple as possible for those who merely need the default ProdVerifier behaviour, as well as those who require custom verification logic.

In a situation where the Tendermint ProdVerifier doesn’t provide the desired outcome, users should define a custom verifier struct and then implement the Verifier trait for it.

In order to wire up the custom verifier, create a newtype ClientState wrapper similar to ClientState and implement all client state traits for it. For method implementation, the simplest way is to import and call their analogous standalone versions under the crate::client_state module, unless bespoke logic is desired for any of those functions. Then, when it comes to implementing the verify_client_message method, use the verify_client_message function and pass your custom verifier object as the verifier parameter.

Source§

fn check_for_misbehaviour( &self, ctx: &V, client_id: &ClientId, client_message: Any, ) -> Result<bool, ClientError>

Checks for evidence of a misbehaviour in Header or Misbehaviour type. It assumes the client_message has already been verified.
Source§

fn status(&self, ctx: &V, client_id: &ClientId) -> Result<Status, ClientError>

Returns the status of the client. Only Active clients are allowed to process packets.
Source§

fn check_substitute( &self, _ctx: &V, substitute_client_state: Any, ) -> Result<(), ClientError>

Verifies whether the calling (subject) client state matches the substitute client state for the purposes of client recovery. Read more
Source§

impl Clone for ClientState

Source§

fn clone(&self) -> ClientState

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ClientState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ClientState

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<ClientState> for Any

Source§

fn from(client_state: ClientState) -> Self

Converts to this type from the input type.
Source§

impl From<ClientState> for ClientState

Source§

fn from(value: ClientStateType) -> Self

Converts to this type from the input type.
Source§

impl From<ClientState> for ClientState

Source§

fn from(client_state: ClientState) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ClientState

Source§

fn eq(&self, other: &ClientState) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Protobuf<Any> for ClientState

Source§

fn encode<B>(self, buf: &mut B) -> Result<(), Error>
where B: BufMut,

Encode into a buffer in Protobuf format. Read more
Source§

fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>
where B: BufMut,

Encode with a length-delimiter to a buffer in Protobuf format. Read more
Source§

fn decode<B>(buf: B) -> Result<Self, Error>
where B: Buf,

Constructor that attempts to decode an instance from a buffer. Read more
Source§

fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>
where B: Buf,

Constructor that attempts to decode a length-delimited instance from the buffer. Read more
Source§

fn encoded_len(self) -> usize

Returns the encoded length of the message without a length delimiter. Read more
Source§

fn encode_vec(self) -> Vec<u8>

Encodes into a Protobuf-encoded Vec<u8>.
Source§

fn decode_vec(v: &[u8]) -> Result<Self, Error>

Constructor that attempts to decode a Protobuf-encoded instance from a Vec<u8> (or equivalent).
Source§

fn encode_length_delimited_vec(self) -> Vec<u8>

Encode with a length-delimiter to a Vec<u8> Protobuf-encoded message.
Source§

fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>

Constructor that attempts to decode a Protobuf-encoded instance with a length-delimiter from a Vec<u8> or equivalent.
Source§

impl Protobuf<ClientState> for ClientState

Source§

fn encode<B>(self, buf: &mut B) -> Result<(), Error>
where B: BufMut,

Encode into a buffer in Protobuf format. Read more
Source§

fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>
where B: BufMut,

Encode with a length-delimiter to a buffer in Protobuf format. Read more
Source§

fn decode<B>(buf: B) -> Result<Self, Error>
where B: Buf,

Constructor that attempts to decode an instance from a buffer. Read more
Source§

fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>
where B: Buf,

Constructor that attempts to decode a length-delimited instance from the buffer. Read more
Source§

fn encoded_len(self) -> usize

Returns the encoded length of the message without a length delimiter. Read more
Source§

fn encode_vec(self) -> Vec<u8>

Encodes into a Protobuf-encoded Vec<u8>.
Source§

fn decode_vec(v: &[u8]) -> Result<Self, Error>

Constructor that attempts to decode a Protobuf-encoded instance from a Vec<u8> (or equivalent).
Source§

fn encode_length_delimited_vec(self) -> Vec<u8>

Encode with a length-delimiter to a Vec<u8> Protobuf-encoded message.
Source§

fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>

Constructor that attempts to decode a Protobuf-encoded instance with a length-delimiter from a Vec<u8> or equivalent.
Source§

impl Serialize for ClientState

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<Any> for ClientState

Source§

type Error = DecodingError

The type returned in the event of a conversion error.
Source§

fn try_from(raw: Any) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<ClientState> for ClientState

Source§

type Error = DecodingError

The type returned in the event of a conversion error.
Source§

fn try_from(raw: RawTmClientState) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl StructuralPartialEq for ClientState

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, E, T> ClientState<V, E> for T

Source§

impl<T, C> Convertible<C> for T
where T: TryFrom<C> + Into<C>,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> JsonSchemaMaybe for T