Skip to content

First stab at migrating to cometbft-rs #1103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ ibc-client-wasm-types = { version = "0.50.0", path = "./ibc-clients/ics08-
ibc-app-transfer-types = { version = "0.50.0", path = "./ibc-apps/ics20-transfer/types", default-features = false }
ibc-app-nft-transfer-types = { version = "0.50.0", path = "./ibc-apps/ics721-nft-transfer/types", default-features = false }

ibc-proto = { version = "0.41.0", default-features = false }
ibc-proto = { git = "https://github.com/cosmos/ibc-proto-rs.git", branch = "migrate-cometbft", default-features = false }

# cosmos dependencies
tendermint = { version = "0.34.0", default-features = false }
tendermint-light-client = { version = "0.34.0", default-features = false }
tendermint-light-client-verifier = { version = "0.34.0", default-features = false }
tendermint-proto = { version = "0.34.0", default-features = false }
tendermint-rpc = { version = "0.34.0", default-features = false }
tendermint-testgen = { version = "0.34.0", default-features = false }
cometbft = { version = "0.1.0-alpha.2", default-features = false }
cometbft-light-client = { version = "0.1.0-alpha.2", default-features = false }
cometbft-light-client-verifier = { version = "0.1.0-alpha.2", default-features = false }
cometbft-proto = { version = "0.1.0-alpha.2", default-features = false }
cometbft-rpc = { version = "0.1.0-alpha.2", default-features = false }
cometbft-testgen = { version = "0.1.0-alpha.2", default-features = false }

# parity dependencies
parity-scale-codec = { version = "3.6.5", default-features = false, features = ["full"] }
Expand Down
6 changes: 3 additions & 3 deletions ci/no-std-check/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ ibc-proto = { version = "0.41.0", default-features = false, features = [
"borsh",
"serde",
] }
tendermint = { version = "0.34", default-features = false }
tendermint-proto = { version = "0.34", default-features = false }
tendermint-light-client-verifier = { version = "0.34", default-features = false, features = ["rust-crypto"] }
cometbft = { version = "0.34", default-features = false }
cometbft-proto = { version = "0.34", default-features = false }
cometbft-light-client-verifier = { version = "0.34", default-features = false, features = ["rust-crypto"] }

sp-core = { version = "28.0.0", default-features = false, optional = true }
sp-io = { version = "30.0.0", default-features = false, optional = true }
Expand Down
4 changes: 2 additions & 2 deletions ibc-clients/ics07-tendermint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ ibc-core-handler-types = { workspace = true }
ibc-primitives = { workspace = true }

# cosmos dependencies
tendermint = { workspace = true }
tendermint-light-client-verifier = { workspace = true, features = ["rust-crypto"] }
cometbft = { workspace = true }
cometbft-light-client-verifier = { workspace = true, features = ["rust-crypto"] }

