Merge branch 'master' into fix-link-parity-tech
* master: Address grumbles [kvdb-rocksdb] ethereum-types is a dev-dependency [kvdb] Use parity-rocksdb 0.5; bump version Use parity-rocksdb 0.1.2-beta.0 [kvdb-rocksdb] bump to v0.1.1 prep kvdb-memorydb Fix scoring to favour lower insertion_ids. crate meta data Rename `path` to `parity-path` Grab-bag of cosmetic changes in prep for publishing Bump to 0.2.3 Add `ethereum` feature
This commit is contained in:
commit
e1f675bdbe
|
@ -9,7 +9,7 @@ members = [
|
|||
"memorydb",
|
||||
"parity-bytes",
|
||||
"parity-crypto",
|
||||
"path",
|
||||
"parity-path",
|
||||
"patricia_trie",
|
||||
"plain_hasher",
|
||||
"rlp",
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
[package]
|
||||
description = "Rust bindings for tinykeccak C library"
|
||||
homepage = "https://github.com/paritytech/keccak-hash"
|
||||
readme = "README.md"
|
||||
license = "GPL-3.0"
|
||||
name = "keccak-hash"
|
||||
version = "0.1.2"
|
||||
description = "`keccak-hash` is a set of utility functions to facilitate working with Keccak hashes (256/512 bits long)."
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
repository = "https://github.com/paritytech/parity-common"
|
||||
readme = "README.md"
|
||||
license = "GPL-3.0"
|
||||
|
||||
[dependencies]
|
||||
ethereum-types = "0.3"
|
||||
ethereum-types = "0.4"
|
||||
tiny-keccak = "1.4"
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
name = "kvdb-memorydb"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
repository = "https://github.com/paritytech/parity-common"
|
||||
description = "A key-value in-memory database that implements the `KeyValueDB` trait"
|
||||
license = "GPL-3.0"
|
||||
|
||||
[dependencies]
|
||||
parking_lot = "0.6"
|
||||
kvdb = { path = "../kvdb" }
|
||||
kvdb = { version = "0.1", path = "../kvdb" }
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
[package]
|
||||
name = "kvdb-rocksdb"
|
||||
version = "0.1.0"
|
||||
version = "0.1.3"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
repository = "https://github.com/paritytech/parity-common"
|
||||
description = "kvdb implementation backed by rocksDB"
|
||||
license = "GPL-3.0"
|
||||
|
||||
[dependencies]
|
||||
elastic-array = "0.10"
|
||||
ethereum-types = "0.3"
|
||||
fs-swap = "0.2.1"
|
||||
interleaved-ordered = "0.1.0"
|
||||
kvdb = { path = "../kvdb" }
|
||||
kvdb = { version = "0.1", path = "../kvdb" }
|
||||
log = "0.3"
|
||||
num_cpus = "1.0"
|
||||
parking_lot = "0.6"
|
||||
regex = "0.2"
|
||||
rocksdb = { git = "https://github.com/paritytech/rust-rocksdb" }
|
||||
parity-rocksdb = "0.5"
|
||||
|
||||
[dev-dependencies]
|
||||
tempdir = "0.3"
|
||||
ethereum-types = "0.4"
|
||||
|
|
|
@ -23,9 +23,11 @@ extern crate interleaved_ordered;
|
|||
extern crate num_cpus;
|
||||
extern crate parking_lot;
|
||||
extern crate regex;
|
||||
extern crate rocksdb;
|
||||
extern crate parity_rocksdb;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate ethereum_types;
|
||||
|
||||
extern crate kvdb;
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
@ -34,7 +36,7 @@ use std::{cmp, fs, io, mem, result, error};
|
|||
use std::path::Path;
|
||||
|
||||
use parking_lot::{Mutex, MutexGuard, RwLock};
|
||||
use rocksdb::{
|
||||
use parity_rocksdb::{
|
||||
DB, Writable, WriteBatch, WriteOptions, IteratorMode, DBIterator,
|
||||
Options, BlockBasedOptions, Direction, Cache, Column, ReadOptions
|
||||
};
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
name = "kvdb"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
repository = "https://github.com/paritytech/parity-common"
|
||||
description = "Generic key-value trait"
|
||||
license = "GPL-3.0"
|
||||
|
||||
[dependencies]
|
||||
elastic-array = "0.10"
|
||||
parity-bytes = { path = "../parity-bytes" }
|
||||
parity-bytes = { version = "0.1", path = "../parity-bytes" }
|
||||
|
|
|
@ -3,6 +3,7 @@ name = "memorydb"
|
|||
version = "0.2.1"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
description = "in-memory implementation of hashdb"
|
||||
repository = "https://github.com/paritytech/parity-common"
|
||||
license = "GPL-3.0"
|
||||
|
||||
[dependencies]
|
||||
|
@ -14,6 +15,6 @@ rlp = { version = "0.2", path = "../rlp", default-features = false }
|
|||
|
||||
[dev-dependencies]
|
||||
tiny-keccak = "1.4.2"
|
||||
ethereum-types = "0.3"
|
||||
ethereum-types = "0.4"
|
||||
keccak-hasher = { version = "0.1", path = "../test-support/keccak-hasher" }
|
||||
keccak-hash = { version = "0.1", path = "../keccak-hash" }
|
|
@ -2,6 +2,7 @@
|
|||
name = "parity-bytes"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
repository = "https://github.com/paritytech/parity-common"
|
||||
description = "byte utilities for Parity"
|
||||
license = "GPL-3.0"
|
||||
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
name = "parity-crypto"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
repository = "https://github.com/paritytech/parity-common"
|
||||
description = "Crypto utils used by ethstore and network."
|
||||
license = "GPL-3.0"
|
||||
|
||||
[dependencies]
|
||||
ethereum-types = "0.3"
|
||||
quick-error = "1.2.2"
|
||||
ring = "0.12"
|
||||
rust-crypto = "0.2.36"
|
||||
|
|
|
@ -14,10 +14,9 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Crypto utils used ethstore and network.
|
||||
//! Crypto utils used by ethstore and network.
|
||||
|
||||
extern crate crypto as rcrypto;
|
||||
extern crate ethereum_types;
|
||||
#[macro_use]
|
||||
extern crate quick_error;
|
||||
extern crate ring;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "parity-path"
|
||||
version = "0.1.1"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
repository = "https://github.com/paritytech/parity-common"
|
||||
description = "Path utilities"
|
||||
license = "GPL-3.0"
|
||||
|
||||
[dependencies]
|
|
@ -1,7 +0,0 @@
|
|||
[package]
|
||||
name = "path"
|
||||
version = "0.1.1"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
license = "GPL3"
|
||||
|
||||
[dependencies]
|
|
@ -3,6 +3,7 @@ name = "patricia-trie"
|
|||
version = "0.2.1"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
description = "Merkle-Patricia Trie generic over key hasher and node encoding"
|
||||
repository = "https://github.com/paritytech/parity-common"
|
||||
license = "GPL-3.0"
|
||||
|
||||
[dependencies]
|
||||
|
@ -14,10 +15,10 @@ parity-bytes = { version = "0.1", path = "../parity-bytes" }
|
|||
|
||||
[dev-dependencies]
|
||||
env_logger = "0.5"
|
||||
ethereum-types = "0.3"
|
||||
ethereum-types = "0.4"
|
||||
keccak-hash = { version = "0.1", path = "../keccak-hash" }
|
||||
memorydb = { version = "0.2", path = "../memorydb", default-features = false }
|
||||
rlp = { version = "0.2.1", path = "../rlp", default-features = false }
|
||||
rlp = { version = "0.2", path = "../rlp", default-features = false }
|
||||
trie-standardmap = { version = "0.1", path = "../trie-standardmap", default-features = false }
|
||||
triehash = { version = "0.2", path = "../triehash", default-features = false }
|
||||
parity-bytes = { version = "0.1.0", path = "../parity-bytes" }
|
||||
|
@ -33,9 +34,9 @@ parity-bytes = { version = "0.1.0", path = "../parity-bytes" }
|
|||
# Note that this is a *copy*, without any git history or link to the mother
|
||||
# repo. They are to be considered test-only helpers and do not necessarily need
|
||||
# to be in sync with the `parity-ethereum` versions.
|
||||
patricia-trie-ethereum = { path = "../test-support/patricia-trie-ethereum" }
|
||||
patricia-trie-ethereum = { version = "0.1", path = "../test-support/patricia-trie-ethereum" }
|
||||
# We need this in-tree or we end up with duplicate versions when `keccak-hasher`
|
||||
# from crates.io fetches `hashdb` from crates, which causes compiler error
|
||||
# `error[E0277]: the trait bound `keccak_hasher::KeccakHasher: hashdb::Hasher`
|
||||
# is not satisfied`. Not sure if there's any way around that.
|
||||
keccak-hasher = { path = "../test-support/keccak-hasher" }
|
||||
keccak-hasher = { version = "0.1", path = "../test-support/keccak-hasher" }
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
[package]
|
||||
description = "Recursive-length prefix encoding, decoding, and compression"
|
||||
repository = "https://github.com/paritytech/parity"
|
||||
license = "MIT/Apache-2.0"
|
||||
name = "rlp"
|
||||
version = "0.2.2"
|
||||
description = "Recursive-length prefix encoding, decoding, and compression"
|
||||
repository = "https://github.com/paritytech/parity-common"
|
||||
license = "MIT/Apache-2.0"
|
||||
version = "0.2.4"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
byteorder = "1.0"
|
||||
elastic-array = "0.10"
|
||||
ethereum-types = { version = "0.3", optional = true }
|
||||
ethereum-types = { version = "0.4", optional = true }
|
||||
rustc-hex = {version = "2.0", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
@ -7,7 +7,7 @@ repository = "https://github.com/paritytech/parity/"
|
|||
license = "GPL-3.0"
|
||||
|
||||
[dependencies]
|
||||
ethereum-types = "0.3"
|
||||
ethereum-types = "0.4"
|
||||
tiny-keccak = "1.4.2"
|
||||
hashdb = { version = "0.2.0", path = "../../hashdb" }
|
||||
plain_hasher = { path = "../../plain_hasher" }
|
|
@ -9,8 +9,8 @@ license = "GPL-3.0"
|
|||
patricia-trie = { version = "0.2", path = "../../patricia_trie" }
|
||||
keccak-hasher = { version = "0.1", path = "../keccak-hasher" }
|
||||
hashdb = { version = "0.2", path = "../../hashdb" }
|
||||
rlp = { version = "0.2.1", path = "../../rlp" }
|
||||
rlp = { version = "0.2.3", path = "../../rlp" }
|
||||
parity-bytes = { version = "0.1", path = "../../parity-bytes" }
|
||||
|
||||
ethereum-types = "0.3"
|
||||
ethereum-types = "0.4"
|
||||
elastic-array = "0.10"
|
|
@ -1,8 +1,9 @@
|
|||
[package]
|
||||
name = "trace-time"
|
||||
description = "Easily trace time to execute a scope."
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
repository = "https://github.com/paritytech/parity-common"
|
||||
license = "GPL-3.0"
|
||||
|
||||
[dependencies]
|
||||
|
|
|
@ -138,7 +138,7 @@ impl<T, S: Clone> Clone for ScoreWithRef<T, S> {
|
|||
impl<S: cmp::Ord, T> Ord for ScoreWithRef<T, S> {
|
||||
fn cmp(&self, other: &Self) -> cmp::Ordering {
|
||||
other.score.cmp(&self.score)
|
||||
.then(other.transaction.insertion_id.cmp(&self.transaction.insertion_id))
|
||||
.then(self.transaction.insertion_id.cmp(&other.transaction.insertion_id))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,3 +155,33 @@ impl<S: cmp::Ord, T> PartialEq for ScoreWithRef<T, S> {
|
|||
}
|
||||
|
||||
impl<S: cmp::Ord, T> Eq for ScoreWithRef<T, S> {}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn score(score: u64, insertion_id: u64) -> ScoreWithRef<(), u64> {
|
||||
ScoreWithRef {
|
||||
score,
|
||||
transaction: Transaction {
|
||||
insertion_id,
|
||||
transaction: Default::default(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn scoring_comparison() {
|
||||
// the higher the score the better
|
||||
assert_eq!(score(10, 0).cmp(&score(0, 0)), cmp::Ordering::Less);
|
||||
assert_eq!(score(0, 0).cmp(&score(10, 0)), cmp::Ordering::Greater);
|
||||
|
||||
// equal is equal
|
||||
assert_eq!(score(0, 0).cmp(&score(0, 0)), cmp::Ordering::Equal);
|
||||
|
||||
// lower insertion id is better
|
||||
assert_eq!(score(0, 0).cmp(&score(0, 10)), cmp::Ordering::Less);
|
||||
assert_eq!(score(0, 10).cmp(&score(0, 0)), cmp::Ordering::Greater);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,6 +210,14 @@ fn should_construct_pending() {
|
|||
|
||||
let tx0 = txq.import(b.tx().nonce(0).gas_price(5).new()).unwrap();
|
||||
let tx1 = txq.import(b.tx().nonce(1).gas_price(5).new()).unwrap();
|
||||
|
||||
let tx9 = txq.import(b.tx().sender(2).nonce(0).new()).unwrap();
|
||||
|
||||
let tx5 = txq.import(b.tx().sender(1).nonce(0).new()).unwrap();
|
||||
let tx6 = txq.import(b.tx().sender(1).nonce(1).new()).unwrap();
|
||||
let tx7 = txq.import(b.tx().sender(1).nonce(2).new()).unwrap();
|
||||
let tx8 = txq.import(b.tx().sender(1).nonce(3).gas_price(4).new()).unwrap();
|
||||
|
||||
let tx2 = txq.import(b.tx().nonce(2).new()).unwrap();
|
||||
// this transaction doesn't get to the block despite high gas price
|
||||
// because of block gas limit and simplistic ordering algorithm.
|
||||
|
@ -217,14 +225,9 @@ fn should_construct_pending() {
|
|||
//gap
|
||||
txq.import(b.tx().nonce(5).new()).unwrap();
|
||||
|
||||
let tx5 = txq.import(b.tx().sender(1).nonce(0).new()).unwrap();
|
||||
let tx6 = txq.import(b.tx().sender(1).nonce(1).new()).unwrap();
|
||||
let tx7 = txq.import(b.tx().sender(1).nonce(2).new()).unwrap();
|
||||
let tx8 = txq.import(b.tx().sender(1).nonce(3).gas_price(4).new()).unwrap();
|
||||
// gap
|
||||
txq.import(b.tx().sender(1).nonce(5).new()).unwrap();
|
||||
|
||||
let tx9 = txq.import(b.tx().sender(2).nonce(0).new()).unwrap();
|
||||
assert_eq!(txq.light_status().transaction_count, 11);
|
||||
assert_eq!(txq.status(NonceReady::default()), Status {
|
||||
stalled: 0,
|
||||
|
@ -325,6 +328,13 @@ fn should_update_scoring_correctly() {
|
|||
let b = TransactionBuilder::default();
|
||||
let mut txq = TestPool::default();
|
||||
|
||||
let tx9 = txq.import(b.tx().sender(2).nonce(0).new()).unwrap();
|
||||
|
||||
let tx5 = txq.import(b.tx().sender(1).nonce(0).new()).unwrap();
|
||||
let tx6 = txq.import(b.tx().sender(1).nonce(1).new()).unwrap();
|
||||
let tx7 = txq.import(b.tx().sender(1).nonce(2).new()).unwrap();
|
||||
let tx8 = txq.import(b.tx().sender(1).nonce(3).gas_price(4).new()).unwrap();
|
||||
|
||||
let tx0 = txq.import(b.tx().nonce(0).gas_price(5).new()).unwrap();
|
||||
let tx1 = txq.import(b.tx().nonce(1).gas_price(5).new()).unwrap();
|
||||
let tx2 = txq.import(b.tx().nonce(2).new()).unwrap();
|
||||
|
@ -334,14 +344,9 @@ fn should_update_scoring_correctly() {
|
|||
//gap
|
||||
txq.import(b.tx().nonce(5).new()).unwrap();
|
||||
|
||||
let tx5 = txq.import(b.tx().sender(1).nonce(0).new()).unwrap();
|
||||
let tx6 = txq.import(b.tx().sender(1).nonce(1).new()).unwrap();
|
||||
let tx7 = txq.import(b.tx().sender(1).nonce(2).new()).unwrap();
|
||||
let tx8 = txq.import(b.tx().sender(1).nonce(3).gas_price(4).new()).unwrap();
|
||||
// gap
|
||||
txq.import(b.tx().sender(1).nonce(5).new()).unwrap();
|
||||
|
||||
let tx9 = txq.import(b.tx().sender(2).nonce(0).new()).unwrap();
|
||||
assert_eq!(txq.light_status().transaction_count, 11);
|
||||
assert_eq!(txq.status(NonceReady::default()), Status {
|
||||
stalled: 0,
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
[package]
|
||||
name = "trie-standardmap"
|
||||
version = "0.1.0"
|
||||
authors = ["debris <marek.kotewicz@gmail.com>"]
|
||||
description = "Standard test map for profiling tries"
|
||||
version = "0.1.1"
|
||||
authors = ["debris <marek.kotewicz@gmail.com>", "Parity Technologies <admin@parity.io>"]
|
||||
repository = "https://github.com/paritytech/parity-common"
|
||||
license = "GPL-3.0"
|
||||
|
||||
[dependencies]
|
||||
ethereum-types = "0.3"
|
||||
ethereum-types = "0.4"
|
||||
keccak-hash = { version = "0.1", path = "../keccak-hash" }
|
||||
parity-bytes = { path = "../parity-bytes" }
|
||||
rlp = { path = "../rlp" }
|
||||
parity-bytes = { version = "0.1", path = "../parity-bytes" }
|
||||
rlp = { version = "0.2.4", path = "../rlp" }
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
[package]
|
||||
name = "triehash"
|
||||
version = "0.2.1"
|
||||
version = "0.2.3"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
description = "in memory patricia trie operations"
|
||||
description = "In-memory patricia trie operations"
|
||||
repository = "https://github.com/paritytech/parity-common"
|
||||
license = "GPL-3.0"
|
||||
|
||||
[dependencies]
|
||||
elastic-array = "0.10"
|
||||
hashdb = { version = "0.2", path = "../hashdb", default-features = false }
|
||||
rlp = { version = "0.2", path = "../rlp", default-features = false }
|
||||
rlp = { version = "0.2.4", path = "../rlp", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
trie-standardmap = { version = "0.1", path = "../trie-standardmap" }
|
||||
keccak-hasher = { version = "0.1", path = "../test-support/keccak-hasher" }
|
||||
tiny-keccak = "1.4.2"
|
||||
ethereum-types = "0.4"
|
||||
ethereum-types = "0.4"
|
||||
|
||||
[features]
|
||||
ethereum = ["rlp/ethereum"]
|
Loading…
Reference in New Issue