Trait ibc::core::client::context::client_state::ClientStateExecution
source · pub trait ClientStateExecution<E>: ClientStateValidation<E>where
E: ClientExecutionContext,{
// Required methods
fn initialise(
&self,
ctx: &mut E,
client_id: &ClientId,
consensus_state: Any
) -> Result<(), ClientError>;
fn update_state(
&self,
ctx: &mut E,
client_id: &ClientId,
header: Any
) -> Result<Vec<Height>, ClientError>;
fn update_state_on_misbehaviour(
&self,
ctx: &mut E,
client_id: &ClientId,
client_message: Any
) -> Result<(), ClientError>;
fn update_state_on_upgrade(
&self,
ctx: &mut E,
client_id: &ClientId,
upgraded_client_state: Any,
upgraded_consensus_state: Any
) -> Result<Height, ClientError>;
fn update_on_recovery(
&self,
ctx: &mut E,
subject_client_id: &ClientId,
substitute_client_state: Any,
substitute_consensus_state: Any
) -> Result<(), ClientError>;
}
Expand description
ClientState
methods which require access to the client’s
ExecutionContext
.
The generic type E
enables light client developers to expand the set of
methods available under the ClientExecutionContext
trait and use them in
their implementation for executing a client state transition.
Required Methods§
sourcefn initialise(
&self,
ctx: &mut E,
client_id: &ClientId,
consensus_state: Any
) -> Result<(), ClientError>
fn initialise( &self, ctx: &mut E, client_id: &ClientId, consensus_state: Any ) -> Result<(), ClientError>
Initialises the client with the initial client and consensus states.
Most clients will want to call E::store_client_state
and
E::store_consensus_state
.
sourcefn update_state(
&self,
ctx: &mut E,
client_id: &ClientId,
header: Any
) -> Result<Vec<Height>, ClientError>
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.
Note that header
is the field associated with UpdateKind::UpdateClient
.
Post-condition: on success, the return value MUST contain at least one height.
sourcefn update_state_on_misbehaviour(
&self,
ctx: &mut E,
client_id: &ClientId,
client_message: Any
) -> Result<(), ClientError>
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
sourcefn update_state_on_upgrade(
&self,
ctx: &mut E,
client_id: &ClientId,
upgraded_client_state: Any,
upgraded_consensus_state: Any
) -> Result<Height, ClientError>
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.
sourcefn update_on_recovery(
&self,
ctx: &mut E,
subject_client_id: &ClientId,
substitute_client_state: Any,
substitute_consensus_state: Any
) -> Result<(), ClientError>
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.