Skip to content

Commit

Permalink
primitive-types/impl-codec: Bump to include new `parity_scale_codec::…
Browse files Browse the repository at this point in the history
…MaxEncodedLen` impls (#552)

* impl-codec: Use new parity-scale-codec 2.2.0 with `max-encoded-len` feature

* impl-codec: Bump to parity-scale-codec is not breaking

* Bump primitive-types to 0.10.1 in order to bump impl-codec to 0.5.1
  • Loading branch information
Xanewok committed Jul 2, 2021
1 parent 84a7d26 commit a05ef25
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
5 changes: 5 additions & 0 deletions primitive-types/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions primitive-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "primitive-types"
version = "0.10.0"
version = "0.10.1"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT OR Apache-2.0"
homepage = "https://github.com/paritytech/parity-common"
Expand All @@ -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 }
Expand Down
4 changes: 4 additions & 0 deletions primitive-types/impls/codec/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions primitive-types/impls/codec/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "impl-codec"
version = "0.5.0"
version = "0.5.1"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT OR Apache-2.0"
homepage = "https://github.com/paritytech/parity-common"
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"]
Expand Down
12 changes: 12 additions & 0 deletions primitive-types/impls/codec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>()
}
}
};
}

Expand All @@ -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>()
}
}
};
}

0 comments on commit a05ef25

Please sign in to comment.