Skip to content

Commit

Permalink
fix(proto): added CosmWasm compatibility (#42)
Browse files Browse the repository at this point in the history
Using the newest version of the repository causes building errors with
cosmwasm smart contracts, this was found to be related to `ibc-proto`
and `cosmos-sdk-proto` using the `transport` feature by default.

Resolves: #41
  • Loading branch information
aelesbao authored Nov 2, 2024
2 parents 7688f20 + b8b5bf7 commit 41d73c4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
19 changes: 14 additions & 5 deletions packages/proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ tonic = { version = "0.12.3", optional = true, default-features = false, feature
"codegen",
"prost",
] }
cosmos-sdk-proto = { version = "0.26.0", features = ["serde"] }
ibc-proto = { version = "0.51.0", features = ["serde"] }
cosmos-sdk-proto = { version = "0.26.0", default-features = false, features = [
"serde",
] }
ibc-proto = { version = "0.51.0", default-features = false, features = [
"serde",
] }

[dev-dependencies]
serde_test = "1.0"
Expand All @@ -38,9 +42,14 @@ tokio = { version = "1.41.0", features = ["full"] }

[features]
default = ["grpc-transport"]
grpc-transport = ["grpc", "tonic/transport", "cosmos-sdk-proto/grpc-transport"]
grpc = ["tonic", "cosmos-sdk-proto/grpc"]
cosmwasm = ["cosmos-sdk-proto/cosmwasm"]
std = ["prost/std", "cosmos-sdk-proto/std", "ibc-proto/std"]
grpc = ["std", "tonic", "cosmos-sdk-proto/grpc", "ibc-proto/client"]
grpc-transport = [
"grpc",
"tonic/transport",
"cosmos-sdk-proto/grpc-transport",
"ibc-proto/transport",
]
proto-descriptor = ["ibc-proto/proto-descriptor"]
# Replaces all structs that use Any with a generic type
abstract-any = []
Expand Down
8 changes: 6 additions & 2 deletions packages/proto/examples/grpc-client.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
use anyhow::Result;
use archway_proto::archway;
use tonic::transport::Channel;
use tonic::transport::{Channel, ClientTlsConfig};

#[tokio::main]
async fn main() -> Result<()> {
let addr = "https://grpc.mainnet.archway.io:443";
let channel = Channel::from_static(addr).connect().await?;
let tls_config = ClientTlsConfig::new().with_native_roots();
let channel = Channel::from_static(addr)
.tls_config(tls_config)?
.connect()
.await?;

let mut client = archway::rewards::v1::query_client::QueryClient::new(channel);

Expand Down
1 change: 1 addition & 0 deletions packages/proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#![allow(rustdoc::bare_urls, clippy::derive_partial_eq_without_eq)]
#![forbid(unsafe_code)]
#![warn(trivial_casts, trivial_numeric_casts, unused_import_braces)]
#![cfg_attr(not(feature = "std"), no_std)]

#[cfg(feature = "abstract-any")]
pub mod any;
Expand Down

0 comments on commit 41d73c4

Please sign in to comment.