Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into feat/blob_service
Browse files Browse the repository at this point in the history
  • Loading branch information
fl0rek committed Nov 28, 2024
2 parents 999138b + 61ef061 commit 55c5c5b
Show file tree
Hide file tree
Showing 76 changed files with 1,462 additions and 731 deletions.
213 changes: 65 additions & 148 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ celestia-proto = { version = "0.5.0", path = "proto" }
celestia-grpc = { version = "0.1.0", path = "grpc" }
celestia-rpc = { version = "0.7.1", path = "rpc", default-features = false }
celestia-types = { version = "0.8.0", path = "types", default-features = false }
celestia-tendermint = { version = "0.33.0", default-features = false }
celestia-tendermint-proto = "0.33.0"
tendermint = { version = "0.40.0", default-features = false }
tendermint-proto = "0.40.0"

libp2p = "0.54.0"
nmt-rs = "0.2.1"
Expand All @@ -23,8 +23,6 @@ prost-types = "0.13.3"
# Uncomment to apply local changes
#beetswap = { path = "../beetswap" }
#blockstore = { path = "../blockstore" }
#celestia-tendermint = { path = "../celestia-tendermint-rs/tendermint" }
#celestia-tendermint-proto = { path = "../celestia-tendermint-rs/proto" }
#nmt-rs = { path = "../nmt-rs" }
#libp2p = { path = "../../rust-libp2p/libp2p" }
#libp2p-core = { path = "../../rust-libp2p/core" }
Expand Down
11 changes: 5 additions & 6 deletions grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ categories = [
]

[dependencies]
celestia-tendermint-proto.workspace = true
celestia-types = { workspace = true, features = [ "tonic" ] }
celestia-proto = { workspace = true, features = [ "tonic" ] }
celestia-tendermint.workspace = true
prost.workspace = true
celestia-grpc-macros = { version = "0.1.0", path = "grpc-macros" }
celestia-proto = { workspace = true, features = ["tonic"] }
celestia-types.workspace = true
prost.workspace = true
tendermint-proto.workspace = true
tendermint.workspace = true

