Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: restore no_std support for JSON serialization #118

Merged
merged 9 commits into from
Aug 17, 2023
2 changes: 2 additions & 0 deletions .changelog/unreleased/bug-fixes/98-restore-no-std-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Restore `no_std` support for JSON serialization
([\#98](https://github.com/cosmos/ibc-proto-rs/issues/98))
7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,16 @@ scale-info = { version = "2.1.2", default-features = false, features = [
## need tracking anchor-lang and near-sdk-rs borsh version
borsh = { version = "0.9", default-features = false, optional = true }

[dependencies.ics23]
version = "0.10.1"
default-features = false
ics23 = { version = "0.10.2" , default-features = false }

[dependencies.tendermint-proto]
version = "0.33"
default-features = false

[features]
default = ["std", "client"]
std = ["prost/std", "bytes/std", "subtle-encoding/std", "base64/std", "flex-error/std", "ics23/std", "ics23/serde"]
std = ["prost/std", "bytes/std", "subtle-encoding/std", "base64/std", "flex-error/std", "ics23/std"]
serde = ["ics23/serde"]
client = ["std", "tonic", "tonic/codegen", "tonic/transport", "tonic/prost"]
json-schema = ["std", "schemars"]
server = ["std", "tonic", "tonic/codegen", "tonic/transport", "tonic/prost"]
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ pub mod stride {
}
}

#[cfg(feature = "std")]
#[cfg(feature = "serde")]
pub(crate) mod base64 {
use alloc::string::String;
use alloc::vec::Vec;
Expand Down
44 changes: 22 additions & 22 deletions src/prost/cosmos.auth.v1beta1.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// BaseAccount defines a base account type. It contains all the necessary fields
/// for basic account functionality. Any custom account type should extend this
/// type for additional functionality (e.g. vesting).
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BaseAccount {
Expand All @@ -15,7 +15,7 @@ pub struct BaseAccount {
pub sequence: u64,
}
/// ModuleAccount defines an account for modules that holds coins on a pool.
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModuleAccount {
Expand All @@ -27,7 +27,7 @@ pub struct ModuleAccount {
pub permissions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Params defines the parameters for the auth module.
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Params {
Expand All @@ -45,7 +45,7 @@ pub struct Params {
/// QueryAccountsRequest is the request type for the Query/Accounts RPC method.
///
/// Since: cosmos-sdk 0.43
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryAccountsRequest {
Expand All @@ -58,7 +58,7 @@ pub struct QueryAccountsRequest {
/// QueryAccountsResponse is the response type for the Query/Accounts RPC method.
///
/// Since: cosmos-sdk 0.43
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryAccountsResponse {
Expand All @@ -72,7 +72,7 @@ pub struct QueryAccountsResponse {
>,
}
/// QueryAccountRequest is the request type for the Query/Account RPC method.
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryAccountRequest {
Expand All @@ -81,7 +81,7 @@ pub struct QueryAccountRequest {
pub address: ::prost::alloc::string::String,
}
/// QueryAccountResponse is the response type for the Query/Account RPC method.
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryAccountResponse {
Expand All @@ -90,12 +90,12 @@ pub struct QueryAccountResponse {
pub account: ::core::option::Option<super::super::super::google::protobuf::Any>,
}
/// QueryParamsRequest is the request type for the Query/Params RPC method.
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryParamsRequest {}
/// QueryParamsResponse is the response type for the Query/Params RPC method.
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryParamsResponse {
Expand All @@ -106,30 +106,30 @@ pub struct QueryParamsResponse {
/// QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method.
///
/// Since: cosmos-sdk 0.46
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryModuleAccountsRequest {}
/// QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method.
///
/// Since: cosmos-sdk 0.46
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryModuleAccountsResponse {
#[prost(message, repeated, tag = "1")]
pub accounts: ::prost::alloc::vec::Vec<super::super::super::google::protobuf::Any>,
}
/// QueryModuleAccountByNameRequest is the request type for the Query/ModuleAccountByName RPC method.
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryModuleAccountByNameRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName RPC method.
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryModuleAccountByNameResponse {
Expand All @@ -139,14 +139,14 @@ pub struct QueryModuleAccountByNameResponse {
/// Bech32PrefixRequest is the request type for Bech32Prefix rpc method.
///
/// Since: cosmos-sdk 0.46
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Bech32PrefixRequest {}
/// Bech32PrefixResponse is the response type for Bech32Prefix rpc method.
///
/// Since: cosmos-sdk 0.46
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Bech32PrefixResponse {
Expand All @@ -156,7 +156,7 @@ pub struct Bech32PrefixResponse {
/// AddressBytesToStringRequest is the request type for AddressString rpc method.
///
/// Since: cosmos-sdk 0.46
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AddressBytesToStringRequest {
Expand All @@ -166,7 +166,7 @@ pub struct AddressBytesToStringRequest {
/// AddressBytesToStringResponse is the response type for AddressString rpc method.
///
/// Since: cosmos-sdk 0.46
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AddressBytesToStringResponse {
Expand All @@ -176,7 +176,7 @@ pub struct AddressBytesToStringResponse {
/// AddressStringToBytesRequest is the request type for AccountBytes rpc method.
///
/// Since: cosmos-sdk 0.46
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AddressStringToBytesRequest {
Expand All @@ -186,7 +186,7 @@ pub struct AddressStringToBytesRequest {
/// AddressStringToBytesResponse is the response type for AddressBytes rpc method.
///
/// Since: cosmos-sdk 0.46
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AddressStringToBytesResponse {
Expand All @@ -196,7 +196,7 @@ pub struct AddressStringToBytesResponse {
/// QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method
///
/// Since: cosmos-sdk 0.46.2
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryAccountAddressByIdRequest {
Expand All @@ -209,7 +209,7 @@ pub struct QueryAccountAddressByIdRequest {
/// QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method
///
/// Since: cosmos-sdk 0.46.2
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryAccountAddressByIdResponse {
Expand Down Expand Up @@ -1184,7 +1184,7 @@ pub mod query_server {
}
}
/// GenesisState defines the auth module's genesis state.
#[cfg_attr(feature = "std", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GenesisState {
Expand Down
Loading
Loading