Skip to content

Commit

Permalink
cosmos-sdk-proto: add support for no_std (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
conr2d committed Jul 31, 2024
1 parent ae003db commit c5db4e5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
7 changes: 4 additions & 3 deletions cosmos-sdk-proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ edition = "2021"
rust-version = "1.72"

[dependencies]
prost = "0.13"
prost-types = "0.13"
prost = { version = "0.13", default-features = false }
prost-types = { version = "0.13", default-features = false }
tendermint-proto = "0.38"

# Optional dependencies
tonic = { version = "0.12", optional = true, default-features = false, features = ["codegen", "prost"] }

[features]
default = ["grpc-transport"]
grpc = ["tonic"]
std = ["prost/std", "prost-types/std"]
grpc = ["std", "tonic"]
grpc-transport = ["grpc", "tonic/transport"]
cosmwasm = []

Expand Down
3 changes: 3 additions & 0 deletions cosmos-sdk-proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
)]
#![forbid(unsafe_code)]
#![warn(trivial_casts, trivial_numeric_casts, unused_import_braces)]
#![cfg_attr(not(feature = "std"), no_std)]

extern crate alloc;

pub mod traits;
mod type_names;
Expand Down
3 changes: 2 additions & 1 deletion cosmos-sdk-proto/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

pub use prost::{Message, Name};

use alloc::{string::String, vec::Vec};
use core::str::FromStr;
use prost::EncodeError;
use std::str::FromStr;

/// Extension trait for [`Message`].
pub trait MessageExt: Message {
Expand Down
2 changes: 1 addition & 1 deletion cosmrs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ edition = "2021"
rust-version = "1.72"

[dependencies]
cosmos-sdk-proto = { version = "=0.23.0-pre", default-features = false, path = "../cosmos-sdk-proto" }
cosmos-sdk-proto = { version = "=0.23.0-pre", default-features = false, features = ["std"], path = "../cosmos-sdk-proto" }
ecdsa = "0.16"
eyre = "0.6"
k256 = { version = "0.13", default-features = false, features = ["ecdsa", "sha256"] }
Expand Down

0 comments on commit c5db4e5

Please sign in to comment.