[features]
default = ["std"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use cometbft_light_client_verifier::Verifier;
use ibc_client_tendermint_types::error::{Error, IntoResult};
use ibc_client_tendermint_types::{Header as TmHeader, Misbehaviour as TmMisbehaviour};
use ibc_core_client::types::error::ClientError;
use ibc_core_host::types::identifiers::ClientId;
use ibc_core_host::types::path::ClientConsensusStatePath;
use ibc_primitives::prelude::*;
use ibc_primitives::Timestamp;
use tendermint_light_client_verifier::Verifier;

use super::{ClientState as TmClientState, TmValidationContext};
use crate::consensus_state::ConsensusState as TmConsensusState;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use cometbft_light_client_verifier::types::{TrustedBlockState, UntrustedBlockState};
use cometbft_light_client_verifier::Verifier;
use ibc_client_tendermint_types::error::{Error, IntoResult};
use ibc_client_tendermint_types::{ConsensusState as ConsensusStateType, Header as TmHeader};
use ibc_core_client::context::ClientExecutionContext;
use ibc_core_client::types::error::ClientError;
use ibc_core_host::types::identifiers::ClientId;
use ibc_core_host::types::path::ClientConsensusStatePath;
use ibc_primitives::prelude::*;
use tendermint_light_client_verifier::types::{TrustedBlockState, UntrustedBlockState};
use tendermint_light_client_verifier::Verifier;

use super::ClientState;
use crate::consensus_state::ConsensusState as TmConsensusState;
Expand Down
6 changes: 3 additions & 3 deletions ibc-clients/ics07-tendermint/src/consensus_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//! implementations that serve to pass through traits implemented on the wrapped
//! `ConsensusState` type.

use cometbft::{block, Hash, Time};
use ibc_client_tendermint_types::error::Error;
use ibc_client_tendermint_types::proto::v1::ConsensusState as RawTmConsensusState;
use ibc_client_tendermint_types::ConsensusState as ConsensusStateType;
Expand All @@ -15,7 +16,6 @@ use ibc_core_commitment_types::commitment::CommitmentRoot;
use ibc_primitives::prelude::*;
use ibc_primitives::proto::{Any, Protobuf};
use ibc_primitives::Timestamp;
use tendermint::{Hash, Time};

/// Newtype wrapper around the `ConsensusState` type imported from the
/// `ibc-client-tendermint-types` crate. This wrapper exists so that we can
Expand Down Expand Up @@ -77,8 +77,8 @@ impl From<ConsensusState> for Any {
}
}

