pub trait ClientStateCommon {
    // Required methods
    fn verify_consensus_state(
        &self,
        consensus_state: Any
    ) -> Result<(), ClientError>;
    fn client_type(&self) -> ClientType;
    fn latest_height(&self) -> Height;
    fn validate_proof_height(
        &self,
        proof_height: Height
    ) -> 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>;
    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>;
}
Expand description

ClientState methods needed in both validation and execution.

They do not require access to a client ValidationContext nor ExecutionContext.

Required Methods§

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

Performs basic validation on the consensus_state.

Notably, an implementation should verify that it can properly deserialize the object into the expected format.

fn client_type(&self) -> ClientType

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

fn latest_height(&self) -> Height

Latest height the client was updated to

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

Validate that the client is at a sufficient height

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.

NOTE: proof heights are not included as upgrade to a new revision is expected to pass only on the last height committed by the current revision. Clients are responsible for ensuring that the planned last height of the current revision is somehow encoded in the proof verification process. This is to ensure that no premature upgrades occur, since upgrade plans committed to by the counterparty may be cancelled or modified before the last planned height.

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>

Implementors§