Skip to content

Commit

Permalink
wip: add custom rollkit client state
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Rodriguez committed Apr 19, 2024
1 parent f164c10 commit 2eb350b
Show file tree
Hide file tree
Showing 6 changed files with 332 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ tendermint-light-client-verifier = "0.34.1"
thiserror = { version = "1.0.49" }

[patch.crates-io]
ibc-proto = { git = "https://github.com/cosmos/ibc-proto-rs.git", rev = "6cbe4c7ace5a688bc98831fa9c1cc2dabf3b2976", default-features = false } # "0.42.2"
ibc-proto = { git = "https://github.com/cosmos/ibc-proto-rs.git", rev = "6d57834e03b5a3789c8d32a04c833d8926fad27b", default-features = false } # "0.42.2"

[dev-dependencies]
cw-multi-test = "2.0.0"
3 changes: 2 additions & 1 deletion src/context/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// mod ctx;
mod ctx;
mod custom_ctx;
mod execution_ctx;
mod validation_ctx;

pub use ctx::*;
pub use custom_ctx::*;
259 changes: 259 additions & 0 deletions src/types/client_state.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
use ibc_clients::tendermint::context::ConsensusStateConverter;
use ibc_clients::tendermint::types::ConsensusState;
use ibc_clients::tendermint::client_state::ClientState as TendermintClientState;
use ibc_proto::ibc::lightclients::rollkit::v1::ClientState as RawClientState;
use ibc_core::client::context::client_state::{ClientStateValidation, ClientStateExecution};
use ibc_core::client::context::client_state::ClientStateCommon;
use ibc_core::client::types::error::ClientError;

use ibc_core::client::types::Height;
use ibc_core::client::types::Status;
use ibc_core::commitment_types::commitment::{
CommitmentPrefix, CommitmentProofBytes, CommitmentRoot,
};
use ibc_core::primitives::proto::{Any, Protobuf};
use ibc_core::host::types::path::Path;
use ibc_core::host::types::identifiers::{ClientType, ClientId};

use crate::types::Error;
use crate::types::da_params::DaParams;
use crate::context::{ValidationContext, ExecutionContext};

pub const ROLLKIT_CLIENT_STATE_TYPE_URL: &str = "/ibc.lightclients.rollkit.v1.ClientState";

/// Defines the `ClientState` type for the Rollkit rollups.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq)]
pub struct ClientState {
pub tendermint_client_state: TendermintClientState,
pub da_params: DaParams,
}

impl ClientState {
pub fn new(tendermint_client_state: TendermintClientState, da_params: DaParams) -> Self {
Self {
tendermint_client_state,
da_params,
}
}

pub fn da_client_id(&self) -> &ClientId {
&self.da_params.client_id
}

pub fn da_fraud_period_window(&self) -> u64 {
self.da_params.fraud_period_window
}
}

impl Protobuf<RawClientState> for ClientState {}

impl TryFrom<RawClientState> for ClientState {
type Error = ClientError;

fn try_from(raw: RawClientState) -> Result<Self, Self::Error> {
let tendermint_client_state = raw
.tendermint_client_state
.ok_or(Error::missing("tendermint_client_state"))?
.try_into()?;

let da_params = raw
.da_params
.ok_or(Error::missing("da_params"))?
.try_into()?;

Ok(Self::new(tendermint_client_state, da_params))
}
}

impl From<ClientState> for RawClientState {
fn from(value: ClientState) -> Self {
Self {
tendermint_client_state: Some(value.tendermint_client_state.into()),
da_params: Some(value.da_params.into()),
}
}
}

impl Protobuf<Any> for ClientState {}

impl TryFrom<Any> for ClientState {
type Error = ClientError;

fn try_from(raw: Any) -> Result<Self, Self::Error> {
fn decode_client_state(value: &[u8]) -> Result<ClientState, ClientError> {
let client_state =
Protobuf::<RawClientState>::decode(value).map_err(|e| ClientError::Other {
description: e.to_string(),
})?;

Ok(client_state)
}

match raw.type_url.as_str() {
ROLLKIT_CLIENT_STATE_TYPE_URL => decode_client_state(&raw.value),
_ => Err(ClientError::UnknownClientStateType {
client_state_type: raw.type_url,
}),
}
}
}

