Separate migrations from util (#6690)
* separate migration from util and make its dependencies into libs: * snappy * kvdb * error * common * renamed common -> macros * util error does not depend on snappy module * ethsync does not depend on util nor ethcore_error * nibbleslice and nibblevec merged with patricia_trie crate * removed unused dependencies from util * util journaldb traits does not need to be public * util_error * fixed ethcore compile error * ignore .swo files * Update chain.rs
This commit is contained in:
parent
4e8853c9f7
commit
6279ff32f5
1
.gitignore
vendored
1
.gitignore
vendored
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
# vim stuff
|
# vim stuff
|
||||||
*.swp
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
# mac stuff
|
# mac stuff
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
86
Cargo.lock
generated
86
Cargo.lock
generated
@ -600,11 +600,14 @@ dependencies = [
|
|||||||
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hyper 0.10.0-a.0 (git+https://github.com/paritytech/hyper)",
|
"hyper 0.10.0-a.0 (git+https://github.com/paritytech/hyper)",
|
||||||
"itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
"itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"kvdb 0.1.0",
|
||||||
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"linked-hash-map 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"linked-hash-map 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"macros 0.1.0",
|
||||||
"memorydb 0.1.0",
|
"memorydb 0.1.0",
|
||||||
|
"migration 0.1.0",
|
||||||
"native-contracts 0.1.0",
|
"native-contracts 0.1.0",
|
||||||
"num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -619,6 +622,7 @@ dependencies = [
|
|||||||
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"semantic_version 0.1.0",
|
"semantic_version 0.1.0",
|
||||||
|
"snappy 0.1.0",
|
||||||
"stats 0.1.0",
|
"stats 0.1.0",
|
||||||
"table 0.1.0",
|
"table 0.1.0",
|
||||||
"time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -626,6 +630,7 @@ dependencies = [
|
|||||||
"triehash 0.1.0",
|
"triehash 0.1.0",
|
||||||
"unexpected 0.1.0",
|
"unexpected 0.1.0",
|
||||||
"using_queue 0.1.0",
|
"using_queue 0.1.0",
|
||||||
|
"util-error 0.1.0",
|
||||||
"vm 0.1.0",
|
"vm 0.1.0",
|
||||||
"wasm 0.1.0",
|
"wasm 0.1.0",
|
||||||
]
|
]
|
||||||
@ -752,6 +757,7 @@ dependencies = [
|
|||||||
"hash 0.1.0",
|
"hash 0.1.0",
|
||||||
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
"itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"kvdb 0.1.0",
|
||||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"memorydb 0.1.0",
|
"memorydb 0.1.0",
|
||||||
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -837,6 +843,7 @@ dependencies = [
|
|||||||
"futures-cpupool 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"futures-cpupool 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hash 0.1.0",
|
"hash 0.1.0",
|
||||||
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"kvdb 0.1.0",
|
||||||
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"native-contracts 0.1.0",
|
"native-contracts 0.1.0",
|
||||||
@ -885,22 +892,19 @@ dependencies = [
|
|||||||
"error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"eth-secp256k1 0.5.6 (git+https://github.com/paritytech/rust-secp256k1)",
|
"eth-secp256k1 0.5.6 (git+https://github.com/paritytech/rust-secp256k1)",
|
||||||
"ethcore-bigint 0.1.3",
|
"ethcore-bigint 0.1.3",
|
||||||
"ethcore-bloom-journal 0.1.0",
|
|
||||||
"ethcore-bytes 0.1.0",
|
"ethcore-bytes 0.1.0",
|
||||||
"ethcore-devtools 1.8.0",
|
"ethcore-devtools 1.8.0",
|
||||||
"ethcore-logger 1.8.0",
|
"ethcore-logger 1.8.0",
|
||||||
"hash 0.1.0",
|
"hash 0.1.0",
|
||||||
"hashdb 0.1.0",
|
"hashdb 0.1.0",
|
||||||
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"kvdb 0.1.0",
|
||||||
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"memorydb 0.1.0",
|
"memorydb 0.1.0",
|
||||||
"nibbleslice 0.1.0",
|
|
||||||
"nibblevec 0.1.0",
|
|
||||||
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"patricia_trie 0.1.0",
|
"patricia_trie 0.1.0",
|
||||||
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"rlp 0.2.0",
|
"rlp 0.2.0",
|
||||||
"rocksdb 0.4.5 (git+https://github.com/paritytech/rust-rocksdb)",
|
"rocksdb 0.4.5 (git+https://github.com/paritytech/rust-rocksdb)",
|
||||||
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -908,6 +912,7 @@ dependencies = [
|
|||||||
"target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tiny-keccak 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tiny-keccak 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"triehash 0.1.0",
|
"triehash 0.1.0",
|
||||||
|
"util-error 0.1.0",
|
||||||
"vergen 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"vergen 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1018,7 +1023,9 @@ dependencies = [
|
|||||||
"hash 0.1.0",
|
"hash 0.1.0",
|
||||||
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"kvdb 0.1.0",
|
||||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"macros 0.1.0",
|
||||||
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rlp 0.2.0",
|
"rlp 0.2.0",
|
||||||
@ -1501,6 +1508,23 @@ dependencies = [
|
|||||||
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "kvdb"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"ethcore-bigint 0.1.3",
|
||||||
|
"ethcore-bytes 0.1.0",
|
||||||
|
"ethcore-devtools 1.8.0",
|
||||||
|
"hashdb 0.1.0",
|
||||||
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rlp 0.2.0",
|
||||||
|
"rocksdb 0.4.5 (git+https://github.com/paritytech/rust-rocksdb)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "language-tags"
|
name = "language-tags"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
@ -1582,6 +1606,10 @@ dependencies = [
|
|||||||
"linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "macros"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "magenta"
|
name = "magenta"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
@ -1636,6 +1664,16 @@ dependencies = [
|
|||||||
"rlp 0.2.0",
|
"rlp 0.2.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "migration"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"ethcore-devtools 1.8.0",
|
||||||
|
"kvdb 0.1.0",
|
||||||
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"macros 0.1.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mime"
|
name = "mime"
|
||||||
version = "0.2.6"
|
version = "0.2.6"
|
||||||
@ -1810,21 +1848,6 @@ dependencies = [
|
|||||||
"ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "nibbleslice"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "nibblevec"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"elastic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"nibbleslice 0.1.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "node-filter"
|
name = "node-filter"
|
||||||
version = "1.8.0"
|
version = "1.8.0"
|
||||||
@ -1836,6 +1859,7 @@ dependencies = [
|
|||||||
"ethcore-network 1.8.0",
|
"ethcore-network 1.8.0",
|
||||||
"ethcore-util 1.8.0",
|
"ethcore-util 1.8.0",
|
||||||
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"kvdb 0.1.0",
|
||||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"native-contracts 0.1.0",
|
"native-contracts 0.1.0",
|
||||||
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -2066,7 +2090,9 @@ dependencies = [
|
|||||||
"ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"isatty 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"isatty 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)",
|
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)",
|
||||||
|
"kvdb 0.1.0",
|
||||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"migration 0.1.0",
|
||||||
"node-filter 1.8.0",
|
"node-filter 1.8.0",
|
||||||
"node-health 0.1.0",
|
"node-health 0.1.0",
|
||||||
"num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -2210,6 +2236,7 @@ dependencies = [
|
|||||||
"ethcore-io 1.8.0",
|
"ethcore-io 1.8.0",
|
||||||
"ethcore-util 1.8.0",
|
"ethcore-util 1.8.0",
|
||||||
"ethkey 0.2.0",
|
"ethkey 0.2.0",
|
||||||
|
"kvdb 0.1.0",
|
||||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rlp 0.2.0",
|
"rlp 0.2.0",
|
||||||
"serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -2267,7 +2294,9 @@ dependencies = [
|
|||||||
"jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)",
|
"jsonrpc-macros 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)",
|
||||||
"jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)",
|
"jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)",
|
||||||
"jsonrpc-ws-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)",
|
"jsonrpc-ws-server 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)",
|
||||||
|
"kvdb 0.1.0",
|
||||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"macros 0.1.0",
|
||||||
"multihash 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"multihash 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"node-health 0.1.0",
|
"node-health 0.1.0",
|
||||||
"order-stat 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"order-stat 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -2456,8 +2485,6 @@ dependencies = [
|
|||||||
"hashdb 0.1.0",
|
"hashdb 0.1.0",
|
||||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"memorydb 0.1.0",
|
"memorydb 0.1.0",
|
||||||
"nibbleslice 0.1.0",
|
|
||||||
"nibblevec 0.1.0",
|
|
||||||
"rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rlp 0.2.0",
|
"rlp 0.2.0",
|
||||||
"triehash 0.1.0",
|
"triehash 0.1.0",
|
||||||
@ -3070,6 +3097,13 @@ dependencies = [
|
|||||||
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "snappy"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "spmc"
|
name = "spmc"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
@ -3480,6 +3514,16 @@ name = "utf8-ranges"
|
|||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "util-error"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"ethcore-bigint 0.1.3",
|
||||||
|
"rlp 0.2.0",
|
||||||
|
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vcpkg"
|
name = "vcpkg"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
|
@ -62,6 +62,8 @@ parity-whisper = { path = "whisper" }
|
|||||||
path = { path = "util/path" }
|
path = { path = "util/path" }
|
||||||
panic_hook = { path = "panic_hook" }
|
panic_hook = { path = "panic_hook" }
|
||||||
hash = { path = "util/hash" }
|
hash = { path = "util/hash" }
|
||||||
|
migration = { path = "util/migration" }
|
||||||
|
kvdb = { path = "util/kvdb" }
|
||||||
|
|
||||||
parity-dapps = { path = "dapps", optional = true }
|
parity-dapps = { path = "dapps", optional = true }
|
||||||
clippy = { version = "0.0.103", optional = true}
|
clippy = { version = "0.0.103", optional = true}
|
||||||
|
@ -55,6 +55,11 @@ rayon = "0.8"
|
|||||||
rand = "0.3"
|
rand = "0.3"
|
||||||
rlp = { path = "../util/rlp" }
|
rlp = { path = "../util/rlp" }
|
||||||
rlp_derive = { path = "../util/rlp_derive" }
|
rlp_derive = { path = "../util/rlp_derive" }
|
||||||
|
kvdb = { path = "../util/kvdb" }
|
||||||
|
util-error = { path = "../util/error" }
|
||||||
|
snappy = { path = "../util/snappy" }
|
||||||
|
migration = { path = "../util/migration" }
|
||||||
|
macros = { path = "../util/macros" }
|
||||||
rust-crypto = "0.2.34"
|
rust-crypto = "0.2.34"
|
||||||
rustc-hex = "1.0"
|
rustc-hex = "1.0"
|
||||||
stats = { path = "../util/stats" }
|
stats = { path = "../util/stats" }
|
||||||
|
@ -39,6 +39,7 @@ parking_lot = "0.4"
|
|||||||
stats = { path = "../../util/stats" }
|
stats = { path = "../../util/stats" }
|
||||||
hash = { path = "../../util/hash" }
|
hash = { path = "../../util/hash" }
|
||||||
triehash = { path = "../../util/triehash" }
|
triehash = { path = "../../util/triehash" }
|
||||||
|
kvdb = { path = "../../util/kvdb" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
@ -45,7 +45,7 @@ use rlp::{Encodable, Decodable, DecoderError, RlpStream, Rlp, UntrustedRlp};
|
|||||||
use heapsize::HeapSizeOf;
|
use heapsize::HeapSizeOf;
|
||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
use bigint::hash::{H256, H256FastMap, H264};
|
use bigint::hash::{H256, H256FastMap, H264};
|
||||||
use util::kvdb::{DBTransaction, KeyValueDB};
|
use kvdb::{DBTransaction, KeyValueDB};
|
||||||
|
|
||||||
use cache::Cache;
|
use cache::Cache;
|
||||||
use parking_lot::{Mutex, RwLock};
|
use parking_lot::{Mutex, RwLock};
|
||||||
@ -728,12 +728,13 @@ mod tests {
|
|||||||
use ethcore::header::Header;
|
use ethcore::header::Header;
|
||||||
use ethcore::spec::Spec;
|
use ethcore::spec::Spec;
|
||||||
use cache::Cache;
|
use cache::Cache;
|
||||||
|
use kvdb::{in_memory, KeyValueDB};
|
||||||
|
|
||||||
use time::Duration;
|
use time::Duration;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
|
||||||
fn make_db() -> Arc<::util::KeyValueDB> {
|
fn make_db() -> Arc<KeyValueDB> {
|
||||||
Arc::new(::util::kvdb::in_memory(0))
|
Arc::new(in_memory(0))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -36,7 +36,7 @@ use bigint::prelude::U256;
|
|||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use futures::{IntoFuture, Future};
|
use futures::{IntoFuture, Future};
|
||||||
|
|
||||||
use util::kvdb::{KeyValueDB, CompactionProfile};
|
use kvdb::{KeyValueDB, CompactionProfile};
|
||||||
|
|
||||||
use self::fetch::ChainDataFetcher;
|
use self::fetch::ChainDataFetcher;
|
||||||
use self::header_chain::{AncestryIter, HeaderChain};
|
use self::header_chain::{AncestryIter, HeaderChain};
|
||||||
@ -214,7 +214,7 @@ impl<T: ChainDataFetcher> Client<T> {
|
|||||||
io_channel: IoChannel<ClientIoMessage>,
|
io_channel: IoChannel<ClientIoMessage>,
|
||||||
cache: Arc<Mutex<Cache>>
|
cache: Arc<Mutex<Cache>>
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let db = ::util::kvdb::in_memory(0);
|
let db = ::kvdb::in_memory(0);
|
||||||
|
|
||||||
Client::new(
|
Client::new(
|
||||||
config,
|
config,
|
||||||
|
@ -25,7 +25,7 @@ use ethcore::db;
|
|||||||
use ethcore::service::ClientIoMessage;
|
use ethcore::service::ClientIoMessage;
|
||||||
use ethcore::spec::Spec;
|
use ethcore::spec::Spec;
|
||||||
use io::{IoContext, IoError, IoHandler, IoService};
|
use io::{IoContext, IoError, IoHandler, IoService};
|
||||||
use util::kvdb::{Database, DatabaseConfig};
|
use kvdb::{Database, DatabaseConfig};
|
||||||
|
|
||||||
use cache::Cache;
|
use cache::Cache;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
@ -91,6 +91,7 @@ extern crate time;
|
|||||||
extern crate vm;
|
extern crate vm;
|
||||||
extern crate hash;
|
extern crate hash;
|
||||||
extern crate triehash;
|
extern crate triehash;
|
||||||
|
extern crate kvdb;
|
||||||
|
|
||||||
#[cfg(feature = "ipc")]
|
#[cfg(feature = "ipc")]
|
||||||
extern crate ethcore_ipc as ipc;
|
extern crate ethcore_ipc as ipc;
|
||||||
|
@ -13,6 +13,7 @@ ethcore-bigint = { path = "../../util/bigint" }
|
|||||||
ethcore-bytes = { path = "../../util/bytes" }
|
ethcore-bytes = { path = "../../util/bytes" }
|
||||||
ethcore-io = { path = "../../util/io" }
|
ethcore-io = { path = "../../util/io" }
|
||||||
ethcore-network = { path = "../../util/network" }
|
ethcore-network = { path = "../../util/network" }
|
||||||
|
kvdb = { path = "../../util/kvdb" }
|
||||||
native-contracts = { path = "../native_contracts" }
|
native-contracts = { path = "../native_contracts" }
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
|
@ -24,6 +24,7 @@ extern crate ethcore_network as network;
|
|||||||
extern crate native_contracts;
|
extern crate native_contracts;
|
||||||
extern crate futures;
|
extern crate futures;
|
||||||
extern crate parking_lot;
|
extern crate parking_lot;
|
||||||
|
extern crate kvdb;
|
||||||
#[cfg(test)] extern crate ethcore_io as io;
|
#[cfg(test)] extern crate ethcore_io as io;
|
||||||
#[macro_use] extern crate log;
|
#[macro_use] extern crate log;
|
||||||
|
|
||||||
@ -134,7 +135,7 @@ mod test {
|
|||||||
let contract_addr = Address::from_str("0000000000000000000000000000000000000005").unwrap();
|
let contract_addr = Address::from_str("0000000000000000000000000000000000000005").unwrap();
|
||||||
let data = include_bytes!("../res/node_filter.json");
|
let data = include_bytes!("../res/node_filter.json");
|
||||||
let spec = Spec::load(&::std::env::temp_dir(), &data[..]).unwrap();
|
let spec = Spec::load(&::std::env::temp_dir(), &data[..]).unwrap();
|
||||||
let client_db = Arc::new(::util::kvdb::in_memory(::ethcore::db::NUM_COLUMNS.unwrap_or(0)));
|
let client_db = Arc::new(::kvdb::in_memory(::ethcore::db::NUM_COLUMNS.unwrap_or(0)));
|
||||||
|
|
||||||
let client = Client::new(
|
let client = Client::new(
|
||||||
ClientConfig::default(),
|
ClientConfig::default(),
|
||||||
|
@ -26,7 +26,6 @@ use bigint::prelude::U256;
|
|||||||
use bigint::hash::{H256, H2048};
|
use bigint::hash::{H256, H2048};
|
||||||
use parking_lot::{Mutex, RwLock};
|
use parking_lot::{Mutex, RwLock};
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use util::*;
|
|
||||||
use rlp::*;
|
use rlp::*;
|
||||||
use header::*;
|
use header::*;
|
||||||
use super::extras::*;
|
use super::extras::*;
|
||||||
@ -47,6 +46,7 @@ use encoded;
|
|||||||
use engines::epoch::{Transition as EpochTransition, PendingTransition as PendingEpochTransition};
|
use engines::epoch::{Transition as EpochTransition, PendingTransition as PendingEpochTransition};
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use ansi_term::Colour;
|
use ansi_term::Colour;
|
||||||
|
use kvdb::{DBTransaction, KeyValueDB};
|
||||||
|
|
||||||
const LOG_BLOOMS_LEVELS: usize = 3;
|
const LOG_BLOOMS_LEVELS: usize = 3;
|
||||||
const LOG_BLOOMS_ELEMENTS_PER_INDEX: usize = 16;
|
const LOG_BLOOMS_ELEMENTS_PER_INDEX: usize = 16;
|
||||||
@ -1479,7 +1479,7 @@ mod tests {
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use rustc_hex::FromHex;
|
use rustc_hex::FromHex;
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use util::kvdb::KeyValueDB;
|
use kvdb::{in_memory, KeyValueDB};
|
||||||
use bigint::hash::*;
|
use bigint::hash::*;
|
||||||
use receipt::{Receipt, TransactionOutcome};
|
use receipt::{Receipt, TransactionOutcome};
|
||||||
use blockchain::{BlockProvider, BlockChain, Config, ImportRoute};
|
use blockchain::{BlockProvider, BlockChain, Config, ImportRoute};
|
||||||
@ -1493,7 +1493,7 @@ mod tests {
|
|||||||
use header::BlockNumber;
|
use header::BlockNumber;
|
||||||
|
|
||||||
fn new_db() -> Arc<KeyValueDB> {
|
fn new_db() -> Arc<KeyValueDB> {
|
||||||
Arc::new(::util::kvdb::in_memory(::db::NUM_COLUMNS.unwrap_or(0)))
|
Arc::new(in_memory(::db::NUM_COLUMNS.unwrap_or(0)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_chain(genesis: &[u8], db: Arc<KeyValueDB>) -> BlockChain {
|
fn new_chain(genesis: &[u8], db: Arc<KeyValueDB>) -> BlockChain {
|
||||||
|
@ -28,7 +28,7 @@ use receipt::Receipt;
|
|||||||
use heapsize::HeapSizeOf;
|
use heapsize::HeapSizeOf;
|
||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
use bigint::hash::{H256, H264};
|
use bigint::hash::{H256, H264};
|
||||||
use util::kvdb::PREFIX_LEN as DB_PREFIX_LEN;
|
use kvdb::PREFIX_LEN as DB_PREFIX_LEN;
|
||||||
|
|
||||||
/// Represents index of extra data in database
|
/// Represents index of extra data in database
|
||||||
#[derive(Copy, Debug, Hash, Eq, PartialEq, Clone)]
|
#[derive(Copy, Debug, Hash, Eq, PartialEq, Clone)]
|
||||||
|
@ -26,10 +26,10 @@ use itertools::Itertools;
|
|||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use timer::PerfTimer;
|
use timer::PerfTimer;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use util::{journaldb, DBValue};
|
use util::{Address, journaldb, DBValue};
|
||||||
use util::{Address, UtilError};
|
use util_error::UtilError;
|
||||||
use trie::{TrieSpec, TrieFactory, Trie};
|
use trie::{TrieSpec, TrieFactory, Trie};
|
||||||
use util::kvdb::*;
|
use kvdb::*;
|
||||||
|
|
||||||
// other
|
// other
|
||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
@ -2090,7 +2090,7 @@ mod tests {
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use util::kvdb::DBTransaction;
|
use kvdb::DBTransaction;
|
||||||
|
|
||||||
let client = generate_dummy_client(0);
|
let client = generate_dummy_client(0);
|
||||||
let genesis = client.chain_info().best_block_hash;
|
let genesis = client.chain_info().best_block_hash;
|
||||||
|
@ -20,7 +20,8 @@ use std::fmt::{Display, Formatter, Error as FmtError};
|
|||||||
|
|
||||||
use mode::Mode as IpcMode;
|
use mode::Mode as IpcMode;
|
||||||
use verification::{VerifierType, QueueConfig};
|
use verification::{VerifierType, QueueConfig};
|
||||||
use util::{journaldb, CompactionProfile};
|
use util::journaldb;
|
||||||
|
use kvdb::CompactionProfile;
|
||||||
|
|
||||||
pub use std::time::Duration;
|
pub use std::time::Duration;
|
||||||
pub use blockchain::Config as BlockChainConfig;
|
pub use blockchain::Config as BlockChainConfig;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use util::UtilError;
|
use util_error::UtilError;
|
||||||
use std::fmt::{Display, Formatter, Error as FmtError};
|
use std::fmt::{Display, Formatter, Error as FmtError};
|
||||||
|
|
||||||
use trie::TrieError;
|
use trie::TrieError;
|
||||||
|
@ -23,7 +23,7 @@ use bigint::hash::H256;
|
|||||||
use util::journaldb;
|
use util::journaldb;
|
||||||
use trie;
|
use trie;
|
||||||
use bytes;
|
use bytes;
|
||||||
use util::kvdb::{self, KeyValueDB};
|
use kvdb::{self, KeyValueDB};
|
||||||
use {state, state_db, client, executive, trace, transaction, db, spec, pod_state};
|
use {state, state_db, client, executive, trace, transaction, db, spec, pod_state};
|
||||||
use factory::Factories;
|
use factory::Factories;
|
||||||
use evm::{self, VMType, FinalizationResult};
|
use evm::{self, VMType, FinalizationResult};
|
||||||
|
@ -27,6 +27,7 @@ use bigint::prelude::U256;
|
|||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use util::*;
|
use util::*;
|
||||||
|
use kvdb::{Database, DatabaseConfig};
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use rlp::*;
|
use rlp::*;
|
||||||
use ethkey::{Generator, Random};
|
use ethkey::{Generator, Random};
|
||||||
|
@ -20,7 +20,7 @@ use std::ops::Deref;
|
|||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use util::{DBTransaction, KeyValueDB};
|
use kvdb::{DBTransaction, KeyValueDB};
|
||||||
|
|
||||||
use rlp;
|
use rlp;
|
||||||
|
|
||||||
|
@ -17,9 +17,12 @@
|
|||||||
//! General error types for use in ethcore.
|
//! General error types for use in ethcore.
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
use kvdb;
|
||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::*;
|
use util::*;
|
||||||
|
use util_error::UtilError;
|
||||||
|
use snappy::InvalidInput;
|
||||||
use unexpected::{Mismatch, OutOfBounds};
|
use unexpected::{Mismatch, OutOfBounds};
|
||||||
use trie::TrieError;
|
use trie::TrieError;
|
||||||
use io::*;
|
use io::*;
|
||||||
@ -299,6 +302,8 @@ impl From<Error> for TransactionImportError {
|
|||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// Client configuration error.
|
/// Client configuration error.
|
||||||
Client(ClientError),
|
Client(ClientError),
|
||||||
|
/// Database error.
|
||||||
|
Database(kvdb::Error),
|
||||||
/// Error concerning a utility.
|
/// Error concerning a utility.
|
||||||
Util(UtilError),
|
Util(UtilError),
|
||||||
/// Error concerning block processing.
|
/// Error concerning block processing.
|
||||||
@ -322,7 +327,7 @@ pub enum Error {
|
|||||||
/// Standard io error.
|
/// Standard io error.
|
||||||
StdIo(::std::io::Error),
|
StdIo(::std::io::Error),
|
||||||
/// Snappy error.
|
/// Snappy error.
|
||||||
Snappy(::util::snappy::InvalidInput),
|
Snappy(InvalidInput),
|
||||||
/// Snapshot error.
|
/// Snapshot error.
|
||||||
Snapshot(SnapshotError),
|
Snapshot(SnapshotError),
|
||||||
/// Consensus vote error.
|
/// Consensus vote error.
|
||||||
@ -337,6 +342,7 @@ impl fmt::Display for Error {
|
|||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match *self {
|
match *self {
|
||||||
Error::Client(ref err) => err.fmt(f),
|
Error::Client(ref err) => err.fmt(f),
|
||||||
|
Error::Database(ref err) => err.fmt(f),
|
||||||
Error::Util(ref err) => err.fmt(f),
|
Error::Util(ref err) => err.fmt(f),
|
||||||
Error::Io(ref err) => err.fmt(f),
|
Error::Io(ref err) => err.fmt(f),
|
||||||
Error::Block(ref err) => err.fmt(f),
|
Error::Block(ref err) => err.fmt(f),
|
||||||
@ -370,6 +376,12 @@ impl From<ClientError> for Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<kvdb::Error> for Error {
|
||||||
|
fn from(err: kvdb::Error) -> Error {
|
||||||
|
Error::Database(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<TransactionError> for Error {
|
impl From<TransactionError> for Error {
|
||||||
fn from(err: TransactionError) -> Error {
|
fn from(err: TransactionError) -> Error {
|
||||||
Error::Transaction(err)
|
Error::Transaction(err)
|
||||||
@ -434,8 +446,8 @@ impl From<BlockImportError> for Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<snappy::InvalidInput> for Error {
|
impl From<::snappy::InvalidInput> for Error {
|
||||||
fn from(err: snappy::InvalidInput) -> Error {
|
fn from(err: ::snappy::InvalidInput) -> Error {
|
||||||
Error::Snappy(err)
|
Error::Snappy(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ pub fn json_chain_test(json_data: &[u8]) -> Vec<String> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
{
|
{
|
||||||
let db = Arc::new(::util::kvdb::in_memory(::db::NUM_COLUMNS.unwrap_or(0)));
|
let db = Arc::new(::kvdb::in_memory(::db::NUM_COLUMNS.unwrap_or(0)));
|
||||||
let client = Client::new(
|
let client = Client::new(
|
||||||
ClientConfig::default(),
|
ClientConfig::default(),
|
||||||
&spec,
|
&spec,
|
||||||
|
@ -112,6 +112,10 @@ extern crate triehash;
|
|||||||
extern crate ansi_term;
|
extern crate ansi_term;
|
||||||
extern crate semantic_version;
|
extern crate semantic_version;
|
||||||
extern crate unexpected;
|
extern crate unexpected;
|
||||||
|
extern crate kvdb;
|
||||||
|
extern crate util_error;
|
||||||
|
extern crate snappy;
|
||||||
|
extern crate migration;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate rlp_derive;
|
extern crate rlp_derive;
|
||||||
@ -124,11 +128,12 @@ extern crate table;
|
|||||||
extern crate bloomable;
|
extern crate bloomable;
|
||||||
extern crate vm;
|
extern crate vm;
|
||||||
extern crate wasm;
|
extern crate wasm;
|
||||||
|
extern crate ethcore_util as util;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate macros;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate ethcore_util as util;
|
extern crate log;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
//! This migration compresses the state db.
|
//! This migration compresses the state db.
|
||||||
|
|
||||||
use util::migration::{SimpleMigration, Progress};
|
use migration::{SimpleMigration, Progress};
|
||||||
use rlp::{Compressible, UntrustedRlp, RlpType};
|
use rlp::{Compressible, UntrustedRlp, RlpType};
|
||||||
|
|
||||||
/// Compressing migration.
|
/// Compressing migration.
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use util::migration::SimpleMigration;
|
use migration::SimpleMigration;
|
||||||
|
|
||||||
/// This migration reduces the sizes of keys and moves `ExtrasIndex` byte from back to the front.
|
/// This migration reduces the sizes of keys and moves `ExtrasIndex` byte from back to the front.
|
||||||
pub struct ToV6;
|
pub struct ToV6;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
//! Database migrations.
|
//! Database migrations.
|
||||||
|
|
||||||
use util::migration::ChangeColumns;
|
use migration::ChangeColumns;
|
||||||
|
|
||||||
pub mod state;
|
pub mod state;
|
||||||
pub mod blocks;
|
pub mod blocks;
|
||||||
|
@ -22,8 +22,8 @@ use std::collections::HashMap;
|
|||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::Address;
|
use util::Address;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use util::kvdb::Database;
|
use kvdb::Database;
|
||||||
use util::migration::{Batch, Config, Error, Migration, SimpleMigration, Progress};
|
use migration::{Batch, Config, Error, Migration, SimpleMigration, Progress};
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
@ -22,11 +22,11 @@ use state_db::{ACCOUNT_BLOOM_SPACE, DEFAULT_ACCOUNT_PRESET, StateDB};
|
|||||||
use trie::TrieDB;
|
use trie::TrieDB;
|
||||||
use views::HeaderView;
|
use views::HeaderView;
|
||||||
use bloom_journal::Bloom;
|
use bloom_journal::Bloom;
|
||||||
use util::migration::{Error, Migration, Progress, Batch, Config};
|
use migration::{Error, Migration, Progress, Batch, Config};
|
||||||
use util::journaldb;
|
use util::journaldb;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use trie::Trie;
|
use trie::Trie;
|
||||||
use util::{Database, DBTransaction};
|
use kvdb::{Database, DBTransaction};
|
||||||
|
|
||||||
/// Account bloom upgrade routine. If bloom already present, does nothing.
|
/// Account bloom upgrade routine. If bloom already present, does nothing.
|
||||||
/// If database empty (no best block), does nothing.
|
/// If database empty (no best block), does nothing.
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
//! This migration consolidates all databases into single one using Column Families.
|
//! This migration consolidates all databases into single one using Column Families.
|
||||||
|
|
||||||
use rlp::{Rlp, RlpStream};
|
use rlp::{Rlp, RlpStream};
|
||||||
use util::kvdb::Database;
|
use kvdb::Database;
|
||||||
use util::migration::{Batch, Config, Error, Migration, Progress};
|
use migration::{Batch, Config, Error, Migration, Progress};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
/// Which part of block to preserve
|
/// Which part of block to preserve
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::*;
|
use kvdb::{Database, DatabaseConfig, KeyValueDB};
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use io::*;
|
use io::*;
|
||||||
use spec::Spec;
|
use spec::Spec;
|
||||||
|
@ -35,7 +35,7 @@ use snapshot::{Error, ManifestData};
|
|||||||
use itertools::{Position, Itertools};
|
use itertools::{Position, Itertools};
|
||||||
use rlp::{RlpStream, UntrustedRlp};
|
use rlp::{RlpStream, UntrustedRlp};
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::KeyValueDB;
|
use kvdb::KeyValueDB;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
|
|
||||||
/// Snapshot creation and restoration for PoA chains.
|
/// Snapshot creation and restoration for PoA chains.
|
||||||
|
@ -25,7 +25,7 @@ use engines::EthEngine;
|
|||||||
use snapshot::{Error, ManifestData};
|
use snapshot::{Error, ManifestData};
|
||||||
|
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::kvdb::KeyValueDB;
|
use kvdb::KeyValueDB;
|
||||||
|
|
||||||
mod authority;
|
mod authority;
|
||||||
mod work;
|
mod work;
|
||||||
|
@ -31,7 +31,7 @@ use engines::EthEngine;
|
|||||||
use snapshot::{Error, ManifestData};
|
use snapshot::{Error, ManifestData};
|
||||||
use snapshot::block::AbridgedBlock;
|
use snapshot::block::AbridgedBlock;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::KeyValueDB;
|
use kvdb::KeyValueDB;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use rlp::{RlpStream, UntrustedRlp};
|
use rlp::{RlpStream, UntrustedRlp};
|
||||||
use rand::OsRng;
|
use rand::OsRng;
|
||||||
|
@ -32,11 +32,12 @@ use ids::BlockId;
|
|||||||
|
|
||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::{HashDB, DBValue, snappy};
|
use util::{HashDB, DBValue};
|
||||||
|
use snappy;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use util::journaldb::{self, Algorithm, JournalDB};
|
use util::journaldb::{self, Algorithm, JournalDB};
|
||||||
use util::kvdb::KeyValueDB;
|
use kvdb::KeyValueDB;
|
||||||
use trie::{TrieDB, TrieDBMut, Trie, TrieMut};
|
use trie::{TrieDB, TrieDBMut, Trie, TrieMut};
|
||||||
use rlp::{RlpStream, UntrustedRlp};
|
use rlp::{RlpStream, UntrustedRlp};
|
||||||
use bloom_journal::Bloom;
|
use bloom_journal::Bloom;
|
||||||
|
@ -37,11 +37,11 @@ use io::IoChannel;
|
|||||||
|
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use parking_lot::{Mutex, RwLock, RwLockReadGuard};
|
use parking_lot::{Mutex, RwLock, RwLockReadGuard};
|
||||||
use util::UtilError;
|
use util_error::UtilError;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use util::journaldb::Algorithm;
|
use util::journaldb::Algorithm;
|
||||||
use util::kvdb::{Database, DatabaseConfig};
|
use kvdb::{Database, DatabaseConfig};
|
||||||
use util::snappy;
|
use snappy;
|
||||||
|
|
||||||
/// Helper for removing directories in case of error.
|
/// Helper for removing directories in case of error.
|
||||||
struct Guard(bool, PathBuf);
|
struct Guard(bool, PathBuf);
|
||||||
@ -682,7 +682,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn cannot_finish_with_invalid_chunks() {
|
fn cannot_finish_with_invalid_chunks() {
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::kvdb::DatabaseConfig;
|
use kvdb::DatabaseConfig;
|
||||||
|
|
||||||
let spec = get_test_spec();
|
let spec = get_test_spec();
|
||||||
let dir = RandomTempPath::new();
|
let dir = RandomTempPath::new();
|
||||||
|
@ -31,7 +31,8 @@ use snapshot::io::{SnapshotReader, PackedWriter, PackedReader};
|
|||||||
use devtools::{RandomTempPath, GuardedTempResult};
|
use devtools::{RandomTempPath, GuardedTempResult};
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
|
||||||
use util::{DBValue, KeyValueDB};
|
use util::DBValue;
|
||||||
|
use kvdb::KeyValueDB;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use hashdb::HashDB;
|
use hashdb::HashDB;
|
||||||
use util::journaldb;
|
use util::journaldb;
|
||||||
@ -165,7 +166,7 @@ pub fn restore(
|
|||||||
genesis: &[u8],
|
genesis: &[u8],
|
||||||
) -> Result<(), ::error::Error> {
|
) -> Result<(), ::error::Error> {
|
||||||
use std::sync::atomic::AtomicBool;
|
use std::sync::atomic::AtomicBool;
|
||||||
use util::snappy;
|
use snappy;
|
||||||
|
|
||||||
let flag = AtomicBool::new(true);
|
let flag = AtomicBool::new(true);
|
||||||
let components = engine.snapshot_components().unwrap();
|
let components = engine.snapshot_components().unwrap();
|
||||||
|
@ -31,7 +31,7 @@ use tests::helpers;
|
|||||||
use transaction::{Transaction, Action, SignedTransaction};
|
use transaction::{Transaction, Action, SignedTransaction};
|
||||||
|
|
||||||
use util::Address;
|
use util::Address;
|
||||||
use util::kvdb;
|
use kvdb;
|
||||||
|
|
||||||
const PASS: &'static str = "";
|
const PASS: &'static str = "";
|
||||||
const TRANSITION_BLOCK_1: usize = 2; // block at which the contract becomes activated.
|
const TRANSITION_BLOCK_1: usize = 2; // block at which the contract becomes activated.
|
||||||
|
@ -25,8 +25,8 @@ use snapshot::{chunk_secondary, Error as SnapshotError, Progress, SnapshotCompon
|
|||||||
use snapshot::io::{PackedReader, PackedWriter, SnapshotReader, SnapshotWriter};
|
use snapshot::io::{PackedReader, PackedWriter, SnapshotReader, SnapshotWriter};
|
||||||
|
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use util::snappy;
|
use snappy;
|
||||||
use util::kvdb::{self, KeyValueDB, DBTransaction};
|
use kvdb::{self, KeyValueDB, DBTransaction};
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::atomic::AtomicBool;
|
use std::sync::atomic::AtomicBool;
|
||||||
|
@ -27,7 +27,7 @@ use tests::helpers::generate_dummy_client_with_spec_and_data;
|
|||||||
|
|
||||||
use devtools::RandomTempPath;
|
use devtools::RandomTempPath;
|
||||||
use io::IoChannel;
|
use io::IoChannel;
|
||||||
use util::kvdb::{Database, DatabaseConfig};
|
use kvdb::{Database, DatabaseConfig};
|
||||||
|
|
||||||
struct NoopDBRestore;
|
struct NoopDBRestore;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ use error::Error;
|
|||||||
use rand::{XorShiftRng, SeedableRng};
|
use rand::{XorShiftRng, SeedableRng};
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::journaldb::{self, Algorithm};
|
use util::journaldb::{self, Algorithm};
|
||||||
use util::kvdb::{Database, DatabaseConfig};
|
use kvdb::{Database, DatabaseConfig};
|
||||||
use memorydb::MemoryDB;
|
use memorydb::MemoryDB;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use devtools::RandomTempPath;
|
use devtools::RandomTempPath;
|
||||||
@ -76,7 +76,7 @@ fn snap_and_restore() {
|
|||||||
|
|
||||||
for chunk_hash in &reader.manifest().state_hashes {
|
for chunk_hash in &reader.manifest().state_hashes {
|
||||||
let raw = reader.chunk(*chunk_hash).unwrap();
|
let raw = reader.chunk(*chunk_hash).unwrap();
|
||||||
let chunk = ::util::snappy::decompress(&raw).unwrap();
|
let chunk = ::snappy::decompress(&raw).unwrap();
|
||||||
|
|
||||||
rebuilder.feed(&chunk, &flag).unwrap();
|
rebuilder.feed(&chunk, &flag).unwrap();
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ fn checks_flag() {
|
|||||||
|
|
||||||
for chunk_hash in &reader.manifest().state_hashes {
|
for chunk_hash in &reader.manifest().state_hashes {
|
||||||
let raw = reader.chunk(*chunk_hash).unwrap();
|
let raw = reader.chunk(*chunk_hash).unwrap();
|
||||||
let chunk = ::util::snappy::decompress(&raw).unwrap();
|
let chunk = ::snappy::decompress(&raw).unwrap();
|
||||||
|
|
||||||
match rebuilder.feed(&chunk, &flag) {
|
match rebuilder.feed(&chunk, &flag) {
|
||||||
Err(Error::Snapshot(SnapshotError::RestorationAborted)) => {},
|
Err(Error::Snapshot(SnapshotError::RestorationAborted)) => {},
|
||||||
|
@ -667,7 +667,8 @@ impl Spec {
|
|||||||
/// constructor.
|
/// constructor.
|
||||||
pub fn genesis_epoch_data(&self) -> Result<Vec<u8>, String> {
|
pub fn genesis_epoch_data(&self) -> Result<Vec<u8>, String> {
|
||||||
use transaction::{Action, Transaction};
|
use transaction::{Action, Transaction};
|
||||||
use util::{journaldb, kvdb};
|
use util::journaldb;
|
||||||
|
use kvdb;
|
||||||
|
|
||||||
let genesis = self.genesis_header();
|
let genesis = self.genesis_header();
|
||||||
|
|
||||||
|
@ -19,14 +19,15 @@ use std::sync::Arc;
|
|||||||
use lru_cache::LruCache;
|
use lru_cache::LruCache;
|
||||||
use util::cache::MemoryLruCache;
|
use util::cache::MemoryLruCache;
|
||||||
use util::journaldb::JournalDB;
|
use util::journaldb::JournalDB;
|
||||||
use util::kvdb::KeyValueDB;
|
use kvdb::{KeyValueDB, DBTransaction};
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use hashdb::HashDB;
|
use hashdb::HashDB;
|
||||||
use state::{self, Account};
|
use state::{self, Account};
|
||||||
use header::BlockNumber;
|
use header::BlockNumber;
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use util::{Address, DBTransaction, UtilError};
|
use util::Address;
|
||||||
|
use util_error::UtilError;
|
||||||
use bloom_journal::{Bloom, BloomJournal};
|
use bloom_journal::{Bloom, BloomJournal};
|
||||||
use db::COL_ACCOUNT_BLOOM;
|
use db::COL_ACCOUNT_BLOOM;
|
||||||
use byteorder::{LittleEndian, ByteOrder};
|
use byteorder::{LittleEndian, ByteOrder};
|
||||||
@ -460,7 +461,8 @@ impl state::Backend for StateDB {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::{Address, DBTransaction};
|
use util::Address;
|
||||||
|
use kvdb::DBTransaction;
|
||||||
use tests::helpers::*;
|
use tests::helpers::*;
|
||||||
use state::{Account, Backend};
|
use state::{Account, Backend};
|
||||||
use ethcore_logger::init_log;
|
use ethcore_logger::init_log;
|
||||||
|
@ -27,6 +27,7 @@ use tests::helpers::*;
|
|||||||
use types::filter::Filter;
|
use types::filter::Filter;
|
||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
use util::*;
|
use util::*;
|
||||||
|
use kvdb::{Database, DatabaseConfig};
|
||||||
use devtools::*;
|
use devtools::*;
|
||||||
use miner::Miner;
|
use miner::Miner;
|
||||||
use spec::Spec;
|
use spec::Spec;
|
||||||
|
@ -231,8 +231,8 @@ pub fn get_test_client_with_blocks(blocks: Vec<Bytes>) -> Arc<Client> {
|
|||||||
client
|
client
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_db() -> Arc<KeyValueDB> {
|
fn new_db() -> Arc<::kvdb::KeyValueDB> {
|
||||||
Arc::new(::util::kvdb::in_memory(::db::NUM_COLUMNS.unwrap_or(0)))
|
Arc::new(::kvdb::in_memory(::db::NUM_COLUMNS.unwrap_or(0)))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn generate_dummy_blockchain(block_number: u32) -> BlockChain {
|
pub fn generate_dummy_blockchain(block_number: u32) -> BlockChain {
|
||||||
|
@ -27,7 +27,7 @@ use client::*;
|
|||||||
use tests::helpers::*;
|
use tests::helpers::*;
|
||||||
use devtools::RandomTempPath;
|
use devtools::RandomTempPath;
|
||||||
use client::{BlockChainClient, Client, ClientConfig};
|
use client::{BlockChainClient, Client, ClientConfig};
|
||||||
use util::kvdb::{Database, DatabaseConfig};
|
use kvdb::{Database, DatabaseConfig};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use header::Header;
|
use header::Header;
|
||||||
use miner::Miner;
|
use miner::Miner;
|
||||||
|
@ -22,7 +22,7 @@ use bloomchain::{Number, Config as BloomConfig};
|
|||||||
use bloomchain::group::{BloomGroupDatabase, BloomGroupChain, GroupPosition, BloomGroup};
|
use bloomchain::group::{BloomGroupDatabase, BloomGroupChain, GroupPosition, BloomGroup};
|
||||||
use heapsize::HeapSizeOf;
|
use heapsize::HeapSizeOf;
|
||||||
use bigint::hash::{H256, H264};
|
use bigint::hash::{H256, H264};
|
||||||
use util::{KeyValueDB, DBTransaction};
|
use kvdb::{KeyValueDB, DBTransaction};
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use header::BlockNumber;
|
use header::BlockNumber;
|
||||||
use trace::{LocalizedTrace, Config, Filter, Database as TraceDatabase, ImportRequest, DatabaseExtras};
|
use trace::{LocalizedTrace, Config, Filter, Database as TraceDatabase, ImportRequest, DatabaseExtras};
|
||||||
@ -415,7 +415,8 @@ mod tests {
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::{Address, DBTransaction};
|
use util::Address;
|
||||||
|
use kvdb::{DBTransaction, in_memory, KeyValueDB};
|
||||||
use header::BlockNumber;
|
use header::BlockNumber;
|
||||||
use trace::{Config, TraceDB, Database as TraceDatabase, DatabaseExtras, ImportRequest};
|
use trace::{Config, TraceDB, Database as TraceDatabase, DatabaseExtras, ImportRequest};
|
||||||
use trace::{Filter, LocalizedTrace, AddressesFilter, TraceError};
|
use trace::{Filter, LocalizedTrace, AddressesFilter, TraceError};
|
||||||
@ -465,8 +466,8 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_db() -> Arc<::util::kvdb::KeyValueDB> {
|
fn new_db() -> Arc<KeyValueDB> {
|
||||||
Arc::new(::util::kvdb::in_memory(::db::NUM_COLUMNS.unwrap_or(0)))
|
Arc::new(in_memory(::db::NUM_COLUMNS.unwrap_or(0)))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -39,7 +39,8 @@ pub use self::types::filter::{Filter, AddressesFilter};
|
|||||||
|
|
||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::{Address, DBTransaction};
|
use util::Address;
|
||||||
|
use kvdb::DBTransaction;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use self::trace::{Call, Create};
|
use self::trace::{Call, Create};
|
||||||
use vm::ActionParams;
|
use vm::ActionParams;
|
||||||
|
@ -178,7 +178,7 @@ mod test {
|
|||||||
"#;
|
"#;
|
||||||
|
|
||||||
let spec = Spec::load(&::std::env::temp_dir(), spec_data.as_bytes()).unwrap();
|
let spec = Spec::load(&::std::env::temp_dir(), spec_data.as_bytes()).unwrap();
|
||||||
let client_db = Arc::new(::util::kvdb::in_memory(::db::NUM_COLUMNS.unwrap_or(0)));
|
let client_db = Arc::new(::kvdb::in_memory(::db::NUM_COLUMNS.unwrap_or(0)));
|
||||||
|
|
||||||
let client = Client::new(
|
let client = Client::new(
|
||||||
ClientConfig::default(),
|
ClientConfig::default(),
|
||||||
|
@ -8,7 +8,8 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
|||||||
ethcore-util = { path = "../util" }
|
ethcore-util = { path = "../util" }
|
||||||
ethcore-io = { path = "../util/io" }
|
ethcore-io = { path = "../util/io" }
|
||||||
ethcore = { path = "../ethcore" }
|
ethcore = { path = "../ethcore" }
|
||||||
rlp = {path = "../util/rlp" }
|
rlp = { path = "../util/rlp" }
|
||||||
|
kvdb = { path = "../util/kvdb" }
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
@ -26,7 +26,7 @@ use ethcore::transaction::{
|
|||||||
use ethcore::service::ClientIoMessage;
|
use ethcore::service::ClientIoMessage;
|
||||||
use io::IoHandler;
|
use io::IoHandler;
|
||||||
use rlp::UntrustedRlp;
|
use rlp::UntrustedRlp;
|
||||||
use util::kvdb::KeyValueDB;
|
use kvdb::KeyValueDB;
|
||||||
|
|
||||||
extern crate ethcore;
|
extern crate ethcore;
|
||||||
extern crate ethcore_util as util;
|
extern crate ethcore_util as util;
|
||||||
@ -34,6 +34,7 @@ extern crate ethcore_io as io;
|
|||||||
extern crate rlp;
|
extern crate rlp;
|
||||||
extern crate serde_json;
|
extern crate serde_json;
|
||||||
extern crate serde;
|
extern crate serde;
|
||||||
|
extern crate kvdb;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate serde_derive;
|
extern crate serde_derive;
|
||||||
@ -242,7 +243,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn twice_empty() {
|
fn twice_empty() {
|
||||||
let db = Arc::new(::util::kvdb::in_memory(0));
|
let db = Arc::new(::kvdb::in_memory(0));
|
||||||
|
|
||||||
{
|
{
|
||||||
let store = super::create(db.clone(), None, Dummy(vec![]));
|
let store = super::create(db.clone(), None, Dummy(vec![]));
|
||||||
@ -271,7 +272,7 @@ mod tests {
|
|||||||
PendingTransaction::new(signed, condition)
|
PendingTransaction::new(signed, condition)
|
||||||
}).collect();
|
}).collect();
|
||||||
|
|
||||||
let db = Arc::new(::util::kvdb::in_memory(0));
|
let db = Arc::new(::kvdb::in_memory(0));
|
||||||
|
|
||||||
{
|
{
|
||||||
// nothing written yet, will write pending.
|
// nothing written yet, will write pending.
|
||||||
@ -310,7 +311,7 @@ mod tests {
|
|||||||
PendingTransaction::new(signed, None)
|
PendingTransaction::new(signed, None)
|
||||||
});
|
});
|
||||||
|
|
||||||
let db = Arc::new(::util::kvdb::in_memory(0));
|
let db = Arc::new(::kvdb::in_memory(0));
|
||||||
{
|
{
|
||||||
// nothing written, will write bad.
|
// nothing written, will write bad.
|
||||||
let store = super::create(db.clone(), None, Dummy(transactions.clone()));
|
let store = super::create(db.clone(), None, Dummy(transactions.clone()));
|
||||||
|
@ -20,7 +20,8 @@ use std::time::Duration;
|
|||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
use bigint::hash::clean_0x;
|
use bigint::hash::clean_0x;
|
||||||
use util::{Address, CompactionProfile};
|
use util::Address;
|
||||||
|
use kvdb::CompactionProfile;
|
||||||
use util::journaldb::Algorithm;
|
use util::journaldb::Algorithm;
|
||||||
use ethcore::client::{Mode, BlockId, VMType, DatabaseCompactionProfile, ClientConfig, VerifierType};
|
use ethcore::client::{Mode, BlockId, VMType, DatabaseCompactionProfile, ClientConfig, VerifierType};
|
||||||
use ethcore::miner::{PendingSet, GasLimit, PrioritizationStrategy};
|
use ethcore::miner::{PendingSet, GasLimit, PrioritizationStrategy};
|
||||||
|
@ -61,6 +61,8 @@ extern crate ethcore_util as util;
|
|||||||
extern crate ethcore_bigint as bigint;
|
extern crate ethcore_bigint as bigint;
|
||||||
extern crate ethcore_bytes as bytes;
|
extern crate ethcore_bytes as bytes;
|
||||||
extern crate ethcore_network as network;
|
extern crate ethcore_network as network;
|
||||||
|
extern crate migration as migr;
|
||||||
|
extern crate kvdb;
|
||||||
extern crate ethkey;
|
extern crate ethkey;
|
||||||
extern crate ethsync;
|
extern crate ethsync;
|
||||||
extern crate node_health;
|
extern crate node_health;
|
||||||
|
@ -21,8 +21,8 @@ use std::path::{Path, PathBuf};
|
|||||||
use std::fmt::{Display, Formatter, Error as FmtError};
|
use std::fmt::{Display, Formatter, Error as FmtError};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use util::journaldb::Algorithm;
|
use util::journaldb::Algorithm;
|
||||||
use util::migration::{Manager as MigrationManager, Config as MigrationConfig, Error as MigrationError, Migration};
|
use migr::{Manager as MigrationManager, Config as MigrationConfig, Error as MigrationError, Migration};
|
||||||
use util::kvdb::{CompactionProfile, Database, DatabaseConfig};
|
use kvdb::{CompactionProfile, Database, DatabaseConfig};
|
||||||
use ethcore::migrations;
|
use ethcore::migrations;
|
||||||
use ethcore::db;
|
use ethcore::db;
|
||||||
use ethcore::migrations::Extract;
|
use ethcore::migrations::Extract;
|
||||||
@ -282,8 +282,8 @@ mod legacy {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use util::journaldb::Algorithm;
|
use util::journaldb::Algorithm;
|
||||||
use util::migration::{Manager as MigrationManager};
|
use migr::{Manager as MigrationManager};
|
||||||
use util::kvdb::CompactionProfile;
|
use kvdb::CompactionProfile;
|
||||||
use ethcore::migrations;
|
use ethcore::migrations;
|
||||||
|
|
||||||
/// Blocks database path.
|
/// Blocks database path.
|
||||||
|
@ -57,12 +57,14 @@ rlp = { path = "../util/rlp" }
|
|||||||
stats = { path = "../util/stats" }
|
stats = { path = "../util/stats" }
|
||||||
vm = { path = "../ethcore/vm" }
|
vm = { path = "../ethcore/vm" }
|
||||||
hash = { path = "../util/hash" }
|
hash = { path = "../util/hash" }
|
||||||
|
kvdb = { path = "../util/kvdb" }
|
||||||
hardware-wallet = { path = "../hw" }
|
hardware-wallet = { path = "../hw" }
|
||||||
|
|
||||||
clippy = { version = "0.0.103", optional = true}
|
clippy = { version = "0.0.103", optional = true}
|
||||||
pretty_assertions = "0.1"
|
pretty_assertions = "0.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
macros = { path = "../util/macros" }
|
||||||
ethcore-network = { path = "../util/network" }
|
ethcore-network = { path = "../util/network" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -50,6 +50,7 @@ extern crate ethcore_devtools as devtools;
|
|||||||
extern crate ethcore_io as io;
|
extern crate ethcore_io as io;
|
||||||
extern crate ethcore_ipc;
|
extern crate ethcore_ipc;
|
||||||
extern crate ethcore_light as light;
|
extern crate ethcore_light as light;
|
||||||
|
extern crate ethcore_util as util;
|
||||||
extern crate ethcrypto as crypto;
|
extern crate ethcrypto as crypto;
|
||||||
extern crate ethkey;
|
extern crate ethkey;
|
||||||
extern crate ethstore;
|
extern crate ethstore;
|
||||||
@ -64,11 +65,10 @@ extern crate rlp;
|
|||||||
extern crate stats;
|
extern crate stats;
|
||||||
extern crate hash;
|
extern crate hash;
|
||||||
extern crate hardware_wallet;
|
extern crate hardware_wallet;
|
||||||
|
extern crate kvdb;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
#[cfg_attr(test, macro_use)]
|
|
||||||
extern crate ethcore_util as util;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate jsonrpc_macros;
|
extern crate jsonrpc_macros;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
@ -81,6 +81,10 @@ extern crate ethjson;
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate pretty_assertions;
|
extern crate pretty_assertions;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
#[macro_use]
|
||||||
|
extern crate macros;
|
||||||
|
|
||||||
pub extern crate jsonrpc_ws_server as ws;
|
pub extern crate jsonrpc_ws_server as ws;
|
||||||
|
|
||||||
mod authcodes;
|
mod authcodes;
|
||||||
|
@ -33,6 +33,7 @@ use io::IoChannel;
|
|||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::Address;
|
use util::Address;
|
||||||
|
use kvdb::in_memory;
|
||||||
|
|
||||||
use jsonrpc_core::IoHandler;
|
use jsonrpc_core::IoHandler;
|
||||||
use v1::impls::{EthClient, SigningUnsafeClient};
|
use v1::impls::{EthClient, SigningUnsafeClient};
|
||||||
@ -130,7 +131,7 @@ impl EthTester {
|
|||||||
let client = Client::new(
|
let client = Client::new(
|
||||||
ClientConfig::default(),
|
ClientConfig::default(),
|
||||||
&spec,
|
&spec,
|
||||||
Arc::new(::util::kvdb::in_memory(::ethcore::db::NUM_COLUMNS.unwrap_or(0))),
|
Arc::new(in_memory(::ethcore::db::NUM_COLUMNS.unwrap_or(0))),
|
||||||
miner_service.clone(),
|
miner_service.clone(),
|
||||||
IoChannel::disconnected(),
|
IoChannel::disconnected(),
|
||||||
).unwrap();
|
).unwrap();
|
||||||
|
@ -32,6 +32,7 @@ ethcore-bytes = { path = "../util/bytes" }
|
|||||||
ethcore-devtools = { path = "../devtools" }
|
ethcore-devtools = { path = "../devtools" }
|
||||||
ethcore-util = { path = "../util" }
|
ethcore-util = { path = "../util" }
|
||||||
ethcore-bigint = { path = "../util/bigint" }
|
ethcore-bigint = { path = "../util/bigint" }
|
||||||
|
kvdb = { path = "../util/kvdb" }
|
||||||
hash = { path = "../util/hash" }
|
hash = { path = "../util/hash" }
|
||||||
ethcore-ipc = { path = "../ipc/rpc" }
|
ethcore-ipc = { path = "../ipc/rpc" }
|
||||||
ethcore-ipc-nano = { path = "../ipc/nano" }
|
ethcore-ipc-nano = { path = "../ipc/nano" }
|
||||||
|
@ -18,7 +18,7 @@ use std::path::PathBuf;
|
|||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use ethkey::{Secret, Public};
|
use ethkey::{Secret, Public};
|
||||||
use util::{Database, DatabaseIterator};
|
use kvdb::{Database, DatabaseIterator};
|
||||||
use types::all::{Error, ServiceConfiguration, ServerKeyId, NodeId};
|
use types::all::{Error, ServiceConfiguration, ServerKeyId, NodeId};
|
||||||
use serialization::{SerializablePublic, SerializableSecret};
|
use serialization::{SerializablePublic, SerializableSecret};
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ fn upgrade_db(db: Database) -> Result<Database, Error> {
|
|||||||
let v2_key = CurrentSerializableDocumentKeyShare {
|
let v2_key = CurrentSerializableDocumentKeyShare {
|
||||||
// author is used in separate generation + encrypt sessions.
|
// author is used in separate generation + encrypt sessions.
|
||||||
// in v0 there have been only simultaneous GenEnc sessions.
|
// in v0 there have been only simultaneous GenEnc sessions.
|
||||||
author: Public::default().into(), // added in v1
|
author: Public::default().into(), // added in v1
|
||||||
threshold: v0_key.threshold,
|
threshold: v0_key.threshold,
|
||||||
id_numbers: v0_key.id_numbers,
|
id_numbers: v0_key.id_numbers,
|
||||||
secret_share: v0_key.secret_share,
|
secret_share: v0_key.secret_share,
|
||||||
@ -293,7 +293,7 @@ pub mod tests {
|
|||||||
use serde_json;
|
use serde_json;
|
||||||
use devtools::RandomTempPath;
|
use devtools::RandomTempPath;
|
||||||
use ethkey::{Random, Generator, Public, Secret};
|
use ethkey::{Random, Generator, Public, Secret};
|
||||||
use util::Database;
|
use kvdb::Database;
|
||||||
use types::all::{Error, NodeAddress, ServiceConfiguration, ClusterConfiguration, ServerKeyId};
|
use types::all::{Error, NodeAddress, ServiceConfiguration, ClusterConfiguration, ServerKeyId};
|
||||||
use super::{DB_META_KEY_VERSION, CURRENT_VERSION, KeyStorage, PersistentKeyStorage, DocumentKeyShare,
|
use super::{DB_META_KEY_VERSION, CURRENT_VERSION, KeyStorage, PersistentKeyStorage, DocumentKeyShare,
|
||||||
SerializableDocumentKeyShareV0, SerializableDocumentKeyShareV1,
|
SerializableDocumentKeyShareV0, SerializableDocumentKeyShareV1,
|
||||||
@ -352,7 +352,7 @@ pub mod tests {
|
|||||||
admin_public: None,
|
admin_public: None,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let key1 = ServerKeyId::from(1);
|
let key1 = ServerKeyId::from(1);
|
||||||
let value1 = DocumentKeyShare {
|
let value1 = DocumentKeyShare {
|
||||||
author: Public::default(),
|
author: Public::default(),
|
||||||
|
@ -48,6 +48,7 @@ extern crate ethcrypto;
|
|||||||
extern crate ethkey;
|
extern crate ethkey;
|
||||||
extern crate native_contracts;
|
extern crate native_contracts;
|
||||||
extern crate hash;
|
extern crate hash;
|
||||||
|
extern crate kvdb;
|
||||||
|
|
||||||
mod key_server_cluster;
|
mod key_server_cluster;
|
||||||
mod types;
|
mod types;
|
||||||
|
@ -22,6 +22,8 @@ ethcore = { path = "../ethcore" }
|
|||||||
rlp = { path = "../util/rlp" }
|
rlp = { path = "../util/rlp" }
|
||||||
hash = { path = "../util/hash" }
|
hash = { path = "../util/hash" }
|
||||||
triehash = { path = "../util/triehash" }
|
triehash = { path = "../util/triehash" }
|
||||||
|
kvdb = { path = "../util/kvdb" }
|
||||||
|
macros = { path = "../util/macros" }
|
||||||
clippy = { version = "0.0.103", optional = true}
|
clippy = { version = "0.0.103", optional = true}
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
env_logger = "0.4"
|
env_logger = "0.4"
|
||||||
|
@ -21,7 +21,6 @@ use hash::{keccak, KECCAK_NULL_RLP, KECCAK_EMPTY_LIST_RLP};
|
|||||||
use heapsize::HeapSizeOf;
|
use heapsize::HeapSizeOf;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use triehash::ordered_trie_root;
|
use triehash::ordered_trie_root;
|
||||||
use util::*;
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use rlp::*;
|
use rlp::*;
|
||||||
use network::NetworkError;
|
use network::NetworkError;
|
||||||
@ -406,7 +405,7 @@ impl BlockCollection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn insert_header(&mut self, header: Bytes) -> Result<H256, UtilError> {
|
fn insert_header(&mut self, header: Bytes) -> Result<H256, DecoderError> {
|
||||||
let info: BlockHeader = UntrustedRlp::new(&header).as_val()?;
|
let info: BlockHeader = UntrustedRlp::new(&header).as_val()?;
|
||||||
let hash = info.hash();
|
let hash = info.hash();
|
||||||
if self.blocks.contains_key(&hash) {
|
if self.blocks.contains_key(&hash) {
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
///
|
|
||||||
/// `BlockChain` synchronization strategy.
|
/// `BlockChain` synchronization strategy.
|
||||||
/// Syncs to peers and keeps up to date.
|
/// Syncs to peers and keeps up to date.
|
||||||
/// This implementation uses ethereum protocol v63
|
/// This implementation uses ethereum protocol v63
|
||||||
@ -2230,19 +2229,18 @@ fn accepts_service_transaction(client_id: &str) -> bool {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::collections::{HashSet, VecDeque};
|
use std::collections::{HashSet, VecDeque};
|
||||||
|
use {ethkey, Address};
|
||||||
use network::PeerId;
|
use network::PeerId;
|
||||||
use tests::helpers::*;
|
use tests::helpers::*;
|
||||||
use tests::snapshot::TestSnapshotService;
|
use tests::snapshot::TestSnapshotService;
|
||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::Address;
|
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use rlp::{Rlp, RlpStream, UntrustedRlp};
|
use rlp::{Rlp, RlpStream, UntrustedRlp};
|
||||||
use super::*;
|
use super::*;
|
||||||
use ::SyncConfig;
|
use ::SyncConfig;
|
||||||
use super::{PeerInfo, PeerAsking};
|
use super::{PeerInfo, PeerAsking};
|
||||||
use ethkey;
|
|
||||||
use ethcore::header::*;
|
use ethcore::header::*;
|
||||||
use ethcore::client::{BlockChainClient, EachBlockWith, TestBlockChainClient};
|
use ethcore::client::{BlockChainClient, EachBlockWith, TestBlockChainClient};
|
||||||
use ethcore::transaction::UnverifiedTransaction;
|
use ethcore::transaction::UnverifiedTransaction;
|
||||||
|
@ -42,6 +42,7 @@ extern crate rlp;
|
|||||||
extern crate ipnetwork;
|
extern crate ipnetwork;
|
||||||
extern crate hash;
|
extern crate hash;
|
||||||
extern crate triehash;
|
extern crate triehash;
|
||||||
|
extern crate kvdb;
|
||||||
|
|
||||||
extern crate ethcore_light as light;
|
extern crate ethcore_light as light;
|
||||||
|
|
||||||
@ -49,9 +50,9 @@ extern crate ethcore_light as light;
|
|||||||
#[cfg(test)] extern crate ethkey;
|
#[cfg(test)] extern crate ethkey;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate macros;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate ethcore_util as util;
|
extern crate log;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate heapsize;
|
extern crate heapsize;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
@ -82,6 +83,9 @@ pub use api::*;
|
|||||||
pub use chain::{SyncStatus, SyncState};
|
pub use chain::{SyncStatus, SyncState};
|
||||||
pub use network::{is_valid_node_url, NonReservedPeerMode, NetworkError, ConnectionFilter, ConnectionDirection};
|
pub use network::{is_valid_node_url, NonReservedPeerMode, NetworkError, ConnectionFilter, ConnectionDirection};
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
pub(crate) type Address = bigint::hash::H160;
|
||||||
|
|
||||||
/// IPC interfaces
|
/// IPC interfaces
|
||||||
#[cfg(feature="ipc")]
|
#[cfg(feature="ipc")]
|
||||||
pub mod remote {
|
pub mod remote {
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
use util::*;
|
|
||||||
use io::{IoHandler, IoContext, IoChannel};
|
use io::{IoHandler, IoContext, IoChannel};
|
||||||
use ethcore::client::{BlockChainClient, Client};
|
use ethcore::client::{BlockChainClient, Client};
|
||||||
use ethcore::service::ClientIoMessage;
|
use ethcore::service::ClientIoMessage;
|
||||||
@ -27,7 +26,7 @@ use ethcore::transaction::*;
|
|||||||
use ethcore::account_provider::AccountProvider;
|
use ethcore::account_provider::AccountProvider;
|
||||||
use ethkey::{KeyPair, Secret};
|
use ethkey::{KeyPair, Secret};
|
||||||
use super::helpers::*;
|
use super::helpers::*;
|
||||||
use SyncConfig;
|
use {SyncConfig, Address};
|
||||||
|
|
||||||
struct TestIoHandler {
|
struct TestIoHandler {
|
||||||
client: Arc<Client>,
|
client: Arc<Client>,
|
||||||
|
@ -291,7 +291,7 @@ impl TestNet<EthPeer<EthcoreClient>> {
|
|||||||
let client = EthcoreClient::new(
|
let client = EthcoreClient::new(
|
||||||
ClientConfig::default(),
|
ClientConfig::default(),
|
||||||
&spec,
|
&spec,
|
||||||
Arc::new(::util::kvdb::in_memory(::ethcore::db::NUM_COLUMNS.unwrap_or(0))),
|
Arc::new(::kvdb::in_memory(::ethcore::db::NUM_COLUMNS.unwrap_or(0))),
|
||||||
Arc::new(Miner::with_spec_and_accounts(&spec, accounts)),
|
Arc::new(Miner::with_spec_and_accounts(&spec, accounts)),
|
||||||
IoChannel::disconnected(),
|
IoChannel::disconnected(),
|
||||||
).unwrap();
|
).unwrap();
|
||||||
|
@ -24,18 +24,16 @@ target_info = "0.1"
|
|||||||
ethcore-bigint = { path = "bigint", features = ["heapsizeof"] }
|
ethcore-bigint = { path = "bigint", features = ["heapsizeof"] }
|
||||||
parking_lot = "0.4"
|
parking_lot = "0.4"
|
||||||
tiny-keccak= "1.0"
|
tiny-keccak= "1.0"
|
||||||
ethcore-bloom-journal = { path = "bloom" }
|
|
||||||
regex = "0.2"
|
|
||||||
lru-cache = "0.1.0"
|
lru-cache = "0.1.0"
|
||||||
ethcore-logger = { path = "../logger" }
|
ethcore-logger = { path = "../logger" }
|
||||||
triehash = { path = "triehash" }
|
triehash = { path = "triehash" }
|
||||||
error-chain = "0.11.0-rc.2"
|
error-chain = "0.11.0-rc.2"
|
||||||
hashdb = { path = "hashdb" }
|
hashdb = { path = "hashdb" }
|
||||||
patricia_trie = { path = "patricia_trie" }
|
patricia_trie = { path = "patricia_trie" }
|
||||||
nibbleslice = { path = "nibbleslice" }
|
|
||||||
nibblevec = { path = "nibblevec" }
|
|
||||||
ethcore-bytes = { path = "bytes" }
|
ethcore-bytes = { path = "bytes" }
|
||||||
memorydb = { path = "memorydb" }
|
memorydb = { path = "memorydb" }
|
||||||
|
util-error = { path = "error" }
|
||||||
|
kvdb = { path = "kvdb" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
10
util/error/Cargo.toml
Normal file
10
util/error/Cargo.toml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[package]
|
||||||
|
name = "util-error"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
rlp = { path = "../rlp" }
|
||||||
|
ethcore-bigint = { path = "../bigint" }
|
||||||
|
error-chain = "0.11.0-rc.2"
|
||||||
|
rustc-hex = "1.0"
|
@ -19,7 +19,14 @@
|
|||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
#![allow(unknown_lints)]
|
#![allow(unknown_lints)]
|
||||||
|
|
||||||
use std::{self, fmt};
|
#[macro_use]
|
||||||
|
extern crate error_chain;
|
||||||
|
|
||||||
|
extern crate ethcore_bigint as bigint;
|
||||||
|
extern crate rlp;
|
||||||
|
extern crate rustc_hex;
|
||||||
|
|
||||||
|
use std::fmt;
|
||||||
use rustc_hex::FromHexError;
|
use rustc_hex::FromHexError;
|
||||||
use rlp::DecoderError;
|
use rlp::DecoderError;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
@ -59,7 +66,6 @@ error_chain! {
|
|||||||
Io(::std::io::Error);
|
Io(::std::io::Error);
|
||||||
FromHex(FromHexError);
|
FromHex(FromHexError);
|
||||||
Decoder(DecoderError);
|
Decoder(DecoderError);
|
||||||
Snappy(::snappy::InvalidInput);
|
|
||||||
BaseData(BaseDataError);
|
BaseData(BaseDataError);
|
||||||
}
|
}
|
||||||
}
|
}
|
17
util/kvdb/Cargo.toml
Normal file
17
util/kvdb/Cargo.toml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
[package]
|
||||||
|
name = "kvdb"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
log = "0.3"
|
||||||
|
ethcore-bytes = { path = "../bytes" }
|
||||||
|
ethcore-bigint = { path = "../bigint" }
|
||||||
|
ethcore-devtools = { path = "../../devtools" }
|
||||||
|
elastic-array = "0.9"
|
||||||
|
hashdb = { path = "../hashdb" }
|
||||||
|
parking_lot = "0.4"
|
||||||
|
regex = "0.2"
|
||||||
|
rlp = { path = "../rlp" }
|
||||||
|
rocksdb = { git = "https://github.com/paritytech/rust-rocksdb" }
|
||||||
|
error-chain = "0.11.0-rc.2"
|
@ -16,9 +16,23 @@
|
|||||||
|
|
||||||
//! Key-Value store abstraction with `RocksDB` backend.
|
//! Key-Value store abstraction with `RocksDB` backend.
|
||||||
|
|
||||||
use std::{mem, fs};
|
#[macro_use]
|
||||||
|
extern crate log;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate error_chain;
|
||||||
|
|
||||||
|
extern crate ethcore_bytes as bytes;
|
||||||
|
extern crate ethcore_bigint as bigint;
|
||||||
|
extern crate ethcore_devtools as devtools;
|
||||||
|
extern crate elastic_array;
|
||||||
|
extern crate hashdb;
|
||||||
|
extern crate parking_lot;
|
||||||
|
extern crate rlp;
|
||||||
|
extern crate rocksdb;
|
||||||
|
extern crate regex;
|
||||||
|
|
||||||
|
use std::{mem, fs, io};
|
||||||
use std::collections::{HashMap, BTreeMap};
|
use std::collections::{HashMap, BTreeMap};
|
||||||
use std::io::ErrorKind;
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::path::{PathBuf, Path};
|
use std::path::{PathBuf, Path};
|
||||||
use parking_lot::{Mutex, MutexGuard, RwLock};
|
use parking_lot::{Mutex, MutexGuard, RwLock};
|
||||||
@ -28,10 +42,8 @@ use hashdb::DBValue;
|
|||||||
use rlp::{UntrustedRlp, RlpType, Compressible};
|
use rlp::{UntrustedRlp, RlpType, Compressible};
|
||||||
use rocksdb::{DB, Writable, WriteBatch, WriteOptions, IteratorMode, DBIterator,
|
use rocksdb::{DB, Writable, WriteBatch, WriteOptions, IteratorMode, DBIterator,
|
||||||
Options, DBCompactionStyle, BlockBasedOptions, Direction, Cache, Column, ReadOptions};
|
Options, DBCompactionStyle, BlockBasedOptions, Direction, Cache, Column, ReadOptions};
|
||||||
use UtilError;
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
|
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
@ -46,6 +58,16 @@ const DB_WRITE_BUFFER_SIZE: usize = 2048 * 1000;
|
|||||||
/// Required length of prefixes.
|
/// Required length of prefixes.
|
||||||
pub const PREFIX_LEN: usize = 12;
|
pub const PREFIX_LEN: usize = 12;
|
||||||
|
|
||||||
|
error_chain! {
|
||||||
|
types {
|
||||||
|
Error, ErrorKind, ResultExt;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreign_links {
|
||||||
|
Io(io::Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Write transaction. Batches a sequence of put/delete operations for efficiency.
|
/// Write transaction. Batches a sequence of put/delete operations for efficiency.
|
||||||
#[derive(Default, Clone, PartialEq)]
|
#[derive(Default, Clone, PartialEq)]
|
||||||
pub struct DBTransaction {
|
pub struct DBTransaction {
|
||||||
@ -182,7 +204,7 @@ pub trait KeyValueDB: Sync + Send {
|
|||||||
-> Box<Iterator<Item=(Box<[u8]>, Box<[u8]>)> + 'a>;
|
-> Box<Iterator<Item=(Box<[u8]>, Box<[u8]>)> + 'a>;
|
||||||
|
|
||||||
/// Attempt to replace this database with a new one located at the given path.
|
/// Attempt to replace this database with a new one located at the given path.
|
||||||
fn restore(&self, new_db: &str) -> Result<(), UtilError>;
|
fn restore(&self, new_db: &str) -> Result<(), Error>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A key-value database fulfilling the `KeyValueDB` trait, living in memory.
|
/// A key-value database fulfilling the `KeyValueDB` trait, living in memory.
|
||||||
@ -279,7 +301,7 @@ impl KeyValueDB for InMemory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn restore(&self, _new_db: &str) -> Result<(), UtilError> {
|
fn restore(&self, _new_db: &str) -> Result<(), Error> {
|
||||||
Err("Attempted to restore in-memory database".into())
|
Err("Attempted to restore in-memory database".into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -777,7 +799,7 @@ impl Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Restore the database from a copy at given path.
|
/// Restore the database from a copy at given path.
|
||||||
pub fn restore(&self, new_db: &str) -> Result<(), UtilError> {
|
pub fn restore(&self, new_db: &str) -> Result<(), Error> {
|
||||||
self.close();
|
self.close();
|
||||||
|
|
||||||
let mut backup_db = PathBuf::from(&self.path);
|
let mut backup_db = PathBuf::from(&self.path);
|
||||||
@ -786,7 +808,7 @@ impl Database {
|
|||||||
|
|
||||||
let existed = match fs::rename(&self.path, &backup_db) {
|
let existed = match fs::rename(&self.path, &backup_db) {
|
||||||
Ok(_) => true,
|
Ok(_) => true,
|
||||||
Err(e) => if let ErrorKind::NotFound = e.kind() {
|
Err(e) => if let io::ErrorKind::NotFound = e.kind() {
|
||||||
false
|
false
|
||||||
} else {
|
} else {
|
||||||
return Err(e.into());
|
return Err(e.into());
|
||||||
@ -889,7 +911,7 @@ impl KeyValueDB for Database {
|
|||||||
Box::new(unboxed.into_iter().flat_map(|inner| inner))
|
Box::new(unboxed.into_iter().flat_map(|inner| inner))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn restore(&self, new_db: &str) -> Result<(), UtilError> {
|
fn restore(&self, new_db: &str) -> Result<(), Error> {
|
||||||
Database::restore(self, new_db)
|
Database::restore(self, new_db)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nibbleslice"
|
name = "macros"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
elastic-array = "0.9"
|
|
@ -82,8 +82,8 @@ macro_rules! map_into {
|
|||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! flush {
|
macro_rules! flush {
|
||||||
($arg:expr) => ($crate::common::flush($arg.into()));
|
($arg:expr) => ($crate::flush($arg.into()));
|
||||||
($($arg:tt)*) => ($crate::common::flush(format!("{}", format_args!($($arg)*))));
|
($($arg:tt)*) => ($crate::flush(format!("{}", format_args!($($arg)*))));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
10
util/migration/Cargo.toml
Normal file
10
util/migration/Cargo.toml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[package]
|
||||||
|
name = "migration"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
log = "0.3"
|
||||||
|
macros = { path = "../macros" }
|
||||||
|
kvdb = { path = "../kvdb" }
|
||||||
|
ethcore-devtools = { path = "../../devtools" }
|
@ -18,13 +18,21 @@
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
extern crate log;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate macros;
|
||||||
|
|
||||||
|
extern crate ethcore_devtools as devtools;
|
||||||
|
extern crate kvdb;
|
||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use ::kvdb::{CompactionProfile, Database, DatabaseConfig, DBTransaction};
|
use kvdb::{CompactionProfile, Database, DatabaseConfig, DBTransaction};
|
||||||
|
|
||||||
/// Migration config.
|
/// Migration config.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
@ -21,7 +21,7 @@
|
|||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use migration::{Batch, Config, Error, SimpleMigration, Migration, Manager};
|
use {Batch, Config, Error, SimpleMigration, Migration, Manager, ChangeColumns};
|
||||||
use kvdb::Database;
|
use kvdb::Database;
|
||||||
use devtools::RandomTempPath;
|
use devtools::RandomTempPath;
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ fn change_columns() {
|
|||||||
use kvdb::DatabaseConfig;
|
use kvdb::DatabaseConfig;
|
||||||
|
|
||||||
let mut manager = Manager::new(Config::default());
|
let mut manager = Manager::new(Config::default());
|
||||||
manager.add_migration(::migration::ChangeColumns {
|
manager.add_migration(ChangeColumns {
|
||||||
pre_columns: None,
|
pre_columns: None,
|
||||||
post_columns: Some(4),
|
post_columns: Some(4),
|
||||||
version: 1,
|
version: 1,
|
@ -12,8 +12,6 @@ ethcore-bigint = { path = "../bigint" }
|
|||||||
hash = { path = "../hash" }
|
hash = { path = "../hash" }
|
||||||
hashdb = { path = "../hashdb" }
|
hashdb = { path = "../hashdb" }
|
||||||
rlp = { path = "../rlp" }
|
rlp = { path = "../rlp" }
|
||||||
nibbleslice = { path = "../nibbleslice" }
|
|
||||||
nibblevec = { path = "../nibblevec" }
|
|
||||||
triehash = { path = "../triehash" }
|
triehash = { path = "../triehash" }
|
||||||
memorydb = { path = "../memorydb" }
|
memorydb = { path = "../memorydb" }
|
||||||
ethcore-logger = { path = "../../logger" }
|
ethcore-logger = { path = "../../logger" }
|
||||||
|
@ -21,8 +21,6 @@ extern crate hash as keccak;
|
|||||||
extern crate rlp;
|
extern crate rlp;
|
||||||
extern crate hashdb;
|
extern crate hashdb;
|
||||||
extern crate ethcore_bytes as bytes;
|
extern crate ethcore_bytes as bytes;
|
||||||
extern crate nibbleslice;
|
|
||||||
extern crate nibblevec;
|
|
||||||
extern crate elastic_array;
|
extern crate elastic_array;
|
||||||
extern crate memorydb;
|
extern crate memorydb;
|
||||||
extern crate ethcore_logger;
|
extern crate ethcore_logger;
|
||||||
@ -54,6 +52,8 @@ pub mod recorder;
|
|||||||
mod fatdb;
|
mod fatdb;
|
||||||
mod fatdbmut;
|
mod fatdbmut;
|
||||||
mod lookup;
|
mod lookup;
|
||||||
|
mod nibbleslice;
|
||||||
|
mod nibblevec;
|
||||||
|
|
||||||
pub use self::standardmap::{Alphabet, StandardMap, ValueMode};
|
pub use self::standardmap::{Alphabet, StandardMap, ValueMode};
|
||||||
pub use self::triedbmut::TrieDBMut;
|
pub use self::triedbmut::TrieDBMut;
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! Nibble-orientated view onto byte-slice, allowing nibble-precision offsets.
|
//! Nibble-orientated view onto byte-slice, allowing nibble-precision offsets.
|
||||||
extern crate elastic_array;
|
|
||||||
|
|
||||||
use std::cmp::*;
|
use std::cmp::*;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
@ -26,9 +25,8 @@ use elastic_array::ElasticArray36;
|
|||||||
/// This is an immutable struct. No operations actually change it.
|
/// This is an immutable struct. No operations actually change it.
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
/// ```rust
|
/// ```snippet
|
||||||
/// extern crate nibbleslice;
|
/// use patricia_trie::nibbleslice::NibbleSlice;
|
||||||
/// use nibbleslice::*;
|
|
||||||
/// fn main() {
|
/// fn main() {
|
||||||
/// let d1 = &[0x01u8, 0x23, 0x45];
|
/// let d1 = &[0x01u8, 0x23, 0x45];
|
||||||
/// let d2 = &[0x34u8, 0x50, 0x12];
|
/// let d2 = &[0x34u8, 0x50, 0x12];
|
@ -14,13 +14,9 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
//! An owning, nibble-oriented byte vector.
|
//! An owning, nibble-oriented byte vector.
|
||||||
extern crate nibbleslice;
|
|
||||||
extern crate elastic_array;
|
|
||||||
|
|
||||||
use nibbleslice::NibbleSlice;
|
|
||||||
use elastic_array::ElasticArray36;
|
use elastic_array::ElasticArray36;
|
||||||
|
use nibbleslice::NibbleSlice;
|
||||||
|
|
||||||
/// Owning, nibble-oriented byte vector. Counterpart to `NibbleSlice`.
|
/// Owning, nibble-oriented byte vector. Counterpart to `NibbleSlice`.
|
||||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
@ -15,7 +15,7 @@
|
|||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use elastic_array::ElasticArray36;
|
use elastic_array::ElasticArray36;
|
||||||
use nibbleslice::*;
|
use nibbleslice::NibbleSlice;
|
||||||
use nibblevec::NibbleVec;
|
use nibblevec::NibbleVec;
|
||||||
use bytes::*;
|
use bytes::*;
|
||||||
use rlp::*;
|
use rlp::*;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use hashdb::*;
|
use hashdb::*;
|
||||||
use nibbleslice::*;
|
use nibbleslice::NibbleSlice;
|
||||||
use rlp::*;
|
use rlp::*;
|
||||||
use super::node::{Node, OwnedNode};
|
use super::node::{Node, OwnedNode};
|
||||||
use super::lookup::Lookup;
|
use super::lookup::Lookup;
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nibblevec"
|
name = "snappy"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
elastic-array = "0.9"
|
libc = "0.2.7"
|
||||||
nibbleslice = { path = "../nibbleslice" }
|
|
@ -15,8 +15,9 @@
|
|||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! Snappy compression bindings.
|
//! Snappy compression bindings.
|
||||||
|
extern crate libc;
|
||||||
|
|
||||||
use std::{self, fmt};
|
use std::fmt;
|
||||||
use libc::{c_char, c_int, size_t};
|
use libc::{c_char, c_int, size_t};
|
||||||
|
|
||||||
const SNAPPY_OK: c_int = 0;
|
const SNAPPY_OK: c_int = 0;
|
@ -20,7 +20,7 @@ use std::{fmt, str};
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
/// Export the journaldb module.
|
/// Export the journaldb module.
|
||||||
pub mod traits;
|
mod traits;
|
||||||
mod archivedb;
|
mod archivedb;
|
||||||
mod earlymergedb;
|
mod earlymergedb;
|
||||||
mod overlayrecentdb;
|
mod overlayrecentdb;
|
||||||
|
@ -27,7 +27,7 @@ use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
|
|||||||
use super::traits::JournalDB;
|
use super::traits::JournalDB;
|
||||||
use kvdb::{KeyValueDB, DBTransaction};
|
use kvdb::{KeyValueDB, DBTransaction};
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use UtilError;
|
use error::UtilError;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
|
|
||||||
/// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay
|
/// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay
|
||||||
|
@ -20,7 +20,7 @@ use std::sync::Arc;
|
|||||||
use hashdb::*;
|
use hashdb::*;
|
||||||
use kvdb::{self, DBTransaction};
|
use kvdb::{self, DBTransaction};
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use UtilError;
|
use error::UtilError;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
|
|
||||||
/// A `HashDB` which can manage a short-term journal potentially containing many forks of mutually
|
/// A `HashDB` which can manage a short-term journal potentially containing many forks of mutually
|
||||||
|
@ -100,7 +100,6 @@ extern crate ethcore_bytes as bytes;
|
|||||||
extern crate parking_lot;
|
extern crate parking_lot;
|
||||||
extern crate tiny_keccak;
|
extern crate tiny_keccak;
|
||||||
extern crate rlp;
|
extern crate rlp;
|
||||||
extern crate regex;
|
|
||||||
extern crate lru_cache;
|
extern crate lru_cache;
|
||||||
extern crate heapsize;
|
extern crate heapsize;
|
||||||
extern crate ethcore_logger;
|
extern crate ethcore_logger;
|
||||||
@ -108,22 +107,15 @@ extern crate hash as keccak;
|
|||||||
extern crate hashdb;
|
extern crate hashdb;
|
||||||
extern crate memorydb;
|
extern crate memorydb;
|
||||||
extern crate patricia_trie as trie;
|
extern crate patricia_trie as trie;
|
||||||
|
extern crate kvdb;
|
||||||
#[macro_use]
|
extern crate util_error as error;
|
||||||
extern crate error_chain;
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log as rlog;
|
extern crate log as rlog;
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
pub mod common;
|
|
||||||
pub mod error;
|
|
||||||
pub mod misc;
|
pub mod misc;
|
||||||
pub mod migration;
|
|
||||||
pub mod overlaydb;
|
pub mod overlaydb;
|
||||||
pub mod journaldb;
|
pub mod journaldb;
|
||||||
pub mod kvdb;
|
|
||||||
pub mod snappy;
|
|
||||||
pub mod cache;
|
pub mod cache;
|
||||||
|
|
||||||
pub use misc::*;
|
pub use misc::*;
|
||||||
@ -131,8 +123,6 @@ pub use hashdb::*;
|
|||||||
pub use memorydb::MemoryDB;
|
pub use memorydb::MemoryDB;
|
||||||
pub use overlaydb::*;
|
pub use overlaydb::*;
|
||||||
pub use journaldb::JournalDB;
|
pub use journaldb::JournalDB;
|
||||||
pub use kvdb::*;
|
|
||||||
pub use error::UtilError;
|
|
||||||
|
|
||||||
/// 160-bit integer representing account address
|
/// 160-bit integer representing account address
|
||||||
pub type Address = bigint::hash::H160;
|
pub type Address = bigint::hash::H160;
|
||||||
|
Loading…
Reference in New Issue
Block a user