Skip to content

Commit

Permalink
Merge branch 'master' into ao-rocksdb-new-format
Browse files Browse the repository at this point in the history
* master:
  kvdb-rocksdb: optimize and rename iter_from_prefix  (#365)
  bump parity-util-mem (#376)
  parity-util-mem: fix for windows (#375)
  keccak-hash: fix bench and add one for range (#372)
  [parity-crypto] Release 0.6.1 (#373)
  keccak-hash: bump version to 0.5.1 (#371)
  keccak-hash: add keccak256_range and keccak512_range functions (#370)
  Allow pubkey recovery for all-zero messages (#369)
  Delete by prefix operator in kvdb (#360)
  kvdb: no overlay (#313)
  Ban duplicates of parity-uil-mem from being linked into the same program (#363)
  Use correct license ID (#362)
  Memtest example for Rocksdb (#349)
  Prep for release (#361)
  parity-util-mem: prepare release for 0.5.2 (#359)
  travis: test parity-util-mem on android (#358)
  parity-util-mem: update mimalloc feature (#352)
  kvdb: remove parity-bytes dependency (#351)
  parity-util-mem: use malloc for usable_size on android (#355)
  CI: troubleshoot macOS build (#356)
  • Loading branch information
ordian committed Apr 22, 2020
2 parents 769351b + a52fbeb commit 08af3ed
Show file tree
Hide file tree
Showing 65 changed files with 769 additions and 371 deletions.
22 changes: 12 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,23 @@ matrix:
rust: stable
before_script:
- rustup component add rustfmt
- os: linux
rust: beta
- os: linux
rust: nightly
script:
- cargo check --all --benches
- cargo check --workspace --benches
- os: linux
rust: stable
install:
- cargo install cross
script:
- cross test --target=aarch64-linux-android -p parity-util-mem
- os: osx
osx_image: xcode11.2
osx_image: xcode11.3
addons:
chrome: stable
firefox: latest
install:
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | sh
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | sh
- source ~/.nvm/nvm.sh
- nvm install --lts
- npm install -g chromedriver
Expand All @@ -32,13 +36,11 @@ matrix:
install:
- curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
script:
- if [ "$TRAVIS_RUST_VERSION" == "stable" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
cargo fmt -- --check;
fi
- cargo check --all --tests
- cargo check --all --benches
- cargo build --all
- cargo test --all --exclude uint --exclude fixed-hash --exclude parity-crypto
- cargo check --workspace --tests --benches
- cargo test --workspace --exclude uint --exclude fixed-hash --exclude parity-crypto
- if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then
cd contract-address/ && cargo test --features=external_doc && cd ..;
fi
Expand Down
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ test_script:
- cd fixed-hash/ && cargo test --all-features && cd ..
- cd uint/ && cargo test --features=std,quickcheck --release && cd ..
- cd plain_hasher/ && cargo test --no-default-features && cd ..
- cd parity-util-mem/ && cargo test --no-default-features && cd ..
- cd parity-util-mem/ && cargo test --features=estimate-heapsize && cd ..
- cd parity-util-mem/ && cargo test && cd ..
3 changes: 3 additions & 0 deletions contract-address/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ 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
- 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,8 +1,8 @@
[package]
name = "contract-address"
version = "0.3.0"
version = "0.4.0"
authors = ["Parity Technologies <[email protected]>"]
license = "MIT/Apache2.0"
license = "MIT OR Apache-2.0"
homepage = "https://github.com/paritytech/parity-common"
repository = "https://github.com/paritytech/parity-common"
description = "A utility crate to create an ethereum contract address"
Expand All @@ -11,9 +11,9 @@ edition = "2018"
readme = "README.md"

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

[features]
default = []
Expand Down
2 changes: 2 additions & 0 deletions ethbloom/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ 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
- Removed `libc` feature. [#317](https://github.com/paritytech/parity-common/pull/317)
- License changed from MIT to dual MIT/Apache2. [#342](https://github.com/paritytech/parity-common/pull/342)

Expand Down
6 changes: 3 additions & 3 deletions ethbloom/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "ethbloom"
version = "0.8.1"
version = "0.9.0"
authors = ["Parity Technologies <[email protected]>"]
description = "Ethereum bloom filter"
license = "MIT/Apache2.0"
license = "MIT OR Apache-2.0"
documentation = "https://docs.rs/ethbloom"
homepage = "https://github.com/paritytech/parity-common"
repository = "https://github.com/paritytech/parity-common"
Expand All @@ -12,7 +12,7 @@ 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.5", default-features = false }
fixed-hash = { path = "../fixed-hash", version = "0.6", 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 }

Expand Down
3 changes: 3 additions & 0 deletions ethereum-types/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ 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
- 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)

### Added
- Uint error type is re-exported. [#244](https://github.com/paritytech/parity-common/pull/244)
10 changes: 5 additions & 5 deletions ethereum-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
name = "ethereum-types"
version = "0.8.0"
version = "0.9.0"
authors = ["Parity Technologies <[email protected]>"]
license = "MIT/Apache2.0"
license = "MIT OR Apache-2.0"
homepage = "https://github.com/paritytech/parity-common"
description = "Ethereum types"
edition = "2018"

[dependencies]
ethbloom = { path = "../ethbloom", version = "0.8", default-features = false }
fixed-hash = { path = "../fixed-hash", version = "0.5", default-features = false, features = ["byteorder", "rustc-hex"] }
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.6", features = ["rlp", "byteorder", "rustc-hex"], default-features = false }
primitive-types = { path = "../primitive-types", version = "0.7", features = ["rlp", "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 }

Expand Down
2 changes: 2 additions & 0 deletions fixed-hash/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog].
[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/

## [Unreleased]

## [0.6.0] - 2020-03-16
- Removed `libc` feature. [#317](https://github.com/paritytech/parity-common/pull/317)
- License changed from MIT to dual MIT/Apache2. [#342](https://github.com/paritytech/parity-common/pull/342)

Expand Down
4 changes: 2 additions & 2 deletions fixed-hash/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "fixed-hash"
version = "0.5.2"
version = "0.6.0"
authors = ["Parity Technologies <[email protected]>"]
license = "MIT/Apache2.0"
license = "MIT OR Apache-2.0"
homepage = "https://github.com/paritytech/parity-common"
repository = "https://github.com/paritytech/parity-common"
description = "Macros to define custom fixed-size hash types"
Expand Down
7 changes: 7 additions & 0 deletions keccak-hash/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ The format is based on [Keep a Changelog].
[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/

## [Unreleased]

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

## [0.5.0] - 2020-03-16
- License changed from GPL3 to dual MIT/Apache2. [#342](https://github.com/paritytech/parity-common/pull/342)
- Updated dependencies. [#361](https://github.com/paritytech/parity-common/pull/361)
- Updated tiny-keccak. [#260](https://github.com/paritytech/parity-common/pull/260)

## [0.4.1] - 2019-10-24
### Dependencies
Expand Down
10 changes: 7 additions & 3 deletions keccak-hash/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[package]
name = "keccak-hash"
version = "0.4.1"
version = "0.5.1"
description = "`keccak-hash` is a set of utility functions to facilitate working with Keccak hashes (256/512 bits long)."
authors = ["Parity Technologies <[email protected]>"]
repository = "https://github.com/paritytech/parity-common"
readme = "README.md"
license = "MIT/Apache-2.0"
license = "MIT OR Apache-2.0"
edition = "2018"

[dependencies]
tiny-keccak = { version = "2.0", features = ["keccak"] }
primitive-types = { path = "../primitive-types", version = "0.6", default-features = false }
primitive-types = { path = "../primitive-types", version = "0.7", default-features = false }

[dev-dependencies]
tempdir = "0.3.7"
Expand All @@ -19,3 +19,7 @@ criterion = "0.3.0"
[features]
default = ["std"]
std = []

[[bench]]
name = "keccak_256"
harness = false
18 changes: 16 additions & 2 deletions keccak-hash/benches/keccak_256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,26 @@ pub fn keccak_256_with_empty_input(c: &mut Criterion) {
}

pub fn keccak_256_with_typical_input(c: &mut Criterion) {
let data: Vec<u8> = From::from("some medium length string with important information");
c.bench_function("keccak_256_with_typical_input", |b| {
let mut data: Vec<u8> = From::from("some medium length string with important information");
let len = data.len();
let mut group = c.benchmark_group("keccak_256_with_typical_input");
group.bench_function("regular", |b| {
b.iter(|| {
let _out = keccak(black_box(&data));
})
});
group.bench_function("inplace", |b| {
b.iter(|| {
keccak_hash::keccak256(black_box(&mut data[..]));
})
});
group.bench_function("inplace_range", |b| {
b.iter(|| {
keccak_hash::keccak256_range(black_box(&mut data[..]), 0..len);
})
});

group.finish();
}

pub fn keccak_256_with_large_input(c: &mut Criterion) {
Expand Down
51 changes: 51 additions & 0 deletions keccak-hash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,64 @@ pub fn keccak256(data: &mut [u8]) {
keccak256.finalize(data);
}

/// Computes in-place keccak256 hash of `data[range]`.
///
/// The `range` argument specifies a subslice of `data` in bytes to be hashed.
/// The resulting hash will be written back to `data`.
/// # Panics
///
/// If `range` is out of bounds.
///
/// # Example
///
/// ```
/// let mut data = [1u8; 32];
/// // Hash the first 8 bytes of `data` and write the result, 32 bytes, to `data`.
/// keccak_hash::keccak256_range(&mut data, 0..8);
/// let expected = [
/// 0x54, 0x84, 0x4f, 0x69, 0xb4, 0xda, 0x4b, 0xb4, 0xa9, 0x9f, 0x24, 0x59, 0xb5, 0x11, 0xd4, 0x42,
/// 0xcc, 0x5b, 0xd2, 0xfd, 0xf4, 0xc3, 0x54, 0xd2, 0x07, 0xbb, 0x13, 0x08, 0x94, 0x43, 0xaf, 0x68,
/// ];
/// assert_eq!(&data, &expected);
/// ```
pub fn keccak256_range(data: &mut [u8], range: core::ops::Range<usize>) {
let mut keccak256 = Keccak::v256();
keccak256.update(&data[range]);
keccak256.finalize(data);
}

/// Computes in-place keccak512 hash of `data`.
pub fn keccak512(data: &mut [u8]) {
let mut keccak512 = Keccak::v512();
keccak512.update(data.as_ref());
keccak512.finalize(data);
}

/// Computes in-place keccak512 hash of `data[range]`.
///
/// The `range` argument specifies a subslice of `data` in bytes to be hashed.
/// The resulting hash will be written back to `data`.
/// # Panics
///
/// If `range` is out of bounds.
///
/// # Example
///
/// ```
/// let mut data = [1u8; 64];
/// keccak_hash::keccak512_range(&mut data, 0..8);
/// let expected = [
/// 0x90, 0x45, 0xc5, 0x9e, 0xd3, 0x0e, 0x1f, 0x42, 0xac, 0x35, 0xcc, 0xc9, 0x55, 0x7c, 0x77, 0x17,
/// 0xc8, 0x89, 0x3a, 0x77, 0x6c, 0xea, 0x2e, 0xf3, 0x88, 0xea, 0xe5, 0xc0, 0xea, 0x40, 0x26, 0x64,
/// ];
/// assert_eq!(&data[..32], &expected);
/// ```
pub fn keccak512_range(data: &mut [u8], range: core::ops::Range<usize>) {
let mut keccak512 = Keccak::v512();
keccak512.update(&data[range]);
keccak512.finalize(data);
}

pub fn keccak_256(input: &[u8], output: &mut [u8]) {
write_keccak(input, output);
}
Expand Down
5 changes: 5 additions & 0 deletions kvdb-memorydb/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ The format is based on [Keep a Changelog].
[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/

## [Unreleased]
### Breaking
- Updated to the new `kvdb` interface. [#313](https://github.com/paritytech/parity-common/pull/313)

## [0.5.0] - 2020-03-16
- License changed from GPL3 to dual MIT/Apache2. [#342](https://github.com/paritytech/parity-common/pull/342)
- Updated dependencies. [#361](https://github.com/paritytech/parity-common/pull/361)

## [0.4.0] - 2019-02-05
- Bump parking_lot to 0.10. [#332](https://github.com/paritytech/parity-common/pull/332)
Expand Down
10 changes: 5 additions & 5 deletions kvdb-memorydb/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[package]
name = "kvdb-memorydb"
version = "0.4.0"
version = "0.5.0"
authors = ["Parity Technologies <[email protected]>"]
repository = "https://github.com/paritytech/parity-common"
description = "A key-value in-memory database that implements the `KeyValueDB` trait"
license = "MIT/Apache-2.0"
license = "MIT OR Apache-2.0"
edition = "2018"

[dependencies]
parity-util-mem = { path = "../parity-util-mem", version = "0.5", default-features = false, features = ["std"] }
parity-util-mem = { path = "../parity-util-mem", version = "0.6", default-features = false, features = ["std"] }
parking_lot = "0.10.0"
kvdb = { version = "0.4", path = "../kvdb" }
kvdb = { version = "0.5", path = "../kvdb" }

[dev-dependencies]
kvdb-shared-tests = { path = "../kvdb-shared-tests", version = "0.2" }
kvdb-shared-tests = { path = "../kvdb-shared-tests", version = "0.3" }
Loading

0 comments on commit 08af3ed

Please sign in to comment.