Skip to content

Commit

Permalink
chore(deps): switch to the released celestia-tendermint crates (#176)
Browse files Browse the repository at this point in the history
* chore(deps): switch to the released celestia-tendermint crates

* fix docs

* rebase with shwap

* fmt
  • Loading branch information
zvolin authored Jan 12, 2024
1 parent ece138a commit 5bcedc1
Show file tree
Hide file tree
Showing 35 changed files with 143 additions and 144 deletions.
102 changes: 52 additions & 50 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 5 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ categories = [

[dependencies]
celestia-proto = { workspace = true }
celestia-tendermint-proto = { workspace = true }
celestia-types = { workspace = true }
libp2p = { workspace = true, features = [
"autonat",
Expand All @@ -28,7 +29,6 @@ libp2p = { workspace = true, features = [
"request-response",
"kad",
] }
tendermint-proto = { workspace = true }

async-trait = "0.1.73"
dashmap = "5.5.3"
Expand Down
2 changes: 1 addition & 1 deletion node/src/header_ex/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion node/src/header_ex/utils.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
2 changes: 1 addition & 1 deletion node/src/store/indexed_db_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion node/src/store/sled_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 6 additions & 6 deletions proto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]"#;

Expand Down Expand Up @@ -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"])
Expand Down
4 changes: 2 additions & 2 deletions proto/src/serializers/option_any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>,
}

Expand All @@ -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],
}

Expand Down
4 changes: 2 additions & 2 deletions proto/src/serializers/option_timestamp.rs
Original file line number Diff line number Diff line change
@@ -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<Timestamp>`.
pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<Timestamp>, D::Error>
Expand Down
6 changes: 3 additions & 3 deletions types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"]
Expand Down
6 changes: 3 additions & 3 deletions types/src/blob.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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<u8>,
/// Version indicating the format in which [`Share`]s should be created from this [`Blob`].
///
Expand Down
8 changes: 4 additions & 4 deletions types/src/blob/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 5bcedc1

Please sign in to comment.