impl From<ClientState> for Any {
fn from(client_state: ClientState) -> Self {
Any {
type_url: ROLLKIT_CLIENT_STATE_TYPE_URL.to_string(),
value: Protobuf::<RawClientState>::encode_vec(client_state),
}
}
}

impl ClientStateCommon for ClientState {
fn verify_consensus_state(&self, consensus_state: Any) -> Result<(), ClientError> {
let tm_consensus_state = ConsensusState::try_from(consensus_state)?;
if tm_consensus_state.root().is_empty() {
return Err(ClientError::Other {
description: "empty commitment root".into(),
});
};

Ok(())
}

fn client_type(&self) -> ClientType {
unimplemented!("client_type")
}

fn latest_height(&self) -> Height {
self.0.latest_height()
}

fn validate_proof_height(&self, proof_height: Height) -> Result<(), ClientError> {
if self.latest_height() < proof_height {
return Err(ClientError::InvalidProofHeight {
latest_height: self.latest_height(),
proof_height,
});
}
unimplemented!("validate_proof_height")
}

/// Perform client-specific verifications and check all data in the new
/// client state to be the same across all valid clients for the new chain.
///
/// You can learn more about how to upgrade IBC-connected SDK chains in
/// [this](https://ibc.cosmos.network/main/ibc/upgrades/quick-guide.html)
/// guide
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> {
unimplemented!("verify_upgrade_client")
}

fn verify_membership(
&self,
_prefix: &CommitmentPrefix,
_proof: &CommitmentProofBytes,
_root: &CommitmentRoot,
_path: Path,
_value: Vec<u8>,
) -> Result<(), ClientError> {
unimplemented!("verify_membership")
}

fn verify_non_membership(
&self,
_prefix: &CommitmentPrefix,
_proof: &CommitmentProofBytes,
_root: &CommitmentRoot,
_path: Path,
) -> Result<(), ClientError> {
unimplemented!("verify_non_membership")
}
}

impl<V> ClientStateValidation<V> for ClientState
where
V: ValidationContext,

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / test-stable

type mismatch resolving `<<V as ClientValidationContext>::ConsensusStateRef as TryInto<ConsensusState>>::Error == ClientError`

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / test-stable

the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / test-stable

the trait bound `ibc_clients::tendermint::consensus_state::ConsensusState: From<<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` is not satisfied

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / test-stable

the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / test-stable

the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / test-stable

the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:182:8 | 182 | V: ValidationContext, | ^^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ValidationContext` --> src/context/ctx.rs:27:30 | 25 | pub trait ValidationContext: ClientValidationContext | ----------------- required by a bound in this trait 26 | where 27 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ValidationContext` help: consider further restricting the associated type | 203 | fn status(&self, ctx: &V, client_id: &ClientId) -> Result<Status, ClientError> where <V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:182:8 | 182 | V: ValidationContext, | ^^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ValidationContext` --> src/context/ctx.rs:27:30 | 25 | pub trait ValidationContext: ClientValidationContext | ----------------- required by a bound in this trait 26 | where 27 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ValidationContext` help: consider further restricting the associated type | 203 | fn status(&self, ctx: &V, client_id: &ClientId) -> Result<Status, ClientError> where <V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:182:8 | 182 | V: ValidationContext, | ^^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ValidationContext` --> src/context/ctx.rs:27:30 | 25 | pub trait ValidationContext: ClientValidationContext | ----------------- required by a bound in this trait 26 | where 27 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ValidationContext` help: consider further restricting the associated type | 199 | ) -> Result<bool, ClientError> where <V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:182:8 | 182 | V: ValidationContext, | ^^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ValidationContext` --> src/context/ctx.rs:27:30 | 25 | pub trait ValidationContext: ClientValidationContext | ----------------- required by a bound in this trait 26 | where 27 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ValidationContext` help: consider further restricting the associated type | 199 | ) -> Result<bool, ClientError> where <V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:182:8 | 182 | V: ValidationContext, | ^^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ValidationContext` --> src/context/ctx.rs:27:30 | 25 | pub trait ValidationContext: ClientValidationContext | ----------------- required by a bound in this trait 26 | where 27 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ValidationContext` help: consider further restricting the associated type | 190 | ) -> Result<(), ClientError> where <V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:182:8 | 182 | V: ValidationContext, | ^^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ValidationContext` --> src/context/ctx.rs:27:30 | 25 | pub trait ValidationContext: ClientValidationContext | ----------------- required by a bound in this trait 26 | where 27 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ValidationContext` help: consider further restricting the associated type | 190 | ) -> Result<(), ClientError> where <V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `ibc_clients::tendermint::consensus_state::ConsensusState: std::convert::From<<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` is not satisfied

