Struct ibc_testkit::testapp::ibc::clients::mock::client_state::MockClientState
source · pub struct MockClientState {
pub header: MockHeader,
pub frozen_height: Option<Height>,
}Expand description
A mock of a client state. For an example of a real structure that this mocks, you can see
ClientState of ics07_tendermint/client_state.rs.
Fields§
§header: MockHeader§frozen_height: Option<Height>Implementations§
source§impl MockClientState
impl MockClientState
pub fn new(header: MockHeader) -> Self
pub fn latest_height(&self) -> Height
pub fn refresh_time(&self) -> Option<Duration>
pub fn with_frozen_height(self, frozen_height: Height) -> Self
pub fn is_frozen(&self) -> bool
Trait Implementations§
source§impl ClientStateCommon for MockClientState
impl ClientStateCommon for MockClientState
source§fn verify_consensus_state(
&self,
consensus_state: Any
) -> Result<(), ClientError>
fn verify_consensus_state( &self, consensus_state: Any ) -> Result<(), ClientError>
Performs basic validation on the
consensus_state. Read moresource§fn client_type(&self) -> ClientType
fn client_type(&self) -> ClientType
Type of client associated with this state (eg. Tendermint)
source§fn latest_height(&self) -> Height
fn latest_height(&self) -> Height
Latest height the client was updated to
source§fn validate_proof_height(&self, proof_height: Height) -> Result<(), ClientError>
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>
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
fn verify_membership( &self, _prefix: &CommitmentPrefix, _proof: &CommitmentProofBytes, _root: &CommitmentRoot, _path: Path, _value: Vec<u8> ) -> Result<(), ClientError>
fn verify_non_membership( &self, _prefix: &CommitmentPrefix, _proof: &CommitmentProofBytes, _root: &CommitmentRoot, _path: Path ) -> Result<(), ClientError>
source§impl<E> ClientStateExecution<E> for MockClientStatewhere
E: ClientExecutionContext + MockClientContext,
<E as ClientExecutionContext>::AnyClientState: From<MockClientState>,
<E as ClientExecutionContext>::AnyConsensusState: From<MockConsensusState>,
impl<E> ClientStateExecution<E> for MockClientStatewhere
E: ClientExecutionContext + MockClientContext,
<E as ClientExecutionContext>::AnyClientState: From<MockClientState>,
<E as ClientExecutionContext>::AnyConsensusState: From<MockConsensusState>,
source§fn 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. Read more
source§fn 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. Read more
source§fn update_state_on_misbehaviour(
&self,
ctx: &mut E,
client_id: &ClientId,
_client_message: Any,
_update_kind: &UpdateKind
) -> Result<(), ClientError>
fn update_state_on_misbehaviour( &self, ctx: &mut E, client_id: &ClientId, _client_message: Any, _update_kind: &UpdateKind ) -> Result<(), ClientError>
update_state_on_misbehaviour should perform appropriate state changes on
a client state given that misbehaviour has been detected and verified
fn update_state_on_upgrade( &self, ctx: &mut E, client_id: &ClientId, upgraded_client_state: Any, upgraded_consensus_state: Any ) -> Result<Height, ClientError>
source§impl<V> ClientStateValidation<V> for MockClientStatewhere
V: ClientValidationContext + MockClientContext,
V::AnyConsensusState: TryInto<MockConsensusState>,
ClientError: From<<V::AnyConsensusState as TryInto<MockConsensusState>>::Error>,
impl<V> ClientStateValidation<V> for MockClientStatewhere
V: ClientValidationContext + MockClientContext,
V::AnyConsensusState: TryInto<MockConsensusState>,
ClientError: From<<V::AnyConsensusState as TryInto<MockConsensusState>>::Error>,
source§fn verify_client_message(
&self,
_ctx: &V,
_client_id: &ClientId,
client_message: Any,
update_kind: &UpdateKind
) -> Result<(), ClientError>
fn verify_client_message( &self, _ctx: &V, _client_id: &ClientId, client_message: Any, update_kind: &UpdateKind ) -> 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§impl Clone for MockClientState
impl Clone for MockClientState
source§fn clone(&self) -> MockClientState
fn clone(&self) -> MockClientState
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for MockClientState
impl Debug for MockClientState
source§impl<'de> Deserialize<'de> for MockClientState
impl<'de> Deserialize<'de> for MockClientState
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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<MockClientState> for Any
impl From<MockClientState> for Any
source§fn from(client_state: MockClientState) -> Self
fn from(client_state: MockClientState) -> Self
Converts to this type from the input type.
source§impl From<MockClientState> for AnyClientState
impl From<MockClientState> for AnyClientState
source§fn from(original: MockClientState) -> AnyClientState
fn from(original: MockClientState) -> AnyClientState
Converts to this type from the input type.
source§impl From<MockClientState> for ClientState
impl From<MockClientState> for ClientState
source§fn from(value: MockClientState) -> Self
fn from(value: MockClientState) -> Self
Converts to this type from the input type.
source§impl From<MockConsensusState> for MockClientState
impl From<MockConsensusState> for MockClientState
source§fn from(cs: MockConsensusState) -> Self
fn from(cs: MockConsensusState) -> Self
Converts to this type from the input type.
source§impl PartialEq for MockClientState
impl PartialEq for MockClientState
source§fn eq(&self, other: &MockClientState) -> bool
fn eq(&self, other: &MockClientState) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl Protobuf<Any> for MockClientState
impl Protobuf<Any> for MockClientState
§fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
Encode into a buffer in Protobuf format. Read more
§fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
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
§fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
Constructor that attempts to decode an instance from a buffer. Read more
§fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
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
§fn encoded_len(self) -> usize
fn encoded_len(self) -> usize
Returns the encoded length of the message without a length delimiter. Read more
§fn encode_vec(self) -> Vec<u8>
fn encode_vec(self) -> Vec<u8>
Encodes into a Protobuf-encoded
Vec<u8>.§fn decode_vec(v: &[u8]) -> Result<Self, Error>
fn decode_vec(v: &[u8]) -> Result<Self, Error>
Constructor that attempts to decode a Protobuf-encoded instance from a
Vec<u8> (or equivalent).§fn encode_length_delimited_vec(self) -> Vec<u8>
fn encode_length_delimited_vec(self) -> Vec<u8>
Encode with a length-delimiter to a
Vec<u8> Protobuf-encoded message.§fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>
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 MockClientState
impl Protobuf<ClientState> for MockClientState
§fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
Encode into a buffer in Protobuf format. Read more
§fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
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
§fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
Constructor that attempts to decode an instance from a buffer. Read more
§fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
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
§fn encoded_len(self) -> usize
fn encoded_len(self) -> usize
Returns the encoded length of the message without a length delimiter. Read more
§fn encode_vec(self) -> Vec<u8>
fn encode_vec(self) -> Vec<u8>
Encodes into a Protobuf-encoded
Vec<u8>.§fn decode_vec(v: &[u8]) -> Result<Self, Error>
fn decode_vec(v: &[u8]) -> Result<Self, Error>
Constructor that attempts to decode a Protobuf-encoded instance from a
Vec<u8> (or equivalent).§fn encode_length_delimited_vec(self) -> Vec<u8>
fn encode_length_delimited_vec(self) -> Vec<u8>
Encode with a length-delimiter to a
Vec<u8> Protobuf-encoded message.§fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>
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 MockClientState
impl Serialize for MockClientState
source§impl TryFrom<Any> for MockClientState
impl TryFrom<Any> for MockClientState
source§impl TryFrom<ClientState> for MockClientState
impl TryFrom<ClientState> for MockClientState
impl Copy for MockClientState
impl Eq for MockClientState
impl StructuralEq for MockClientState
impl StructuralPartialEq for MockClientState
Auto Trait Implementations§
impl RefUnwindSafe for MockClientState
impl Send for MockClientState
impl Sync for MockClientState
impl Unpin for MockClientState
impl UnwindSafe for MockClientState
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more