From b63a035c81ec764a70f1874b8868e5403c54e036 Mon Sep 17 00:00:00 2001 From: Mikhail Zabaluev Date: Wed, 28 Feb 2024 15:47:35 +0200 Subject: [PATCH 1/2] Switch over to cometbft-rs in Cargo.toml --- Cargo.toml | 14 +++++++------- ci/no-std-check/Cargo.toml | 6 +++--- ibc-clients/ics07-tendermint/Cargo.toml | 4 ++-- ibc-clients/ics07-tendermint/types/Cargo.toml | 10 +++++----- ibc-core/ics02-client/context/Cargo.toml | 4 ++-- ibc-core/ics02-client/types/Cargo.toml | 4 ++-- ibc-core/ics03-connection/types/Cargo.toml | 4 ++-- ibc-core/ics04-channel/types/Cargo.toml | 4 ++-- ibc-core/ics24-host/cosmos/Cargo.toml | 2 +- ibc-core/ics25-handler/types/Cargo.toml | 4 ++-- ibc-core/ics26-routing/types/Cargo.toml | 4 ++-- ibc-primitives/Cargo.toml | 4 ++-- ibc-testkit/Cargo.toml | 6 +++--- 13 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c4590de59..b93b878d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] } diff --git a/ci/no-std-check/Cargo.toml b/ci/no-std-check/Cargo.toml index 815a42f96..a719df948 100644 --- a/ci/no-std-check/Cargo.toml +++ b/ci/no-std-check/Cargo.toml @@ -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 } diff --git a/ibc-clients/ics07-tendermint/Cargo.toml b/ibc-clients/ics07-tendermint/Cargo.toml index b1727305e..3d5e25c05 100644 --- a/ibc-clients/ics07-tendermint/Cargo.toml +++ b/ibc-clients/ics07-tendermint/Cargo.toml @@ -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"] diff --git a/ibc-clients/ics07-tendermint/types/Cargo.toml b/ibc-clients/ics07-tendermint/types/Cargo.toml index 2eae85a94..69a91b3c0 100644 --- a/ibc-clients/ics07-tendermint/types/Cargo.toml +++ b/ibc-clients/ics07-tendermint/types/Cargo.toml @@ -31,9 +31,9 @@ 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 } @@ -41,7 +41,7 @@ scale-info = { workspace = true, optional = true } [dev-dependencies] serde_json = { workspace = true } -tendermint-rpc = { workspace = true } +cometbft-rpc = { workspace = true } [features] default = ["std"] @@ -54,7 +54,7 @@ std = [ "ibc-core-host-types/std", "ibc-primitives/std", "ibc-proto/std", - "tendermint/std", + "cometbft/std", ] serde = [ "dep:serde", diff --git a/ibc-core/ics02-client/context/Cargo.toml b/ibc-core/ics02-client/context/Cargo.toml index e4eb8db05..b90d1d583 100644 --- a/ibc-core/ics02-client/context/Cargo.toml +++ b/ibc-core/ics02-client/context/Cargo.toml @@ -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"] @@ -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", diff --git a/ibc-core/ics02-client/types/Cargo.toml b/ibc-core/ics02-client/types/Cargo.toml index de5f7b656..4bbdb4dd0 100644 --- a/ibc-core/ics02-client/types/Cargo.toml +++ b/ibc-core/ics02-client/types/Cargo.toml @@ -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 } @@ -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", diff --git a/ibc-core/ics03-connection/types/Cargo.toml b/ibc-core/ics03-connection/types/Cargo.toml index 07091d845..cdb7fb2f3 100644 --- a/ibc-core/ics03-connection/types/Cargo.toml +++ b/ibc-core/ics03-connection/types/Cargo.toml @@ -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 } @@ -51,7 +51,7 @@ std = [ "ibc-core-host-types/std", "ibc-primitives/std", "ibc-proto/std", - "tendermint/std", + "cometbft/std", ] serde = [ "dep:serde", diff --git a/ibc-core/ics04-channel/types/Cargo.toml b/ibc-core/ics04-channel/types/Cargo.toml index 55aee47f5..0c82e245c 100644 --- a/ibc-core/ics04-channel/types/Cargo.toml +++ b/ibc-core/ics04-channel/types/Cargo.toml @@ -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 } @@ -55,7 +55,7 @@ std = [ "ibc-core-commitment-types/std", "ibc-primitives/std", "ibc-proto/std", - "tendermint/std", + "cometbft/std", ] serde = [ "dep:serde", diff --git a/ibc-core/ics24-host/cosmos/Cargo.toml b/ibc-core/ics24-host/cosmos/Cargo.toml index e9c2e73e6..fdabbcc0f 100644 --- a/ibc-core/ics24-host/cosmos/Cargo.toml +++ b/ibc-core/ics24-host/cosmos/Cargo.toml @@ -39,7 +39,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 } diff --git a/ibc-core/ics25-handler/types/Cargo.toml b/ibc-core/ics25-handler/types/Cargo.toml index 853e43c39..94de831a7 100644 --- a/ibc-core/ics25-handler/types/Cargo.toml +++ b/ibc-core/ics25-handler/types/Cargo.toml @@ -37,7 +37,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 } @@ -57,7 +57,7 @@ std = [ "ibc-core-router-types/std", "ibc-primitives/std", "ibc-proto/std", - "tendermint/std", + "cometbft/std", ] serde = [ "dep:serde", diff --git a/ibc-core/ics26-routing/types/Cargo.toml b/ibc-core/ics26-routing/types/Cargo.toml index e9691d43a..b87e585d3 100644 --- a/ibc-core/ics26-routing/types/Cargo.toml +++ b/ibc-core/ics26-routing/types/Cargo.toml @@ -32,7 +32,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 } @@ -47,7 +47,7 @@ std = [ "ibc-primitives/std", "ibc-core-host-types/std", "ibc-proto/std", - "tendermint/std", + "cometbft/std", ] serde = [ "dep:serde", diff --git a/ibc-primitives/Cargo.toml b/ibc-primitives/Cargo.toml index 800b82cbd..7352f5f93 100644 --- a/ibc-primitives/Cargo.toml +++ b/ibc-primitives/Cargo.toml @@ -31,7 +31,7 @@ time = { version = ">=0.3.0, <0.3.35", default-features = false } ibc-proto = { workspace = true } # cosmos dependencies -tendermint = { workspace = true } +cometbft = { workspace = true } # parity dependencies parity-scale-codec = { workspace = true, optional = true } @@ -44,7 +44,7 @@ std = [ "prost/std", "serde/std", "ibc-proto/std", - "tendermint/std", + "cometbft/std", "time/std", ] serde = [ diff --git a/ibc-testkit/Cargo.toml b/ibc-testkit/Cargo.toml index 55546cf8c..74989207c 100644 --- a/ibc-testkit/Cargo.toml +++ b/ibc-testkit/Cargo.toml @@ -33,8 +33,8 @@ ibc = { workspace = true, features = ["std"] } ibc-proto = { workspace = true } # cosmos dependencies -tendermint = { workspace = true } -tendermint-testgen = { workspace = true } +cometbft = { workspace = true } +cometbft-testgen = { workspace = true } [dev-dependencies] env_logger = "0.11.0" @@ -51,7 +51,7 @@ std = [ "serde_json/std", "ibc/std", "ibc-proto/std", - "tendermint/std", + "cometbft/std", ] serde = [ "dep:serde", From f0b4bc943d183de346d4168240894f5e7dbf91e5 Mon Sep 17 00:00:00 2001 From: Mikhail Zabaluev Date: Wed, 28 Feb 2024 16:17:09 +0200 Subject: [PATCH 2/2] Bulk change of tendermint impots to cometbft Had to augment some IBC data structures due to changes in protos. --- .../src/client_state/misbehaviour.rs | 2 +- .../src/client_state/update_client.rs | 4 ++-- .../ics07-tendermint/src/consensus_state.rs | 6 +++--- .../ics07-tendermint/types/src/client_state.rs | 10 +++++----- .../ics07-tendermint/types/src/consensus_state.rs | 15 ++++++++------- ibc-clients/ics07-tendermint/types/src/error.rs | 8 ++++---- ibc-clients/ics07-tendermint/types/src/header.rs | 8 ++++---- .../ics07-tendermint/types/src/trust_threshold.rs | 2 +- ibc-core/ics02-client/types/src/events.rs | 2 +- ibc-core/ics03-connection/types/src/events.rs | 4 ++-- ibc-core/ics04-channel/types/src/channel.rs | 9 ++++++++- .../types/src/events/channel_attributes.rs | 2 +- ibc-core/ics04-channel/types/src/events/mod.rs | 4 ++-- .../types/src/events/packet_attributes.rs | 2 +- .../types/src/msgs/chan_close_confirm.rs | 4 ++++ .../types/src/msgs/chan_open_init.rs | 1 + .../ics04-channel/types/src/msgs/chan_open_try.rs | 1 + .../types/src/msgs/timeout_on_close.rs | 4 ++++ .../cosmos/src/upgrade_proposal/events.rs | 2 +- .../cosmos/src/upgrade_proposal/handler.rs | 2 +- .../ics24-host/cosmos/src/validate_self_client.rs | 2 +- ibc-core/ics25-handler/types/src/events.rs | 2 +- ibc-core/ics26-routing/types/src/event.rs | 2 +- ibc-primitives/src/types/timestamp.rs | 4 ++-- ibc-testkit/src/fixtures/clients/tendermint.rs | 12 ++++++------ ibc-testkit/src/fixtures/core/channel/packet.rs | 3 ++- ibc-testkit/src/fixtures/core/client/mod.rs | 2 +- ibc-testkit/src/fixtures/core/context.rs | 2 +- ibc-testkit/src/hosts/block.rs | 14 +++++++------- ibc-testkit/src/testapp/ibc/core/types.rs | 2 +- .../tests/core/ics02_client/update_client.rs | 2 +- 31 files changed, 79 insertions(+), 60 deletions(-) diff --git a/ibc-clients/ics07-tendermint/src/client_state/misbehaviour.rs b/ibc-clients/ics07-tendermint/src/client_state/misbehaviour.rs index c671ffa63..04f1e04c4 100644 --- a/ibc-clients/ics07-tendermint/src/client_state/misbehaviour.rs +++ b/ibc-clients/ics07-tendermint/src/client_state/misbehaviour.rs @@ -1,3 +1,4 @@ +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; @@ -5,7 +6,6 @@ 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; diff --git a/ibc-clients/ics07-tendermint/src/client_state/update_client.rs b/ibc-clients/ics07-tendermint/src/client_state/update_client.rs index f412e6242..9a2d9306b 100644 --- a/ibc-clients/ics07-tendermint/src/client_state/update_client.rs +++ b/ibc-clients/ics07-tendermint/src/client_state/update_client.rs @@ -1,3 +1,5 @@ +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; @@ -5,8 +7,6 @@ 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; diff --git a/ibc-clients/ics07-tendermint/src/consensus_state.rs b/ibc-clients/ics07-tendermint/src/consensus_state.rs index 020849e57..b0b5ee36d 100644 --- a/ibc-clients/ics07-tendermint/src/consensus_state.rs +++ b/ibc-clients/ics07-tendermint/src/consensus_state.rs @@ -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; @@ -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 @@ -77,8 +77,8 @@ impl From for Any { } } -impl From for ConsensusState { - fn from(header: tendermint::block::Header) -> Self { +impl From for ConsensusState { + fn from(header: block::Header) -> Self { Self(ConsensusStateType::from(header)) } } diff --git a/ibc-clients/ics07-tendermint/types/src/client_state.rs b/ibc-clients/ics07-tendermint/types/src/client_state.rs index e88495872..90605193f 100644 --- a/ibc-clients/ics07-tendermint/types/src/client_state.rs +++ b/ibc-clients/ics07-tendermint/types/src/client_state.rs @@ -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; @@ -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; @@ -377,9 +377,9 @@ impl From 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(json_data: &str) where diff --git a/ibc-clients/ics07-tendermint/types/src/consensus_state.rs b/ibc-clients/ics07-tendermint/types/src/consensus_state.rs index e48b016c3..1777f913e 100644 --- a/ibc-clients/ics07-tendermint/types/src/consensus_state.rs +++ b/ibc-clients/ics07-tendermint/types/src/consensus_state.rs @@ -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; @@ -132,8 +133,8 @@ impl From for Any { } } -impl From for ConsensusState { - fn from(header: tendermint::block::Header) -> Self { +impl From for ConsensusState { + fn from(header: block::Header) -> Self { Self { root: CommitmentRoot::from_bytes(header.app_hash.as_ref()), timestamp: header.time, @@ -150,7 +151,7 @@ impl From
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; diff --git a/ibc-clients/ics07-tendermint/types/src/error.rs b/ibc-clients/ics07-tendermint/types/src/error.rs index 556d5e6fe..5ea559768 100644 --- a/ibc-clients/ics07-tendermint/types/src/error.rs +++ b/ibc-clients/ics07-tendermint/types/src/error.rs @@ -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)] diff --git a/ibc-clients/ics07-tendermint/types/src/header.rs b/ibc-clients/ics07-tendermint/types/src/header.rs index 494fd7d43..b0224657e 100644 --- a/ibc-clients/ics07-tendermint/types/src/header.rs +++ b/ibc-clients/ics07-tendermint/types/src/header.rs @@ -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; @@ -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; diff --git a/ibc-clients/ics07-tendermint/types/src/trust_threshold.rs b/ibc-clients/ics07-tendermint/types/src/trust_threshold.rs index 9ca77a660..3e4009915 100644 --- a/ibc-clients/ics07-tendermint/types/src/trust_threshold.rs +++ b/ibc-clients/ics07-tendermint/types/src/trust_threshold.rs @@ -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. diff --git a/ibc-core/ics02-client/types/src/events.rs b/ibc-core/ics02-client/types/src/events.rs index d7c7545c1..39b97efad 100644 --- a/ibc-core/ics02-client/types/src/events.rs +++ b/ibc-core/ics02-client/types/src/events.rs @@ -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; diff --git a/ibc-core/ics03-connection/types/src/events.rs b/ibc-core/ics03-connection/types/src/events.rs index 0d10512a4..3caab97c5 100644 --- a/ibc-core/ics03-connection/types/src/events.rs +++ b/ibc-core/ics03-connection/types/src/events.rs @@ -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"; @@ -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::*; diff --git a/ibc-core/ics04-channel/types/src/channel.rs b/ibc-core/ics04-channel/types/src/channel.rs index 732e17185..ee4ae8034 100644 --- a/ibc-core/ics04-channel/types/src/channel.rs +++ b/ibc-core/ics04-channel/types/src/channel.rs @@ -58,6 +58,7 @@ impl TryFrom for IdentifiedChannelEnd { counterparty: value.counterparty, connection_hops: value.connection_hops, version: value.version, + upgrade_sequence: value.upgrade_sequence, }; Ok(IdentifiedChannelEnd { @@ -83,6 +84,7 @@ impl From for RawIdentifiedChannel { version: value.channel_end.version.to_string(), port_id: value.port_id.to_string(), channel_id: value.channel_id.to_string(), + upgrade_sequence: value.channel_end.upgrade_sequence, } } } @@ -108,6 +110,8 @@ pub struct ChannelEnd { pub remote: Counterparty, pub connection_hops: Vec, pub version: Version, + // FIXME: model with a domain type + pub upgrade_sequence: u64, } impl Display for ChannelEnd { @@ -161,6 +165,7 @@ impl From for RawChannel { .map(|v| v.as_str().to_string()) .collect(), version: value.version.to_string(), + upgrade_sequence: value.upgrade_sequence, } } } @@ -177,6 +182,7 @@ impl ChannelEnd { remote: Counterparty, connection_hops: Vec, version: Version, + upgrade_sequence: u64, ) -> Self { Self { state, @@ -184,6 +190,7 @@ impl ChannelEnd { remote, connection_hops, version, + upgrade_sequence, } } @@ -196,7 +203,7 @@ impl ChannelEnd { version: Version, ) -> Result { let channel_end = - Self::new_without_validation(state, ordering, remote, connection_hops, version); + Self::new_without_validation(state, ordering, remote, connection_hops, version, 0); channel_end.validate_basic()?; Ok(channel_end) } diff --git a/ibc-core/ics04-channel/types/src/events/channel_attributes.rs b/ibc-core/ics04-channel/types/src/events/channel_attributes.rs index 8032fb44d..230f2d9be 100644 --- a/ibc-core/ics04-channel/types/src/events/channel_attributes.rs +++ b/ibc-core/ics04-channel/types/src/events/channel_attributes.rs @@ -1,8 +1,8 @@ //! This module holds all the abci event attributes for IBC events emitted //! during the channel handshake. +use cometbft::abci; use derive_more::From; use ibc_core_host_types::identifiers::{ChannelId, ConnectionId, PortId}; -use tendermint::abci; use crate::Version; diff --git a/ibc-core/ics04-channel/types/src/events/mod.rs b/ibc-core/ics04-channel/types/src/events/mod.rs index 606d248db..39e4fc15b 100644 --- a/ibc-core/ics04-channel/types/src/events/mod.rs +++ b/ibc-core/ics04-channel/types/src/events/mod.rs @@ -3,10 +3,10 @@ mod channel_attributes; mod packet_attributes; +use cometbft::abci; use ibc_core_host_types::identifiers::{ChannelId, ConnectionId, PortId, Sequence}; use ibc_primitives::prelude::*; use ibc_primitives::Timestamp; -use tendermint::abci; use self::channel_attributes::{ ChannelIdAttribute, ConnectionIdAttribute, CounterpartyChannelIdAttribute, @@ -1118,7 +1118,7 @@ impl TryFrom for abci::Event { #[cfg(test)] mod tests { - use tendermint::abci::Event as AbciEvent; + use cometbft::abci::Event as AbciEvent; use super::*; diff --git a/ibc-core/ics04-channel/types/src/events/packet_attributes.rs b/ibc-core/ics04-channel/types/src/events/packet_attributes.rs index 2366ae71e..9891376a6 100644 --- a/ibc-core/ics04-channel/types/src/events/packet_attributes.rs +++ b/ibc-core/ics04-channel/types/src/events/packet_attributes.rs @@ -3,12 +3,12 @@ //! use core::str; +use cometbft::abci; use derive_more::From; use ibc_core_host_types::identifiers::{ChannelId, ConnectionId, PortId, Sequence}; use ibc_primitives::prelude::*; use ibc_primitives::Timestamp; use subtle_encoding::hex; -use tendermint::abci; use crate::acknowledgement::Acknowledgement; use crate::channel::Order; diff --git a/ibc-core/ics04-channel/types/src/msgs/chan_close_confirm.rs b/ibc-core/ics04-channel/types/src/msgs/chan_close_confirm.rs index c60d3bf5e..d677fff99 100644 --- a/ibc-core/ics04-channel/types/src/msgs/chan_close_confirm.rs +++ b/ibc-core/ics04-channel/types/src/msgs/chan_close_confirm.rs @@ -27,6 +27,8 @@ pub struct MsgChannelCloseConfirm { pub proof_chan_end_on_a: CommitmentProofBytes, pub proof_height_on_a: Height, pub signer: Signer, + // FIXME: model with a domain type + pub counterparty_upgrade_sequence: u64, } impl Protobuf for MsgChannelCloseConfirm {} @@ -47,6 +49,7 @@ impl TryFrom for MsgChannelCloseConfirm { .and_then(|raw_height| raw_height.try_into().ok()) .ok_or(ChannelError::MissingHeight)?, signer: raw_msg.signer.into(), + counterparty_upgrade_sequence: raw_msg.counterparty_upgrade_sequence, }) } } @@ -59,6 +62,7 @@ impl From for RawMsgChannelCloseConfirm { proof_init: domain_msg.proof_chan_end_on_a.clone().into(), proof_height: Some(domain_msg.proof_height_on_a.into()), signer: domain_msg.signer.to_string(), + counterparty_upgrade_sequence: domain_msg.counterparty_upgrade_sequence, } } } diff --git a/ibc-core/ics04-channel/types/src/msgs/chan_open_init.rs b/ibc-core/ics04-channel/types/src/msgs/chan_open_init.rs index 7ab3f1598..36972cdd6 100644 --- a/ibc-core/ics04-channel/types/src/msgs/chan_open_init.rs +++ b/ibc-core/ics04-channel/types/src/msgs/chan_open_init.rs @@ -71,6 +71,7 @@ impl From for RawMsgChannelOpenInit { Counterparty::new(domain_msg.port_id_on_b, None), domain_msg.connection_hops_on_a, domain_msg.version_proposal, + 0, ); RawMsgChannelOpenInit { port_id: domain_msg.port_id_on_a.to_string(), diff --git a/ibc-core/ics04-channel/types/src/msgs/chan_open_try.rs b/ibc-core/ics04-channel/types/src/msgs/chan_open_try.rs index 4b1d54384..ac8dd3cd8 100644 --- a/ibc-core/ics04-channel/types/src/msgs/chan_open_try.rs +++ b/ibc-core/ics04-channel/types/src/msgs/chan_open_try.rs @@ -103,6 +103,7 @@ impl From for RawMsgChannelOpenTry { Counterparty::new(domain_msg.port_id_on_a, Some(domain_msg.chan_id_on_a)), domain_msg.connection_hops_on_b, Version::empty(), // Excessive field to satisfy the type conversion + 0, ); #[allow(deprecated)] RawMsgChannelOpenTry { diff --git a/ibc-core/ics04-channel/types/src/msgs/timeout_on_close.rs b/ibc-core/ics04-channel/types/src/msgs/timeout_on_close.rs index 95cdb826d..9a71a84ad 100644 --- a/ibc-core/ics04-channel/types/src/msgs/timeout_on_close.rs +++ b/ibc-core/ics04-channel/types/src/msgs/timeout_on_close.rs @@ -27,6 +27,8 @@ pub struct MsgTimeoutOnClose { pub proof_close_on_b: CommitmentProofBytes, pub proof_height_on_b: Height, pub signer: Signer, + // FIXME: model with a domain type + pub counterparty_upgrade_sequence: u64, } impl Protobuf for MsgTimeoutOnClose {} @@ -58,6 +60,7 @@ impl TryFrom for MsgTimeoutOnClose { .and_then(|raw_height| raw_height.try_into().ok()) .ok_or(PacketError::MissingHeight)?, signer: raw_msg.signer.into(), + counterparty_upgrade_sequence: raw_msg.counterparty_upgrade_sequence, }) } } @@ -71,6 +74,7 @@ impl From for RawMsgTimeoutOnClose { proof_height: Some(domain_msg.proof_height_on_b.into()), next_sequence_recv: domain_msg.next_seq_recv_on_b.into(), signer: domain_msg.signer.to_string(), + counterparty_upgrade_sequence: domain_msg.counterparty_upgrade_sequence, } } } diff --git a/ibc-core/ics24-host/cosmos/src/upgrade_proposal/events.rs b/ibc-core/ics24-host/cosmos/src/upgrade_proposal/events.rs index b4e3550c9..4a8b3f460 100644 --- a/ibc-core/ics24-host/cosmos/src/upgrade_proposal/events.rs +++ b/ibc-core/ics24-host/cosmos/src/upgrade_proposal/events.rs @@ -1,8 +1,8 @@ //! Definitions of events emitted when an upgrade client is proposed or executed. +use cometbft::abci; use derive_more::From; use ibc_primitives::prelude::*; -use tendermint::abci; const UPGRADE_CHAIN_EVENT: &str = "upgrade_chain"; const UPGRADE_CLIENT_PROPOSAL_EVENT: &str = "upgrade_client_proposal"; diff --git a/ibc-core/ics24-host/cosmos/src/upgrade_proposal/handler.rs b/ibc-core/ics24-host/cosmos/src/upgrade_proposal/handler.rs index 31f187175..ec25e1ded 100644 --- a/ibc-core/ics24-host/cosmos/src/upgrade_proposal/handler.rs +++ b/ibc-core/ics24-host/cosmos/src/upgrade_proposal/handler.rs @@ -1,8 +1,8 @@ +use cometbft::abci::Event as TmEvent; use ibc_client_tendermint::types::ClientState as TmClientState; use ibc_core_client_types::error::UpgradeClientError; use ibc_core_host_types::path::UpgradeClientPath; use ibc_primitives::prelude::*; -use tendermint::abci::Event as TmEvent; use crate::upgrade_proposal::{UpgradeClientProposal, UpgradeExecutionContext, UpgradeProposal}; diff --git a/ibc-core/ics24-host/cosmos/src/validate_self_client.rs b/ibc-core/ics24-host/cosmos/src/validate_self_client.rs index e0cdb9b81..1b21cfef9 100644 --- a/ibc-core/ics24-host/cosmos/src/validate_self_client.rs +++ b/ibc-core/ics24-host/cosmos/src/validate_self_client.rs @@ -1,5 +1,6 @@ use core::time::Duration; +use cometbft::trust_threshold::TrustThresholdFraction as TendermintTrustThresholdFraction; use ibc_client_tendermint::client_state::ClientState; use ibc_core_client_context::client_state::ClientStateCommon; use ibc_core_client_types::error::ClientError; @@ -10,7 +11,6 @@ use ibc_core_handler_types::error::ContextError; use ibc_core_host_types::identifiers::ChainId; use ibc_primitives::prelude::*; use ibc_proto::google::protobuf::Any; -use tendermint::trust_threshold::TrustThresholdFraction as TendermintTrustThresholdFraction; /// Provides an implementation of `ValidationContext::validate_self_client` for /// Tendermint-based hosts. diff --git a/ibc-core/ics25-handler/types/src/events.rs b/ibc-core/ics25-handler/types/src/events.rs index d6a72140b..771f29001 100644 --- a/ibc-core/ics25-handler/types/src/events.rs +++ b/ibc-core/ics25-handler/types/src/events.rs @@ -1,5 +1,6 @@ //! Defines events emitted during handling of IBC messages +use cometbft::abci; use displaydoc::Display; use ibc_core_channel_types::{error as channel_error, events as ChannelEvents}; use ibc_core_client_types::error as client_error; @@ -9,7 +10,6 @@ use ibc_core_host_types::error::IdentifierError; use ibc_core_router_types::event::ModuleEvent; use ibc_primitives::prelude::*; use ibc_primitives::ParseTimestampError; -use tendermint::abci; /// All error variants related to IBC events #[derive(Debug, Display)] diff --git a/ibc-core/ics26-routing/types/src/event.rs b/ibc-core/ics26-routing/types/src/event.rs index b3754b2d7..c5da5838d 100644 --- a/ibc-core/ics26-routing/types/src/event.rs +++ b/ibc-core/ics26-routing/types/src/event.rs @@ -1,5 +1,5 @@ +use cometbft::abci; use ibc_primitives::prelude::*; -use tendermint::abci; /// The event type emitted by IBC applications #[cfg_attr( diff --git a/ibc-primitives/src/types/timestamp.rs b/ibc-primitives/src/types/timestamp.rs index c7d8e5aae..b4e86ca7a 100644 --- a/ibc-primitives/src/types/timestamp.rs +++ b/ibc-primitives/src/types/timestamp.rs @@ -7,8 +7,8 @@ use core::ops::{Add, Sub}; use core::str::FromStr; use core::time::Duration; +use cometbft::Time; use displaydoc::Display; -use tendermint::Time; use time::OffsetDateTime; use crate::prelude::*; @@ -120,7 +120,7 @@ impl Timestamp { ParseTimestampError::DataOutOfRange(e.to_string()) })? .try_into() - .map_err(|e: tendermint::error::Error| { + .map_err(|e: cometbft::error::Error| { ParseTimestampError::DataOutOfRange(e.to_string()) })?; Ok(Timestamp { time: Some(ts) }) diff --git a/ibc-testkit/src/fixtures/clients/tendermint.rs b/ibc-testkit/src/fixtures/clients/tendermint.rs index 39f8de82f..26456f204 100644 --- a/ibc-testkit/src/fixtures/clients/tendermint.rs +++ b/ibc-testkit/src/fixtures/clients/tendermint.rs @@ -1,6 +1,7 @@ use core::str::FromStr; use core::time::Duration; +use cometbft::block::Header as TmHeader; use ibc::clients::tendermint::client_state::ClientState as TmClientState; use ibc::clients::tendermint::types::error::{Error as ClientError, Error}; use ibc::clients::tendermint::types::proto::v1::{ClientState as RawTmClientState, Fraction}; @@ -14,7 +15,6 @@ use ibc::core::client::types::Height; use ibc::core::commitment_types::specs::ProofSpecs; use ibc::core::host::types::identifiers::ChainId; use ibc::core::primitives::prelude::*; -use tendermint::block::Header as TmHeader; /// Returns a dummy tendermint `ClientState` by given `frozen_height`, for testing purposes only! pub fn dummy_tm_client_state_from_raw(frozen_height: RawHeight) -> Result { @@ -105,8 +105,8 @@ impl TryFrom for TmClientState { } #[cfg(feature = "serde")] -pub fn dummy_tendermint_header() -> tendermint::block::Header { - use tendermint::block::signed_header::SignedHeader; +pub fn dummy_tendermint_header() -> TmHeader { + use cometbft::block::signed_header::SignedHeader; serde_json::from_str::(include_str!(concat!( env!("CARGO_MANIFEST_DIR"), @@ -132,10 +132,10 @@ pub fn dummy_tendermint_header() -> tendermint::block::Header { // i.e. `trusted_validator_set` = `validator_set` #[cfg(feature = "serde")] pub fn dummy_ics07_header() -> Header { + use cometbft::block::signed_header::SignedHeader; + use cometbft::validator::{Info as ValidatorInfo, Set as ValidatorSet}; + use cometbft::PublicKey; use subtle_encoding::hex; - use tendermint::block::signed_header::SignedHeader; - use tendermint::validator::{Info as ValidatorInfo, Set as ValidatorSet}; - use tendermint::PublicKey; // Build a SignedHeader from a JSON file. let shdr = serde_json::from_str::(include_str!(concat!( diff --git a/ibc-testkit/src/fixtures/core/channel/packet.rs b/ibc-testkit/src/fixtures/core/channel/packet.rs index 1161dae40..f9b4c3924 100644 --- a/ibc-testkit/src/fixtures/core/channel/packet.rs +++ b/ibc-testkit/src/fixtures/core/channel/packet.rs @@ -69,6 +69,7 @@ pub fn dummy_proof() -> Vec { #[cfg(test)] mod tests { + use cometbft::abci; use ibc::core::channel::types::channel::Order; use ibc::core::channel::types::events::SendPacket; use ibc::core::handler::types::events::IbcEvent; @@ -269,6 +270,6 @@ mod tests { Order::Unordered, ConnectionId::default(), )); - let _ = tendermint::abci::Event::try_from(ibc_event); + let _ = abci::Event::try_from(ibc_event); } } diff --git a/ibc-testkit/src/fixtures/core/client/mod.rs b/ibc-testkit/src/fixtures/core/client/mod.rs index a536d778c..d06e31ef8 100644 --- a/ibc-testkit/src/fixtures/core/client/mod.rs +++ b/ibc-testkit/src/fixtures/core/client/mod.rs @@ -14,13 +14,13 @@ pub use msg_upgrade_client::*; mod tests { use core::str::FromStr; + use cometbft::abci::Event as AbciEvent; use ibc::core::client::types::events::*; use ibc::core::client::types::Height; use ibc::core::host::types::identifiers::*; use ibc::primitives::prelude::*; use ibc::primitives::ToVec; use ibc_proto::google::protobuf::Any; - use tendermint::abci::Event as AbciEvent; use crate::fixtures::clients::mock::dummy_new_mock_header; diff --git a/ibc-testkit/src/fixtures/core/context.rs b/ibc-testkit/src/fixtures/core/context.rs index a886777e7..ba81fb18f 100644 --- a/ibc-testkit/src/fixtures/core/context.rs +++ b/ibc-testkit/src/fixtures/core/context.rs @@ -3,12 +3,12 @@ use core::cmp::min; use core::ops::{Add, Sub}; use core::time::Duration; +use cometbft_testgen::Validator as TestgenValidator; use ibc::core::client::types::Height; use ibc::core::host::types::identifiers::ChainId; use ibc::core::primitives::prelude::*; use ibc::core::primitives::Timestamp; use parking_lot::Mutex; -use tendermint_testgen::Validator as TestgenValidator; use typed_builder::TypedBuilder; use crate::hosts::block::{HostBlock, HostType}; diff --git a/ibc-testkit/src/hosts/block.rs b/ibc-testkit/src/hosts/block.rs index 526ca1784..e5f9b63ec 100644 --- a/ibc-testkit/src/hosts/block.rs +++ b/ibc-testkit/src/hosts/block.rs @@ -2,6 +2,13 @@ use core::str::FromStr; +use cometbft::block::Header as TmHeader; +use cometbft::validator::Set as ValidatorSet; +use cometbft_testgen::light_block::TmLightBlock; +use cometbft_testgen::{ + Generator, Header as TestgenHeader, LightBlock as TestgenLightBlock, + Validator as TestgenValidator, +}; use ibc::clients::tendermint::consensus_state::ConsensusState as TmConsensusState; use ibc::clients::tendermint::types::proto::v1::Header as RawHeader; use ibc::clients::tendermint::types::{Header, TENDERMINT_HEADER_TYPE_URL}; @@ -12,13 +19,6 @@ use ibc::core::primitives::prelude::*; use ibc::core::primitives::Timestamp; use ibc::primitives::proto::{Any, Protobuf}; use ibc::primitives::ToVec; -use tendermint::block::Header as TmHeader; -use tendermint::validator::Set as ValidatorSet; -use tendermint_testgen::light_block::TmLightBlock; -use tendermint_testgen::{ - Generator, Header as TestgenHeader, LightBlock as TestgenLightBlock, - Validator as TestgenValidator, -}; use crate::testapp::ibc::clients::mock::consensus_state::MockConsensusState; use crate::testapp::ibc::clients::mock::header::MockHeader; diff --git a/ibc-testkit/src/testapp/ibc/core/types.rs b/ibc-testkit/src/testapp/ibc/core/types.rs index ddd3ec96c..bef339b34 100644 --- a/ibc-testkit/src/testapp/ibc/core/types.rs +++ b/ibc-testkit/src/testapp/ibc/core/types.rs @@ -6,6 +6,7 @@ use core::fmt::Debug; use core::ops::{Add, Sub}; use core::time::Duration; +use cometbft_testgen::Validator as TestgenValidator; use ibc::clients::tendermint::client_state::ClientState as TmClientState; use ibc::clients::tendermint::types::TENDERMINT_CLIENT_TYPE; use ibc::core::channel::types::channel::ChannelEnd; @@ -24,7 +25,6 @@ use ibc::core::primitives::prelude::*; use ibc::core::primitives::Timestamp; use ibc::core::router::router::Router; use parking_lot::Mutex; -use tendermint_testgen::Validator as TestgenValidator; use typed_builder::TypedBuilder; use super::client_ctx::{MockClientRecord, PortChannelIdMap}; diff --git a/ibc-testkit/tests/core/ics02_client/update_client.rs b/ibc-testkit/tests/core/ics02_client/update_client.rs index bc7bf02ad..54e1dac39 100644 --- a/ibc-testkit/tests/core/ics02_client/update_client.rs +++ b/ibc-testkit/tests/core/ics02_client/update_client.rs @@ -1,6 +1,7 @@ use core::str::FromStr; use core::time::Duration; +use cometbft_testgen::Validator as TestgenValidator; use ibc::clients::tendermint::client_state::ClientState; use ibc::clients::tendermint::types::proto::v1::{ClientState as RawTmClientState, Fraction}; use ibc::clients::tendermint::types::{ @@ -34,7 +35,6 @@ use ibc_testkit::testapp::ibc::clients::AnyConsensusState; use ibc_testkit::testapp::ibc::core::router::MockRouter; use ibc_testkit::testapp::ibc::core::types::{MockClientConfig, MockContext}; use rstest::*; -use tendermint_testgen::Validator as TestgenValidator; struct Fixture { ctx: MockContext,