error[E0277]: the trait bound `ibc_clients::tendermint::consensus_state::ConsensusState: std::convert::From<<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` is not satisfied --> src/types/client_state.rs:182:8 | 182 | V: ValidationContext, | ^^^^^^^^^^^^^^^^^ the trait `std::convert::From<<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` is not implemented for `ibc_clients::tendermint::consensus_state::ConsensusState`, which is required by `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | = note: required for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `std::convert::Into<ibc_clients::tendermint::consensus_state::ConsensusState>` = note: required for `ibc_clients::tendermint::consensus_state::ConsensusState` to implement `std::convert::TryFrom<<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` = note: required for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `std::convert::TryInto<ibc_clients::tendermint::consensus_state::ConsensusState>` note: required for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ValidationContext` --> src/context/ctx.rs:27:30 | 25 | pub trait ValidationContext: ClientValidationContext | ----------------- required by a bound in this trait 26 | where 27 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ValidationContext` help: consider extending the `where` clause, but there might be an alternative better way to express this requirement | 183 | V::ConsensusStateRef: ConsensusStateConverter, ibc_clients::tendermint::consensus_state::ConsensusState: std::convert::From<<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `ibc_clients::tendermint::consensus_state::ConsensusState: std::convert::From<<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` is not satisfied

error[E0277]: the trait bound `ibc_clients::tendermint::consensus_state::ConsensusState: std::convert::From<<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` is not satisfied --> src/types/client_state.rs:182:8 | 182 | V: ValidationContext, | ^^^^^^^^^^^^^^^^^ the trait `std::convert::From<<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` is not implemented for `ibc_clients::tendermint::consensus_state::ConsensusState`, which is required by `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | = note: required for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `std::convert::Into<ibc_clients::tendermint::consensus_state::ConsensusState>` = note: required for `ibc_clients::tendermint::consensus_state::ConsensusState` to implement `std::convert::TryFrom<<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` = note: required for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `std::convert::TryInto<ibc_clients::tendermint::consensus_state::ConsensusState>` note: required for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ValidationContext` --> src/context/ctx.rs:27:30 | 25 | pub trait ValidationContext: ClientValidationContext | ----------------- required by a bound in this trait 26 | where 27 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ValidationContext` help: consider extending the `where` clause, but there might be an alternative better way to express this requirement | 183 | V::ConsensusStateRef: ConsensusStateConverter, ibc_clients::tendermint::consensus_state::ConsensusState: std::convert::From<<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:182:8 | 182 | V: ValidationContext, | ^^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ValidationContext` --> src/context/ctx.rs:27:30 | 25 | pub trait ValidationContext: ClientValidationContext | ----------------- required by a bound in this trait 26 | where 27 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ValidationContext` help: consider further restricting the associated type | 183 | V::ConsensusStateRef: ConsensusStateConverter, <V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:182:8 | 182 | V: ValidationContext, | ^^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ValidationContext` --> src/context/ctx.rs:27:30 | 25 | pub trait ValidationContext: ClientValidationContext | ----------------- required by a bound in this trait 26 | where 27 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ValidationContext` help: consider further restricting the associated type | 183 | V::ConsensusStateRef: ConsensusStateConverter, <V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