hex = "0.4.3"
k256 = "0.13.4"
pbjson-types = "0.7.0"
serde = "1.0.215"
thiserror = "1.0.61"
tonic = { version = "0.12.3", default-features = false, features = [
Expand Down
9 changes: 4 additions & 5 deletions grpc/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@ use prost::Message;
use tonic::service::Interceptor;
use tonic::transport::Channel;

use celestia_grpc_macros::grpc_method;
use celestia_proto::celestia::blob::v1::query_client::QueryClient as BlobQueryClient;
use celestia_proto::cosmos::auth::v1beta1::query_client::QueryClient as AuthQueryClient;
use celestia_proto::cosmos::base::node::v1beta1::service_client::ServiceClient as ConfigServiceClient;
use celestia_proto::cosmos::base::tendermint::v1beta1::service_client::ServiceClient as TendermintServiceClient;
use celestia_proto::cosmos::tx::v1beta1::service_client::ServiceClient as TxServiceClient;
use celestia_tendermint::block::Block;
use celestia_proto::cosmos::tx::v1beta1::Tx as RawTx;
use celestia_types::blob::{Blob, BlobParams, RawBlobTx};
use celestia_types::block::Block;
use celestia_types::state::auth::AuthParams;
use celestia_types::state::Address;
use celestia_types::state::{RawTx, TxResponse};

use celestia_grpc_macros::grpc_method;
use celestia_types::state::{Address, TxResponse};

use crate::types::auth::Account;
use crate::types::tx::GetTxResponse;
Expand Down
4 changes: 2 additions & 2 deletions grpc/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ pub enum Error {

/// Tendermint Error
#[error(transparent)]
TendermintError(#[from] celestia_tendermint::Error),
TendermintError(#[from] tendermint::Error),

/// Celestia types error
#[error(transparent)]
CelestiaTypesError(#[from] celestia_types::Error),

/// Tendermint Proto Error
#[error(transparent)]
TendermintProtoError(#[from] celestia_tendermint_proto::Error),
TendermintProtoError(#[from] tendermint_proto::Error),

/// Failed to parse gRPC response
#[error("Failed to parse response")]
Expand Down
2 changes: 1 addition & 1 deletion grpc/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use celestia_proto::cosmos::base::tendermint::v1beta1::{
GetBlockByHeightRequest, GetBlockByHeightResponse, GetLatestBlockRequest,
GetLatestBlockResponse,
};
use celestia_tendermint::block::Block;
use celestia_types::blob::BlobParams;
use celestia_types::block::Block;

use crate::Error;

Expand Down
2 changes: 1 addition & 1 deletion grpc/src/types/auth.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use pbjson_types::Any;
use prost::{Message, Name};

use celestia_proto::cosmos::auth::v1beta1::{
Expand All @@ -9,6 +8,7 @@ use celestia_types::state::auth::{
AuthParams, BaseAccount, ModuleAccount, RawBaseAccount, RawModuleAccount,
};
use celestia_types::state::Address;
use tendermint_proto::google::protobuf::Any;

use crate::types::make_empty_params;
use crate::types::{FromGrpcResponse, IntoGrpcParam};
Expand Down
13 changes: 5 additions & 8 deletions grpc/src/types/tx.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
use std::convert::Infallible;

use k256::ecdsa::{signature::Signer, Signature};
use pbjson_types::Any;
use prost::{Message, Name};

use celestia_proto::cosmos::crypto::secp256k1;
use celestia_proto::cosmos::tx::v1beta1::{
BroadcastTxRequest, BroadcastTxResponse, GetTxRequest as RawGetTxRequest,
GetTxResponse as RawGetTxResponse, SignDoc,
};
use celestia_tendermint::public_key::Secp256k1 as VerifyingKey;
use celestia_tendermint_proto::Protobuf;
use celestia_types::state::auth::BaseAccount;
use celestia_types::state::{
AuthInfo, Fee, ModeInfo, RawTx, RawTxBody, SignerInfo, Sum, Tx, TxResponse,
};
use tendermint::public_key::Secp256k1 as VerifyingKey;
use tendermint_proto::google::protobuf::Any;
use tendermint_proto::Protobuf;

use crate::types::{FromGrpcResponse, IntoGrpcParam};
use crate::Error;
Expand Down Expand Up @@ -102,7 +100,7 @@ pub fn sign_tx(
};
let public_key_as_any = Any {
type_url: secp256k1::PubKey::type_url(),
value: public_key.encode_to_vec().into(),
value: public_key.encode_to_vec(),
};

let auth_info = AuthInfo {
Expand All @@ -113,11 +111,10 @@ pub fn sign_tx(
}],
fee: Fee::new(fee, gas_limit),
};
let auth_info_bytes: Result<_, Infallible> = auth_info.encode_vec();

let bytes_to_sign = SignDoc {
body_bytes: tx_body.encode_to_vec(),
auth_info_bytes: auth_info_bytes.expect("Result to be Infallible"),
auth_info_bytes: auth_info.clone().encode_vec(),
chain_id,
account_number: base_account.account_number,
}
Expand Down
4 changes: 2 additions & 2 deletions grpc/tests/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use tonic::transport::Channel;
use tonic::{Request, Status};

use celestia_grpc::GrpcClient;
use celestia_tendermint::crypto::default::ecdsa_secp256k1::SigningKey;
use celestia_tendermint::public_key::Secp256k1 as VerifyingKey;
use celestia_types::state::Address;
use tendermint::crypto::default::ecdsa_secp256k1::SigningKey;
use tendermint::public_key::Secp256k1 as VerifyingKey;

const CELESTIA_GRPC_URL: &str = "http://localhost:19090";

Expand Down
2 changes: 1 addition & 1 deletion node-wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ crate-type = ["cdylib", "rlib"]

[target.'cfg(target_arch = "wasm32")'.dependencies]
blockstore.workspace = true
celestia-tendermint.workspace = true
celestia-types = { workspace = true, features = ["wasm-bindgen"] }
libp2p = { workspace = true, features = ["serde"] }
lumina-node.workspace = true
tendermint.workspace = true

anyhow = "1.0.86"
console_error_panic_hook = "0.1.7"
Expand Down
2 changes: 1 addition & 1 deletion node-wasm/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ mod tests {
}
let header = found.expect("blob to exists");

let blob = client
let _blob = client
.request_all_blobs(to_value(&header).unwrap(), namespace, None)
.await
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion node-wasm/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ from_js_value! {

from_display! {
blockstore::Error,
celestia_tendermint::error::Error,
tendermint::error::Error,
libp2p::identity::ParseError,
libp2p::multiaddr::Error,
lumina_node::node::NodeError,
Expand Down
4 changes: 2 additions & 2 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ categories = [

[dependencies]
celestia-proto.workspace = true
celestia-tendermint.workspace = true
celestia-tendermint-proto.workspace = true
celestia-types.workspace = true
libp2p = { workspace = true, features = [
"autonat",
Expand All @@ -33,6 +31,8 @@ libp2p = { workspace = true, features = [
"kad",
] }
prost.workspace = true
tendermint-proto.workspace = true
tendermint.workspace = true

async-trait = "0.1.80"
beetswap = "0.4.0"
Expand Down
2 changes: 1 addition & 1 deletion node/src/daser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ use std::cmp::min;
use std::collections::HashSet;
use std::sync::Arc;

use celestia_tendermint::Time;
use futures::future::BoxFuture;
use futures::stream::FuturesUnordered;
use futures::{FutureExt, StreamExt};
use rand::Rng;
use tendermint::Time;
use tokio::select;
use tokio_util::sync::CancellationToken;
use tracing::{debug, error, warn};
Expand Down
9 changes: 5 additions & 4 deletions node/src/p2p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ use std::time::Duration;

use blockstore::Blockstore;
use celestia_proto::p2p::pb::{header_request, HeaderRequest};
use celestia_tendermint_proto::Protobuf;
use celestia_types::fraud_proof::BadEncodingFraudProof;
use celestia_types::hash::Hash;
use celestia_types::nmt::{Namespace, NamespacedSha2Hasher};
use celestia_types::row::{Row, RowId};
use celestia_types::row_namespace_data::{RowNamespaceData, RowNamespaceDataId};
use celestia_types::sample::{Sample, SampleId};
use celestia_types::{fraud_proof::BadEncodingFraudProof, hash::Hash};
use celestia_types::{Blob, ExtendedHeader, FraudProof};
use cid::Cid;
use futures::stream::FuturesOrdered;
Expand All @@ -48,6 +48,7 @@ use libp2p::{
Multiaddr, PeerId,
};
use smallvec::SmallVec;
use tendermint_proto::Protobuf;
use tokio::select;
use tokio::sync::{mpsc, oneshot, watch};
use tokio_util::sync::CancellationToken;
Expand Down Expand Up @@ -131,7 +132,7 @@ pub enum P2pError {

/// ProtoBuf message failed to be decoded.
#[error("ProtoBuf decoding error: {0}")]
ProtoDecodeFailed(#[from] celestia_tendermint_proto::Error),
ProtoDecodeFailed(#[from] tendermint_proto::Error),

/// An error propagated from [`celestia_types`] that is related to [`Cid`].
#[error("CID error: {0}")]
Expand Down Expand Up @@ -182,7 +183,7 @@ impl From<oneshot::error::RecvError> for P2pError {

impl From<prost::DecodeError> for P2pError {
fn from(value: prost::DecodeError) -> Self {
P2pError::ProtoDecodeFailed(celestia_tendermint_proto::Error::decode_message(value))
P2pError::ProtoDecodeFailed(tendermint_proto::Error::decode_message(value))
}
}

Expand Down
2 changes: 1 addition & 1 deletion node/src/p2p/header_ex/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ mod tests {
use crate::test_utils::{async_test, gen_filled_store};
use celestia_proto::p2p::pb::header_request::Data;
use celestia_proto::p2p::pb::StatusCode;
use celestia_tendermint_proto::Protobuf;
use celestia_types::ExtendedHeader;
use std::future::poll_fn;
use tendermint_proto::Protobuf;
use tokio::select;
use tokio::sync::oneshot;

Expand Down
4 changes: 2 additions & 2 deletions node/src/p2p/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::p2p::header_ex::HeaderExError;

Expand Down Expand Up @@ -88,7 +88,7 @@ pub(super) trait ExtendedHeaderExt {
impl ExtendedHeaderExt for ExtendedHeader {
fn to_header_response(&self) -> HeaderResponse {
HeaderResponse {
body: self.encode_vec().unwrap(),
body: self.clone().encode_vec(),
status_code: StatusCode::Ok.into(),
}
}
Expand Down
2 changes: 1 addition & 1 deletion node/src/pruner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use std::sync::Arc;
use std::time::Duration;

use blockstore::Blockstore;
use celestia_tendermint::Time;
use celestia_types::ExtendedHeader;
use tendermint::Time;
use tokio::select;
use tokio_util::sync::CancellationToken;
use tracing::{debug, error, warn};
Expand Down
2 changes: 1 addition & 1 deletion node/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ use std::io::Cursor;
use std::ops::{Bound, RangeBounds, RangeInclusive};

use async_trait::async_trait;
use celestia_tendermint_proto::Protobuf;
use celestia_types::hash::Hash;
use celestia_types::ExtendedHeader;
use cid::Cid;
use prost::Message;
use serde::{Deserialize, Serialize};
use tendermint_proto::Protobuf;
use thiserror::Error;

pub use crate::block_ranges::{BlockRange, BlockRanges, BlockRangesError};
Expand Down
Loading

0 comments on commit 55c5c5b

Please sign in to comment.