pub trait ClientStateValidation<V>: ClientStateCommon{
    // Required methods
    fn verify_client_message(
        &self,
        ctx: &V,
        client_id: &ClientId,
        client_message: Any
    ) -> Result<(), ClientError>;
    fn check_for_misbehaviour(
        &self,
        ctx: &V,
        client_id: &ClientId,
        client_message: Any
    ) -> Result<bool, ClientError>;
    fn status(
        &self,
        ctx: &V,
        client_id: &ClientId
    ) -> Result<Status, ClientError>;
}
Expand description

ClientState methods which require access to the client’s validation context

The generic type V enables light client developers to expand the set of methods available under the ClientValidationContext trait and use them in their implementation for validating a client state transition.

impl<V> ClientStateValidation<V> for MyClientState
where
    V: ClientValidationContext + MyValidationContext,
{
  // `MyValidationContext` methods available
}

trait MyValidationContext {
  // My Context methods
}

Required Methods§

source

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

verify_client_message must verify a client_message. A client_message could be a Header, Misbehaviour. It must handle each type of client_message appropriately. Calls to check_for_misbehaviour, update_state, and update_state_on_misbehaviour will assume that the content of the client_message has been verified and can be trusted. An error should be returned if the client_message fails to verify.

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.

Object Safety§

This trait is not object safe.

Implementors§