diff --git a/Cargo.lock b/Cargo.lock index 005c8e3c..950071a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -679,12 +679,12 @@ name = "celestia-proto" version = "0.1.0" dependencies = [ "anyhow", + "celestia-tendermint-proto", "prost", "prost-build", "prost-types", "serde", "serde_json", - "tendermint-proto", "wasm-bindgen-test", ] @@ -708,6 +708,54 @@ dependencies = [ "tracing", ] +[[package]] +name = "celestia-tendermint" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c452fbfbc7b397f5ee39be36bfbbb1870898f8644f88da96fcdbda9015397d51" +dependencies = [ + "bytes", + "celestia-tendermint-proto", + "digest 0.10.7", + "ed25519", + "ed25519-consensus", + "flex-error", + "futures", + "instant", + "num-traits", + "once_cell", + "prost", + "prost-types", + "serde", + "serde_bytes", + "serde_json", + "serde_repr", + "sha2 0.10.8", + "signature", + "subtle", + "subtle-encoding", + "time", + "zeroize", +] + +[[package]] +name = "celestia-tendermint-proto" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670067a9fb113fe86cb5f1b3db08c718da158a40beed6d167027ae7723fb5642" +dependencies = [ + "bytes", + "flex-error", + "num-derive", + "num-traits", + "prost", + "prost-types", + "serde", + "serde_bytes", + "subtle-encoding", + "time", +] + [[package]] name = "celestia-types" version = "0.1.0" @@ -717,6 +765,8 @@ dependencies = [ "blockstore", "bytes", "celestia-proto", + "celestia-tendermint", + "celestia-tendermint-proto", "cid", "const_format", "ed25519-consensus", @@ -734,8 +784,6 @@ dependencies = [ "serde_json", "serde_repr", "sha2 0.10.8", - "tendermint", - "tendermint-proto", "thiserror", "wasm-bindgen-test", ] @@ -2714,6 +2762,7 @@ dependencies = [ "bytes", "celestia-proto", "celestia-rpc", + "celestia-tendermint-proto", "celestia-types", "dashmap", "directories", @@ -2737,7 +2786,6 @@ dependencies = [ "sled", "smallvec", "tempdir", - "tendermint-proto", "thiserror", "tokio", "tokio-util", @@ -4596,52 +4644,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "tendermint" -version = "0.32.0" -source = "git+https://github.com/eigerco/celestia-tendermint-rs.git?rev=bbe7de8#bbe7de8c777f0c44b338f4bf26f0f6efb18e87f0" -dependencies = [ - "bytes", - "digest 0.10.7", - "ed25519", - "ed25519-consensus", - "flex-error", - "futures", - "instant", - "num-traits", - "once_cell", - "prost", - "prost-types", - "serde", - "serde_bytes", - "serde_json", - "serde_repr", - "sha2 0.10.8", - "signature", - "subtle", - "subtle-encoding", - "tendermint-proto", - "time", - "zeroize", -] - -[[package]] -name = "tendermint-proto" -version = "0.32.0" -source = "git+https://github.com/eigerco/celestia-tendermint-rs.git?rev=bbe7de8#bbe7de8c777f0c44b338f4bf26f0f6efb18e87f0" -dependencies = [ - "bytes", - "flex-error", - "num-derive", - "num-traits", - "prost", - "prost-types", - "serde", - "serde_bytes", - "subtle-encoding", - "time", -] - [[package]] name = "thiserror" version = "1.0.50" diff --git a/Cargo.toml b/Cargo.toml index 41aa71ce..94774ea9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,15 +10,12 @@ celestia-rpc = { version = "0.1.0", path = "rpc", default-features = false } celestia-types = { version = "0.1.0", path = "types", default-features = false } libp2p = "0.53.1" nmt-rs = "0.1.0" -tendermint = { git = "https://github.com/eigerco/celestia-tendermint-rs.git", rev = "bbe7de8", default-features = false } -tendermint-proto = { git = "https://github.com/eigerco/celestia-tendermint-rs.git", rev = "bbe7de8" } +celestia-tendermint = { version = "0.32.0", default-features = false } +celestia-tendermint-proto = "0.32.0" blockstore = { version = "0.1.0", path = "blockstore" } -[patch.'https://github.com/eigerco/celestia-tendermint-rs.git'] -# Uncomment to apply local changes -#tendermint = { path = "../celestia-tendermint-rs/tendermint" } -#tendermint-proto = { path = "../celestia-tendermint-rs/proto" } - -[patch.'https://github.com/eigerco/nmt-rs.git'] +[patch.crates-io] # Uncomment to apply local changes +#celestia-tendermint = { path = "../celestia-tendermint-rs/tendermint" } +#celestia-tendermint-proto = { path = "../celestia-tendermint-rs/proto" } #nmt-rs = { path = "../nmt-rs" } diff --git a/node/Cargo.toml b/node/Cargo.toml index 5e702680..afa18204 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -18,6 +18,7 @@ categories = [ [dependencies] celestia-proto = { workspace = true } +celestia-tendermint-proto = { workspace = true } celestia-types = { workspace = true } libp2p = { workspace = true, features = [ "autonat", @@ -28,7 +29,6 @@ libp2p = { workspace = true, features = [ "request-response", "kad", ] } -tendermint-proto = { workspace = true } async-trait = "0.1.73" dashmap = "5.5.3" diff --git a/node/src/header_ex/server.rs b/node/src/header_ex/server.rs index 0bca3752..aa4e121e 100644 --- a/node/src/header_ex/server.rs +++ b/node/src/header_ex/server.rs @@ -209,11 +209,11 @@ mod tests { use crate::test_utils::gen_filled_store; use celestia_proto::p2p::pb::header_request::Data; use celestia_proto::p2p::pb::{HeaderRequest, StatusCode}; + use celestia_tendermint_proto::Protobuf; use celestia_types::ExtendedHeader; use libp2p::PeerId; use std::future::poll_fn; use std::sync::Arc; - use tendermint_proto::Protobuf; use tokio::select; use tokio::sync::oneshot; diff --git a/node/src/header_ex/utils.rs b/node/src/header_ex/utils.rs index b121c7b2..2e04d6c5 100644 --- a/node/src/header_ex/utils.rs +++ b/node/src/header_ex/utils.rs @@ -1,9 +1,9 @@ use celestia_proto::p2p::pb::header_request::Data; use celestia_proto::p2p::pb::{HeaderRequest, HeaderResponse, StatusCode}; +use celestia_tendermint_proto::Protobuf; use celestia_types::consts::HASH_SIZE; use celestia_types::hash::Hash; use celestia_types::ExtendedHeader; -use tendermint_proto::Protobuf; use crate::header_ex::HeaderExError; diff --git a/node/src/store/indexed_db_store.rs b/node/src/store/indexed_db_store.rs index 7b2140a7..f80bc329 100644 --- a/node/src/store/indexed_db_store.rs +++ b/node/src/store/indexed_db_store.rs @@ -2,13 +2,13 @@ use std::cell::RefCell; use std::convert::Infallible; use async_trait::async_trait; +use celestia_tendermint_proto::Protobuf; use celestia_types::hash::Hash; use celestia_types::ExtendedHeader; use rexie::{Direction, Index, KeyRange, ObjectStore, Rexie, TransactionMode}; use send_wrapper::SendWrapper; use serde::{Deserialize, Serialize}; use serde_wasm_bindgen::{from_value, to_value}; -use tendermint_proto::Protobuf; use crate::store::{Result, Store, StoreError}; diff --git a/node/src/store/sled_store.rs b/node/src/store/sled_store.rs index 514390fd..0539b84c 100644 --- a/node/src/store/sled_store.rs +++ b/node/src/store/sled_store.rs @@ -4,13 +4,13 @@ use std::path::Path; use std::sync::Arc; use async_trait::async_trait; +use celestia_tendermint_proto::Protobuf; use celestia_types::hash::Hash; use celestia_types::ExtendedHeader; use directories::ProjectDirs; use sled::transaction::{ConflictableTransactionError, TransactionError}; use sled::{Db, Error as SledError, Transactional, Tree}; use tempdir::TempDir; -use tendermint_proto::Protobuf; use tokio::task::spawn_blocking; use tokio::task::JoinError; use tracing::debug; diff --git a/proto/Cargo.toml b/proto/Cargo.toml index 46281f68..ab5c9254 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -12,10 +12,10 @@ keywords = ["blockchain", "celestia", "lumina"] categories = ["encoding", "cryptography::cryptocurrencies"] [dependencies] +celestia-tendermint-proto = { workspace = true } prost = "0.12.0" prost-types = "0.12.0" serde = { version = "1.0.188", features = ["derive"] } -tendermint-proto = { workspace = true } [build-dependencies] anyhow = "1.0.75" diff --git a/proto/build.rs b/proto/build.rs index f6107180..6047bd3a 100644 --- a/proto/build.rs +++ b/proto/build.rs @@ -4,10 +4,10 @@ use anyhow::Result; const SERIALIZED: &str = r#"#[derive(::serde::Deserialize, ::serde::Serialize)] #[serde(default)]"#; const BASE64STRING: &str = - r#"#[serde(with = "tendermint_proto::serializers::bytes::base64string")]"#; -const QUOTED: &str = r#"#[serde(with = "tendermint_proto::serializers::from_str")]"#; + r#"#[serde(with = "celestia_tendermint_proto::serializers::bytes::base64string")]"#; +const QUOTED: &str = r#"#[serde(with = "celestia_tendermint_proto::serializers::from_str")]"#; const VEC_BASE64STRING: &str = - r#"#[serde(with = "tendermint_proto::serializers::bytes::vec_base64string")]"#; + r#"#[serde(with = "celestia_tendermint_proto::serializers::bytes::vec_base64string")]"#; const OPTION_ANY: &str = r#"#[serde(with = "crate::serializers::option_any")]"#; const OPTION_TIMESTAMP: &str = r#"#[serde(with = "crate::serializers::option_timestamp")]"#; @@ -69,14 +69,14 @@ fn main() -> Result<()> { config .include_file("mod.rs") - .extern_path(".tendermint", "::tendermint_proto::v0_34") + .extern_path(".tendermint", "::celestia_tendermint_proto::v0_34") .extern_path( ".google.protobuf.Timestamp", - "::tendermint_proto::google::protobuf::Timestamp", + "::celestia_tendermint_proto::google::protobuf::Timestamp", ) .extern_path( ".google.protobuf.Duration", - "::tendermint_proto::google::protobuf::Duration", + "::celestia_tendermint_proto::google::protobuf::Duration", ) // Comments in Google's protobuf are causing issues with cargo-test .disable_comments([".google"]) diff --git a/proto/src/serializers/option_any.rs b/proto/src/serializers/option_any.rs index 83872e48..b728dbd0 100644 --- a/proto/src/serializers/option_any.rs +++ b/proto/src/serializers/option_any.rs @@ -11,7 +11,7 @@ where #[derive(Deserialize)] struct Def { type_url: String, - #[serde(with = "tendermint_proto::serializers::bytes::base64string")] + #[serde(with = "celestia_tendermint_proto::serializers::bytes::base64string")] value: Vec, } @@ -31,7 +31,7 @@ where #[derive(Serialize)] struct Def<'a> { type_url: &'a str, - #[serde(with = "tendermint_proto::serializers::bytes::base64string")] + #[serde(with = "celestia_tendermint_proto::serializers::bytes::base64string")] value: &'a [u8], } diff --git a/proto/src/serializers/option_timestamp.rs b/proto/src/serializers/option_timestamp.rs index 3c15bbd3..7563ccd0 100644 --- a/proto/src/serializers/option_timestamp.rs +++ b/proto/src/serializers/option_timestamp.rs @@ -1,8 +1,8 @@ //! [`serde`] serializer for the optional [`Timestamp`]. +use celestia_tendermint_proto::google::protobuf::Timestamp; +use celestia_tendermint_proto::serializers::timestamp; use serde::{Deserialize, Deserializer, Serializer}; -use tendermint_proto::google::protobuf::Timestamp; -use tendermint_proto::serializers::timestamp; /// Deserialize `Option`. pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> diff --git a/types/Cargo.toml b/types/Cargo.toml index 79fafe29..e645a41f 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -14,9 +14,9 @@ categories = ["encoding", "cryptography::cryptocurrencies"] [dependencies] blockstore = { workspace = true } celestia-proto = { workspace = true } +celestia-tendermint = { workspace = true, features = ["std", "rust-crypto"] } +celestia-tendermint-proto = { workspace = true } nmt-rs = { workspace = true } -tendermint = { workspace = true, features = ["std", "rust-crypto"] } -tendermint-proto = { workspace = true } base64 = "0.21.2" bech32 = "0.9.1" @@ -52,7 +52,7 @@ wasm-bindgen-test = "0.3" default = ["p2p"] p2p = ["dep:libp2p-identity", "dep:multiaddr", "dep:serde_repr"] test-utils = ["dep:ed25519-consensus", "dep:rand"] -wasm-bindgen = ["tendermint/wasm-bindgen"] +wasm-bindgen = ["celestia-tendermint/wasm-bindgen"] [package.metadata.docs.rs] features = ["p2p", "test-utils"] diff --git a/types/src/blob.rs b/types/src/blob.rs index 60b36ac6..fde67e65 100644 --- a/types/src/blob.rs +++ b/types/src/blob.rs @@ -1,8 +1,8 @@ //! Types related to creation and submission of blobs. +use celestia_tendermint_proto::v0_34::types::Blob as RawBlob; +use celestia_tendermint_proto::Protobuf; use serde::{Deserialize, Serialize}; -use tendermint_proto::v0_34::types::Blob as RawBlob; -use tendermint_proto::Protobuf; mod commitment; @@ -38,7 +38,7 @@ pub struct Blob { /// A [`Namespace`] the [`Blob`] belongs to. pub namespace: Namespace, /// Data stored within the [`Blob`]. - #[serde(with = "tendermint_proto::serializers::bytes::base64string")] + #[serde(with = "celestia_tendermint_proto::serializers::bytes::base64string")] pub data: Vec, /// Version indicating the format in which [`Share`]s should be created from this [`Blob`]. /// diff --git a/types/src/blob/commitment.rs b/types/src/blob/commitment.rs index 5bba42f1..545443c9 100644 --- a/types/src/blob/commitment.rs +++ b/types/src/blob/commitment.rs @@ -3,11 +3,11 @@ use std::num::NonZeroU64; use base64::prelude::*; use bytes::{Buf, BufMut, BytesMut}; +use celestia_tendermint::crypto::sha256::HASH_SIZE; +use celestia_tendermint::{crypto, merkle}; +use celestia_tendermint_proto::serializers::cow_str::CowStr; use nmt_rs::NamespaceMerkleHasher; use serde::{Deserialize, Deserializer, Serialize, Serializer}; -use tendermint::crypto::sha256::HASH_SIZE; -use tendermint::{crypto, merkle}; -use tendermint_proto::serializers::cow_str::CowStr; use crate::consts::appconsts; use crate::nmt::{Namespace, NamespacedHashExt, NamespacedSha2Hasher, Nmt, RawNamespacedHash}; @@ -46,7 +46,7 @@ use crate::{InfoByte, Share}; /// [`Blob`]: crate::Blob /// [`Share`]: crate::share::Share /// [`MsgPayForBlobs`]: celestia_proto::celestia::blob::v1::MsgPayForBlobs -/// [`merkle hash`]: tendermint::merkle::simple_hash_from_byte_vectors +/// [`merkle hash`]: celestia_tendermint::merkle::simple_hash_from_byte_vectors /// [`Nmt`]: crate::nmt::Nmt /// [`ExtendedDataSquare`]: crate::ExtendedDataSquare /// [`share commitment rules`]: https://github.com/celestiaorg/celestia-app/blob/main/specs/src/specs/data_square_layout.md#blob-share-commitment-rules diff --git a/types/src/block.rs b/types/src/block.rs index a314c1c0..da1df2ad 100644 --- a/types/src/block.rs +++ b/types/src/block.rs @@ -1,7 +1,7 @@ -use tendermint::block::{Commit, CommitSig, Header, Id}; -use tendermint::signature::SIGNATURE_LENGTH; -use tendermint::vote; -use tendermint::{chain, Hash, Vote}; +use celestia_tendermint::block::{Commit, CommitSig, Header, Id}; +use celestia_tendermint::signature::SIGNATURE_LENGTH; +use celestia_tendermint::vote; +use celestia_tendermint::{chain, Hash, Vote}; use crate::consts::{genesis::MAX_CHAIN_ID_LEN, version}; use crate::{bail_validation, Error, Result, ValidateBasic, ValidationError}; @@ -9,7 +9,7 @@ use crate::{bail_validation, Error, Result, ValidateBasic, ValidationError}; pub(crate) const GENESIS_HEIGHT: u64 = 1; /// The height of the block in Celestia network. -pub type Height = tendermint::block::Height; +pub type Height = celestia_tendermint::block::Height; impl ValidateBasic for Header { fn validate_basic(&self) -> Result<(), ValidationError> { @@ -98,12 +98,12 @@ impl ValidateBasic for CommitSig { /// An extension trait for the [`Commit`] to perform additional actions. /// -/// [`Commit`]: tendermint::block::Commit +/// [`Commit`]: celestia_tendermint::block::Commit pub trait CommitExt { /// Get the signed [`Vote`] from the [`Commit`] at the given index. /// - /// [`Commit`]: tendermint::block::Commit - /// [`Vote`]: tendermint::Vote + /// [`Commit`]: celestia_tendermint::block::Commit + /// [`Vote`]: celestia_tendermint::Vote fn vote_sign_bytes(&self, chain_id: &chain::Id, signature_idx: usize) -> Result>; } diff --git a/types/src/byzantine.rs b/types/src/byzantine.rs index a9a5d5c5..fbca59dd 100644 --- a/types/src/byzantine.rs +++ b/types/src/byzantine.rs @@ -1,9 +1,9 @@ use celestia_proto::share::eds::byzantine::pb::BadEncoding as RawBadEncodingFraudProof; use celestia_proto::share::eds::byzantine::pb::Share as RawShareWithProof; +use celestia_tendermint::{block::Height, Hash}; +use celestia_tendermint_proto::Protobuf; use cid::CidGeneric; use serde::{Deserialize, Serialize}; -use tendermint::{block::Height, Hash}; -use tendermint_proto::Protobuf; use crate::bail_validation; use crate::consts::appconsts; diff --git a/types/src/consts.rs b/types/src/consts.rs index eade92ef..a93a4316 100644 --- a/types/src/consts.rs +++ b/types/src/consts.rs @@ -1,7 +1,7 @@ //! Constants used within celestia ecosystem. /// The size of the SHA256 hash. -pub const HASH_SIZE: usize = tendermint::hash::SHA256_HASH_SIZE; +pub const HASH_SIZE: usize = celestia_tendermint::hash::SHA256_HASH_SIZE; // celestia-core/types/genesis /// Constants related to genesis definition. diff --git a/types/src/data_availability_header.rs b/types/src/data_availability_header.rs index 9651bb57..b244839c 100644 --- a/types/src/data_availability_header.rs +++ b/types/src/data_availability_header.rs @@ -1,8 +1,8 @@ use celestia_proto::celestia::da::DataAvailabilityHeader as RawDataAvailabilityHeader; +use celestia_tendermint::merkle::simple_hash_from_byte_vectors; +use celestia_tendermint_proto::Protobuf; use serde::{Deserialize, Serialize}; use sha2::Sha256; -use tendermint::merkle::simple_hash_from_byte_vectors; -use tendermint_proto::Protobuf; use crate::consts::data_availability_header::{ MAX_EXTENDED_SQUARE_WIDTH, MIN_EXTENDED_SQUARE_WIDTH, diff --git a/types/src/error.rs b/types/src/error.rs index 986cb446..27ff6848 100644 --- a/types/src/error.rs +++ b/types/src/error.rs @@ -18,13 +18,13 @@ pub enum Error { #[error("Invalid namespace size")] InvalidNamespaceSize, - /// Error propagated from the [`tendermint`]. + /// Error propagated from the [`celestia_tendermint`]. #[error(transparent)] - Tendermint(#[from] tendermint::Error), + Tendermint(#[from] celestia_tendermint::Error), - /// Error propagated from the [`tendermint_proto`]. + /// Error propagated from the [`celestia_tendermint_proto`]. #[error(transparent)] - Protobuf(#[from] tendermint_proto::Error), + Protobuf(#[from] celestia_tendermint_proto::Error), /// Error propagated from the [`cid::multihash`]. #[error(transparent)] diff --git a/types/src/extended_header.rs b/types/src/extended_header.rs index 79ecdd10..1c2424d6 100644 --- a/types/src/extended_header.rs +++ b/types/src/extended_header.rs @@ -3,12 +3,12 @@ use std::fmt::{Display, Formatter}; use std::time::Duration; use celestia_proto::header::pb::ExtendedHeader as RawExtendedHeader; +use celestia_tendermint::block::header::Header; +use celestia_tendermint::block::{Commit, Height}; +use celestia_tendermint::chain::id::Id; +use celestia_tendermint::{validator, Hash, Time}; +use celestia_tendermint_proto::Protobuf; use serde::{Deserialize, Serialize}; -use tendermint::block::header::Header; -use tendermint::block::{Commit, Height}; -use tendermint::chain::id::Id; -use tendermint::{validator, Hash, Time}; -use tendermint_proto::Protobuf; use crate::trust_level::DEFAULT_TRUST_LEVEL; use crate::validator_set::ValidatorSetExt; diff --git a/types/src/fraud_proof.rs b/types/src/fraud_proof.rs index 0a498fa9..ec54784d 100644 --- a/types/src/fraud_proof.rs +++ b/types/src/fraud_proof.rs @@ -4,10 +4,10 @@ use std::convert::Infallible; +use celestia_tendermint::block::Height; +use celestia_tendermint::Hash; +use celestia_tendermint_proto::Protobuf; use serde::{Deserialize, Serialize, Serializer}; -use tendermint::block::Height; -use tendermint::Hash; -use tendermint_proto::Protobuf; pub use crate::byzantine::BadEncodingFraudProof; use crate::{Error, ExtendedHeader, Result}; @@ -38,7 +38,7 @@ pub trait FraudProof { #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct RawFraudProof { proof_type: String, - #[serde(with = "tendermint_proto::serializers::bytes::base64string")] + #[serde(with = "celestia_tendermint_proto::serializers::bytes::base64string")] data: Vec, } diff --git a/types/src/hash.rs b/types/src/hash.rs index d11cd2c4..47baaf0e 100644 --- a/types/src/hash.rs +++ b/types/src/hash.rs @@ -1,7 +1,7 @@ //! Celestia hash related types and traits. /// The hash type used commonly in the Celestia. -pub type Hash = tendermint::hash::Hash; +pub type Hash = celestia_tendermint::hash::Hash; /// A trait extending [`Hash`] functionality. /// diff --git a/types/src/namespaced_data.rs b/types/src/namespaced_data.rs index 1f3e2f08..16018ef4 100644 --- a/types/src/namespaced_data.rs +++ b/types/src/namespaced_data.rs @@ -9,10 +9,10 @@ use blockstore::block::CidError; use bytes::{BufMut, BytesMut}; use celestia_proto::share::p2p::shwap::Data as RawNamespacedData; +use celestia_tendermint_proto::Protobuf; use cid::CidGeneric; use multihash::Multihash; use serde::{Deserialize, Serialize}; -use tendermint_proto::Protobuf; use crate::nmt::{Namespace, NamespaceProof, NS_SIZE}; use crate::row::RowId; diff --git a/types/src/nmt.rs b/types/src/nmt.rs index 4d41ca68..1fc65884 100644 --- a/types/src/nmt.rs +++ b/types/src/nmt.rs @@ -19,14 +19,14 @@ use base64::prelude::*; use blockstore::block::CidError; +use celestia_tendermint::hash::SHA256_HASH_SIZE; +use celestia_tendermint_proto::serializers::cow_str::CowStr; use cid::CidGeneric; use multihash::Multihash; use nmt_rs::simple_merkle::db::MemDb; use nmt_rs::simple_merkle::tree::MerkleHash; use nmt_rs::NamespaceMerkleHasher; use serde::{Deserialize, Deserializer, Serialize, Serializer}; -use tendermint::hash::SHA256_HASH_SIZE; -use tendermint_proto::serializers::cow_str::CowStr; mod namespace_proof; mod namespaced_hash; diff --git a/types/src/nmt/namespace_proof.rs b/types/src/nmt/namespace_proof.rs index d71b37df..3e162ec5 100644 --- a/types/src/nmt/namespace_proof.rs +++ b/types/src/nmt/namespace_proof.rs @@ -1,9 +1,9 @@ use std::ops::{Deref, DerefMut}; use celestia_proto::proof::pb::Proof as RawProof; +use celestia_tendermint_proto::Protobuf; use nmt_rs::simple_merkle::proof::Proof as NmtProof; use serde::{Deserialize, Serialize}; -use tendermint_proto::Protobuf; use crate::nmt::{NamespacedHash, NamespacedHashExt, NamespacedSha2Hasher, NS_SIZE}; use crate::{Error, Result}; diff --git a/types/src/p2p.rs b/types/src/p2p.rs index 0fee378f..66f2c1ed 100644 --- a/types/src/p2p.rs +++ b/types/src/p2p.rs @@ -58,7 +58,7 @@ pub struct ResourceManagerStats { /// [`PeerId`]: libp2p_identity::PeerId #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] pub struct PeerId( - #[serde(with = "tendermint_proto::serializers::from_str")] pub libp2p_identity::PeerId, + #[serde(with = "celestia_tendermint_proto::serializers::from_str")] pub libp2p_identity::PeerId, ); impl From for PeerId { diff --git a/types/src/row.rs b/types/src/row.rs index a76c575d..987782bb 100644 --- a/types/src/row.rs +++ b/types/src/row.rs @@ -11,11 +11,11 @@ use std::io::Cursor; use blockstore::block::CidError; use bytes::{Buf, BufMut, BytesMut}; use celestia_proto::share::p2p::shwap::Row as RawRow; +use celestia_tendermint_proto::Protobuf; use cid::CidGeneric; use multihash::Multihash; use nmt_rs::NamespaceMerkleHasher; use serde::{Deserialize, Serialize}; -use tendermint_proto::Protobuf; use crate::nmt::NS_SIZE; use crate::nmt::{Namespace, NamespacedSha2Hasher, Nmt}; diff --git a/types/src/rsmt2d.rs b/types/src/rsmt2d.rs index ea3aef31..b90fc002 100644 --- a/types/src/rsmt2d.rs +++ b/types/src/rsmt2d.rs @@ -134,7 +134,7 @@ impl TryFrom for AxisType { #[derive(Debug, Clone, PartialEq, Eq, Serialize)] pub struct ExtendedDataSquare { /// The raw data of the EDS. - #[serde(with = "tendermint_proto::serializers::bytes::vec_base64string")] + #[serde(with = "celestia_tendermint_proto::serializers::bytes::vec_base64string")] pub data_square: Vec>, /// The codec used to encode parity shares. pub codec: String, @@ -244,7 +244,7 @@ impl ExtendedDataSquare { #[derive(Deserialize)] struct RawExtendedDataSquare { - #[serde(with = "tendermint_proto::serializers::bytes::vec_base64string")] + #[serde(with = "celestia_tendermint_proto::serializers::bytes::vec_base64string")] pub data_square: Vec>, pub codec: String, } diff --git a/types/src/sample.rs b/types/src/sample.rs index 65ababdf..f8b60295 100644 --- a/types/src/sample.rs +++ b/types/src/sample.rs @@ -12,12 +12,12 @@ use std::mem::size_of; use blockstore::block::CidError; use bytes::{BufMut, BytesMut}; use celestia_proto::share::p2p::shwap::Sample as RawSample; +use celestia_tendermint_proto::Protobuf; use cid::CidGeneric; use multihash::Multihash; use nmt_rs::nmt_proof::NamespaceProof as NmtNamespaceProof; use nmt_rs::NamespaceMerkleHasher; use serde::{Deserialize, Serialize}; -use tendermint_proto::Protobuf; use crate::nmt::{Namespace, NamespaceProof, NamespacedSha2Hasher, Nmt, NS_SIZE}; use crate::row::RowId; diff --git a/types/src/share.rs b/types/src/share.rs index f34f3f38..c6ab9269 100644 --- a/types/src/share.rs +++ b/types/src/share.rs @@ -1,11 +1,11 @@ use blockstore::block::{Block, CidError}; use celestia_proto::share::p2p::shrex::nd::NamespaceRowResponse as RawNamespacedRow; +use celestia_tendermint_proto::Protobuf; use cid::CidGeneric; use multihash::Multihash; use nmt_rs::simple_merkle::tree::MerkleHash; use nmt_rs::NamespaceMerkleHasher; use serde::{Deserialize, Serialize}; -use tendermint_proto::Protobuf; use crate::consts::appconsts; use crate::nmt::{ @@ -181,7 +181,7 @@ impl From for RawNamespacedShares { #[derive(Serialize, Deserialize)] #[serde(transparent)] struct RawShare { - #[serde(with = "tendermint_proto::serializers::bytes::base64string")] + #[serde(with = "celestia_tendermint_proto::serializers::bytes::base64string")] data: Vec, } diff --git a/types/src/state/address.rs b/types/src/state/address.rs index 483e6afe..faf4bd23 100644 --- a/types/src/state/address.rs +++ b/types/src/state/address.rs @@ -2,9 +2,9 @@ use std::fmt::Display; use std::str::FromStr; use bech32::{FromBase32, ToBase32}; +use celestia_tendermint::account::Id; use enum_dispatch::enum_dispatch; use serde::{Deserialize, Serialize}; -use tendermint::account::Id; use crate::consts::cosmos::*; use crate::{Error, Result}; @@ -88,7 +88,7 @@ pub struct ConsAddress { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(transparent)] struct Raw { - #[serde(with = "tendermint_proto::serializers::from_str")] + #[serde(with = "celestia_tendermint_proto::serializers::from_str")] addr: String, } diff --git a/types/src/state/tx.rs b/types/src/state/tx.rs index 741fffc5..b1f72e4a 100644 --- a/types/src/state/tx.rs +++ b/types/src/state/tx.rs @@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(transparent)] pub struct RawTx { - #[serde(with = "tendermint_proto::serializers::bytes::base64string")] + #[serde(with = "celestia_tendermint_proto::serializers::bytes::base64string")] data: Vec, } diff --git a/types/src/sync.rs b/types/src/sync.rs index 3923e296..36c57937 100644 --- a/types/src/sync.rs +++ b/types/src/sync.rs @@ -1,6 +1,6 @@ +use celestia_tendermint::hash::Hash; +use celestia_tendermint::time::Time; use serde::{Deserialize, Serialize}; -use tendermint::hash::Hash; -use tendermint::time::Time; /// A state of the blockchain synchronization. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] diff --git a/types/src/test_utils.rs b/types/src/test_utils.rs index b1fd7e4d..91490f99 100644 --- a/types/src/test_utils.rs +++ b/types/src/test_utils.rs @@ -1,7 +1,6 @@ //! Utilities for writing tests. -use ed25519_consensus::SigningKey; -use tendermint::{ +use celestia_tendermint::{ block::{ header::{Header, Version}, parts, Commit, CommitSig, @@ -10,6 +9,7 @@ use tendermint::{ public_key::PublicKey, Signature, Time, }; +use ed25519_consensus::SigningKey; use crate::block::{CommitExt, GENESIS_HEIGHT}; use crate::consts::version; @@ -227,19 +227,19 @@ pub fn unverify(header: &mut ExtendedHeader) { let key = SigningKey::new(rand::thread_rng()); let pub_key_bytes = key.verification_key().to_bytes(); let pub_key = PublicKey::from_raw_ed25519(&pub_key_bytes).unwrap(); - let validator_address = tendermint::account::Id::new(rand::random()); + let validator_address = celestia_tendermint::account::Id::new(rand::random()); header.header.proposer_address = validator_address; header.validator_set = ValidatorSet::new( - vec![tendermint::validator::Info { + vec![celestia_tendermint::validator::Info { address: validator_address, pub_key, power: 5000_u32.into(), name: None, proposer_priority: 0_i64.into(), }], - Some(tendermint::validator::Info { + Some(celestia_tendermint::validator::Info { address: validator_address, pub_key, power: 5000_u32.into(), @@ -262,12 +262,12 @@ fn generate_new(height: u64, chain_id: &chain::Id, signing_key: &SigningKey) -> let pub_key_bytes = signing_key.verification_key().to_bytes(); let pub_key = PublicKey::from_raw_ed25519(&pub_key_bytes).unwrap(); - let validator_address = tendermint::account::Id::new(rand::random()); + let validator_address = celestia_tendermint::account::Id::new(rand::random()); let last_block_id = if height == GENESIS_HEIGHT { None } else { - Some(tendermint::block::Id { + Some(celestia_tendermint::block::Id { hash: Hash::Sha256(rand::random()), part_set_header: parts::Header::new(1, Hash::Sha256(rand::random())) .expect("invalid PartSetHeader"), @@ -301,7 +301,7 @@ fn generate_new(height: u64, chain_id: &chain::Id, signing_key: &SigningKey) -> commit: Commit { height: height.try_into().unwrap(), round: 0_u16.into(), - block_id: tendermint::block::Id { + block_id: celestia_tendermint::block::Id { hash: Hash::None, part_set_header: parts::Header::new(1, Hash::Sha256(rand::random())) .expect("invalid PartSetHeader"), @@ -313,14 +313,14 @@ fn generate_new(height: u64, chain_id: &chain::Id, signing_key: &SigningKey) -> }], }, validator_set: ValidatorSet::new( - vec![tendermint::validator::Info { + vec![celestia_tendermint::validator::Info { address: validator_address, pub_key, power: 5000_u32.into(), name: None, proposer_priority: 0_i64.into(), }], - Some(tendermint::validator::Info { + Some(celestia_tendermint::validator::Info { address: validator_address, pub_key, power: 5000_u32.into(), @@ -356,7 +356,7 @@ fn generate_next( let last_block_id = if increment == 1 { Some(current.commit.block_id) } else { - Some(tendermint::block::Id { + Some(celestia_tendermint::block::Id { hash: Hash::Sha256(rand::random()), part_set_header: parts::Header::new(1, Hash::Sha256(rand::random())) .expect("invalid PartSetHeader"), @@ -387,7 +387,7 @@ fn generate_next( commit: Commit { height, round: 0_u16.into(), - block_id: tendermint::block::Id { + block_id: celestia_tendermint::block::Id { hash: Hash::None, part_set_header: parts::Header::new(1, Hash::Sha256(rand::random())) .expect("invalid PartSetHeader"), diff --git a/types/src/validator_set.rs b/types/src/validator_set.rs index 8c67dfb7..7af7fcfc 100644 --- a/types/src/validator_set.rs +++ b/types/src/validator_set.rs @@ -1,9 +1,9 @@ use std::collections::HashMap; -use tendermint::block::CommitSig; -use tendermint::crypto::default::signature::Verifier; -use tendermint::validator::{Info, Set}; -use tendermint::{account, block, chain}; +use celestia_tendermint::block::CommitSig; +use celestia_tendermint::crypto::default::signature::Verifier; +use celestia_tendermint::validator::{Info, Set}; +use celestia_tendermint::{account, block, chain}; use crate::trust_level::TrustLevelRatio; use crate::{ @@ -162,7 +162,7 @@ fn find_validator<'a>(vals: &'a Set, val_id: &account::Id) -> Option<(usize, &'a mod tests { use super::*; - use tendermint_proto::v0_34::types::ValidatorSet as RawValidatorSet; + use celestia_tendermint_proto::v0_34::types::ValidatorSet as RawValidatorSet; #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::wasm_bindgen_test as test;