type mismatch resolving `<<V as ClientValidationContext>::ConsensusStateRef as TryInto<ConsensusState>>::Error == ClientError`

error[E0271]: type mismatch resolving `<<V as ClientValidationContext>::ConsensusStateRef as TryInto<ConsensusState>>::Error == ClientError` --> src/types/client_state.rs:182:8 | 182 | V: ValidationContext, | ^^^^^^^^^^^^^^^^^ expected `ClientError`, found `Infallible` | note: required for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------- unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ValidationContext` --> src/context/ctx.rs:27:30 | 25 | pub trait ValidationContext: ClientValidationContext | ----------------- required by a bound in this trait 26 | where 27 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ValidationContext`

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

type mismatch resolving `<<V as ClientValidationContext>::ConsensusStateRef as TryInto<ConsensusState>>::Error == ClientError`

error[E0271]: type mismatch resolving `<<V as ClientValidationContext>::ConsensusStateRef as TryInto<ConsensusState>>::Error == ClientError` --> src/types/client_state.rs:182:8 | 182 | V: ValidationContext, | ^^^^^^^^^^^^^^^^^ expected `ClientError`, found `Infallible` | note: required for `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------- unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ValidationContext` --> src/context/ctx.rs:27:30 | 25 | pub trait ValidationContext: ClientValidationContext | ----------------- required by a bound in this trait 26 | where 27 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ValidationContext`

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / doc_all_features

type mismatch resolving `<<V as ClientValidationContext>::ConsensusStateRef as TryInto<ConsensusState>>::Error == ClientError`

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / doc_all_features

the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / doc_all_features

the trait bound `ibc_clients::tendermint::consensus_state::ConsensusState: From<<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` is not satisfied

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / doc_all_features

the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / doc_all_features

the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

Check failure on line 182 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / doc_all_features

the trait bound `<V as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied
V::ConsensusStateRef: ConsensusStateConverter,
{
fn verify_client_message(
&self,
_ctx: &V,
_client_id: &ClientId,
_client_message: Any,
) -> Result<(), ClientError> {
unimplemented!("verify_client_message")
}

fn check_for_misbehaviour(
&self,
_ctx: &V,
_client_id: &ClientId,
_client_message: Any,
) -> Result<bool, ClientError> {
unimplemented!("check_for_misbehaviour")
}

fn status(&self, ctx: &V, client_id: &ClientId) -> Result<Status, ClientError> {
unimplemented!("status")
}
}

impl<E> ClientStateExecution<E> for ClientState
where
E: ExecutionContext,

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / test-stable

type mismatch resolving `<<E as ClientValidationContext>::ConsensusStateRef as TryInto<ConsensusState>>::Error == ClientError`

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / test-stable

the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / test-stable

the trait bound `ibc_clients::tendermint::consensus_state::ConsensusState: From<<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` is not satisfied

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / test-stable

