Skip to content

Commit

Permalink
Update parity-util-mem to 0.9.0 (#1)
Browse files Browse the repository at this point in the history
* The time crate after 0.2 is unergonomic to use; just use chrono (paritytech#458)

The 0.2 series of `time` doesn't make it easy to "just" create a timestamp. The `chrono` crate uses `time` v0.1 and is, I believe, what users like us should be using. So let's just do that.

* build(deps): update send_wrapper requirement from 0.3.0 to 0.5.0 (paritytech#461)

Updates the requirements on [send_wrapper](https://github.com/thk1/send_wrapper) to permit the latest version.
- [Release notes](https://github.com/thk1/send_wrapper/releases)
- [Changelog](https://github.com/thk1/send_wrapper/blob/master/CHANGELOG.md)
- [Commits](thk1/send_wrapper@v0.3.0...v0.5.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* rlp: add bytes impls (paritytech#459)

* rlp: add bytes impls

* add tests

* rlp: Fix buffer indexing (paritytech#462)

* Fix buffer indexing

* test for clear

* rlp: store test bytes in hex literals (paritytech#465)

* Make RLP optional in several crates (paritytech#466)

* bump versions and update changelogs (paritytech#463)

* update other dependencies (paritytech#471)

* ethereum-types/rlp should pull primitive-types/rlp (paritytech#474)

* uint: optimize FromStr, make it no_std-compatible (paritytech#468)

* Add from_str bench

* uint: optimize FromStr, make it no_std-compatible

* custom error type

* fmt::Display is actually available in core

* Error::source for FromHexError

* uppercase consts

* additional tests

* kvdb-rocksdb: replace tempdir with tempfile(paritytech#350) (paritytech#477)

* chore(deps): cargo upgrade parking_lot --all (paritytech#470)

* chore(deps): cargo upgrade parking_lot --all

* chore(deps): bump versions breaking change.

* chore: update changelog

	* kvdb
	* kvdb-memorydb
	* kvdb-rocksdb
	* parity-util-mem

* fix nits

* fix: kvdb-web add missing changelog entry

* fix: bad merge

* fix more nits: use breaking label

* [kvdb-memorydb]: add `wasm-bindgen` feature flag

* grumbles: remove `wasm-bindgen` feature flag

* Add hack only in `kvdb-web`
* Remove feature flag `wasm-bindgen` from `kvdb-memorydb`

* Bump bytes to 1.0 (paritytech#482)

* Implement Num from num-traits (paritytech#480)

* parity-crypto: remove UB test (paritytech#484)

* parity-crypto: remove UB test

* rlp: fix unused import

* parity-crypto: upgrade deps (paritytech#483)

* update some dev-dependencies (paritytech#493)

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* fix: make from_str parse 0x-prefixed strings (paritytech#487)

* fix: make from_str parse 0x-prefixed strings

* fix(uint): make from_str parse 0x-prefixed strings

* chore: address review styling comments

* fix: tabs instead of spaces

* chore: cargo fmt

* fix: use strip_prefix instead of starts_with

* build(deps): update impl-trait-for-tuples requirement (paritytech#490)

Updates the requirements on [impl-trait-for-tuples](https://github.com/bkchr/impl-trait-for-tuples) to permit the latest version.
- [Release notes](https://github.com/bkchr/impl-trait-for-tuples/releases)
- [Commits](https://github.com/bkchr/impl-trait-for-tuples/commits/v0.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* primitive-types: address nits of paritytech#480 (paritytech#485)

* primitive-types: address nits of paritytech#480

* fix ethereum-types

* Remove deprecated FromStr/TryFrom impls for Secret (paritytech#495)

* Remove deprecated FromStr/TryFrom impls for Secret

* update CHANGELOG

* build(deps): update secp256k1 requirement from 0.19.0 to 0.20.0 (paritytech#496)

Updates the requirements on [secp256k1](https://github.com/rust-bitcoin/rust-secp256k1) to permit the latest version.
- [Release notes](https://github.com/rust-bitcoin/rust-secp256k1/releases)
- [Changelog](https://github.com/rust-bitcoin/rust-secp256k1/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-bitcoin/rust-secp256k1/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andronik Ordian <write@reusable.software>

* build(deps): update smallvec requirement from 0.6.10 to 1.6.0 (paritytech#494)

Updates the requirements on [smallvec](https://github.com/servo/rust-smallvec) to permit the latest version.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/commits/v1.6.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andronik Ordian <write@reusable.software>

* build(deps): update rand requirement from 0.7.2 to 0.8.0 (paritytech#488)

* build(deps): update rand requirement from 0.7.2 to 0.8.0

Updates the requirements on [rand](https://github.com/rust-random/rand) to permit the latest version.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](rust-random/rand@0.7.3...0.8.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Seed from u64

* uint: use rand 0.7 for quickcheck feature

* kvdb-rocksdb: fix compilation for benches

* parity-crypto: remove unused dep and fix a warning

* cargo fmt and another unused dep

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andronik Ordian <write@reusable.software>
Co-authored-by: David Palm <dvdplm@gmail.com>

* build(deps): update rand_xorshift requirement from 0.2.0 to 0.3.0 (paritytech#491)

Updates the requirements on [rand_xorshift](https://github.com/rust-random/rngs) to permit the latest version.
- [Release notes](https://github.com/rust-random/rngs/releases)
- [Commits](https://github.com/rust-random/rngs/commits/rand_xorshift-0.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update changelogs and bump uint (paritytech#486)

* update changelogs and bump uint

* update ethereum-types changelog

* update uint changelog

* tabs

* fixed-hash: bump to 0.7

* bump keccak-hash to 0.6.0

* contract-address: bump keccak-hash to 0.6

* update changelogs after publishing

* bump fs-swap (paritytech#498)

* triehash: patch release (paritytech#499)

* fix clippy warning (paritytech#504)

* add a test for paritytech#507 (paritytech#508)

* add a test for paritytech#507

* CI: test uint on a big-endian platform

* a workaround for gmp

* grumbles

* bump byteorder to 1.4.2

* ethereum-types: fix wasm builds for serialize feature (paritytech#503)

* ethbloom: do not pull std for 'serialize' feature

* ethereum-types: do not pull std for 'serialize' feature

* CI: check wasm builds for ethbloom and ethereum-types

* fix wasm target

* CI: remove redundant check

* CI: fix wasm target install

* update changelogs

* remove parity-runtime (paritytech#511)

* Update codec and crates depending (paritytech#510)

Co-authored-by: Andronik Ordian <write@reusable.software>

Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Artem Vorotnikov <artem@vorotnikov.me>
Co-authored-by: Andronik Ordian <write@reusable.software>
Co-authored-by: Frost Red Lee <frostredlee@gmail.com>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: Sam Wilson <57262657+SamWilsn@users.noreply.github.com>
Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com>
Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
Co-authored-by: honeywest <50997103+honeywest@users.noreply.github.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
  • Loading branch information
13 people authored Aug 18, 2021
1 parent 72702ef commit d087317
Show file tree
Hide file tree
Showing 76 changed files with 850 additions and 674 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ matrix:
- cargo install cross
script:
- cross test --target=aarch64-linux-android -p parity-util-mem
- cross test --target=mips64-unknown-linux-gnuabi64 -p uint
- os: osx
osx_image: xcode11.3
addons:
Expand All @@ -26,6 +27,7 @@ matrix:
allow_failures:
- rust: nightly
install:
- rustup target add wasm32-unknown-unknown
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | sh
- source ~/.nvm/nvm.sh
- nvm install --lts
Expand All @@ -42,6 +44,7 @@ script:
cd contract-address/ && cargo test --features=external_doc && cd ..;
fi
- cd ethbloom/ && cargo test --no-default-features --features="rustc-hex" && cargo check --benches && cd ..
- cd ethereum-types/ && cargo build --no-default-features --features="serialize,rlp" --target=wasm32-unknown-unknown && cd ..
- cd fixed-hash/ && cargo test --all-features && cargo test --no-default-features --features="byteorder,rustc-hex" && cd ..
- cd uint/ && cargo test --all-features && cargo test --no-default-features && cd ..
- cd keccak-hash/ && cargo test --no-default-features && cd ..
Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ members = [
"plain_hasher",
"rlp",
"rlp-derive",
"runtime",
"transaction-pool",
"trace-time",
"triehash",
Expand Down
13 changes: 11 additions & 2 deletions contract-address/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
# Changelog

The format is based on [Keep a Changelog].
The format is based on [Keep a Changelog].

[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/

## [Unreleased]

## [0.9.0] - 2020-03-16
## [0.6.0] - 2021-01-27
### Breaking
- Updated `ethereum-types` to 0.11. [#510](https://github.com/paritytech/parity-common/pull/510)
- Updated `keccak-hash` to 0.7. [#510](https://github.com/paritytech/parity-common/pull/510)

## [0.5.0] - 2021-01-05
### Breaking
- Updated `ethereum-types` to 0.10. [#463](https://github.com/paritytech/parity-common/pull/463)

## [0.4.0] - 2020-03-16
- License changed from MIT to dual MIT/Apache2. [#342](https://github.com/paritytech/parity-common/pull/342)
- Updated dependencies. [#361](https://github.com/paritytech/parity-common/pull/361)
8 changes: 4 additions & 4 deletions contract-address/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "contract-address"
version = "0.4.0"
version = "0.6.0"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT OR Apache-2.0"
homepage = "https://github.com/paritytech/parity-common"
Expand All @@ -11,9 +11,9 @@ edition = "2018"
readme = "README.md"

[dependencies]
ethereum-types = { version = "0.9.0", path = "../ethereum-types" }
rlp = { version = "0.4", path = "../rlp" }
keccak-hash = { version = "0.5", path = "../keccak-hash", default-features = false }
ethereum-types = { version = "0.11.0", path = "../ethereum-types" }
rlp = { version = "0.5", path = "../rlp" }
keccak-hash = { version = "0.7", path = "../keccak-hash", default-features = false }

[features]
default = []
Expand Down
11 changes: 11 additions & 0 deletions ethbloom/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ The format is based on [Keep a Changelog].

## [Unreleased]

## [0.11.0] - 2021-01-27
### Breaking
- Updated `impl-codec` to 0.5. [#510](https://github.com/paritytech/parity-common/pull/510)

### Potentially-breaking
- `serialize` feature no longer pulls `std`. [#503](https://github.com/paritytech/parity-common/pull/503)

## [0.10.0] - 2021-01-05
### Breaking
- Updated `rlp` to 0.5. [#463](https://github.com/paritytech/parity-common/pull/463)

## [0.9.2] - 2020-05-18
- Added `codec` feature. [#393](https://github.com/paritytech/parity-common/pull/393)

Expand Down
15 changes: 8 additions & 7 deletions ethbloom/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ethbloom"
version = "0.9.2"
version = "0.11.0"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Ethereum bloom filter"
license = "MIT OR Apache-2.0"
Expand All @@ -12,22 +12,23 @@ edition = "2018"
[dependencies]
tiny-keccak = { version = "2.0", features = ["keccak"] }
crunchy = { version = "0.2.2", default-features = false, features = ["limit_256"] }
fixed-hash = { path = "../fixed-hash", version = "0.6", default-features = false }
fixed-hash = { path = "../fixed-hash", version = "0.7", default-features = false }
impl-serde = { path = "../primitive-types/impls/serde", version = "0.3", default-features = false, optional = true }
impl-rlp = { path = "../primitive-types/impls/rlp", version = "0.2", default-features = false }
impl-codec = { version = "0.4.1", path = "../primitive-types/impls/codec", default-features = false, optional = true }
impl-rlp = { path = "../primitive-types/impls/rlp", version = "0.3", default-features = false, optional = true }
impl-codec = { version = "0.5.0", path = "../primitive-types/impls/codec", default-features = false, optional = true }

[dev-dependencies]
criterion = "0.3.0"
rand = "0.7.2"
rand = "0.8.0"
hex-literal = "0.3.1"

[features]
default = ["std", "serialize", "rustc-hex"]
default = ["std", "rlp", "serialize", "rustc-hex"]
std = ["fixed-hash/std", "crunchy/std"]
serialize = ["std", "impl-serde"]
serialize = ["impl-serde"]
rustc-hex = ["fixed-hash/rustc-hex"]
arbitrary = ["fixed-hash/arbitrary"]
rlp = ["impl-rlp"]
codec = ["impl-codec"]

[[bench]]
Expand Down
2 changes: 2 additions & 0 deletions ethbloom/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ use crunchy::unroll;
use fixed_hash::*;
#[cfg(feature = "codec")]
use impl_codec::impl_fixed_hash_codec;
#[cfg(feature = "rlp")]
use impl_rlp::impl_fixed_hash_rlp;
#[cfg(feature = "serialize")]
use impl_serde::impl_fixed_hash_serde;
Expand All @@ -69,6 +70,7 @@ construct_fixed_hash! {
/// Bloom hash type with 256 bytes (2048 bits) size.
pub struct Bloom(BLOOM_SIZE);
}
#[cfg(feature = "rlp")]
impl_fixed_hash_rlp!(Bloom, BLOOM_SIZE);
#[cfg(feature = "serialize")]
impl_fixed_hash_serde!(Bloom, BLOOM_SIZE);
Expand Down
14 changes: 14 additions & 0 deletions ethereum-types/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ The format is based on [Keep a Changelog].

## [Unreleased]

## [0.11.0] - 2021-01-27
### Breaking
- Updated `ethbloom` to 0.11. [#510](https://github.com/paritytech/parity-common/pull/510)
- Updated `primitive-types` to 0.9. [#510](https://github.com/paritytech/parity-common/pull/510)
- Updated `impl-codec` to 0.5. [#510](https://github.com/paritytech/parity-common/pull/510)

### Potentially-breaking
- `serialize` feature no longer pulls `std`. [#503](https://github.com/paritytech/parity-common/pull/503)

## [0.10.0] - 2021-01-05
### Breaking
- Updated `rlp` to 0.5. [#463](https://github.com/paritytech/parity-common/pull/463)
- Updated `uint` to 0.9. [#486](https://github.com/paritytech/parity-common/pull/486)

## [0.9.2] - 2020-05-18
- Added `codec` feature. [#393](https://github.com/paritytech/parity-common/pull/393)

Expand Down
20 changes: 11 additions & 9 deletions ethereum-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
[package]
name = "ethereum-types"
version = "0.9.2"
version = "0.11.0"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT OR Apache-2.0"
homepage = "https://github.com/paritytech/parity-common"
description = "Ethereum types"
edition = "2018"

[dependencies]
ethbloom = { path = "../ethbloom", version = "0.9", default-features = false }
fixed-hash = { path = "../fixed-hash", version = "0.6", default-features = false, features = ["byteorder", "rustc-hex"] }
uint-crate = { path = "../uint", package = "uint", version = "0.8", default-features = false }
primitive-types = { path = "../primitive-types", version = "0.7", features = ["rlp", "byteorder", "rustc-hex"], default-features = false }
ethbloom = { path = "../ethbloom", version = "0.11", default-features = false }
fixed-hash = { path = "../fixed-hash", version = "0.7", default-features = false, features = ["byteorder", "rustc-hex"] }
uint-crate = { path = "../uint", package = "uint", version = "0.9", default-features = false }
primitive-types = { path = "../primitive-types", version = "0.9", features = ["byteorder", "rustc-hex"], default-features = false }
impl-serde = { path = "../primitive-types/impls/serde", version = "0.3.0", default-features = false, optional = true }
impl-rlp = { path = "../primitive-types/impls/rlp", version = "0.2", default-features = false }
impl-codec = { version = "0.4.1", path = "../primitive-types/impls/codec", default-features = false, optional = true }
impl-rlp = { path = "../primitive-types/impls/rlp", version = "0.3", default-features = false, optional = true }
impl-codec = { version = "0.5.0", path = "../primitive-types/impls/codec", default-features = false, optional = true }

[dev-dependencies]
serde_json = "1.0.41"

[features]
default = ["std", "serialize"]
default = ["std", "rlp", "serialize"]
std = ["uint-crate/std", "fixed-hash/std", "ethbloom/std", "primitive-types/std"]
serialize = ["std", "impl-serde", "primitive-types/serde", "ethbloom/serialize"]
serialize = ["impl-serde", "primitive-types/serde_no_std", "ethbloom/serialize"]
arbitrary = ["ethbloom/arbitrary", "fixed-hash/arbitrary", "uint-crate/arbitrary"]
rlp = ["impl-rlp", "ethbloom/rlp", "primitive-types/rlp"]
codec = ["impl-codec", "ethbloom/codec"]
num-traits = ["primitive-types/num-traits"]
11 changes: 11 additions & 0 deletions ethereum-types/src/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{U128, U256, U512, U64};
use fixed_hash::*;
#[cfg(feature = "codec")]
use impl_codec::impl_fixed_hash_codec;
#[cfg(feature = "rlp")]
use impl_rlp::impl_fixed_hash_rlp;
#[cfg(feature = "serialize")]
use impl_serde::impl_fixed_hash_serde;
Expand All @@ -22,20 +23,23 @@ pub trait BigEndianHash {
}

construct_fixed_hash! { pub struct H32(4); }
#[cfg(feature = "rlp")]
impl_fixed_hash_rlp!(H32, 4);
#[cfg(feature = "serialize")]
impl_fixed_hash_serde!(H32, 4);
#[cfg(feature = "codec")]
impl_fixed_hash_codec!(H32, 4);

construct_fixed_hash! { pub struct H64(8); }
#[cfg(feature = "rlp")]
impl_fixed_hash_rlp!(H64, 8);
#[cfg(feature = "serialize")]
impl_fixed_hash_serde!(H64, 8);
#[cfg(feature = "codec")]
impl_fixed_hash_codec!(H64, 8);

construct_fixed_hash! { pub struct H128(16); }
#[cfg(feature = "rlp")]
impl_fixed_hash_rlp!(H128, 16);
#[cfg(feature = "serialize")]
impl_fixed_hash_serde!(H128, 16);
Expand All @@ -46,6 +50,7 @@ pub use primitive_types::H160;
pub use primitive_types::H256;

construct_fixed_hash! { pub struct H264(33); }
#[cfg(feature = "rlp")]
impl_fixed_hash_rlp!(H264, 33);
#[cfg(feature = "serialize")]
impl_fixed_hash_serde!(H264, 33);
Expand All @@ -55,6 +60,7 @@ impl_fixed_hash_codec!(H264, 33);
pub use primitive_types::H512;

construct_fixed_hash! { pub struct H520(65); }
#[cfg(feature = "rlp")]
impl_fixed_hash_rlp!(H520, 65);
#[cfg(feature = "serialize")]
impl_fixed_hash_serde!(H520, 65);
Expand Down Expand Up @@ -128,6 +134,11 @@ mod tests {
}
}

#[test]
fn test_parse_0x() {
assert!("0x0000000000000000000000000000000000000000000000000000000000000000".parse::<H256>().is_ok())
}

#[test]
fn test_serialize_invalid() {
assert!(ser::from_str::<H256>("\"0x000000000000000000000000000000000000000000000000000000000000000\"")
Expand Down
2 changes: 1 addition & 1 deletion ethereum-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mod uint;

pub use ethbloom::{Bloom, BloomRef, Input as BloomInput};
pub use hash::{BigEndianHash, H128, H160, H256, H264, H32, H512, H520, H64};
pub use uint::{FromDecStrErr, U128, U256, U512, U64};
pub use uint::{FromDecStrErr, FromStrRadixErr, FromStrRadixErrKind, U128, U256, U512, U64};

pub type Address = H160;
pub type Secret = H256;
Expand Down
4 changes: 3 additions & 1 deletion ethereum-types/src/uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@

#[cfg(feature = "codec")]
use impl_codec::impl_uint_codec;
#[cfg(feature = "rlp")]
use impl_rlp::impl_uint_rlp;
#[cfg(feature = "serialize")]
use impl_serde::impl_uint_serde;
use uint_crate::*;

pub use uint_crate::FromDecStrErr;
pub use uint_crate::{FromDecStrErr, FromStrRadixErr, FromStrRadixErrKind};

construct_uint! {
/// Unsigned 64-bit integer.
pub struct U64(1);
}
#[cfg(feature = "rlp")]
impl_uint_rlp!(U64, 1);
#[cfg(feature = "serialize")]
impl_uint_serde!(U64, 1);
Expand Down
4 changes: 4 additions & 0 deletions fixed-hash/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.7.0] - 2021-01-05
### Breaking
- Updated `rand` to 0.8. [#488](https://github.com/paritytech/parity-common/pull/488)

## [0.6.1] - 2020-04-27
- Added `arbitrary` feature. [#378](https://github.com/paritytech/parity-common/pull/378)

Expand Down
9 changes: 5 additions & 4 deletions fixed-hash/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fixed-hash"
version = "0.6.1"
version = "0.7.0"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT OR Apache-2.0"
homepage = "https://github.com/paritytech/parity-common"
Expand All @@ -14,16 +14,17 @@ edition = "2018"
features = ["quickcheck", "api-dummy"]

[dependencies]
byteorder = { version = "1.3.2", optional = true, default-features = false }
byteorder = { version = "1.4.2", optional = true, default-features = false }
quickcheck = { version = "0.9.0", optional = true }
rand = { version = "0.7.2", optional = true, default-features = false }
rand = { version = "0.8.0", optional = true, default-features = false }
rustc-hex = { version = "2.0.1", optional = true, default-features = false }
static_assertions = "1.0.0"
arbitrary = { version = "0.4", optional = true }

[dev-dependencies]
rand_xorshift = "0.2.0"
rand_xorshift = "0.3.0"
criterion = "0.3.0"
rand = { version = "0.8.0", default-features = false, features = ["std_rng"] }

[features]
default = ["std", "rand", "rustc-hex", "byteorder"]
Expand Down
7 changes: 4 additions & 3 deletions fixed-hash/src/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
/// ```
/// use fixed_hash::construct_fixed_hash;
/// construct_fixed_hash!{
/// /// My unformatted 160 bytes sized hash type.
/// #[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
/// pub struct H160(20);
/// /// My unformatted 160 bytes sized hash type.
/// #[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
/// pub struct H160(20);
/// }
/// assert_eq!(std::mem::size_of::<H160>(), 20);
/// ```
Expand Down Expand Up @@ -588,6 +588,7 @@ macro_rules! impl_rustc_hex_for_fixed_hash {
/// - When encountering invalid non hex-digits
/// - Upon empty string input or invalid input length in general
fn from_str(input: &str) -> $crate::core_::result::Result<$name, $crate::rustc_hex::FromHexError> {
let input = input.strip_prefix("0x").unwrap_or(input);
let mut iter = $crate::rustc_hex::FromHexIter::new(input);
let mut result = Self::zero();
for byte in result.as_mut() {
Expand Down
19 changes: 2 additions & 17 deletions fixed-hash/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,23 +244,8 @@ mod rand {

#[test]
fn random() {
let default_seed = <StdRng as SeedableRng>::Seed::default();
let mut rng = StdRng::from_seed(default_seed);
assert_eq!(H32::random_using(&mut rng), H32::from([0x76, 0xa0, 0x40, 0x53]));
}

#[test]
fn randomize() {
let default_seed = <StdRng as SeedableRng>::Seed::default();
let mut rng = StdRng::from_seed(default_seed);
assert_eq!(
{
let mut ret = H32::zero();
ret.randomize_using(&mut rng);
ret
},
H32::from([0x76, 0xa0, 0x40, 0x53])
)
let mut rng = StdRng::seed_from_u64(123);
assert_eq!(H32::random_using(&mut rng), H32::from([0xeb, 0x96, 0xaf, 0x1c]));
}
}

Expand Down
8 changes: 8 additions & 0 deletions keccak-hash/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ The format is based on [Keep a Changelog].

## [Unreleased]

## [0.7.0] - 2021-01-27
### Breaking
- Updated `primitive-types` to 0.9. [#510](https://github.com/paritytech/parity-common/pull/510)

## [0.6.0] - 2021-01-05
### Breaking
- Updated `primitive-types` to 0.8. [#463](https://github.com/paritytech/parity-common/pull/463)

## [0.5.1] - 2020-04-10
- Added `keccak256_range` and `keccak512_range` functions. [#370](https://github.com/paritytech/parity-common/pull/370)

Expand Down
Loading

0 comments on commit d087317

Please sign in to comment.