impl From<tendermint::block::Header> for ConsensusState {
fn from(header: tendermint::block::Header) -> Self {
impl From<block::Header> for ConsensusState {
fn from(header: block::Header) -> Self {
Self(ConsensusStateType::from(header))
}
}
Expand Down
10 changes: 5 additions & 5 deletions ibc-clients/ics07-tendermint/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ ibc-primitives = { workspace = true }
ibc-proto = { workspace = true }

# cosmos dependencies
tendermint = { workspace = true }
tendermint-light-client-verifier = { workspace = true, features = ["rust-crypto"] }
tendermint-proto = { workspace = true }
cometbft = { workspace = true }
cometbft-light-client-verifier = { workspace = true, features = ["rust-crypto"] }
cometbft-proto = { workspace = true }

# parity dependencies
parity-scale-codec = { workspace = true, optional = true }
scale-info = { workspace = true, optional = true }

[dev-dependencies]
serde_json = { workspace = true }
tendermint-rpc = { workspace = true }
cometbft-rpc = { workspace = true }

[features]
default = ["std"]
Expand All @@ -54,7 +54,7 @@ std = [
"ibc-core-host-types/std",
"ibc-primitives/std",
"ibc-proto/std",
"tendermint/std",
"cometbft/std",
]
serde = [
"dep:serde",
Expand Down
10 changes: 5 additions & 5 deletions ibc-clients/ics07-tendermint/types/src/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ use core::cmp::max;
use core::str::FromStr;
use core::time::Duration;

use cometbft::chain::id::MAX_LENGTH as MaxChainIdLen;
use cometbft::trust_threshold::TrustThresholdFraction as TendermintTrustThresholdFraction;
use cometbft_light_client_verifier::options::Options;
use cometbft_light_client_verifier::ProdVerifier;
use ibc_core_client_types::error::ClientError;
use ibc_core_client_types::proto::v1::Height as RawHeight;
use ibc_core_client_types::Height;
Expand All @@ -14,10 +18,6 @@ use ibc_primitives::ZERO_DURATION;
use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::lightclients::tendermint::v1::ClientState as RawTmClientState;
use ibc_proto::Protobuf;
use tendermint::chain::id::MAX_LENGTH as MaxChainIdLen;
use tendermint::trust_threshold::TrustThresholdFraction as TendermintTrustThresholdFraction;
use tendermint_light_client_verifier::options::Options;
use tendermint_light_client_verifier::ProdVerifier;

use crate::error::Error;
use crate::header::Header as TmHeader;
Expand Down Expand Up @@ -377,9 +377,9 @@ impl From<ClientState> for Any {

#[cfg(all(test, feature = "serde"))]
pub(crate) mod serde_tests {
use cometbft_rpc::endpoint::abci_query::AbciQuery;
use serde::de::DeserializeOwned;
use serde::Serialize;
use tendermint_rpc::endpoint::abci_query::AbciQuery;

pub fn test_serialization_roundtrip<T>(json_data: &str)
where
Expand Down
15 changes: 8 additions & 7 deletions ibc-clients/ics07-tendermint/types/src/consensus_state.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
//! Defines Tendermint's `ConsensusState` type

use cometbft::block;
use cometbft::hash::Algorithm;
use cometbft::time::Time;
use cometbft::Hash;
use cometbft_proto::google::protobuf as tpb;
use ibc_core_client_types::error::ClientError;
use ibc_core_commitment_types::commitment::CommitmentRoot;
use ibc_primitives::prelude::*;
use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::lightclients::tendermint::v1::ConsensusState as RawConsensusState;
use ibc_proto::Protobuf;
use tendermint::hash::Algorithm;
use tendermint::time::Time;
use tendermint::Hash;
use tendermint_proto::google::protobuf as tpb;

use crate::error::Error;
use crate::header::Header;
Expand Down Expand Up @@ -132,8 +133,8 @@ impl From<ConsensusState> for Any {
}
}

impl From<tendermint::block::Header> for ConsensusState {
fn from(header: tendermint::block::Header) -> Self {
impl From<block::Header> for ConsensusState {
fn from(header: block::Header) -> Self {
Self {
root: CommitmentRoot::from_bytes(header.app_hash.as_ref()),
timestamp: header.time,
Expand All @@ -150,7 +151,7 @@ impl From<Header> for ConsensusState {

#[cfg(all(test, feature = "serde"))]
mod tests {
use tendermint_rpc::endpoint::abci_query::AbciQuery;
use cometbft_rpc::endpoint::abci_query::AbciQuery;

use crate::serde_tests::test_serialization_roundtrip;

Expand Down
8 changes: 4 additions & 4 deletions ibc-clients/ics07-tendermint/types/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

use core::time::Duration;

use cometbft::{Error as TendermintError, Hash};
use cometbft_light_client_verifier::errors::VerificationErrorDetail as LightClientErrorDetail;
use cometbft_light_client_verifier::operations::VotingPowerTally;
use cometbft_light_client_verifier::Verdict;
use displaydoc::Display;
use ibc_core_client_types::error::ClientError;
use ibc_core_client_types::Height;
use ibc_core_host_types::error::IdentifierError;
use ibc_core_host_types::identifiers::ClientId;
use ibc_primitives::prelude::*;
use tendermint::{Error as TendermintError, Hash};
use tendermint_light_client_verifier::errors::VerificationErrorDetail as LightClientErrorDetail;
use tendermint_light_client_verifier::operations::VotingPowerTally;
use tendermint_light_client_verifier::Verdict;

/// The main error type
#[derive(Debug, Display)]
Expand Down
8 changes: 4 additions & 4 deletions ibc-clients/ics07-tendermint/types/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
use core::fmt::{Display, Error as FmtError, Formatter};
use core::str::FromStr;

use cometbft::block::signed_header::SignedHeader;
use cometbft::chain::Id as TmChainId;
use cometbft::validator::Set as ValidatorSet;
use cometbft_light_client_verifier::types::{TrustedBlockState, UntrustedBlockState};
use ibc_core_client_types::error::ClientError;
use ibc_core_client_types::Height;
use ibc_core_host_types::identifiers::ChainId;
Expand All @@ -12,10 +16,6 @@ use ibc_proto::google::protobuf::Any;
use ibc_proto::ibc::lightclients::tendermint::v1::Header as RawHeader;
use ibc_proto::Protobuf;
use pretty::{PrettySignedHeader, PrettyValidatorSet};
use tendermint::block::signed_header::SignedHeader;
use tendermint::chain::Id as TmChainId;
use tendermint::validator::Set as ValidatorSet;
use tendermint_light_client_verifier::types::{TrustedBlockState, UntrustedBlockState};

use crate::consensus_state::ConsensusState as TmConsensusState;
use crate::error::Error;
Expand Down
2 changes: 1 addition & 1 deletion ibc-clients/ics07-tendermint/types/src/trust_threshold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

use core::fmt::{Display, Error as FmtError, Formatter};

use cometbft::trust_threshold::TrustThresholdFraction;
use ibc_core_client_types::error::ClientError;
use ibc_proto::ibc::lightclients::tendermint::v1::Fraction;
use ibc_proto::Protobuf;
use tendermint::trust_threshold::TrustThresholdFraction;

/// [`TrustThreshold`] defines the level of trust that a client has
/// towards a set of validators of a chain.
Expand Down
4 changes: 2 additions & 2 deletions ibc-core/ics02-client/context/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ibc-core-handler-types = { workspace = true }
ibc-primitives = { workspace = true }

# cosmos dependencies
tendermint = { workspace = true }
cometbft = { workspace = true }

[features]
default = ["std"]
Expand All @@ -43,7 +43,7 @@ std = [
"ibc-core-host-types/std",
"ibc-core-handler-types/std",
"ibc-primitives/std",
"tendermint/std",
"cometbft/std",
]
serde = [
"ibc-core-client-types/serde",
Expand Down
4 changes: 2 additions & 2 deletions ibc-core/ics02-client/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ibc-primitives = { workspace = true }
ibc-proto = { workspace = true }

# cosmos dependencies
tendermint = { workspace = true }
cometbft = { workspace = true }

# parity dependencies
parity-scale-codec = { workspace = true, optional = true }
Expand All @@ -49,7 +49,7 @@ std = [
"ibc-core-host-types/std",
"ibc-primitives/std",
"ibc-proto/std",
"tendermint/std",
"cometbft/std",
]
serde = [
"ibc-core-host-types/serde",
Expand Down
2 changes: 1 addition & 1 deletion ibc-core/ics02-client/types/src/events.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! Types for the IBC events emitted from Tendermint Websocket by the client module.
use cometbft::abci;
use derive_more::From;
use ibc_core_host_types::identifiers::{ClientId, ClientType};
use ibc_primitives::prelude::*;
use subtle_encoding::hex;
use tendermint::abci;

use crate::height::Height;

Expand Down
4 changes: 2 additions & 2 deletions ibc-core/ics03-connection/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ibc-primitives = { workspace = true }
ibc-proto = { workspace = true }

# cosmos dependencies
tendermint = { workspace = true }
cometbft = { workspace = true }

# parity dependencies
parity-scale-codec = { workspace = true, optional = true }
Expand All @@ -51,7 +51,7 @@ std = [
"ibc-core-host-types/std",
"ibc-primitives/std",
"ibc-proto/std",
"tendermint/std",
"cometbft/std",
]
serde = [
"dep:serde",
Expand Down
4 changes: 2 additions & 2 deletions ibc-core/ics03-connection/types/src/events.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Types for the IBC events emitted from Tendermint Websocket by the connection module.

use cometbft::abci;
use ibc_core_host_types::identifiers::{ClientId, ConnectionId};
use ibc_primitives::prelude::*;
use tendermint::abci;

/// Connection event types
const CONNECTION_OPEN_INIT_EVENT: &str = "connection_open_init";
Expand Down Expand Up @@ -307,8 +307,8 @@ mod tests {

use core::str::FromStr;

use cometbft::abci::Event as AbciEvent;
use ibc_core_host_types::identifiers::ClientType;
use tendermint::abci::Event as AbciEvent;

use super::*;

Expand Down
4 changes: 2 additions & 2 deletions ibc-core/ics04-channel/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ibc-primitives = { workspace = true }
ibc-proto = { workspace = true }

# cosmos dependencies
tendermint = { workspace = true }
cometbft = { workspace = true }

# parity dependencies
parity-scale-codec = { workspace = true, optional = true }
Expand All @@ -55,7 +55,7 @@ std = [
"ibc-core-commitment-types/std",
"ibc-primitives/std",
"ibc-proto/std",
"tendermint/std",
"cometbft/std",
]
serde = [
"dep:serde",
Expand Down
Loading