the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:210:8 | 210 | E: ExecutionContext, | ^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ExecutionContext` --> src/context/ctx.rs:59:30 | 57 | pub trait ExecutionContext: ValidationContext + ClientExecutionContext | ---------------- required by a bound in this trait 58 | where 59 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ExecutionContext` help: consider further restricting the associated type | 247 | ) -> Result<Height, ClientError> where <E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:210:8 | 210 | E: ExecutionContext, | ^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ExecutionContext` --> src/context/ctx.rs:59:30 | 57 | pub trait ExecutionContext: ValidationContext + ClientExecutionContext | ---------------- required by a bound in this trait 58 | where 59 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ExecutionContext` help: consider further restricting the associated type | 247 | ) -> Result<Height, ClientError> where <E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:210:8 | 210 | E: ExecutionContext, | ^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ExecutionContext` --> src/context/ctx.rs:59:30 | 57 | pub trait ExecutionContext: ValidationContext + ClientExecutionContext | ---------------- required by a bound in this trait 58 | where 59 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ExecutionContext` help: consider further restricting the associated type | 237 | ) -> Result<(), ClientError> where <E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:210:8 | 210 | E: ExecutionContext, | ^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ExecutionContext` --> src/context/ctx.rs:59:30 | 57 | pub trait ExecutionContext: ValidationContext + ClientExecutionContext | ---------------- required by a bound in this trait 58 | where 59 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ExecutionContext` help: consider further restricting the associated type | 237 | ) -> Result<(), ClientError> where <E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:210:8 | 210 | E: ExecutionContext, | ^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ExecutionContext` --> src/context/ctx.rs:59:30 | 57 | pub trait ExecutionContext: ValidationContext + ClientExecutionContext | ---------------- required by a bound in this trait 58 | where 59 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ExecutionContext` help: consider further restricting the associated type | 228 | ) -> Result<Vec<Height>, ClientError> where <E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:210:8 | 210 | E: ExecutionContext, | ^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ExecutionContext` --> src/context/ctx.rs:59:30 | 57 | pub trait ExecutionContext: ValidationContext + ClientExecutionContext | ---------------- required by a bound in this trait 58 | where 59 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ExecutionContext` help: consider further restricting the associated type | 228 | ) -> Result<Vec<Height>, ClientError> where <E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:210:8 | 210 | E: ExecutionContext, | ^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ExecutionContext` --> src/context/ctx.rs:59:30 | 57 | pub trait ExecutionContext: ValidationContext + ClientExecutionContext | ---------------- required by a bound in this trait 58 | where 59 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ExecutionContext` help: consider further restricting the associated type | 219 | ) -> Result<(), ClientError> where <E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:210:8 | 210 | E: ExecutionContext, | ^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ExecutionContext` --> src/context/ctx.rs:59:30 | 57 | pub trait ExecutionContext: ValidationContext + ClientExecutionContext | ---------------- required by a bound in this trait 58 | where 59 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ExecutionContext` help: consider further restricting the associated type | 219 | ) -> Result<(), ClientError> where <E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `ibc_clients::tendermint::consensus_state::ConsensusState: std::convert::From<<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` is not satisfied

error[E0277]: the trait bound `ibc_clients::tendermint::consensus_state::ConsensusState: std::convert::From<<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` is not satisfied --> src/types/client_state.rs:210:8 | 210 | E: ExecutionContext, | ^^^^^^^^^^^^^^^^ the trait `std::convert::From<<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` is not implemented for `ibc_clients::tendermint::consensus_state::ConsensusState`, which is required by `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | = note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `std::convert::Into<ibc_clients::tendermint::consensus_state::ConsensusState>` = note: required for `ibc_clients::tendermint::consensus_state::ConsensusState` to implement `std::convert::TryFrom<<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` = note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `std::convert::TryInto<ibc_clients::tendermint::consensus_state::ConsensusState>` note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ExecutionContext` --> src/context/ctx.rs:59:30 | 57 | pub trait ExecutionContext: ValidationContext + ClientExecutionContext | ---------------- required by a bound in this trait 58 | where 59 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ExecutionContext` help: consider extending the `where` clause, but there might be an alternative better way to express this requirement | 212 | E::ConsensusStateRef: ConsensusStateConverter, ibc_clients::tendermint::consensus_state::ConsensusState: std::convert::From<<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `ibc_clients::tendermint::consensus_state::ConsensusState: std::convert::From<<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` is not satisfied

error[E0277]: the trait bound `ibc_clients::tendermint::consensus_state::ConsensusState: std::convert::From<<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` is not satisfied --> src/types/client_state.rs:210:8 | 210 | E: ExecutionContext, | ^^^^^^^^^^^^^^^^ the trait `std::convert::From<<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` is not implemented for `ibc_clients::tendermint::consensus_state::ConsensusState`, which is required by `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | = note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `std::convert::Into<ibc_clients::tendermint::consensus_state::ConsensusState>` = note: required for `ibc_clients::tendermint::consensus_state::ConsensusState` to implement `std::convert::TryFrom<<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` = note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `std::convert::TryInto<ibc_clients::tendermint::consensus_state::ConsensusState>` note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ExecutionContext` --> src/context/ctx.rs:59:30 | 57 | pub trait ExecutionContext: ValidationContext + ClientExecutionContext | ---------------- required by a bound in this trait 58 | where 59 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ExecutionContext` help: consider extending the `where` clause, but there might be an alternative better way to express this requirement | 212 | E::ConsensusStateRef: ConsensusStateConverter, ibc_clients::tendermint::consensus_state::ConsensusState: std::convert::From<<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:210:8 | 210 | E: ExecutionContext, | ^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ExecutionContext` --> src/context/ctx.rs:59:30 | 57 | pub trait ExecutionContext: ValidationContext + ClientExecutionContext | ---------------- required by a bound in this trait 58 | where 59 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ExecutionContext` help: consider further restricting the associated type | 212 | E::ConsensusStateRef: ConsensusStateConverter, <E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

