diff --git a/primitive-types/CHANGELOG.md b/primitive-types/CHANGELOG.md index 520cc9d43..39c1a4e52 100644 --- a/primitive-types/CHANGELOG.md +++ b/primitive-types/CHANGELOG.md @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog]. ## [Unreleased] +## [0.10.1] - 2021-07-02 +### Added +- Implemented `parity_scale_codec::MaxEncodedLen` trait for `{U128, U256, U512}` and `{H128, H160, H256, H512}` types. + +## [0.10.0] - 2021-07-02 ### Added - Added `U128::full_mul` method. [#546](https://github.com/paritytech/parity-common/pull/546) ### Breaking diff --git a/primitive-types/Cargo.toml b/primitive-types/Cargo.toml index 030db9470..7a0b9d9e5 100644 --- a/primitive-types/Cargo.toml +++ b/primitive-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "primitive-types" -version = "0.10.0" +version = "0.10.1" authors = ["Parity Technologies "] license = "MIT OR Apache-2.0" homepage = "https://github.com/paritytech/parity-common" @@ -11,7 +11,7 @@ edition = "2018" fixed-hash = { version = "0.7", path = "../fixed-hash", default-features = false } uint = { version = "0.9.0", path = "../uint", default-features = false } impl-serde = { version = "0.3.1", path = "impls/serde", default-features = false, optional = true } -impl-codec = { version = "0.5.0", path = "impls/codec", default-features = false, optional = true } +impl-codec = { version = "0.5.1", path = "impls/codec", default-features = false, optional = true } impl-num-traits = { version = "0.1.0", path = "impls/num-traits", default-features = false, optional = true } impl-rlp = { version = "0.3", path = "impls/rlp", default-features = false, optional = true } scale-info-crate = { package = "scale-info", version = ">=0.9, <2", features = ["derive"], default-features = false, optional = true } diff --git a/primitive-types/impls/codec/CHANGELOG.md b/primitive-types/impls/codec/CHANGELOG.md index 179be164f..c7fca7d25 100644 --- a/primitive-types/impls/codec/CHANGELOG.md +++ b/primitive-types/impls/codec/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog]. ## [Unreleased] +## [0.5.1] - 2021-07-02 +### Dependencies +- Updated `parity-scale-codec` to 2.2. [#552](https://github.com/paritytech/parity-common/pull/552) + ## [0.5.0] - 2021-01-27 ### Breaking - Updated `parity-scale-codec` to 2.0. [#510](https://github.com/paritytech/parity-common/pull/510) diff --git a/primitive-types/impls/codec/Cargo.toml b/primitive-types/impls/codec/Cargo.toml index 27a4aa7b6..8721e4333 100644 --- a/primitive-types/impls/codec/Cargo.toml +++ b/primitive-types/impls/codec/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "impl-codec" -version = "0.5.0" +version = "0.5.1" authors = ["Parity Technologies "] license = "MIT OR Apache-2.0" homepage = "https://github.com/paritytech/parity-common" @@ -8,7 +8,7 @@ description = "Parity Codec serialization support for uint and fixed hash." edition = "2018" [dependencies] -parity-scale-codec = { version = "2.0.0", default-features = false } +parity-scale-codec = { version = "2.2.0", default-features = false, features = ["max-encoded-len"] } [features] default = ["std"] diff --git a/primitive-types/impls/codec/src/lib.rs b/primitive-types/impls/codec/src/lib.rs index 1a4f2e252..feacec08a 100644 --- a/primitive-types/impls/codec/src/lib.rs +++ b/primitive-types/impls/codec/src/lib.rs @@ -32,6 +32,12 @@ macro_rules! impl_uint_codec { <[u8; $len * 8] as $crate::codec::Decode>::decode(input).map(|b| $name::from_little_endian(&b)) } } + + impl $crate::codec::MaxEncodedLen for $name { + fn max_encoded_len() -> usize { + ::core::mem::size_of::<$name>() + } + } }; } @@ -52,5 +58,11 @@ macro_rules! impl_fixed_hash_codec { <[u8; $len] as $crate::codec::Decode>::decode(input).map($name) } } + + impl $crate::codec::MaxEncodedLen for $name { + fn max_encoded_len() -> usize { + ::core::mem::size_of::<$name>() + } + } }; }