diff --git a/Cargo.lock b/Cargo.lock index 45846ce7..76bce5e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -808,7 +808,6 @@ version = "0.7.1" dependencies = [ "anyhow", "async-trait", - "celestia-proto", "celestia-tendermint", "celestia-tendermint-proto", "celestia-types", diff --git a/grpc/Cargo.toml b/grpc/Cargo.toml index 18546d99..f2bcd408 100644 --- a/grpc/Cargo.toml +++ b/grpc/Cargo.toml @@ -27,13 +27,13 @@ prost.workspace = true celestia-grpc-macros = { version = "0.1.0", path = "grpc-macros" } hex = "0.4.3" -serde = "1.0.215" 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 = [ "codegen", "prost" ]} -pbjson-types = "0.7.0" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] anyhow = "1.0.86" diff --git a/grpc/src/types/pagination.rs b/grpc/src/types/pagination.rs deleted file mode 100644 index 1666e99a..00000000 --- a/grpc/src/types/pagination.rs +++ /dev/null @@ -1,30 +0,0 @@ -use celestia_proto::cosmos::base::query::v1beta1::pagination::PageRequest as RawPageRequest; -use celestia_proto::cosmos::base::query::v1beta1::pagination::PageResponse as RawPageResponse; - -use crate::tonic::types::FromGrpcResponse; -use crate::tonic::Error; - -pub enum KeyOrOffset { - Key(Vec), - Offset(u64), -} - -pub struct PageRequest { - query_start: KeyOrOffset, - limit: Option, - count_total: bool, - reverse: bool, -} - -impl From for RawPageRequest { - fn from(item: PageRequest) -> RawPageRequest { - RawPageRequest { - - } - } -} - -pub struct PageResponse { - pub next_key: Option>, - pub total: Option, -} diff --git a/grpc/tests/tonic.rs b/grpc/tests/tonic.rs index 94581c2e..b82316ae 100644 --- a/grpc/tests/tonic.rs +++ b/grpc/tests/tonic.rs @@ -75,7 +75,7 @@ async fn submit_blob() { let (address, keypair) = load_account(BRIDGE_0_DATA); let namespace = Namespace::new_v0(&[1, 2, 3]).unwrap(); - let blobs = vec![Blob::new(namespace, "Hello, World!".into(), AppVersion::V1).unwrap()]; + let blobs = vec![Blob::new(namespace, "Hello, World!".into(), AppVersion::V3).unwrap()]; let chain_id = "private".to_string(); let account = client.get_account(address.clone()).await.unwrap(); diff --git a/grpc/tests/utils.rs b/grpc/tests/utils.rs index 95fa0408..78120fb2 100644 --- a/grpc/tests/utils.rs +++ b/grpc/tests/utils.rs @@ -57,8 +57,6 @@ pub fn load_account(path: &str) -> (String, AccountKeypair) { let account = fs::read_to_string(account_file).expect("file with account name to exists"); let hex_encoded_key = fs::read_to_string(key_file).expect("file with plaintext key to exists"); - //let (_label, key_material) = SecretDocument::read_pem_file(key_file).expect("valid private key file"); - //let key : EcPrivateKey = key_material.try_into().expect("valid key data"); let signing_key = SigningKey::from_slice( &hex::decode(hex_encoded_key.trim()).expect("valid hex representation"), diff --git a/proto/build.rs b/proto/build.rs index 9b25447e..c07f7a8a 100644 --- a/proto/build.rs +++ b/proto/build.rs @@ -72,6 +72,7 @@ static EXTERN_PATHS: &[(&str, &str)] = &[ (".tendermint", "::celestia_tendermint_proto::v0_34"), (".google.protobuf.Timestamp", "::celestia_tendermint_proto::google::protobuf::Timestamp"), (".google.protobuf.Duration", "::celestia_tendermint_proto::google::protobuf::Duration"), + #[cfg(feature = "tonic")] (".google.protobuf.Any", "::pbjson_types::Any"), ]; diff --git a/proto/src/serializers/option_any.rs b/proto/src/serializers/option_any.rs index 7e3fed72..f266dbb5 100644 --- a/proto/src/serializers/option_any.rs +++ b/proto/src/serializers/option_any.rs @@ -1,5 +1,8 @@ //! [`serde`] serializer for the optional [`Any`]. +#[cfg(feature = "tonic")] +use pbjson_types::Any; +#[cfg(not(feature = "tonic"))] use prost_types::Any; use serde::{Deserialize, Deserializer, Serialize, Serializer}; diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 994d237a..4b14163a 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -21,7 +21,6 @@ categories = [ [dependencies] celestia-tendermint-proto.workspace = true celestia-types.workspace = true -celestia-proto = { optional = true, workspace = true } celestia-tendermint.workspace = true prost.workspace = true diff --git a/types/Cargo.toml b/types/Cargo.toml index ade0bda9..daf7a15b 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -62,7 +62,7 @@ default = ["p2p"] p2p = ["dep:libp2p-identity", "dep:multiaddr", "dep:serde_repr"] test-utils = ["dep:ed25519-consensus", "dep:rand"] wasm-bindgen = ["celestia-tendermint/wasm-bindgen"] -tonic = ["dep:pbjson-types"] +tonic = ["dep:pbjson-types", "celestia-proto/tonic"] [package.metadata.docs.rs] features = ["p2p", "test-utils"] diff --git a/types/src/auth.rs b/types/src/auth.rs index dd56f47b..5f160be1 100644 --- a/types/src/auth.rs +++ b/types/src/auth.rs @@ -1,6 +1,9 @@ //! types related to accounts +#[cfg(feature = "tonic")] use pbjson_types::Any; +#[cfg(not(feature = "tonic"))] +use prost_types::Any; use prost::Message; use celestia_proto::cosmos::crypto::ed25519::PubKey as Ed25519PubKey; diff --git a/types/src/tx.rs b/types/src/tx.rs index 1f51fa2e..e9be2609 100644 --- a/types/src/tx.rs +++ b/types/src/tx.rs @@ -1,8 +1,11 @@ //! Types associated with submitting and querying transaction -use celestia_tendermint_proto::Protobuf; +#[cfg(feature = "tonic")] use pbjson_types::Any; +#[cfg(not(feature = "tonic"))] +use prost_types::Any; +use celestia_tendermint_proto::Protobuf; use celestia_proto::cosmos::tx::v1beta1::{ AuthInfo as RawAuthInfo, Fee, SignerInfo, TxBody as RawTxBody, };