error[E0277]: the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied --> src/types/client_state.rs:210:8 | 210 | E: ExecutionContext, | ^^^^^^^^^^^^^^^^ the trait `std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not implemented for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef`, which is required by `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: context::ctx::ConsensusStateConverter` | note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------------------ unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ExecutionContext` --> src/context/ctx.rs:59:30 | 57 | pub trait ExecutionContext: ValidationContext + ClientExecutionContext | ---------------- required by a bound in this trait 58 | where 59 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ExecutionContext` help: consider further restricting the associated type | 212 | E::ConsensusStateRef: ConsensusStateConverter, <E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: std::convert::From<ibc_clients::tendermint::consensus_state::ConsensusState> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

type mismatch resolving `<<E as ClientValidationContext>::ConsensusStateRef as TryInto<ConsensusState>>::Error == ClientError`

error[E0271]: type mismatch resolving `<<E as ClientValidationContext>::ConsensusStateRef as TryInto<ConsensusState>>::Error == ClientError` --> src/types/client_state.rs:210:8 | 210 | E: ExecutionContext, | ^^^^^^^^^^^^^^^^ expected `ClientError`, found `Infallible` | note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------- unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ExecutionContext` --> src/context/ctx.rs:59:30 | 57 | pub trait ExecutionContext: ValidationContext + ClientExecutionContext | ---------------- required by a bound in this trait 58 | where 59 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ExecutionContext`

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / clippy

type mismatch resolving `<<E as ClientValidationContext>::ConsensusStateRef as TryInto<ConsensusState>>::Error == ClientError`

