diff --git a/.changelog/unreleased/bug-fixes/1059-add-missing-deps-for-feature-flags.md b/.changelog/unreleased/bug-fixes/1059-add-missing-deps-for-feature-flags.md new file mode 100644 index 000000000..42592cb58 --- /dev/null +++ b/.changelog/unreleased/bug-fixes/1059-add-missing-deps-for-feature-flags.md @@ -0,0 +1,2 @@ +- [ibc] Add missing dependencies for some feature flags across multiple crates + ([\#1059](https://github.com/cosmos/ibc-rs/issues/1059)) diff --git a/.changelog/unreleased/improvements/1060-ease-serde-derive-on-ics20-721-types.md b/.changelog/unreleased/improvements/1060-ease-serde-derive-on-ics20-721-types.md new file mode 100644 index 000000000..7d6fd9306 --- /dev/null +++ b/.changelog/unreleased/improvements/1060-ease-serde-derive-on-ics20-721-types.md @@ -0,0 +1,2 @@ +- [ibc-apps] Ease `serde` derive on `ICS-20` and `ICS-721` types + ([\#1060](https://github.com/cosmos/ibc-rs/pull/1060)) diff --git a/.changelog/0.50.0/breaking-changes/1036-bump-ibc-proto-to-v0-41-0.md b/.changelog/v0.50.0/breaking-changes/1036-bump-ibc-proto-to-v0-41-0.md similarity index 100% rename from .changelog/0.50.0/breaking-changes/1036-bump-ibc-proto-to-v0-41-0.md rename to .changelog/v0.50.0/breaking-changes/1036-bump-ibc-proto-to-v0-41-0.md diff --git a/.changelog/0.50.0/bug-fixes/910-refactor-client-state-derive-to-handle-context-with-generics.md b/.changelog/v0.50.0/bug-fixes/910-refactor-client-state-derive-to-handle-context-with-generics.md similarity index 100% rename from .changelog/0.50.0/bug-fixes/910-refactor-client-state-derive-to-handle-context-with-generics.md rename to .changelog/v0.50.0/bug-fixes/910-refactor-client-state-derive-to-handle-context-with-generics.md diff --git a/.changelog/0.50.0/bug-fixes/999-make-ibc-derive-work-with-ibc-core.md b/.changelog/v0.50.0/bug-fixes/999-make-ibc-derive-work-with-ibc-core.md similarity index 100% rename from .changelog/0.50.0/bug-fixes/999-make-ibc-derive-work-with-ibc-core.md rename to .changelog/v0.50.0/bug-fixes/999-make-ibc-derive-work-with-ibc-core.md diff --git a/.changelog/0.50.0/features/1030-implement-08-wasm-client-types.md b/.changelog/v0.50.0/features/1030-implement-08-wasm-client-types.md similarity index 100% rename from .changelog/0.50.0/features/1030-implement-08-wasm-client-types.md rename to .changelog/v0.50.0/features/1030-implement-08-wasm-client-types.md diff --git a/.changelog/0.50.0/features/346-implement-ics721-nft-transfer.md b/.changelog/v0.50.0/features/346-implement-ics721-nft-transfer.md similarity index 100% rename from .changelog/0.50.0/features/346-implement-ics721-nft-transfer.md rename to .changelog/v0.50.0/features/346-implement-ics721-nft-transfer.md diff --git a/.changelog/0.50.0/improvements/1041-re-export-missing-types.md b/.changelog/v0.50.0/improvements/1041-re-export-missing-types.md similarity index 100% rename from .changelog/0.50.0/improvements/1041-re-export-missing-types.md rename to .changelog/v0.50.0/improvements/1041-re-export-missing-types.md diff --git a/.changelog/0.50.0/improvements/1042-deprecate-mockcontext-new-methods.md b/.changelog/v0.50.0/improvements/1042-deprecate-mockcontext-new-methods.md similarity index 100% rename from .changelog/0.50.0/improvements/1042-deprecate-mockcontext-new-methods.md rename to .changelog/v0.50.0/improvements/1042-deprecate-mockcontext-new-methods.md diff --git a/.changelog/0.50.0/improvements/1043-remove-field-access-of-mockcontext.md b/.changelog/v0.50.0/improvements/1043-remove-field-access-of-mockcontext.md similarity index 100% rename from .changelog/0.50.0/improvements/1043-remove-field-access-of-mockcontext.md rename to .changelog/v0.50.0/improvements/1043-remove-field-access-of-mockcontext.md diff --git a/.changelog/0.50.0/improvements/1049-deprecate-mockcontext-withclient-methods.md b/.changelog/v0.50.0/improvements/1049-deprecate-mockcontext-withclient-methods.md similarity index 100% rename from .changelog/0.50.0/improvements/1049-deprecate-mockcontext-withclient-methods.md rename to .changelog/v0.50.0/improvements/1049-deprecate-mockcontext-withclient-methods.md diff --git a/.changelog/0.50.0/improvements/1054-re-export-all-google-proto-types.md b/.changelog/v0.50.0/improvements/1054-re-export-all-google-proto-types.md similarity index 100% rename from .changelog/0.50.0/improvements/1054-re-export-all-google-proto-types.md rename to .changelog/v0.50.0/improvements/1054-re-export-all-google-proto-types.md diff --git a/.changelog/0.50.0/improvements/1055-move-serializers-into-ibc-primitives.md b/.changelog/v0.50.0/improvements/1055-move-serializers-into-ibc-primitives.md similarity index 100% rename from .changelog/0.50.0/improvements/1055-move-serializers-into-ibc-primitives.md rename to .changelog/v0.50.0/improvements/1055-move-serializers-into-ibc-primitives.md diff --git a/.changelog/0.50.0/summary.md b/.changelog/v0.50.0/summary.md similarity index 100% rename from .changelog/0.50.0/summary.md rename to .changelog/v0.50.0/summary.md diff --git a/ibc-apps/ics20-transfer/src/lib.rs b/ibc-apps/ics20-transfer/src/lib.rs index 8c2c31d9c..2f2bec601 100644 --- a/ibc-apps/ics20-transfer/src/lib.rs +++ b/ibc-apps/ics20-transfer/src/lib.rs @@ -24,7 +24,6 @@ pub mod types { pub use ibc_app_transfer_types::*; } -#[cfg(feature = "serde")] pub mod context; #[cfg(feature = "serde")] pub mod handler; diff --git a/ibc-apps/ics20-transfer/types/src/amount.rs b/ibc-apps/ics20-transfer/types/src/amount.rs index 89d3531a6..7754f4723 100644 --- a/ibc-apps/ics20-transfer/types/src/amount.rs +++ b/ibc-apps/ics20-transfer/types/src/amount.rs @@ -4,6 +4,7 @@ use core::str::FromStr; use derive_more::{Display, From, Into}; use ibc_core::primitives::prelude::*; +#[cfg(feature = "serde")] use ibc_core::primitives::serializers; use primitive_types::U256; @@ -15,8 +16,8 @@ use super::error::TokenTransferError; #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Display, From, Into)] pub struct Amount( #[cfg_attr(feature = "schema", schemars(with = "String"))] - #[serde(serialize_with = "serializers::serialize")] - #[serde(deserialize_with = "deserialize")] + #[cfg_attr(feature = "serde", serde(serialize_with = "serializers::serialize"))] + #[cfg_attr(feature = "serde", serde(deserialize_with = "deserialize"))] U256, ); diff --git a/ibc-apps/ics20-transfer/types/src/denom.rs b/ibc-apps/ics20-transfer/types/src/denom.rs index a6ee5aad2..c76eaf062 100644 --- a/ibc-apps/ics20-transfer/types/src/denom.rs +++ b/ibc-apps/ics20-transfer/types/src/denom.rs @@ -5,6 +5,7 @@ use core::str::FromStr; use derive_more::{Display, From}; use ibc_core::host::types::identifiers::{ChannelId, PortId}; use ibc_core::primitives::prelude::*; +#[cfg(feature = "serde")] use ibc_core::primitives::serializers; use ibc_proto::ibc::applications::transfer::v1::DenomTrace as RawDenomTrace; diff --git a/ibc-apps/ics20-transfer/types/src/lib.rs b/ibc-apps/ics20-transfer/types/src/lib.rs index 44fe89603..9ef3e8413 100644 --- a/ibc-apps/ics20-transfer/types/src/lib.rs +++ b/ibc-apps/ics20-transfer/types/src/lib.rs @@ -15,27 +15,18 @@ #[cfg(any(test, feature = "std"))] extern crate std; -#[cfg(feature = "serde")] mod amount; -#[cfg(feature = "serde")] -pub use amount::*; -#[cfg(feature = "serde")] mod coin; -#[cfg(feature = "serde")] -pub use coin::*; -#[cfg(feature = "serde")] mod denom; -#[cfg(feature = "serde")] +mod memo; + +pub use amount::*; +pub use coin::*; pub use denom::*; -#[cfg(feature = "serde")] +pub mod error; pub mod events; -#[cfg(feature = "serde")] pub mod msgs; -#[cfg(feature = "serde")] pub mod packet; - -pub mod error; -mod memo; pub use memo::*; /// Re-exports `U256` from `primitive-types` crate for convenience. pub use primitive_types::U256; diff --git a/ibc-apps/ics721-nft-transfer/types/src/class.rs b/ibc-apps/ics721-nft-transfer/types/src/class.rs index 41d150fa0..adbc95f92 100644 --- a/ibc-apps/ics721-nft-transfer/types/src/class.rs +++ b/ibc-apps/ics721-nft-transfer/types/src/class.rs @@ -6,6 +6,7 @@ use derive_more::From; use http::Uri; use ibc_core::host::types::identifiers::{ChannelId, PortId}; use ibc_core::primitives::prelude::*; +#[cfg(feature = "serde")] use ibc_core::primitives::serializers; use ibc_proto::ibc::applications::nft_transfer::v1::ClassTrace as RawClassTrace; diff --git a/ibc-apps/ics721-nft-transfer/types/src/data.rs b/ibc-apps/ics721-nft-transfer/types/src/data.rs index 098c8c094..c94e9ee31 100644 --- a/ibc-apps/ics721-nft-transfer/types/src/data.rs +++ b/ibc-apps/ics721-nft-transfer/types/src/data.rs @@ -2,7 +2,9 @@ use core::fmt::{self, Display, Formatter}; use core::str::FromStr; +#[cfg(feature = "serde")] use base64::prelude::BASE64_STANDARD; +#[cfg(feature = "serde")] use base64::Engine; use ibc_core::primitives::prelude::*; use mime::Mime; @@ -25,6 +27,7 @@ use crate::error::NftTransferError; #[derive(Clone, Debug, Default, PartialEq, Eq, derive_more::From)] pub struct Data(String); +#[cfg(feature = "serde")] impl Data { /// Parses the data in the format specified by ICS-721. pub fn parse_as_ics721_data(&self) -> Result { @@ -46,6 +49,7 @@ impl FromStr for Data { } } +#[cfg(feature = "serde")] impl serde::Serialize for Data { fn serialize(&self, serializer: S) -> Result where @@ -55,6 +59,7 @@ impl serde::Serialize for Data { } } +#[cfg(feature = "serde")] impl<'de> serde::Deserialize<'de> for Data { fn deserialize(deserializer: D) -> Result where @@ -86,6 +91,7 @@ impl<'de> serde::Deserialize<'de> for Data { #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct Ics721Data(BTreeMap); +#[cfg(feature = "serde")] impl FromStr for Ics721Data { type Err = NftTransferError; diff --git a/ibc-apps/ics721-nft-transfer/types/src/lib.rs b/ibc-apps/ics721-nft-transfer/types/src/lib.rs index 8ca548269..7a55e1368 100644 --- a/ibc-apps/ics721-nft-transfer/types/src/lib.rs +++ b/ibc-apps/ics721-nft-transfer/types/src/lib.rs @@ -17,28 +17,19 @@ #[cfg(any(test, feature = "std"))] extern crate std; -#[cfg(feature = "serde")] mod class; -#[cfg(feature = "serde")] -pub use class::*; -#[cfg(feature = "serde")] mod data; -#[cfg(feature = "serde")] -pub use data::*; -#[cfg(feature = "serde")] +mod memo; +mod token; + pub mod events; -#[cfg(feature = "serde")] pub mod msgs; -#[cfg(feature = "serde")] +pub use class::*; +pub use data::*; pub mod packet; -#[cfg(feature = "serde")] -mod token; -#[cfg(feature = "serde")] +pub use memo::*; pub use token::*; - pub mod error; -mod memo; -pub use memo::*; /// Re-exports ICS-721 NFT transfer proto types from the `ibc-proto` crate. pub mod proto { diff --git a/ibc-apps/ics721-nft-transfer/types/src/packet.rs b/ibc-apps/ics721-nft-transfer/types/src/packet.rs index 183dbc2bf..efa8e6264 100644 --- a/ibc-apps/ics721-nft-transfer/types/src/packet.rs +++ b/ibc-apps/ics721-nft-transfer/types/src/packet.rs @@ -5,7 +5,9 @@ use core::convert::TryFrom; use base64::prelude::BASE64_STANDARD; use base64::Engine; use ibc_core::primitives::prelude::*; -use ibc_core::primitives::{serializers, Signer}; +#[cfg(feature = "serde")] +use ibc_core::primitives::serializers; +use ibc_core::primitives::Signer; use ibc_proto::ibc::applications::nft_transfer::v1::NonFungibleTokenPacketData as RawPacketData; use crate::class::{ClassData, ClassUri, PrefixedClassId}; @@ -15,7 +17,7 @@ use crate::token::{TokenData, TokenIds, TokenUri}; /// Defines the structure of token transfers' packet bytes #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[serde(rename_all = "camelCase")] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] #[cfg_attr( feature = "parity-scale-codec", diff --git a/ibc-apps/ics721-nft-transfer/types/src/token.rs b/ibc-apps/ics721-nft-transfer/types/src/token.rs index ca8adb343..6128bb630 100644 --- a/ibc-apps/ics721-nft-transfer/types/src/token.rs +++ b/ibc-apps/ics721-nft-transfer/types/src/token.rs @@ -4,6 +4,7 @@ use core::str::FromStr; use http::Uri; use ibc_core::primitives::prelude::*; +#[cfg(feature = "serde")] use ibc_core::primitives::serializers; use crate::data::Data; diff --git a/ibc-clients/ics08-wasm/types/Cargo.toml b/ibc-clients/ics08-wasm/types/Cargo.toml index 1db31f114..a04c64f48 100644 --- a/ibc-clients/ics08-wasm/types/Cargo.toml +++ b/ibc-clients/ics08-wasm/types/Cargo.toml @@ -36,6 +36,7 @@ default = ["std"] std = [ "ibc-core-client/std", "ibc-core-host-types/std", + "ibc-primitives/std", "ibc-proto/std", "base64/std", "serde/std" diff --git a/ibc-core/Cargo.toml b/ibc-core/Cargo.toml index f19a89432..277e4a438 100644 --- a/ibc-core/Cargo.toml +++ b/ibc-core/Cargo.toml @@ -37,6 +37,7 @@ std = [ "ibc-core-host/std", "ibc-core-router/std", "ibc-core-handler/std", + "ibc-primitives/std", ] serde = [ "ibc-core-client/serde", @@ -46,6 +47,7 @@ serde = [ "ibc-core-host/serde", "ibc-core-router/serde", "ibc-core-handler/serde", + "ibc-primitives/serde", ] borsh = [ "ibc-core-client/borsh", @@ -55,6 +57,7 @@ borsh = [ "ibc-core-host/borsh", "ibc-core-router/borsh", "ibc-core-handler/borsh", + "ibc-primitives/borsh", ] schema = [ "ibc-core-client/schema", @@ -64,6 +67,7 @@ schema = [ "ibc-core-host/schema", "ibc-core-router/schema", "ibc-core-handler/schema", + "ibc-primitives/schema", "serde", "std" ] @@ -71,6 +75,7 @@ parity-scale-codec = [ "ibc-core-client/parity-scale-codec", "ibc-core-connection/parity-scale-codec", "ibc-core-channel/parity-scale-codec", + "ibc-core-commitment-types/parity-scale-codec", "ibc-core-host/parity-scale-codec", "ibc-core-router/parity-scale-codec", "ibc-core-handler/parity-scale-codec", diff --git a/ibc-core/ics02-client/context/Cargo.toml b/ibc-core/ics02-client/context/Cargo.toml index d93aebbaa..65e90d116 100644 --- a/ibc-core/ics02-client/context/Cargo.toml +++ b/ibc-core/ics02-client/context/Cargo.toml @@ -63,6 +63,7 @@ schema = [ "ibc-core-client-types/schema", "ibc-core-host-types/schema", "ibc-core-handler-types/schema", + "ibc-primitives/schema", "serde", "std" ] diff --git a/ibc-core/ics02-client/types/Cargo.toml b/ibc-core/ics02-client/types/Cargo.toml index 5069cd604..de5f7b656 100644 --- a/ibc-core/ics02-client/types/Cargo.toml +++ b/ibc-core/ics02-client/types/Cargo.toml @@ -77,7 +77,8 @@ schema = [ parity-scale-codec = [ "dep:parity-scale-codec", "dep:scale-info", - "ibc-core-commitment-types/parity-scale-codec", "ibc-core-host-types/parity-scale-codec", + "ibc-core-commitment-types/parity-scale-codec", "ibc-primitives/parity-scale-codec", + "ibc-proto/parity-scale-codec", ] diff --git a/ibc-core/ics03-connection/Cargo.toml b/ibc-core/ics03-connection/Cargo.toml index f7531db79..3bb727d2b 100644 --- a/ibc-core/ics03-connection/Cargo.toml +++ b/ibc-core/ics03-connection/Cargo.toml @@ -43,6 +43,7 @@ schema = [ "ibc-core-client/schema", "ibc-core-connection-types/schema", "ibc-core-host/schema", + "ibc-core-handler-types/schema", "ibc-primitives/schema", "serde", "std" diff --git a/ibc-core/ics24-host/Cargo.toml b/ibc-core/ics24-host/Cargo.toml index 79adcf6e5..cb7e22342 100644 --- a/ibc-core/ics24-host/Cargo.toml +++ b/ibc-core/ics24-host/Cargo.toml @@ -62,6 +62,7 @@ serde = [ ] schema = [ "ibc-core-client-types/schema", + "ibc-core-client-context/schema", "ibc-core-connection-types/schema", "ibc-core-channel-types/schema", "ibc-core-commitment-types/schema", @@ -73,6 +74,7 @@ schema = [ ] borsh = [ "ibc-core-client-types/borsh", + "ibc-core-client-context/borsh", "ibc-core-connection-types/borsh", "ibc-core-channel-types/borsh", "ibc-core-commitment-types/borsh", diff --git a/ibc-core/ics24-host/cosmos/Cargo.toml b/ibc-core/ics24-host/cosmos/Cargo.toml index bbe7d7bb2..e9c2e73e6 100644 --- a/ibc-core/ics24-host/cosmos/Cargo.toml +++ b/ibc-core/ics24-host/cosmos/Cargo.toml @@ -90,6 +90,7 @@ borsh = [ "dep:borsh", "ibc-client-tendermint/borsh", "ibc-core-client-types/borsh", + "ibc-core-client-context/borsh", "ibc-core-connection-types/borsh", "ibc-core-commitment-types/borsh", "ibc-core-host-types/borsh", diff --git a/ibc-core/ics25-handler/Cargo.toml b/ibc-core/ics25-handler/Cargo.toml index 1e158e402..15231a4af 100644 --- a/ibc-core/ics25-handler/Cargo.toml +++ b/ibc-core/ics25-handler/Cargo.toml @@ -37,6 +37,7 @@ std = [ "ibc-core-host/std", "ibc-core-router/std", "ibc-core-handler-types/std", + "ibc-primitives/std", ] serde = [ "ibc-core-client/serde", @@ -46,6 +47,7 @@ serde = [ "ibc-core-host/serde", "ibc-core-router/serde", "ibc-core-handler-types/serde", + "ibc-primitives/serde", ] borsh = [ "ibc-core-client/borsh", @@ -55,6 +57,7 @@ borsh = [ "ibc-core-host/borsh", "ibc-core-router/borsh", "ibc-core-handler-types/borsh", + "ibc-primitives/borsh", ] schema = [ "ibc-core-client/schema", @@ -64,6 +67,7 @@ schema = [ "ibc-core-host/schema", "ibc-core-router/schema", "ibc-core-handler-types/schema", + "ibc-primitives/schema", "serde", "std" ] diff --git a/ibc-data-types/Cargo.toml b/ibc-data-types/Cargo.toml index 00830d562..30bc92a2c 100644 --- a/ibc-data-types/Cargo.toml +++ b/ibc-data-types/Cargo.toml @@ -62,6 +62,7 @@ borsh = [ "ibc-core-client-types/borsh", "ibc-core-connection-types/borsh", "ibc-core-channel-types/borsh", + "ibc-core-commitment-types/borsh", "ibc-core-host-types/borsh", "ibc-core-router-types/borsh", "ibc-core-handler-types/borsh", @@ -73,6 +74,7 @@ schema = [ "ibc-core-client-types/schema", "ibc-core-connection-types/schema", "ibc-core-channel-types/schema", + "ibc-core-commitment-types/schema", "ibc-core-host-types/schema", "ibc-core-router-types/schema", "ibc-core-handler-types/schema", @@ -85,6 +87,7 @@ parity-scale-codec = [ "ibc-core-client-types/parity-scale-codec", "ibc-core-connection-types/parity-scale-codec", "ibc-core-channel-types/parity-scale-codec", + "ibc-core-commitment-types/parity-scale-codec", "ibc-core-host-types/parity-scale-codec", "ibc-core-router-types/parity-scale-codec", "ibc-core-handler-types/parity-scale-codec",