error[E0271]: type mismatch resolving `<<E as ClientValidationContext>::ConsensusStateRef as TryInto<ConsensusState>>::Error == ClientError` --> src/types/client_state.rs:210:8 | 210 | E: ExecutionContext, | ^^^^^^^^^^^^^^^^ expected `ClientError`, found `Infallible` | note: required for `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef` to implement `context::ctx::ConsensusStateConverter` --> src/context/ctx.rs:19:9 | 19 | impl<C> ConsensusStateConverter for C where | ^^^^^^^^^^^^^^^^^^^^^^^ ^ 20 | C: TryInto<TendermintConsensusState, Error = ClientError> + From<TendermintConsensusState> | ------------------- unsatisfied trait bound introduced here note: required by a bound in `context::ctx::ExecutionContext` --> src/context/ctx.rs:59:30 | 57 | pub trait ExecutionContext: ValidationContext + ClientExecutionContext | ---------------- required by a bound in this trait 58 | where 59 | Self::ConsensusStateRef: ConsensusStateConverter, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ExecutionContext`

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / doc_all_features

type mismatch resolving `<<E as ClientValidationContext>::ConsensusStateRef as TryInto<ConsensusState>>::Error == ClientError`

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / doc_all_features

the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / doc_all_features

the trait bound `ibc_clients::tendermint::consensus_state::ConsensusState: From<<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef>` is not satisfied

Check failure on line 210 in src/types/client_state.rs

View workflow job for this annotation

GitHub Actions / doc_all_features

the trait bound `<E as ibc_core::client::context::ClientValidationContext>::ConsensusStateRef: From<ibc_clients::tendermint::consensus_state::ConsensusState>` is not satisfied
E::ClientStateRef: From<ClientState>,
E::ConsensusStateRef: ConsensusStateConverter,
{
fn initialise(
&self,
ctx: &mut E,
client_id: &ClientId,
consensus_state: Any,
) -> Result<(), ClientError> {
unimplemented!("initialise")
}

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

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

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

// fn update_on_recovery(
// &self,
// ctx: &mut E,
// subject_client_id: &ClientId,
// substitute_client_state: Any,
// ) -> Result<(), ClientError> {
// unimplemented!("update_on_recovery")
// }
}
15 changes: 3 additions & 12 deletions src/types/da_data.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
use base64::engine::general_purpose;
use base64::Engine;
use core::fmt::{Debug, Display, Error as FmtError, Formatter};
use core::str::FromStr;

use ibc_core::host::types::identifiers::ClientId;
use ibc_core::primitives::proto::Protobuf;
use ibc_proto::ibc::lightclients::rollkit::v1::DaData as RawDaData;

use crate::types::Error;

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
/// Tendermint consensus header
#[derive(Clone, PartialEq, Eq)]
pub struct DaData {
pub client_id: ClientId,
pub shared_proof: Vec<u8>,
}

Expand All @@ -27,17 +23,15 @@ impl Display for DaData {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"DaData {{ client_id: {}, shared_proof: {} }}",
&self.client_id,
"DaData {{ shared_proof: {} }}",
&general_purpose::STANDARD.encode(&self.shared_proof)
)
}
}

impl DaData {
pub fn new(client_id: ClientId, shared_proof: Vec<u8>) -> Self {
pub fn new(shared_proof: Vec<u8>) -> Self {
Self {
client_id,
shared_proof,
}
}
Expand All @@ -49,16 +43,13 @@ impl TryFrom<RawDaData> for DaData {
type Error = Error;

fn try_from(raw: RawDaData) -> Result<Self, Self::Error> {
let client_id = ClientId::from_str(&raw.client_id).map_err(Error::source)?;

Ok(Self::new(client_id, raw.shared_proof))
Ok(Self::new(raw.shared_proof))
}
}

impl From<DaData> for RawDaData {
fn from(value: DaData) -> Self {
Self {
client_id: value.client_id.to_string(),
shared_proof: value.shared_proof,
}
}
Expand Down
62 changes: 62 additions & 0 deletions src/types/da_params.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
use core::str::FromStr;
use core::fmt::{Debug, Display, Error as FmtError, Formatter};

use ibc_core::host::types::identifiers::ClientId;
use ibc_core::primitives::proto::Protobuf;
use ibc_proto::ibc::lightclients::rollkit::v1::DaParams as RawDaParams;

use crate::types::Error;

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, PartialEq, Eq)]
pub struct DaParams {
pub client_id: ClientId,
pub fraud_period_window: u64,
}

impl Debug for DaParams {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(f, " DaParams {{...}}")
}
}

impl Display for DaParams {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
write!(
f,
"DaParams {{ client_id: {}, fraud_period_window: {} }}",
&self.client_id,
&self.fraud_period_window,
)
}
}

impl DaParams {
pub fn new(client_id: ClientId, fraud_period_window: u64) -> Self {
Self {
client_id,
fraud_period_window,
}
}
}

impl Protobuf<RawDaParams> for DaParams {}

impl TryFrom<RawDaParams> for DaParams {
type Error = Error;

fn try_from(raw: RawDaParams) -> Result<Self, Self::Error> {
let client_id = ClientId::from_str(&raw.client_id).map_err(Error::source)?;

Ok(Self::new(client_id, raw.fraud_period_window))
}
}

impl From<DaParams> for RawDaParams {
fn from(value: DaParams) -> Self {
Self {
client_id: value.client_id.to_string(),
fraud_period_window: value.fraud_period_window
}
}
}
Loading

0 comments on commit 2eb350b

Please sign in to comment.