Extract blockchain from ethcore (#10114)
* Split blockchain & db from ethcore. * Clean up blockchain deps. * Missing docs. * Fix blockchain tests. * Make other crates compile. * Remove some re-exports. * Remove types re-export from ethcore. * Remove EVM dependency from transaction. * Merge ethcore-transaction with common-types. * Clean-up ethcore deps a bit. * remove ethcore from cargo.toml * Update ethcore/blockchain/src/lib.rs Co-Authored-By: tomusdrw <tomusdrw@users.noreply.github.com> * Address review comments. * Update DB comment. * Add tracking issue to the TODO and fix typo. * Common naming for common types. * Update ethcore/db/src/keys.rs Co-Authored-By: tomusdrw <tomusdrw@users.noreply.github.com> * Update ethcore/blockchain/src/generator.rs Co-Authored-By: tomusdrw <tomusdrw@users.noreply.github.com> * Try to fix beta tests.
This commit is contained in:
parent
3090324366
commit
3650f2d51c
101
Cargo.lock
generated
101
Cargo.lock
generated
@ -291,12 +291,15 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
|
"ethkey 0.3.0",
|
||||||
"heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-machine 0.1.0",
|
||||||
"rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rlp_derive 0.1.0",
|
"rlp_derive 0.1.0",
|
||||||
"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)",
|
||||||
|
"unexpected 0.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -583,15 +586,6 @@ dependencies = [
|
|||||||
"heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "env_logger"
|
|
||||||
version = "0.4.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "env_logger"
|
name = "env_logger"
|
||||||
version = "0.5.13"
|
version = "0.5.13"
|
||||||
@ -693,18 +687,19 @@ dependencies = [
|
|||||||
"common-types 0.1.0",
|
"common-types 0.1.0",
|
||||||
"criterion 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"criterion 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"crossbeam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"crossbeam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethabi 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethabi 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethabi-contract 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethabi-contract 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethabi-derive 6.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethabi-derive 6.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethash 1.12.0",
|
"ethash 1.12.0",
|
||||||
|
"ethcore-blockchain 0.1.0",
|
||||||
"ethcore-bloom-journal 0.1.0",
|
"ethcore-bloom-journal 0.1.0",
|
||||||
|
"ethcore-db 0.1.0",
|
||||||
"ethcore-io 1.12.0",
|
"ethcore-io 1.12.0",
|
||||||
"ethcore-logger 1.12.0",
|
"ethcore-logger 1.12.0",
|
||||||
"ethcore-miner 1.12.0",
|
"ethcore-miner 1.12.0",
|
||||||
"ethcore-stratum 1.12.0",
|
"ethcore-stratum 1.12.0",
|
||||||
"ethcore-transaction 0.1.0",
|
|
||||||
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
"ethkey 0.3.0",
|
"ethkey 0.3.0",
|
||||||
@ -756,6 +751,33 @@ dependencies = [
|
|||||||
"wasm 0.1.0",
|
"wasm 0.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ethcore-blockchain"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"blooms-db 0.1.0",
|
||||||
|
"common-types 0.1.0",
|
||||||
|
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"ethcore-db 0.1.0",
|
||||||
|
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"ethkey 0.3.0",
|
||||||
|
"heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"kvdb-memorydb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rayon 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rlp_compress 0.1.0",
|
||||||
|
"rlp_derive 0.1.0",
|
||||||
|
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ethcore-bloom-journal"
|
name = "ethcore-bloom-journal"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@ -763,6 +785,19 @@ dependencies = [
|
|||||||
"siphasher 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"siphasher 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ethcore-db"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"common-types 0.1.0",
|
||||||
|
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rlp_derive 0.1.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ethcore-io"
|
name = "ethcore-io"
|
||||||
version = "1.12.0"
|
version = "1.12.0"
|
||||||
@ -785,11 +820,13 @@ name = "ethcore-light"
|
|||||||
version = "1.12.0"
|
version = "1.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"common-types 0.1.0",
|
||||||
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore 1.12.0",
|
"ethcore 1.12.0",
|
||||||
|
"ethcore-blockchain 0.1.0",
|
||||||
|
"ethcore-db 0.1.0",
|
||||||
"ethcore-io 1.12.0",
|
"ethcore-io 1.12.0",
|
||||||
"ethcore-network 1.12.0",
|
"ethcore-network 1.12.0",
|
||||||
"ethcore-transaction 0.1.0",
|
|
||||||
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"failsafe 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"failsafe 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"fastmap 0.1.0",
|
"fastmap 0.1.0",
|
||||||
@ -840,10 +877,10 @@ name = "ethcore-miner"
|
|||||||
version = "1.12.0"
|
version = "1.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"common-types 0.1.0",
|
||||||
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethash 1.12.0",
|
"ethash 1.12.0",
|
||||||
"ethcore-transaction 0.1.0",
|
|
||||||
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
"ethkey 0.3.0",
|
||||||
"fetch 0.1.0",
|
"fetch 0.1.0",
|
||||||
@ -919,6 +956,7 @@ dependencies = [
|
|||||||
name = "ethcore-private-tx"
|
name = "ethcore-private-tx"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"common-types 0.1.0",
|
||||||
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethabi 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethabi 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethabi-contract 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethabi-contract 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -927,7 +965,6 @@ dependencies = [
|
|||||||
"ethcore-io 1.12.0",
|
"ethcore-io 1.12.0",
|
||||||
"ethcore-logger 1.12.0",
|
"ethcore-logger 1.12.0",
|
||||||
"ethcore-miner 1.12.0",
|
"ethcore-miner 1.12.0",
|
||||||
"ethcore-transaction 0.1.0",
|
|
||||||
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
"ethkey 0.3.0",
|
"ethkey 0.3.0",
|
||||||
@ -958,13 +995,13 @@ name = "ethcore-secretstore"
|
|||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"common-types 0.1.0",
|
||||||
"ethabi 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethabi 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethabi-contract 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethabi-contract 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethabi-derive 6.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethabi-derive 6.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore 1.12.0",
|
"ethcore 1.12.0",
|
||||||
"ethcore-logger 1.12.0",
|
"ethcore-logger 1.12.0",
|
||||||
"ethcore-sync 1.12.0",
|
"ethcore-sync 1.12.0",
|
||||||
"ethcore-transaction 0.1.0",
|
|
||||||
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
"ethkey 0.3.0",
|
||||||
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -997,6 +1034,8 @@ dependencies = [
|
|||||||
"ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore 1.12.0",
|
"ethcore 1.12.0",
|
||||||
|
"ethcore-blockchain 0.1.0",
|
||||||
|
"ethcore-db 0.1.0",
|
||||||
"ethcore-io 1.12.0",
|
"ethcore-io 1.12.0",
|
||||||
"ethcore-private-tx 1.0.0",
|
"ethcore-private-tx 1.0.0",
|
||||||
"ethcore-sync 1.12.0",
|
"ethcore-sync 1.12.0",
|
||||||
@ -1037,9 +1076,9 @@ dependencies = [
|
|||||||
"ethcore-network 1.12.0",
|
"ethcore-network 1.12.0",
|
||||||
"ethcore-network-devp2p 1.12.0",
|
"ethcore-network-devp2p 1.12.0",
|
||||||
"ethcore-private-tx 1.0.0",
|
"ethcore-private-tx 1.0.0",
|
||||||
"ethcore-transaction 0.1.0",
|
|
||||||
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
"ethkey 0.3.0",
|
||||||
|
"ethstore 0.2.0",
|
||||||
"fastmap 0.1.0",
|
"fastmap 0.1.0",
|
||||||
"hashdb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hashdb 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1058,21 +1097,6 @@ dependencies = [
|
|||||||
"triehash-ethereum 0.2.0",
|
"triehash-ethereum 0.2.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ethcore-transaction"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"ethjson 0.1.0",
|
|
||||||
"ethkey 0.3.0",
|
|
||||||
"evm 0.1.0",
|
|
||||||
"heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"unexpected 0.1.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ethereum-types"
|
name = "ethereum-types"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
@ -1205,10 +1229,10 @@ dependencies = [
|
|||||||
name = "evmbin"
|
name = "evmbin"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"common-types 0.1.0",
|
||||||
"docopt 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"docopt 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore 1.12.0",
|
"ethcore 1.12.0",
|
||||||
"ethcore-transaction 0.1.0",
|
|
||||||
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
"evm 0.1.0",
|
"evm 0.1.0",
|
||||||
@ -2357,12 +2381,15 @@ dependencies = [
|
|||||||
"blooms-db 0.1.0",
|
"blooms-db 0.1.0",
|
||||||
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cli-signer 1.4.0",
|
"cli-signer 1.4.0",
|
||||||
|
"common-types 0.1.0",
|
||||||
"ctrlc 1.1.1 (git+https://github.com/paritytech/rust-ctrlc.git)",
|
"ctrlc 1.1.1 (git+https://github.com/paritytech/rust-ctrlc.git)",
|
||||||
"daemonize 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"daemonize 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"dir 0.1.2",
|
"dir 0.1.2",
|
||||||
"docopt 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"docopt 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore 1.12.0",
|
"ethcore 1.12.0",
|
||||||
|
"ethcore-blockchain 0.1.0",
|
||||||
|
"ethcore-db 0.1.0",
|
||||||
"ethcore-io 1.12.0",
|
"ethcore-io 1.12.0",
|
||||||
"ethcore-light 1.12.0",
|
"ethcore-light 1.12.0",
|
||||||
"ethcore-logger 1.12.0",
|
"ethcore-logger 1.12.0",
|
||||||
@ -2372,9 +2399,9 @@ dependencies = [
|
|||||||
"ethcore-secretstore 1.0.0",
|
"ethcore-secretstore 1.0.0",
|
||||||
"ethcore-service 0.1.0",
|
"ethcore-service 0.1.0",
|
||||||
"ethcore-sync 1.12.0",
|
"ethcore-sync 1.12.0",
|
||||||
"ethcore-transaction 0.1.0",
|
|
||||||
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethkey 0.3.0",
|
"ethkey 0.3.0",
|
||||||
|
"ethstore 0.2.0",
|
||||||
"fake-fetch 0.0.1",
|
"fake-fetch 0.0.1",
|
||||||
"fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -2461,9 +2488,8 @@ dependencies = [
|
|||||||
name = "parity-local-store"
|
name = "parity-local-store"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ethcore 1.12.0",
|
"common-types 0.1.0",
|
||||||
"ethcore-io 1.12.0",
|
"ethcore-io 1.12.0",
|
||||||
"ethcore-transaction 0.1.0",
|
|
||||||
"ethkey 0.3.0",
|
"ethkey 0.3.0",
|
||||||
"kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kvdb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"kvdb-memorydb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kvdb-memorydb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -2513,6 +2539,7 @@ version = "1.12.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cid 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cid 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"common-types 0.1.0",
|
||||||
"eip-712 0.1.0",
|
"eip-712 0.1.0",
|
||||||
"ethash 1.12.0",
|
"ethash 1.12.0",
|
||||||
"ethcore 1.12.0",
|
"ethcore 1.12.0",
|
||||||
@ -2523,7 +2550,6 @@ dependencies = [
|
|||||||
"ethcore-network 1.12.0",
|
"ethcore-network 1.12.0",
|
||||||
"ethcore-private-tx 1.0.0",
|
"ethcore-private-tx 1.0.0",
|
||||||
"ethcore-sync 1.12.0",
|
"ethcore-sync 1.12.0",
|
||||||
"ethcore-transaction 0.1.0",
|
|
||||||
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
"ethkey 0.3.0",
|
"ethkey 0.3.0",
|
||||||
@ -2635,6 +2661,7 @@ dependencies = [
|
|||||||
name = "parity-updater"
|
name = "parity-updater"
|
||||||
version = "1.12.0"
|
version = "1.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"common-types 0.1.0",
|
||||||
"ethabi 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethabi 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethabi-contract 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethabi-contract 6.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethabi-derive 6.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethabi-derive 6.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -4131,7 +4158,6 @@ name = "vm"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"common-types 0.1.0",
|
|
||||||
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
"keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -4393,7 +4419,6 @@ dependencies = [
|
|||||||
"checksum edit-distance 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3bd26878c3d921f89797a4e1a1711919f999a9f6946bb6f5a4ffda126d297b7e"
|
"checksum edit-distance 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3bd26878c3d921f89797a4e1a1711919f999a9f6946bb6f5a4ffda126d297b7e"
|
||||||
"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0"
|
"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0"
|
||||||
"checksum elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "88d4851b005ef16de812ea9acdb7bece2f0a40dd86c07b85631d7dafa54537bb"
|
"checksum elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "88d4851b005ef16de812ea9acdb7bece2f0a40dd86c07b85631d7dafa54537bb"
|
||||||
"checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b"
|
|
||||||
"checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38"
|
"checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38"
|
||||||
"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
|
"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
|
||||||
"checksum eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)" = "<none>"
|
"checksum eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)" = "<none>"
|
||||||
|
@ -33,6 +33,9 @@ ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" }
|
|||||||
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-2.2" }
|
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-2.2" }
|
||||||
ethcore = { path = "ethcore", features = ["parity"] }
|
ethcore = { path = "ethcore", features = ["parity"] }
|
||||||
parity-bytes = "0.1"
|
parity-bytes = "0.1"
|
||||||
|
common-types = { path = "ethcore/types" }
|
||||||
|
ethcore-blockchain = { path = "ethcore/blockchain" }
|
||||||
|
ethcore-db = { path = "ethcore/db" }
|
||||||
ethcore-io = { path = "util/io" }
|
ethcore-io = { path = "util/io" }
|
||||||
ethcore-light = { path = "ethcore/light" }
|
ethcore-light = { path = "ethcore/light" }
|
||||||
ethcore-logger = { path = "logger" }
|
ethcore-logger = { path = "logger" }
|
||||||
@ -41,7 +44,7 @@ ethcore-network = { path = "util/network" }
|
|||||||
ethcore-private-tx = { path = "ethcore/private-tx" }
|
ethcore-private-tx = { path = "ethcore/private-tx" }
|
||||||
ethcore-service = { path = "ethcore/service" }
|
ethcore-service = { path = "ethcore/service" }
|
||||||
ethcore-sync = { path = "ethcore/sync" }
|
ethcore-sync = { path = "ethcore/sync" }
|
||||||
ethcore-transaction = { path = "ethcore/transaction" }
|
ethstore = { path = "accounts/ethstore" }
|
||||||
ethereum-types = "0.4"
|
ethereum-types = "0.4"
|
||||||
node-filter = { path = "ethcore/node-filter" }
|
node-filter = { path = "ethcore/node-filter" }
|
||||||
ethkey = { path = "accounts/ethkey" }
|
ethkey = { path = "accounts/ethkey" }
|
||||||
|
@ -8,68 +8,68 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ansi_term = "0.10"
|
ansi_term = "0.10"
|
||||||
blooms-db = { path = "../util/blooms-db" }
|
blooms-db = { path = "../util/blooms-db", optional = true }
|
||||||
bn = { git = "https://github.com/paritytech/bn", default-features = false }
|
bn = { git = "https://github.com/paritytech/bn", default-features = false }
|
||||||
byteorder = "1.0"
|
byteorder = "1.0"
|
||||||
common-types = { path = "types" }
|
common-types = { path = "types" }
|
||||||
crossbeam = "0.4"
|
crossbeam = "0.4"
|
||||||
ethash = { path = "../ethash" }
|
|
||||||
ethcore-bloom-journal = { path = "../util/bloom" }
|
|
||||||
parity-bytes = "0.1"
|
|
||||||
hashdb = "0.3.0"
|
|
||||||
memorydb = "0.3.0"
|
|
||||||
patricia-trie = "0.3.0"
|
|
||||||
patricia-trie-ethereum = { path = "../util/patricia-trie-ethereum" }
|
|
||||||
parity-crypto = "0.2"
|
|
||||||
error-chain = { version = "0.12", default-features = false }
|
error-chain = { version = "0.12", default-features = false }
|
||||||
|
ethabi = "6.0"
|
||||||
|
ethabi-contract = "6.0"
|
||||||
|
ethabi-derive = "6.0"
|
||||||
|
ethash = { path = "../ethash" }
|
||||||
|
ethcore-blockchain = { path = "./blockchain" }
|
||||||
|
ethcore-bloom-journal = { path = "../util/bloom" }
|
||||||
|
ethcore-db = { path = "./db" }
|
||||||
ethcore-io = { path = "../util/io" }
|
ethcore-io = { path = "../util/io" }
|
||||||
ethcore-logger = { path = "../logger" }
|
ethcore-logger = { path = "../logger", optional = true }
|
||||||
ethcore-miner = { path = "../miner" }
|
ethcore-miner = { path = "../miner" }
|
||||||
ethcore-stratum = { path = "../miner/stratum", optional = true }
|
ethcore-stratum = { path = "../miner/stratum", optional = true }
|
||||||
ethcore-transaction = { path = "./transaction" }
|
|
||||||
ethereum-types = "0.4"
|
ethereum-types = "0.4"
|
||||||
memory-cache = { path = "../util/memory-cache" }
|
|
||||||
ethabi = "6.0"
|
|
||||||
ethabi-derive = "6.0"
|
|
||||||
ethabi-contract = "6.0"
|
|
||||||
ethjson = { path = "../json" }
|
ethjson = { path = "../json" }
|
||||||
ethkey = { path = "../accounts/ethkey" }
|
ethkey = { path = "../accounts/ethkey" }
|
||||||
ethstore = { path = "../accounts/ethstore" }
|
ethstore = { path = "../accounts/ethstore" }
|
||||||
evm = { path = "evm" }
|
evm = { path = "evm" }
|
||||||
|
hashdb = "0.3.0"
|
||||||
heapsize = "0.4"
|
heapsize = "0.4"
|
||||||
itertools = "0.5"
|
itertools = "0.5"
|
||||||
lazy_static = "1.0"
|
journaldb = { path = "../util/journaldb" }
|
||||||
log = "0.4"
|
keccak-hash = "0.1"
|
||||||
lru-cache = "0.1"
|
keccak-hasher = { path = "../util/keccak-hasher" }
|
||||||
num = { version = "0.1", default-features = false, features = ["bigint"] }
|
|
||||||
num_cpus = "1.2"
|
|
||||||
parity-machine = { path = "../machine" }
|
|
||||||
parking_lot = "0.7"
|
|
||||||
rayon = "1.0"
|
|
||||||
rand = "0.4"
|
|
||||||
rlp = { version = "0.3.0", features = ["ethereum"] }
|
|
||||||
rlp_compress = { path = "../util/rlp-compress" }
|
|
||||||
rlp_derive = { path = "../util/rlp-derive" }
|
|
||||||
kvdb = "0.1"
|
kvdb = "0.1"
|
||||||
kvdb-memorydb = "0.1"
|
kvdb-memorydb = "0.1"
|
||||||
parity-snappy = "0.1"
|
kvdb-rocksdb = { version = "0.1.3", optional = true }
|
||||||
|
lazy_static = "1.0"
|
||||||
|
len-caching-lock = { path = "../util/len-caching-lock" }
|
||||||
|
log = "0.4"
|
||||||
|
lru-cache = "0.1"
|
||||||
macros = { path = "../util/macros" }
|
macros = { path = "../util/macros" }
|
||||||
|
memory-cache = { path = "../util/memory-cache" }
|
||||||
|
memorydb = "0.3.0"
|
||||||
|
num = { version = "0.1", default-features = false, features = ["bigint"] }
|
||||||
|
num_cpus = "1.2"
|
||||||
|
parity-bytes = "0.1"
|
||||||
|
parity-crypto = "0.2"
|
||||||
|
parity-machine = { path = "../machine" }
|
||||||
|
parity-snappy = "0.1"
|
||||||
|
parking_lot = "0.7"
|
||||||
|
patricia-trie = "0.3.0"
|
||||||
|
patricia-trie-ethereum = { path = "../util/patricia-trie-ethereum" }
|
||||||
|
rand = "0.4"
|
||||||
|
rayon = "1.0"
|
||||||
|
rlp = { version = "0.3.0", features = ["ethereum"] }
|
||||||
|
rlp_derive = { path = "../util/rlp-derive" }
|
||||||
rustc-hex = "1.0"
|
rustc-hex = "1.0"
|
||||||
|
serde = "1.0"
|
||||||
|
serde_derive = "1.0"
|
||||||
stats = { path = "../util/stats" }
|
stats = { path = "../util/stats" }
|
||||||
|
tempdir = {version="0.3", optional = true}
|
||||||
trace-time = "0.1"
|
trace-time = "0.1"
|
||||||
|
triehash-ethereum = { version = "0.2", path = "../util/triehash-ethereum" }
|
||||||
|
unexpected = { path = "../util/unexpected" }
|
||||||
using_queue = { path = "../miner/using-queue" }
|
using_queue = { path = "../miner/using-queue" }
|
||||||
vm = { path = "vm" }
|
vm = { path = "vm" }
|
||||||
wasm = { path = "wasm" }
|
wasm = { path = "wasm" }
|
||||||
keccak-hash = "0.1"
|
|
||||||
triehash-ethereum = { version = "0.2", path = "../util/triehash-ethereum" }
|
|
||||||
unexpected = { path = "../util/unexpected" }
|
|
||||||
journaldb = { path = "../util/journaldb" }
|
|
||||||
keccak-hasher = { path = "../util/keccak-hasher" }
|
|
||||||
kvdb-rocksdb = "0.1.3"
|
|
||||||
serde = "1.0"
|
|
||||||
serde_derive = "1.0"
|
|
||||||
tempdir = {version="0.3", optional = true}
|
|
||||||
len-caching-lock = { path = "../util/len-caching-lock" }
|
|
||||||
|
|
||||||
[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "windows", target_os = "android"))'.dependencies]
|
[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "windows", target_os = "android"))'.dependencies]
|
||||||
hardware-wallet = { path = "../accounts/hw" }
|
hardware-wallet = { path = "../accounts/hw" }
|
||||||
@ -78,10 +78,14 @@ hardware-wallet = { path = "../accounts/hw" }
|
|||||||
fake-hardware-wallet = { path = "../accounts/fake-hardware-wallet" }
|
fake-hardware-wallet = { path = "../accounts/fake-hardware-wallet" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.4"
|
blooms-db = { path = "../util/blooms-db" }
|
||||||
|
criterion = "0.2"
|
||||||
|
env_logger = "0.5"
|
||||||
|
ethcore-logger = { path = "../logger" }
|
||||||
|
kvdb-rocksdb = "0.1.3"
|
||||||
|
rlp_compress = { path = "../util/rlp-compress" }
|
||||||
tempdir = "0.3"
|
tempdir = "0.3"
|
||||||
trie-standardmap = "0.1"
|
trie-standardmap = "0.1"
|
||||||
criterion = "0.2"
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
parity = ["work-notify", "price-info", "stratum"]
|
parity = ["work-notify", "price-info", "stratum"]
|
||||||
@ -105,13 +109,13 @@ evm-debug-tests = ["evm-debug", "evm/evm-debug-tests"]
|
|||||||
# EVM debug traces are printed.
|
# EVM debug traces are printed.
|
||||||
slow-blocks = []
|
slow-blocks = []
|
||||||
# Run JSON consensus tests.
|
# Run JSON consensus tests.
|
||||||
json-tests = ["ethcore-transaction/json-tests", "test-helpers", "tempdir", "to-pod-full"]
|
json-tests = ["ethcore-logger", "test-helpers", "tempdir", "to-pod-full"]
|
||||||
# Skip JSON consensus tests with pending issues.
|
# Skip JSON consensus tests with pending issues.
|
||||||
ci-skip-issue = []
|
ci-skip-issue = []
|
||||||
# Run memory/cpu heavy tests.
|
# Run memory/cpu heavy tests.
|
||||||
test-heavy = []
|
test-heavy = []
|
||||||
# Compile test helpers
|
# Compile test helpers
|
||||||
test-helpers = ["tempdir"]
|
test-helpers = ["tempdir", "kvdb-rocksdb", "blooms-db"]
|
||||||
# Enables slow 'to-pod-full' method for use in tests and evmbin.
|
# Enables slow 'to-pod-full' method for use in tests and evmbin.
|
||||||
to-pod-full = []
|
to-pod-full = []
|
||||||
|
|
||||||
|
33
ethcore/blockchain/Cargo.toml
Normal file
33
ethcore/blockchain/Cargo.toml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
[package]
|
||||||
|
description = "Ethcore blockchain database"
|
||||||
|
homepage = "http://parity.io"
|
||||||
|
license = "GPL-3.0"
|
||||||
|
name = "ethcore-blockchain"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
ansi_term = "0.10"
|
||||||
|
blooms-db = { path = "../../util/blooms-db" }
|
||||||
|
common-types = { path = "../types" }
|
||||||
|
ethcore-db = { path = "../db" }
|
||||||
|
ethereum-types = "0.4"
|
||||||
|
heapsize = "0.4"
|
||||||
|
itertools = "0.5"
|
||||||
|
kvdb = "0.1"
|
||||||
|
log = "0.4"
|
||||||
|
parity-bytes = "0.1"
|
||||||
|
parking_lot = "0.7"
|
||||||
|
rayon = "1.0"
|
||||||
|
rlp = { version = "0.3.0", features = ["ethereum"] }
|
||||||
|
rlp_compress = { path = "../../util/rlp-compress" }
|
||||||
|
rlp_derive = { path = "../../util/rlp-derive" }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
env_logger = "0.5"
|
||||||
|
ethkey = { path = "../../accounts/ethkey" }
|
||||||
|
keccak-hash = "0.1"
|
||||||
|
rustc-hex = "1.0"
|
||||||
|
tempdir = "0.3"
|
||||||
|
kvdb-memorydb = "0.1"
|
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
use ethereum_types::{H256, U256};
|
use ethereum_types::{H256, U256};
|
||||||
|
|
||||||
use encoded;
|
use common_types::{encoded, BlockNumber};
|
||||||
use header::{Header, BlockNumber};
|
use common_types::header::Header;
|
||||||
|
|
||||||
/// Contains information on a best block that is specific to the consensus engine.
|
/// Contains information on a best block that is specific to the consensus engine.
|
||||||
///
|
///
|
@ -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 ethereum_types::{H256, U256};
|
use ethereum_types::{H256, U256};
|
||||||
use header::BlockNumber;
|
use common_types::BlockNumber;
|
||||||
|
|
||||||
/// Brief info about inserted block.
|
/// Brief info about inserted block.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
@ -22,34 +22,37 @@ use std::path::Path;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use ansi_term::Colour;
|
use ansi_term::Colour;
|
||||||
use blockchain::{CacheSize, ImportRoute, Config};
|
|
||||||
use blockchain::best_block::{BestBlock, BestAncientBlock};
|
|
||||||
use blockchain::block_info::{BlockInfo, BlockLocation, BranchBecomingCanonChainData};
|
|
||||||
use blockchain::extras::{BlockReceipts, BlockDetails, TransactionAddress, EPOCH_KEY_PREFIX, EpochTransitions};
|
|
||||||
use blockchain::update::{ExtrasUpdate, ExtrasInsert};
|
|
||||||
use blooms_db;
|
use blooms_db;
|
||||||
use bytes::Bytes;
|
use common_types::BlockNumber;
|
||||||
use cache_manager::CacheManager;
|
use common_types::blockchain_info::BlockChainInfo;
|
||||||
use db::{self, Writable, Readable, CacheUpdatePolicy};
|
use common_types::encoded;
|
||||||
use encoded;
|
use common_types::engines::ForkChoice;
|
||||||
use engines::epoch::{Transition as EpochTransition, PendingTransition as PendingEpochTransition};
|
use common_types::engines::epoch::{Transition as EpochTransition, PendingTransition as PendingEpochTransition};
|
||||||
use engines::ForkChoice;
|
use common_types::header::{Header, ExtendedHeader};
|
||||||
|
use common_types::log_entry::{LogEntry, LocalizedLogEntry};
|
||||||
|
use common_types::receipt::Receipt;
|
||||||
|
use common_types::transaction::LocalizedTransaction;
|
||||||
|
use common_types::tree_route::TreeRoute;
|
||||||
|
use common_types::view;
|
||||||
|
use common_types::views::{BlockView, HeaderView};
|
||||||
|
use ethcore_db::cache_manager::CacheManager;
|
||||||
|
use ethcore_db::keys::{BlockReceipts, BlockDetails, TransactionAddress, EPOCH_KEY_PREFIX, EpochTransitions};
|
||||||
|
use ethcore_db::{self as db, Writable, Readable, CacheUpdatePolicy};
|
||||||
use ethereum_types::{H256, Bloom, BloomRef, U256};
|
use ethereum_types::{H256, Bloom, BloomRef, U256};
|
||||||
use error::Error as EthcoreError;
|
|
||||||
use header::*;
|
|
||||||
use heapsize::HeapSizeOf;
|
use heapsize::HeapSizeOf;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use kvdb::{DBTransaction, KeyValueDB};
|
use kvdb::{DBTransaction, KeyValueDB};
|
||||||
use log_entry::{LogEntry, LocalizedLogEntry};
|
use log::{trace, warn, info};
|
||||||
|
use parity_bytes::Bytes;
|
||||||
use parking_lot::{Mutex, RwLock};
|
use parking_lot::{Mutex, RwLock};
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use receipt::Receipt;
|
|
||||||
use rlp_compress::{compress, decompress, blocks_swapper};
|
|
||||||
use rlp::RlpStream;
|
use rlp::RlpStream;
|
||||||
use transaction::*;
|
use rlp_compress::{compress, decompress, blocks_swapper};
|
||||||
use types::blockchain_info::BlockChainInfo;
|
|
||||||
use types::tree_route::TreeRoute;
|
use crate::best_block::{BestBlock, BestAncientBlock};
|
||||||
use views::{BlockView, HeaderView};
|
use crate::block_info::{BlockInfo, BlockLocation, BranchBecomingCanonChainData};
|
||||||
|
use crate::update::{ExtrasUpdate, ExtrasInsert};
|
||||||
|
use crate::{CacheSize, ImportRoute, Config};
|
||||||
|
|
||||||
/// Database backing `BlockChain`.
|
/// Database backing `BlockChain`.
|
||||||
pub trait BlockChainDB: Send + Sync {
|
pub trait BlockChainDB: Send + Sync {
|
||||||
@ -63,7 +66,7 @@ pub trait BlockChainDB: Send + Sync {
|
|||||||
fn trace_blooms(&self) -> &blooms_db::Database;
|
fn trace_blooms(&self) -> &blooms_db::Database;
|
||||||
|
|
||||||
/// Restore the DB from the given path
|
/// Restore the DB from the given path
|
||||||
fn restore(&self, new_db: &str) -> Result<(), EthcoreError> {
|
fn restore(&self, new_db: &str) -> Result<(), io::Error> {
|
||||||
// First, close the Blooms databases
|
// First, close the Blooms databases
|
||||||
self.blooms().close()?;
|
self.blooms().close()?;
|
||||||
self.trace_blooms().close()?;
|
self.trace_blooms().close()?;
|
||||||
@ -1549,25 +1552,55 @@ impl BlockChain {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
use std::iter;
|
use std::iter;
|
||||||
use std::sync::Arc;
|
|
||||||
use rustc_hex::FromHex;
|
use common_types::receipt::{Receipt, TransactionOutcome};
|
||||||
use hash::keccak;
|
use common_types::transaction::{Transaction, Action};
|
||||||
use kvdb::DBTransaction;
|
use crate::generator::{BlockGenerator, BlockBuilder, BlockOptions};
|
||||||
use ethereum_types::*;
|
|
||||||
use receipt::{Receipt, TransactionOutcome};
|
|
||||||
use blockchain::{BlockProvider, BlockChain, BlockChainDB, Config, ImportRoute};
|
|
||||||
use test_helpers::{
|
|
||||||
generate_dummy_blockchain, generate_dummy_blockchain_with_extra,
|
|
||||||
generate_dummy_empty_blockchain
|
|
||||||
};
|
|
||||||
use blockchain::generator::{BlockGenerator, BlockBuilder, BlockOptions};
|
|
||||||
use blockchain::extras::TransactionAddress;
|
|
||||||
use transaction::{Transaction, Action};
|
|
||||||
use log_entry::{LogEntry, LocalizedLogEntry};
|
|
||||||
use ethkey::Secret;
|
use ethkey::Secret;
|
||||||
use test_helpers::new_db;
|
use keccak_hash::keccak;
|
||||||
use encoded;
|
use rustc_hex::FromHex;
|
||||||
|
use tempdir::TempDir;
|
||||||
|
|
||||||
|
struct TestBlockChainDB {
|
||||||
|
_blooms_dir: TempDir,
|
||||||
|
_trace_blooms_dir: TempDir,
|
||||||
|
blooms: blooms_db::Database,
|
||||||
|
trace_blooms: blooms_db::Database,
|
||||||
|
key_value: Arc<KeyValueDB>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl BlockChainDB for TestBlockChainDB {
|
||||||
|
fn key_value(&self) -> &Arc<KeyValueDB> {
|
||||||
|
&self.key_value
|
||||||
|
}
|
||||||
|
|
||||||
|
fn blooms(&self) -> &blooms_db::Database {
|
||||||
|
&self.blooms
|
||||||
|
}
|
||||||
|
|
||||||
|
fn trace_blooms(&self) -> &blooms_db::Database {
|
||||||
|
&self.trace_blooms
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Creates new test instance of `BlockChainDB`
|
||||||
|
pub fn new_db() -> Arc<BlockChainDB> {
|
||||||
|
let blooms_dir = TempDir::new("").unwrap();
|
||||||
|
let trace_blooms_dir = TempDir::new("").unwrap();
|
||||||
|
|
||||||
|
let db = TestBlockChainDB {
|
||||||
|
blooms: blooms_db::Database::open(blooms_dir.path()).unwrap(),
|
||||||
|
trace_blooms: blooms_db::Database::open(trace_blooms_dir.path()).unwrap(),
|
||||||
|
_blooms_dir: blooms_dir,
|
||||||
|
_trace_blooms_dir: trace_blooms_dir,
|
||||||
|
key_value: Arc::new(kvdb_memorydb::create(ethcore_db::NUM_COLUMNS.unwrap()))
|
||||||
|
};
|
||||||
|
|
||||||
|
Arc::new(db)
|
||||||
|
}
|
||||||
|
|
||||||
fn new_chain(genesis: encoded::Block, db: Arc<BlockChainDB>) -> BlockChain {
|
fn new_chain(genesis: encoded::Block, db: Arc<BlockChainDB>) -> BlockChain {
|
||||||
BlockChain::new(Config::default(), genesis.raw(), db)
|
BlockChain::new(Config::default(), genesis.raw(), db)
|
||||||
@ -1588,7 +1621,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn insert_block_batch(batch: &mut DBTransaction, bc: &BlockChain, block: encoded::Block, receipts: Vec<Receipt>) -> ImportRoute {
|
fn insert_block_batch(batch: &mut DBTransaction, bc: &BlockChain, block: encoded::Block, receipts: Vec<Receipt>) -> ImportRoute {
|
||||||
use blockchain::ExtrasInsert;
|
use crate::ExtrasInsert;
|
||||||
|
|
||||||
let fork_choice = {
|
let fork_choice = {
|
||||||
let header = block.header_view();
|
let header = block.header_view();
|
||||||
@ -1596,9 +1629,9 @@ mod tests {
|
|||||||
let parent_details = bc.block_details(&parent_hash).unwrap_or_else(|| panic!("Invalid parent hash: {:?}", parent_hash));
|
let parent_details = bc.block_details(&parent_hash).unwrap_or_else(|| panic!("Invalid parent hash: {:?}", parent_hash));
|
||||||
let block_total_difficulty = parent_details.total_difficulty + header.difficulty();
|
let block_total_difficulty = parent_details.total_difficulty + header.difficulty();
|
||||||
if block_total_difficulty > bc.best_block_total_difficulty() {
|
if block_total_difficulty > bc.best_block_total_difficulty() {
|
||||||
::engines::ForkChoice::New
|
common_types::engines::ForkChoice::New
|
||||||
} else {
|
} else {
|
||||||
::engines::ForkChoice::Old
|
common_types::engines::ForkChoice::Old
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2012,43 +2045,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn can_contain_arbitrary_block_sequence() {
|
|
||||||
let bc = generate_dummy_blockchain(50);
|
|
||||||
assert_eq!(bc.best_block_number(), 49);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn can_collect_garbage() {
|
|
||||||
let bc = generate_dummy_blockchain(3000);
|
|
||||||
|
|
||||||
assert_eq!(bc.best_block_number(), 2999);
|
|
||||||
let best_hash = bc.best_block_hash();
|
|
||||||
let mut block_header = bc.block_header_data(&best_hash);
|
|
||||||
|
|
||||||
while !block_header.is_none() {
|
|
||||||
block_header = bc.block_header_data(&block_header.unwrap().parent_hash());
|
|
||||||
}
|
|
||||||
assert!(bc.cache_size().blocks > 1024 * 1024);
|
|
||||||
|
|
||||||
for _ in 0..2 {
|
|
||||||
bc.collect_garbage();
|
|
||||||
}
|
|
||||||
assert!(bc.cache_size().blocks < 1024 * 1024);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn can_contain_arbitrary_block_sequence_with_extra() {
|
|
||||||
let bc = generate_dummy_blockchain_with_extra(25);
|
|
||||||
assert_eq!(bc.best_block_number(), 24);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn can_contain_only_genesis_block() {
|
|
||||||
let bc = generate_dummy_empty_blockchain();
|
|
||||||
assert_eq!(bc.best_block_number(), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn find_transaction_by_hash() {
|
fn find_transaction_by_hash() {
|
||||||
let genesis = "f901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0af81e09f8c46ca322193edfda764fa7e88e81923f802f1d325ec0b0308ac2cd0a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200008083023e38808454c98c8142a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421880102030405060708c0c0".from_hex().unwrap();
|
let genesis = "f901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0af81e09f8c46ca322193edfda764fa7e88e81923f802f1d325ec0b0308ac2cd0a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200008083023e38808454c98c8142a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421880102030405060708c0c0".from_hex().unwrap();
|
||||||
@ -2369,7 +2365,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn epoch_transitions_iter() {
|
fn epoch_transitions_iter() {
|
||||||
use ::engines::EpochTransition;
|
use common_types::engines::epoch::Transition as EpochTransition;
|
||||||
|
|
||||||
let genesis = BlockBuilder::genesis();
|
let genesis = BlockBuilder::genesis();
|
||||||
let next_5 = genesis.add_blocks(5);
|
let next_5 = genesis.add_blocks(5);
|
||||||
@ -2418,7 +2414,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn epoch_transition_for() {
|
fn epoch_transition_for() {
|
||||||
use ::engines::EpochTransition;
|
use common_types::engines::epoch::Transition as EpochTransition;
|
||||||
|
|
||||||
let genesis = BlockBuilder::genesis();
|
let genesis = BlockBuilder::genesis();
|
||||||
let fork_7 = genesis.add_blocks_with(7, || BlockOptions {
|
let fork_7 = genesis.add_blocks_with(7, || BlockOptions {
|
@ -19,51 +19,65 @@
|
|||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use ethereum_types::{U256, H256, Bloom};
|
use ethereum_types::{U256, H256, Bloom};
|
||||||
|
|
||||||
use header::Header;
|
use common_types::encoded;
|
||||||
|
use common_types::header::Header;
|
||||||
|
use common_types::transaction::SignedTransaction;
|
||||||
|
use common_types::view;
|
||||||
|
use common_types::views::BlockView;
|
||||||
use rlp::encode;
|
use rlp::encode;
|
||||||
use transaction::SignedTransaction;
|
use rlp_derive::RlpEncodable;
|
||||||
use views::BlockView;
|
|
||||||
use encoded;
|
|
||||||
|
|
||||||
/// Helper structure, used for encoding blocks.
|
/// Helper structure, used for encoding blocks.
|
||||||
#[derive(Default, Clone, RlpEncodable)]
|
#[derive(Default, Clone, RlpEncodable)]
|
||||||
pub struct Block {
|
pub struct Block {
|
||||||
|
/// Block header
|
||||||
pub header: Header,
|
pub header: Header,
|
||||||
|
/// Block transactions
|
||||||
pub transactions: Vec<SignedTransaction>,
|
pub transactions: Vec<SignedTransaction>,
|
||||||
|
/// Block uncles
|
||||||
pub uncles: Vec<Header>
|
pub uncles: Vec<Header>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Block {
|
impl Block {
|
||||||
|
/// Get a copy of the header
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn header(&self) -> Header {
|
pub fn header(&self) -> Header {
|
||||||
self.header.clone()
|
self.header.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get block hash
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn hash(&self) -> H256 {
|
pub fn hash(&self) -> H256 {
|
||||||
view!(BlockView, &self.encoded().raw()).header_view().hash()
|
view!(BlockView, &self.encoded().raw()).header_view().hash()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get block number
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn number(&self) -> u64 {
|
pub fn number(&self) -> u64 {
|
||||||
self.header.number()
|
self.header.number()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get RLP encoding of this block
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn encoded(&self) -> encoded::Block {
|
pub fn encoded(&self) -> encoded::Block {
|
||||||
encoded::Block::new(encode(self))
|
encoded::Block::new(encode(self))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get block difficulty
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn difficulty(&self) -> U256 {
|
pub fn difficulty(&self) -> U256 {
|
||||||
*self.header.difficulty()
|
*self.header.difficulty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Specify block options for generator
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct BlockOptions {
|
pub struct BlockOptions {
|
||||||
|
/// Difficulty
|
||||||
pub difficulty: U256,
|
pub difficulty: U256,
|
||||||
|
/// Set bloom filter
|
||||||
pub bloom: Bloom,
|
pub bloom: Bloom,
|
||||||
|
/// Transactions included in blocks
|
||||||
pub transactions: Vec<SignedTransaction>,
|
pub transactions: Vec<SignedTransaction>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,12 +91,14 @@ impl Default for BlockOptions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Utility to create blocks
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct BlockBuilder {
|
pub struct BlockBuilder {
|
||||||
blocks: VecDeque<Block>,
|
blocks: VecDeque<Block>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BlockBuilder {
|
impl BlockBuilder {
|
||||||
|
/// Create new BlockBuilder starting at genesis.
|
||||||
pub fn genesis() -> Self {
|
pub fn genesis() -> Self {
|
||||||
let mut blocks = VecDeque::with_capacity(1);
|
let mut blocks = VecDeque::with_capacity(1);
|
||||||
blocks.push_back(Block::default());
|
blocks.push_back(Block::default());
|
||||||
@ -92,21 +108,25 @@ impl BlockBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add new block with default options.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn add_block(&self) -> Self {
|
pub fn add_block(&self) -> Self {
|
||||||
self.add_block_with(|| BlockOptions::default())
|
self.add_block_with(|| BlockOptions::default())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add `count` number of blocks with default options.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn add_blocks(&self, count: usize) -> Self {
|
pub fn add_blocks(&self, count: usize) -> Self {
|
||||||
self.add_blocks_with(count, || BlockOptions::default())
|
self.add_blocks_with(count, || BlockOptions::default())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add block with specified options.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn add_block_with<T>(&self, get_metadata: T) -> Self where T: Fn() -> BlockOptions {
|
pub fn add_block_with<T>(&self, get_metadata: T) -> Self where T: Fn() -> BlockOptions {
|
||||||
self.add_blocks_with(1, get_metadata)
|
self.add_blocks_with(1, get_metadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add a block with given difficulty
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn add_block_with_difficulty<T>(&self, difficulty: T) -> Self where T: Into<U256> {
|
pub fn add_block_with_difficulty<T>(&self, difficulty: T) -> Self where T: Into<U256> {
|
||||||
let difficulty = difficulty.into();
|
let difficulty = difficulty.into();
|
||||||
@ -116,6 +136,7 @@ impl BlockBuilder {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add a block with given transactions.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn add_block_with_transactions<T>(&self, transactions: T) -> Self
|
pub fn add_block_with_transactions<T>(&self, transactions: T) -> Self
|
||||||
where T: IntoIterator<Item = SignedTransaction> {
|
where T: IntoIterator<Item = SignedTransaction> {
|
||||||
@ -126,6 +147,7 @@ impl BlockBuilder {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add a block with given bloom filter.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn add_block_with_bloom(&self, bloom: Bloom) -> Self {
|
pub fn add_block_with_bloom(&self, bloom: Bloom) -> Self {
|
||||||
self.add_blocks_with(1, move || BlockOptions {
|
self.add_blocks_with(1, move || BlockOptions {
|
||||||
@ -134,6 +156,7 @@ impl BlockBuilder {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add a bunch of blocks with given metadata.
|
||||||
pub fn add_blocks_with<T>(&self, count: usize, get_metadata: T) -> Self where T: Fn() -> BlockOptions {
|
pub fn add_blocks_with<T>(&self, count: usize, get_metadata: T) -> Self where T: Fn() -> BlockOptions {
|
||||||
assert!(count > 0, "There must be at least 1 block");
|
assert!(count > 0, "There must be at least 1 block");
|
||||||
let mut parent_hash = self.last().hash();
|
let mut parent_hash = self.last().hash();
|
||||||
@ -160,18 +183,21 @@ impl BlockBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get a reference to the last generated block.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn last(&self) -> &Block {
|
pub fn last(&self) -> &Block {
|
||||||
self.blocks.back().expect("There is always at least 1 block")
|
self.blocks.back().expect("There is always at least 1 block")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Generates a blockchain from given block builders (blocks will be concatenated).
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct BlockGenerator {
|
pub struct BlockGenerator {
|
||||||
builders: VecDeque<BlockBuilder>,
|
builders: VecDeque<BlockBuilder>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BlockGenerator {
|
impl BlockGenerator {
|
||||||
|
/// Create new block generator.
|
||||||
pub fn new<T>(builders: T) -> Self where T: IntoIterator<Item = BlockBuilder> {
|
pub fn new<T>(builders: T) -> Self where T: IntoIterator<Item = BlockBuilder> {
|
||||||
BlockGenerator {
|
BlockGenerator {
|
||||||
builders: builders.into_iter().collect(),
|
builders: builders.into_iter().collect(),
|
@ -17,7 +17,7 @@
|
|||||||
//! Import route.
|
//! Import route.
|
||||||
|
|
||||||
use ethereum_types::H256;
|
use ethereum_types::H256;
|
||||||
use blockchain::block_info::{BlockInfo, BlockLocation};
|
use crate::block_info::{BlockInfo, BlockLocation};
|
||||||
|
|
||||||
/// Import route for newly inserted block.
|
/// Import route for newly inserted block.
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
@ -31,6 +31,7 @@ pub struct ImportRoute {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ImportRoute {
|
impl ImportRoute {
|
||||||
|
/// Empty import route.
|
||||||
pub fn none() -> Self {
|
pub fn none() -> Self {
|
||||||
ImportRoute {
|
ImportRoute {
|
||||||
retracted: vec![],
|
retracted: vec![],
|
||||||
@ -68,8 +69,8 @@ impl From<BlockInfo> for ImportRoute {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use ethereum_types::{H256, U256};
|
use ethereum_types::{H256, U256};
|
||||||
use blockchain::block_info::{BlockInfo, BlockLocation, BranchBecomingCanonChainData};
|
use crate::block_info::{BlockInfo, BlockLocation, BranchBecomingCanonChainData};
|
||||||
use blockchain::ImportRoute;
|
use super::ImportRoute;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn import_route_none() {
|
fn import_route_none() {
|
@ -16,22 +16,22 @@
|
|||||||
|
|
||||||
//! Blockchain database.
|
//! Blockchain database.
|
||||||
|
|
||||||
|
#![warn(missing_docs)]
|
||||||
|
|
||||||
mod best_block;
|
mod best_block;
|
||||||
mod block_info;
|
mod block_info;
|
||||||
mod blockchain;
|
mod blockchain;
|
||||||
mod cache;
|
mod cache;
|
||||||
mod config;
|
mod config;
|
||||||
mod extras;
|
|
||||||
mod import_route;
|
mod import_route;
|
||||||
mod update;
|
mod update;
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
pub mod generator;
|
pub mod generator;
|
||||||
|
|
||||||
pub use self::blockchain::{BlockProvider, BlockChain, BlockChainDB, BlockChainDBHandler};
|
pub use self::blockchain::{BlockProvider, BlockChain, BlockChainDB, BlockChainDBHandler};
|
||||||
pub use self::cache::CacheSize;
|
pub use self::cache::CacheSize;
|
||||||
pub use self::config::Config;
|
pub use self::config::Config;
|
||||||
pub use self::extras::{BlockReceipts, BlockDetails, TransactionAddress};
|
|
||||||
pub use self::import_route::ImportRoute;
|
pub use self::import_route::ImportRoute;
|
||||||
pub use self::update::ExtrasInsert;
|
pub use self::update::ExtrasInsert;
|
||||||
pub use types::tree_route::TreeRoute;
|
pub use ethcore_db::keys::{BlockReceipts, BlockDetails, TransactionAddress};
|
||||||
|
pub use common_types::tree_route::TreeRoute;
|
@ -15,11 +15,14 @@
|
|||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use common_types::BlockNumber;
|
||||||
|
use common_types::encoded::Block;
|
||||||
|
use common_types::engines::ForkChoice;
|
||||||
|
use ethcore_db::keys::{BlockDetails, BlockReceipts, TransactionAddress};
|
||||||
use ethereum_types::{H256, Bloom};
|
use ethereum_types::{H256, Bloom};
|
||||||
use header::BlockNumber;
|
|
||||||
use blockchain::block_info::BlockInfo;
|
use crate::block_info::BlockInfo;
|
||||||
use blockchain::extras::{BlockDetails, BlockReceipts, TransactionAddress};
|
|
||||||
use encoded::Block;
|
|
||||||
|
|
||||||
/// Block extras update info.
|
/// Block extras update info.
|
||||||
pub struct ExtrasUpdate {
|
pub struct ExtrasUpdate {
|
||||||
@ -42,7 +45,7 @@ pub struct ExtrasUpdate {
|
|||||||
/// Extra information in block insertion.
|
/// Extra information in block insertion.
|
||||||
pub struct ExtrasInsert {
|
pub struct ExtrasInsert {
|
||||||
/// The primitive fork choice before applying finalization rules.
|
/// The primitive fork choice before applying finalization rules.
|
||||||
pub fork_choice: ::engines::ForkChoice,
|
pub fork_choice: ForkChoice,
|
||||||
/// Is the inserted block considered finalized.
|
/// Is the inserted block considered finalized.
|
||||||
pub is_finalized: bool,
|
pub is_finalized: bool,
|
||||||
}
|
}
|
17
ethcore/db/Cargo.toml
Normal file
17
ethcore/db/Cargo.toml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
[package]
|
||||||
|
description = "Ethcore DB access utilities"
|
||||||
|
homepage = "http://parity.io"
|
||||||
|
license = "GPL-3.0"
|
||||||
|
name = "ethcore-db"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
common-types = { path = "../types" }
|
||||||
|
ethereum-types = "0.4"
|
||||||
|
heapsize = "0.4"
|
||||||
|
kvdb = "0.1"
|
||||||
|
parking_lot = "0.7"
|
||||||
|
rlp = { version = "0.3.0", features = ["ethereum"] }
|
||||||
|
rlp_derive = { path = "../../util/rlp-derive" }
|
@ -14,11 +14,14 @@
|
|||||||
// 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/>.
|
||||||
|
|
||||||
|
//! Database cache manager
|
||||||
|
|
||||||
use std::collections::{VecDeque, HashSet};
|
use std::collections::{VecDeque, HashSet};
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
||||||
const COLLECTION_QUEUE_SIZE: usize = 8;
|
const COLLECTION_QUEUE_SIZE: usize = 8;
|
||||||
|
|
||||||
|
/// DB cache manager
|
||||||
pub struct CacheManager<T> {
|
pub struct CacheManager<T> {
|
||||||
pref_cache_size: usize,
|
pref_cache_size: usize,
|
||||||
max_cache_size: usize,
|
max_cache_size: usize,
|
||||||
@ -27,6 +30,7 @@ pub struct CacheManager<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T> CacheManager<T> where T: Eq + Hash {
|
impl<T> CacheManager<T> where T: Eq + Hash {
|
||||||
|
/// Create new cache manager with preferred (heap) sizes.
|
||||||
pub fn new(pref_cache_size: usize, max_cache_size: usize, bytes_per_cache_entry: usize) -> Self {
|
pub fn new(pref_cache_size: usize, max_cache_size: usize, bytes_per_cache_entry: usize) -> Self {
|
||||||
CacheManager {
|
CacheManager {
|
||||||
pref_cache_size: pref_cache_size,
|
pref_cache_size: pref_cache_size,
|
||||||
@ -36,6 +40,7 @@ impl<T> CacheManager<T> where T: Eq + Hash {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Mark element as used.
|
||||||
pub fn note_used(&mut self, id: T) {
|
pub fn note_used(&mut self, id: T) {
|
||||||
if !self.cache_usage[0].contains(&id) {
|
if !self.cache_usage[0].contains(&id) {
|
||||||
if let Some(c) = self.cache_usage.iter_mut().skip(1).find(|e| e.contains(&id)) {
|
if let Some(c) = self.cache_usage.iter_mut().skip(1).find(|e| e.contains(&id)) {
|
@ -19,14 +19,16 @@
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::ops;
|
use std::ops;
|
||||||
|
|
||||||
use db::Key;
|
use common_types::BlockNumber;
|
||||||
use engines::epoch::{Transition as EpochTransition};
|
use common_types::engines::epoch::Transition as EpochTransition;
|
||||||
|
use common_types::receipt::Receipt;
|
||||||
use ethereum_types::{H256, H264, U256};
|
use ethereum_types::{H256, H264, U256};
|
||||||
use header::BlockNumber;
|
|
||||||
use heapsize::HeapSizeOf;
|
use heapsize::HeapSizeOf;
|
||||||
use kvdb::PREFIX_LEN as DB_PREFIX_LEN;
|
use kvdb::PREFIX_LEN as DB_PREFIX_LEN;
|
||||||
use receipt::Receipt;
|
|
||||||
use rlp;
|
use rlp;
|
||||||
|
use rlp_derive::{RlpEncodableWrapper, RlpDecodableWrapper, RlpEncodable, RlpDecodable};
|
||||||
|
|
||||||
|
use crate::db::Key;
|
||||||
|
|
||||||
/// 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)]
|
||||||
@ -52,6 +54,7 @@ fn with_index(hash: &H256, i: ExtrasIndex) -> H264 {
|
|||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Wrapper for block number used as a DB key.
|
||||||
pub struct BlockNumberKey([u8; 5]);
|
pub struct BlockNumberKey([u8; 5]);
|
||||||
|
|
||||||
impl ops::Deref for BlockNumberKey {
|
impl ops::Deref for BlockNumberKey {
|
||||||
@ -100,7 +103,7 @@ impl Key<BlockReceipts> for H256 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Key<::engines::epoch::PendingTransition> for H256 {
|
impl Key<common_types::engines::epoch::PendingTransition> for H256 {
|
||||||
type Target = H264;
|
type Target = H264;
|
||||||
|
|
||||||
fn key(&self) -> H264 {
|
fn key(&self) -> H264 {
|
||||||
@ -117,6 +120,7 @@ pub const EPOCH_KEY_PREFIX: &'static [u8; DB_PREFIX_LEN] = &[
|
|||||||
ExtrasIndex::EpochTransitions as u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
ExtrasIndex::EpochTransitions as u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/// Epoch transitions key
|
||||||
pub struct EpochTransitionsKey([u8; EPOCH_KEY_LEN]);
|
pub struct EpochTransitionsKey([u8; EPOCH_KEY_LEN]);
|
||||||
|
|
||||||
impl ops::Deref for EpochTransitionsKey {
|
impl ops::Deref for EpochTransitionsKey {
|
||||||
@ -217,10 +221,12 @@ impl HeapSizeOf for TransactionAddress {
|
|||||||
/// Contains all block receipts.
|
/// Contains all block receipts.
|
||||||
#[derive(Clone, RlpEncodableWrapper, RlpDecodableWrapper)]
|
#[derive(Clone, RlpEncodableWrapper, RlpDecodableWrapper)]
|
||||||
pub struct BlockReceipts {
|
pub struct BlockReceipts {
|
||||||
|
/// Block receipts
|
||||||
pub receipts: Vec<Receipt>,
|
pub receipts: Vec<Receipt>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BlockReceipts {
|
impl BlockReceipts {
|
||||||
|
/// Create new block receipts wrapper.
|
||||||
pub fn new(receipts: Vec<Receipt>) -> Self {
|
pub fn new(receipts: Vec<Receipt>) -> Self {
|
||||||
BlockReceipts {
|
BlockReceipts {
|
||||||
receipts: receipts
|
receipts: receipts
|
||||||
@ -237,7 +243,9 @@ impl HeapSizeOf for BlockReceipts {
|
|||||||
/// Candidate transitions to an epoch with specific number.
|
/// Candidate transitions to an epoch with specific number.
|
||||||
#[derive(Clone, RlpEncodable, RlpDecodable)]
|
#[derive(Clone, RlpEncodable, RlpDecodable)]
|
||||||
pub struct EpochTransitions {
|
pub struct EpochTransitions {
|
||||||
|
/// Epoch number
|
||||||
pub number: u64,
|
pub number: u64,
|
||||||
|
/// List of candidate transitions
|
||||||
pub candidates: Vec<EpochTransition>,
|
pub candidates: Vec<EpochTransition>,
|
||||||
}
|
}
|
||||||
|
|
26
ethcore/db/src/lib.rs
Normal file
26
ethcore/db/src/lib.rs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// Parity is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Parity Ethereum database access utilities.
|
||||||
|
|
||||||
|
#![warn(missing_docs)]
|
||||||
|
|
||||||
|
mod db;
|
||||||
|
|
||||||
|
pub mod keys;
|
||||||
|
pub mod cache_manager;
|
||||||
|
|
||||||
|
pub use self::db::*;
|
@ -8,9 +8,11 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
ethcore = { path = ".."}
|
|
||||||
parity-bytes = "0.1"
|
parity-bytes = "0.1"
|
||||||
ethcore-transaction = { path = "../transaction" }
|
common-types = { path = "../types" }
|
||||||
|
ethcore = { path = ".."}
|
||||||
|
ethcore-db = { path = "../db" }
|
||||||
|
ethcore-blockchain = { path = "../blockchain" }
|
||||||
ethereum-types = "0.4"
|
ethereum-types = "0.4"
|
||||||
memorydb = "0.3.0"
|
memorydb = "0.3.0"
|
||||||
patricia-trie = "0.3.0"
|
patricia-trie = "0.3.0"
|
||||||
|
@ -20,15 +20,15 @@
|
|||||||
//! Furthermore, stores a "gas price corpus" of relative recency, which is a sorted
|
//! Furthermore, stores a "gas price corpus" of relative recency, which is a sorted
|
||||||
//! vector of all gas prices from a recent range of blocks.
|
//! vector of all gas prices from a recent range of blocks.
|
||||||
|
|
||||||
use ethcore::encoded;
|
|
||||||
use ethcore::header::BlockNumber;
|
|
||||||
use ethcore::receipt::Receipt;
|
|
||||||
|
|
||||||
use stats::Corpus;
|
|
||||||
use std::time::{Instant, Duration};
|
use std::time::{Instant, Duration};
|
||||||
use heapsize::HeapSizeOf;
|
|
||||||
|
use common_types::encoded;
|
||||||
|
use common_types::BlockNumber;
|
||||||
|
use common_types::receipt::Receipt;
|
||||||
use ethereum_types::{H256, U256};
|
use ethereum_types::{H256, U256};
|
||||||
|
use heapsize::HeapSizeOf;
|
||||||
use memory_cache::MemoryLruCache;
|
use memory_cache::MemoryLruCache;
|
||||||
|
use stats::Corpus;
|
||||||
|
|
||||||
/// Configuration for how much data to cache.
|
/// Configuration for how much data to cache.
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
//! root has. A correct proof implies that the claimed block is identical to the one
|
//! root has. A correct proof implies that the claimed block is identical to the one
|
||||||
//! we discarded.
|
//! we discarded.
|
||||||
|
|
||||||
use ethcore::ids::BlockId;
|
use common_types::ids::BlockId;
|
||||||
use ethereum_types::{H256, U256};
|
use ethereum_types::{H256, U256};
|
||||||
use hashdb::HashDB;
|
use hashdb::HashDB;
|
||||||
use keccak_hasher::KeccakHasher;
|
use keccak_hasher::KeccakHasher;
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use ethcore::encoded;
|
use common_types::encoded;
|
||||||
|
use common_types::header::Header;
|
||||||
|
use common_types::receipt::Receipt;
|
||||||
use ethcore::engines::{EthEngine, StateDependentProof};
|
use ethcore::engines::{EthEngine, StateDependentProof};
|
||||||
use ethcore::machine::EthereumMachine;
|
use ethcore::machine::EthereumMachine;
|
||||||
use ethcore::header::Header;
|
|
||||||
use ethcore::receipt::Receipt;
|
|
||||||
use futures::future::IntoFuture;
|
|
||||||
use ethereum_types::H256;
|
use ethereum_types::H256;
|
||||||
|
use futures::future::IntoFuture;
|
||||||
|
|
||||||
/// Provides full chain data.
|
/// Provides full chain data.
|
||||||
pub trait ChainDataFetcher: Send + Sync + 'static {
|
pub trait ChainDataFetcher: Send + Sync + 'static {
|
||||||
|
@ -30,12 +30,12 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
use cache::Cache;
|
use cache::Cache;
|
||||||
use cht;
|
use cht;
|
||||||
use ethcore::block_status::BlockStatus;
|
use common_types::block_status::BlockStatus;
|
||||||
use ethcore::encoded;
|
use common_types::encoded;
|
||||||
|
use common_types::header::Header;
|
||||||
|
use common_types::ids::BlockId;
|
||||||
use ethcore::engines::epoch::{Transition as EpochTransition, PendingTransition as PendingEpochTransition};
|
use ethcore::engines::epoch::{Transition as EpochTransition, PendingTransition as PendingEpochTransition};
|
||||||
use ethcore::error::{Error, EthcoreResult, ErrorKind as EthcoreErrorKind, BlockError};
|
use ethcore::error::{Error, EthcoreResult, ErrorKind as EthcoreErrorKind, BlockError};
|
||||||
use ethcore::header::Header;
|
|
||||||
use ethcore::ids::BlockId;
|
|
||||||
use ethcore::spec::{Spec, SpecHardcodedSync};
|
use ethcore::spec::{Spec, SpecHardcodedSync};
|
||||||
use ethereum_types::{H256, H264, U256};
|
use ethereum_types::{H256, H264, U256};
|
||||||
use heapsize::HeapSizeOf;
|
use heapsize::HeapSizeOf;
|
||||||
@ -862,11 +862,11 @@ mod tests {
|
|||||||
use super::{HeaderChain, HardcodedSync};
|
use super::{HeaderChain, HardcodedSync};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use ethereum_types::U256;
|
|
||||||
use ethcore::ids::BlockId;
|
|
||||||
use ethcore::header::Header;
|
|
||||||
use ethcore::spec::Spec;
|
|
||||||
use cache::Cache;
|
use cache::Cache;
|
||||||
|
use common_types::header::Header;
|
||||||
|
use common_types::ids::BlockId;
|
||||||
|
use ethcore::spec::Spec;
|
||||||
|
use ethereum_types::U256;
|
||||||
use kvdb::KeyValueDB;
|
use kvdb::KeyValueDB;
|
||||||
use kvdb_memorydb;
|
use kvdb_memorydb;
|
||||||
|
|
||||||
|
@ -18,21 +18,22 @@
|
|||||||
|
|
||||||
use std::sync::{Weak, Arc};
|
use std::sync::{Weak, Arc};
|
||||||
|
|
||||||
use ethcore::block_status::BlockStatus;
|
|
||||||
use ethcore::client::{ClientReport, EnvInfo, ClientIoMessage};
|
use ethcore::client::{ClientReport, EnvInfo, ClientIoMessage};
|
||||||
use ethcore::engines::{epoch, EthEngine, EpochChange, EpochTransition, Proof};
|
use ethcore::engines::{epoch, EthEngine, EpochChange, EpochTransition, Proof};
|
||||||
use ethcore::machine::EthereumMachine;
|
use ethcore::machine::EthereumMachine;
|
||||||
use ethcore::error::{Error, EthcoreResult};
|
use ethcore::error::{Error, EthcoreResult};
|
||||||
use ethcore::ids::BlockId;
|
|
||||||
use ethcore::header::{BlockNumber, Header};
|
|
||||||
use ethcore::verification::queue::{self, HeaderQueue};
|
use ethcore::verification::queue::{self, HeaderQueue};
|
||||||
use ethcore::blockchain_info::BlockChainInfo;
|
|
||||||
use ethcore::spec::{Spec, SpecHardcodedSync};
|
use ethcore::spec::{Spec, SpecHardcodedSync};
|
||||||
use ethcore::encoded;
|
|
||||||
use io::IoChannel;
|
use io::IoChannel;
|
||||||
use parking_lot::{Mutex, RwLock};
|
use parking_lot::{Mutex, RwLock};
|
||||||
use ethereum_types::{H256, U256};
|
use ethereum_types::{H256, U256};
|
||||||
use futures::{IntoFuture, Future};
|
use futures::{IntoFuture, Future};
|
||||||
|
use common_types::BlockNumber;
|
||||||
|
use common_types::block_status::BlockStatus;
|
||||||
|
use common_types::blockchain_info::BlockChainInfo;
|
||||||
|
use common_types::encoded;
|
||||||
|
use common_types::header::Header;
|
||||||
|
use common_types::ids::BlockId;
|
||||||
|
|
||||||
use kvdb::KeyValueDB;
|
use kvdb::KeyValueDB;
|
||||||
|
|
||||||
|
@ -20,8 +20,9 @@
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use ethcore_db as db;
|
||||||
|
use ethcore_blockchain::BlockChainDB;
|
||||||
use ethcore::client::ClientIoMessage;
|
use ethcore::client::ClientIoMessage;
|
||||||
use ethcore::{db, BlockChainDB};
|
|
||||||
use ethcore::error::Error as CoreError;
|
use ethcore::error::Error as CoreError;
|
||||||
use ethcore::spec::Spec;
|
use ethcore::spec::Spec;
|
||||||
use io::{IoContext, IoError, IoHandler, IoService};
|
use io::{IoContext, IoError, IoHandler, IoService};
|
||||||
|
@ -54,10 +54,12 @@ extern crate serde_derive;
|
|||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
||||||
extern crate bincode;
|
extern crate bincode;
|
||||||
|
extern crate common_types;
|
||||||
|
extern crate ethcore_blockchain;
|
||||||
|
extern crate ethcore_db;
|
||||||
extern crate ethcore_io as io;
|
extern crate ethcore_io as io;
|
||||||
extern crate ethcore_network as network;
|
extern crate ethcore_network as network;
|
||||||
extern crate parity_bytes as bytes;
|
extern crate parity_bytes as bytes;
|
||||||
extern crate ethcore_transaction as transaction;
|
|
||||||
extern crate ethereum_types;
|
extern crate ethereum_types;
|
||||||
extern crate ethcore;
|
extern crate ethcore;
|
||||||
extern crate hashdb;
|
extern crate hashdb;
|
||||||
|
@ -18,8 +18,7 @@
|
|||||||
//!
|
//!
|
||||||
//! This uses a "Provider" to answer requests.
|
//! This uses a "Provider" to answer requests.
|
||||||
|
|
||||||
use transaction::UnverifiedTransaction;
|
use common_types::transaction::UnverifiedTransaction;
|
||||||
|
|
||||||
use ethereum_types::{H256, U256};
|
use ethereum_types::{H256, U256};
|
||||||
use io::TimerToken;
|
use io::TimerToken;
|
||||||
use kvdb::DBValue;
|
use kvdb::DBValue;
|
||||||
|
@ -17,21 +17,21 @@
|
|||||||
//! Tests for the `LightProtocol` implementation.
|
//! Tests for the `LightProtocol` implementation.
|
||||||
//! These don't test of the higher level logic on top of
|
//! These don't test of the higher level logic on top of
|
||||||
|
|
||||||
use ethcore::blockchain_info::BlockChainInfo;
|
use common_types::blockchain_info::BlockChainInfo;
|
||||||
|
use common_types::encoded;
|
||||||
|
use common_types::ids::BlockId;
|
||||||
|
use common_types::transaction::{Action, PendingTransaction};
|
||||||
use ethcore::client::{EachBlockWith, TestBlockChainClient};
|
use ethcore::client::{EachBlockWith, TestBlockChainClient};
|
||||||
use ethcore::encoded;
|
|
||||||
use ethcore::ids::BlockId;
|
|
||||||
use ethereum_types::{H256, U256, Address};
|
use ethereum_types::{H256, U256, Address};
|
||||||
use net::{LightProtocol, Params, packet, Peer, Statistics};
|
|
||||||
use net::context::IoContext;
|
use net::context::IoContext;
|
||||||
use net::status::{Capabilities, Status};
|
|
||||||
use net::load_timer::MOVING_SAMPLE_SIZE;
|
use net::load_timer::MOVING_SAMPLE_SIZE;
|
||||||
|
use net::status::{Capabilities, Status};
|
||||||
|
use net::{LightProtocol, Params, packet, Peer, Statistics};
|
||||||
use network::{PeerId, NodeId};
|
use network::{PeerId, NodeId};
|
||||||
use provider::Provider;
|
use provider::Provider;
|
||||||
use request;
|
|
||||||
use request::*;
|
use request::*;
|
||||||
|
use request;
|
||||||
use rlp::{Rlp, RlpStream};
|
use rlp::{Rlp, RlpStream};
|
||||||
use transaction::{Action, PendingTransaction};
|
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
@ -20,11 +20,12 @@ use std::cmp;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use ethcore::basic_account::BasicAccount;
|
use common_types::basic_account::BasicAccount;
|
||||||
use ethcore::encoded;
|
use common_types::encoded;
|
||||||
|
use common_types::receipt::Receipt;
|
||||||
|
use common_types::transaction::SignedTransaction;
|
||||||
use ethcore::engines::{EthEngine, StateDependentProof};
|
use ethcore::engines::{EthEngine, StateDependentProof};
|
||||||
use ethcore::machine::EthereumMachine;
|
use ethcore::machine::EthereumMachine;
|
||||||
use ethcore::receipt::Receipt;
|
|
||||||
use ethcore::state::{self, ProvedExecution};
|
use ethcore::state::{self, ProvedExecution};
|
||||||
use ethereum_types::{H256, U256, Address};
|
use ethereum_types::{H256, U256, Address};
|
||||||
use ethtrie::{TrieError, TrieDB};
|
use ethtrie::{TrieError, TrieDB};
|
||||||
@ -35,7 +36,6 @@ use memorydb::MemoryDB;
|
|||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use request::{self as net_request, IncompleteRequest, CompleteRequest, Output, OutputKind, Field};
|
use request::{self as net_request, IncompleteRequest, CompleteRequest, Output, OutputKind, Field};
|
||||||
use rlp::{RlpStream, Rlp};
|
use rlp::{RlpStream, Rlp};
|
||||||
use transaction::SignedTransaction;
|
|
||||||
use trie::Trie;
|
use trie::Trie;
|
||||||
use vm::EnvInfo;
|
use vm::EnvInfo;
|
||||||
|
|
||||||
@ -1108,10 +1108,10 @@ mod tests {
|
|||||||
use trie::Recorder;
|
use trie::Recorder;
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
|
|
||||||
use ::ethcore::client::{BlockChainClient, BlockInfo, TestBlockChainClient, EachBlockWith};
|
use ethcore::client::{BlockChainClient, BlockInfo, TestBlockChainClient, EachBlockWith};
|
||||||
use ethcore::header::Header;
|
use common_types::header::Header;
|
||||||
use ethcore::encoded;
|
use common_types::encoded;
|
||||||
use ethcore::receipt::{Receipt, TransactionOutcome};
|
use common_types::receipt::{Receipt, TransactionOutcome};
|
||||||
|
|
||||||
fn make_cache() -> ::cache::Cache {
|
fn make_cache() -> ::cache::Cache {
|
||||||
::cache::Cache::new(Default::default(), Duration::from_secs(1))
|
::cache::Cache::new(Default::default(), Duration::from_secs(1))
|
||||||
|
@ -17,13 +17,13 @@
|
|||||||
//! Tests for the on-demand service.
|
//! Tests for the on-demand service.
|
||||||
|
|
||||||
use cache::Cache;
|
use cache::Cache;
|
||||||
use ethcore::header::Header;
|
|
||||||
use futures::Future;
|
use futures::Future;
|
||||||
use network::{PeerId, NodeId};
|
use network::{PeerId, NodeId};
|
||||||
use net::*;
|
use net::*;
|
||||||
|
use common_types::header::Header;
|
||||||
use ethereum_types::H256;
|
use ethereum_types::H256;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use ::request::{self as basic_request, Response};
|
use request::{self as basic_request, Response};
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
@ -19,13 +19,13 @@
|
|||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use ethcore::blockchain_info::BlockChainInfo;
|
use common_types::blockchain_info::BlockChainInfo;
|
||||||
|
use common_types::encoded;
|
||||||
|
use common_types::ids::BlockId;
|
||||||
|
use common_types::transaction::PendingTransaction;
|
||||||
use ethcore::client::{BlockChainClient, ProvingBlockChainClient, ChainInfo, BlockInfo as ClientBlockInfo};
|
use ethcore::client::{BlockChainClient, ProvingBlockChainClient, ChainInfo, BlockInfo as ClientBlockInfo};
|
||||||
use ethcore::ids::BlockId;
|
|
||||||
use ethcore::encoded;
|
|
||||||
use ethereum_types::H256;
|
use ethereum_types::H256;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use transaction::PendingTransaction;
|
|
||||||
|
|
||||||
use cht::{self, BlockInfo};
|
use cht::{self, BlockInfo};
|
||||||
use client::{LightChainClient, AsLightClient};
|
use client::{LightChainClient, AsLightClient};
|
||||||
@ -161,7 +161,7 @@ impl<T: ProvingBlockChainClient + ?Sized> Provider for T {
|
|||||||
fn transaction_index(&self, req: request::CompleteTransactionIndexRequest)
|
fn transaction_index(&self, req: request::CompleteTransactionIndexRequest)
|
||||||
-> Option<request::TransactionIndexResponse>
|
-> Option<request::TransactionIndexResponse>
|
||||||
{
|
{
|
||||||
use ethcore::ids::TransactionId;
|
use common_types::ids::TransactionId;
|
||||||
|
|
||||||
self.transaction_receipt(TransactionId::Hash(req.hash)).map(|receipt| request::TransactionIndexResponse {
|
self.transaction_receipt(TransactionId::Hash(req.hash)).map(|receipt| request::TransactionIndexResponse {
|
||||||
num: receipt.block_number,
|
num: receipt.block_number,
|
||||||
@ -265,7 +265,7 @@ impl<T: ProvingBlockChainClient + ?Sized> Provider for T {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn transaction_proof(&self, req: request::CompleteExecutionRequest) -> Option<request::ExecutionResponse> {
|
fn transaction_proof(&self, req: request::CompleteExecutionRequest) -> Option<request::ExecutionResponse> {
|
||||||
use transaction::Transaction;
|
use common_types::transaction::Transaction;
|
||||||
|
|
||||||
let id = BlockId::Hash(req.block_hash);
|
let id = BlockId::Hash(req.block_hash);
|
||||||
let nonce = match self.nonce(&req.from, id) {
|
let nonce = match self.nonce(&req.from, id) {
|
||||||
|
@ -27,7 +27,7 @@ use std::fmt;
|
|||||||
use std::collections::{BTreeMap, HashMap};
|
use std::collections::{BTreeMap, HashMap};
|
||||||
use std::collections::hash_map::Entry;
|
use std::collections::hash_map::Entry;
|
||||||
|
|
||||||
use transaction::{self, Condition, PendingTransaction, SignedTransaction};
|
use common_types::transaction::{self, Condition, PendingTransaction, SignedTransaction};
|
||||||
use ethereum_types::{H256, U256, Address};
|
use ethereum_types::{H256, U256, Address};
|
||||||
use fastmap::H256FastMap;
|
use fastmap::H256FastMap;
|
||||||
|
|
||||||
@ -370,7 +370,7 @@ impl TransactionQueue {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::TransactionQueue;
|
use super::TransactionQueue;
|
||||||
use ethereum_types::Address;
|
use ethereum_types::Address;
|
||||||
use transaction::{Transaction, PendingTransaction, Condition};
|
use common_types::transaction::{Transaction, PendingTransaction, Condition};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn queued_senders() {
|
fn queued_senders() {
|
||||||
|
@ -670,7 +670,7 @@ pub trait ResponseLike {
|
|||||||
/// Header request.
|
/// Header request.
|
||||||
pub mod header {
|
pub mod header {
|
||||||
use super::{Field, HashOrNumber, NoSuchOutput, OutputKind, Output};
|
use super::{Field, HashOrNumber, NoSuchOutput, OutputKind, Output};
|
||||||
use ethcore::encoded;
|
use common_types::encoded;
|
||||||
use rlp::{Encodable, Decodable, DecoderError, RlpStream, Rlp};
|
use rlp::{Encodable, Decodable, DecoderError, RlpStream, Rlp};
|
||||||
|
|
||||||
/// Potentially incomplete headers request.
|
/// Potentially incomplete headers request.
|
||||||
@ -753,7 +753,7 @@ pub mod header {
|
|||||||
|
|
||||||
impl Decodable for Response {
|
impl Decodable for Response {
|
||||||
fn decode(rlp: &Rlp) -> Result<Self, DecoderError> {
|
fn decode(rlp: &Rlp) -> Result<Self, DecoderError> {
|
||||||
use ethcore::header::Header as FullHeader;
|
use common_types::header::Header as FullHeader;
|
||||||
|
|
||||||
let mut headers = Vec::new();
|
let mut headers = Vec::new();
|
||||||
|
|
||||||
@ -954,7 +954,7 @@ pub mod transaction_index {
|
|||||||
/// Request and response for block receipts
|
/// Request and response for block receipts
|
||||||
pub mod block_receipts {
|
pub mod block_receipts {
|
||||||
use super::{Field, NoSuchOutput, OutputKind, Output};
|
use super::{Field, NoSuchOutput, OutputKind, Output};
|
||||||
use ethcore::receipt::Receipt;
|
use common_types::receipt::Receipt;
|
||||||
use ethereum_types::H256;
|
use ethereum_types::H256;
|
||||||
|
|
||||||
/// Potentially incomplete block receipts request.
|
/// Potentially incomplete block receipts request.
|
||||||
@ -1022,7 +1022,7 @@ pub mod block_receipts {
|
|||||||
/// Request and response for a block body
|
/// Request and response for a block body
|
||||||
pub mod block_body {
|
pub mod block_body {
|
||||||
use super::{Field, NoSuchOutput, OutputKind, Output};
|
use super::{Field, NoSuchOutput, OutputKind, Output};
|
||||||
use ethcore::encoded;
|
use common_types::encoded;
|
||||||
use rlp::{Encodable, Decodable, DecoderError, RlpStream, Rlp};
|
use rlp::{Encodable, Decodable, DecoderError, RlpStream, Rlp};
|
||||||
use ethereum_types::H256;
|
use ethereum_types::H256;
|
||||||
|
|
||||||
@ -1089,8 +1089,8 @@ pub mod block_body {
|
|||||||
|
|
||||||
impl Decodable for Response {
|
impl Decodable for Response {
|
||||||
fn decode(rlp: &Rlp) -> Result<Self, DecoderError> {
|
fn decode(rlp: &Rlp) -> Result<Self, DecoderError> {
|
||||||
use ethcore::header::Header as FullHeader;
|
use common_types::header::Header as FullHeader;
|
||||||
use transaction::UnverifiedTransaction;
|
use common_types::transaction::UnverifiedTransaction;
|
||||||
|
|
||||||
// check body validity.
|
// check body validity.
|
||||||
let _: Vec<UnverifiedTransaction> = rlp.list_at(0)?;
|
let _: Vec<UnverifiedTransaction> = rlp.list_at(0)?;
|
||||||
@ -1406,7 +1406,7 @@ pub mod contract_code {
|
|||||||
/// A request for proof of execution.
|
/// A request for proof of execution.
|
||||||
pub mod execution {
|
pub mod execution {
|
||||||
use super::{Field, NoSuchOutput, OutputKind, Output};
|
use super::{Field, NoSuchOutput, OutputKind, Output};
|
||||||
use transaction::Action;
|
use common_types::transaction::Action;
|
||||||
use rlp::{Encodable, Decodable, DecoderError, RlpStream, Rlp};
|
use rlp::{Encodable, Decodable, DecoderError, RlpStream, Rlp};
|
||||||
use ethereum_types::{H256, U256, Address};
|
use ethereum_types::{H256, U256, Address};
|
||||||
use kvdb::DBValue;
|
use kvdb::DBValue;
|
||||||
@ -1629,7 +1629,7 @@ pub mod epoch_signal {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use ethcore::header::Header;
|
use common_types::header::Header;
|
||||||
|
|
||||||
fn check_roundtrip<T>(val: T)
|
fn check_roundtrip<T>(val: T)
|
||||||
where T: ::rlp::Encodable + ::rlp::Decodable + PartialEq + ::std::fmt::Debug
|
where T: ::rlp::Encodable + ::rlp::Decodable + PartialEq + ::std::fmt::Debug
|
||||||
@ -1676,7 +1676,7 @@ mod tests {
|
|||||||
let full_req = Request::Headers(req.clone());
|
let full_req = Request::Headers(req.clone());
|
||||||
let res = HeadersResponse {
|
let res = HeadersResponse {
|
||||||
headers: vec![
|
headers: vec![
|
||||||
::ethcore::encoded::Header::new(::rlp::encode(&Header::default()))
|
::common_types::encoded::Header::new(::rlp::encode(&Header::default()))
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
let full_res = Response::Headers(res.clone());
|
let full_res = Response::Headers(res.clone());
|
||||||
@ -1729,7 +1729,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn receipts_roundtrip() {
|
fn receipts_roundtrip() {
|
||||||
use ethcore::receipt::{Receipt, TransactionOutcome};
|
use common_types::receipt::{Receipt, TransactionOutcome};
|
||||||
let req = IncompleteReceiptsRequest {
|
let req = IncompleteReceiptsRequest {
|
||||||
hash: Field::Scalar(Default::default()),
|
hash: Field::Scalar(Default::default()),
|
||||||
};
|
};
|
||||||
@ -1749,7 +1749,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn body_roundtrip() {
|
fn body_roundtrip() {
|
||||||
use transaction::{Transaction, UnverifiedTransaction};
|
use common_types::transaction::{Transaction, UnverifiedTransaction};
|
||||||
let req = IncompleteBodyRequest {
|
let req = IncompleteBodyRequest {
|
||||||
hash: Field::Scalar(Default::default()),
|
hash: Field::Scalar(Default::default()),
|
||||||
};
|
};
|
||||||
@ -1757,13 +1757,13 @@ mod tests {
|
|||||||
let full_req = Request::Body(req.clone());
|
let full_req = Request::Body(req.clone());
|
||||||
let res = BodyResponse {
|
let res = BodyResponse {
|
||||||
body: {
|
body: {
|
||||||
let header = ::ethcore::header::Header::default();
|
let header = ::common_types::header::Header::default();
|
||||||
let tx = UnverifiedTransaction::from(Transaction::default().fake_sign(Default::default()));
|
let tx = UnverifiedTransaction::from(Transaction::default().fake_sign(Default::default()));
|
||||||
let mut stream = RlpStream::new_list(2);
|
let mut stream = RlpStream::new_list(2);
|
||||||
stream.begin_list(2).append(&tx).append(&tx)
|
stream.begin_list(2).append(&tx).append(&tx)
|
||||||
.begin_list(1).append(&header);
|
.begin_list(1).append(&header);
|
||||||
|
|
||||||
::ethcore::encoded::Body::new(stream.out())
|
::common_types::encoded::Body::new(stream.out())
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let full_res = Response::Body(res.clone());
|
let full_res = Response::Body(res.clone());
|
||||||
@ -1844,7 +1844,7 @@ mod tests {
|
|||||||
let req = IncompleteExecutionRequest {
|
let req = IncompleteExecutionRequest {
|
||||||
block_hash: Field::Scalar(Default::default()),
|
block_hash: Field::Scalar(Default::default()),
|
||||||
from: Default::default(),
|
from: Default::default(),
|
||||||
action: ::transaction::Action::Create,
|
action: ::common_types::transaction::Action::Create,
|
||||||
gas: 100_000.into(),
|
gas: 100_000.into(),
|
||||||
gas_price: 0.into(),
|
gas_price: 0.into(),
|
||||||
value: 100_000_001.into(),
|
value: 100_000_001.into(),
|
||||||
@ -1874,7 +1874,7 @@ mod tests {
|
|||||||
let reqs: Vec<_> = (0..10).map(|_| IncompleteExecutionRequest {
|
let reqs: Vec<_> = (0..10).map(|_| IncompleteExecutionRequest {
|
||||||
block_hash: Field::Scalar(Default::default()),
|
block_hash: Field::Scalar(Default::default()),
|
||||||
from: Default::default(),
|
from: Default::default(),
|
||||||
action: ::transaction::Action::Create,
|
action: ::common_types::transaction::Action::Create,
|
||||||
gas: 100_000.into(),
|
gas: 100_000.into(),
|
||||||
gas_price: 0.into(),
|
gas_price: 0.into(),
|
||||||
value: 100_000_001.into(),
|
value: 100_000_001.into(),
|
||||||
@ -1892,11 +1892,11 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn responses_vec() {
|
fn responses_vec() {
|
||||||
use ethcore::receipt::{Receipt, TransactionOutcome};
|
use common_types::receipt::{Receipt, TransactionOutcome};
|
||||||
let mut stream = RlpStream::new_list(2);
|
let mut stream = RlpStream::new_list(2);
|
||||||
stream.begin_list(0).begin_list(0);
|
stream.begin_list(0).begin_list(0);
|
||||||
|
|
||||||
let body = ::ethcore::encoded::Body::new(stream.out());
|
let body = ::common_types::encoded::Body::new(stream.out());
|
||||||
let reqs = vec![
|
let reqs = vec![
|
||||||
Response::Headers(HeadersResponse { headers: vec![] }),
|
Response::Headers(HeadersResponse { headers: vec![] }),
|
||||||
Response::HeaderProof(HeaderProofResponse { proof: vec![], hash: Default::default(), td: 100.into()}),
|
Response::HeaderProof(HeaderProofResponse { proof: vec![], hash: Default::default(), td: 100.into()}),
|
||||||
|
@ -6,17 +6,15 @@ license = "GPL-3.0"
|
|||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
common-types = { path = "../types" }
|
||||||
error-chain = { version = "0.12", default-features = false }
|
error-chain = { version = "0.12", default-features = false }
|
||||||
ethabi = "6.0"
|
ethabi = "6.0"
|
||||||
ethabi-derive = "6.0"
|
|
||||||
ethabi-contract = "6.0"
|
ethabi-contract = "6.0"
|
||||||
|
ethabi-derive = "6.0"
|
||||||
ethcore = { path = ".." }
|
ethcore = { path = ".." }
|
||||||
parity-bytes = "0.1"
|
|
||||||
parity-crypto = "0.2"
|
|
||||||
ethcore-io = { path = "../../util/io" }
|
ethcore-io = { path = "../../util/io" }
|
||||||
ethcore-logger = { path = "../../logger" }
|
ethcore-logger = { path = "../../logger" }
|
||||||
ethcore-miner = { path = "../../miner" }
|
ethcore-miner = { path = "../../miner" }
|
||||||
ethcore-transaction = { path = "../transaction" }
|
|
||||||
ethereum-types = "0.4"
|
ethereum-types = "0.4"
|
||||||
ethjson = { path = "../../json" }
|
ethjson = { path = "../../json" }
|
||||||
ethkey = { path = "../../accounts/ethkey" }
|
ethkey = { path = "../../accounts/ethkey" }
|
||||||
@ -25,6 +23,8 @@ futures = "0.1"
|
|||||||
heapsize = "0.4"
|
heapsize = "0.4"
|
||||||
keccak-hash = "0.1.2"
|
keccak-hash = "0.1.2"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
parity-bytes = "0.1"
|
||||||
|
parity-crypto = "0.2"
|
||||||
parking_lot = "0.7"
|
parking_lot = "0.7"
|
||||||
patricia-trie = "0.3.0"
|
patricia-trie = "0.3.0"
|
||||||
patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" }
|
patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" }
|
||||||
|
@ -19,7 +19,7 @@ use rlp::DecoderError;
|
|||||||
use ethtrie::TrieError;
|
use ethtrie::TrieError;
|
||||||
use ethcore::account_provider::SignError;
|
use ethcore::account_provider::SignError;
|
||||||
use ethcore::error::{Error as EthcoreError, ExecutionError};
|
use ethcore::error::{Error as EthcoreError, ExecutionError};
|
||||||
use transaction::Error as TransactionError;
|
use types::transaction::Error as TransactionError;
|
||||||
use ethkey::Error as KeyError;
|
use ethkey::Error as KeyError;
|
||||||
use txpool::Error as TxPoolError;
|
use txpool::Error as TxPoolError;
|
||||||
|
|
||||||
|
@ -25,27 +25,27 @@ mod private_transactions;
|
|||||||
mod messages;
|
mod messages;
|
||||||
mod error;
|
mod error;
|
||||||
|
|
||||||
|
extern crate common_types as types;
|
||||||
|
extern crate ethabi;
|
||||||
extern crate ethcore;
|
extern crate ethcore;
|
||||||
extern crate parity_bytes as bytes;
|
|
||||||
extern crate parity_crypto as crypto;
|
|
||||||
extern crate ethcore_io as io;
|
extern crate ethcore_io as io;
|
||||||
extern crate ethcore_miner;
|
extern crate ethcore_miner;
|
||||||
extern crate ethcore_transaction as transaction;
|
|
||||||
extern crate ethabi;
|
|
||||||
extern crate ethereum_types;
|
extern crate ethereum_types;
|
||||||
extern crate ethkey;
|
|
||||||
extern crate ethjson;
|
extern crate ethjson;
|
||||||
|
extern crate ethkey;
|
||||||
extern crate fetch;
|
extern crate fetch;
|
||||||
extern crate futures;
|
extern crate futures;
|
||||||
extern crate heapsize;
|
extern crate heapsize;
|
||||||
extern crate keccak_hash as hash;
|
extern crate keccak_hash as hash;
|
||||||
|
extern crate parity_bytes as bytes;
|
||||||
|
extern crate parity_crypto as crypto;
|
||||||
extern crate parking_lot;
|
extern crate parking_lot;
|
||||||
extern crate patricia_trie as trie;
|
extern crate patricia_trie as trie;
|
||||||
extern crate transaction_pool as txpool;
|
|
||||||
extern crate patricia_trie_ethereum as ethtrie;
|
extern crate patricia_trie_ethereum as ethtrie;
|
||||||
extern crate rlp;
|
extern crate rlp;
|
||||||
extern crate url;
|
|
||||||
extern crate rustc_hex;
|
extern crate rustc_hex;
|
||||||
|
extern crate transaction_pool as txpool;
|
||||||
|
extern crate url;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
@ -78,7 +78,7 @@ use ethkey::{Signature, recover, public_to_address};
|
|||||||
use io::IoChannel;
|
use io::IoChannel;
|
||||||
use ethcore::executive::{Executive, TransactOptions};
|
use ethcore::executive::{Executive, TransactOptions};
|
||||||
use ethcore::executed::{Executed};
|
use ethcore::executed::{Executed};
|
||||||
use transaction::{SignedTransaction, Transaction, Action, UnverifiedTransaction};
|
use types::transaction::{SignedTransaction, Transaction, Action, UnverifiedTransaction};
|
||||||
use ethcore::{contract_address as ethcore_contract_address};
|
use ethcore::{contract_address as ethcore_contract_address};
|
||||||
use ethcore::client::{
|
use ethcore::client::{
|
||||||
Client, ChainNotify, NewBlocks, ChainMessageType, ClientIoMessage, BlockId,
|
Client, ChainNotify, NewBlocks, ChainMessageType, ClientIoMessage, BlockId,
|
||||||
|
@ -19,7 +19,7 @@ use bytes::Bytes;
|
|||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use rlp::Encodable;
|
use rlp::Encodable;
|
||||||
use ethkey::Signature;
|
use ethkey::Signature;
|
||||||
use transaction::signature::{add_chain_replay_protection, check_replay_protection};
|
use types::transaction::signature::{add_chain_replay_protection, check_replay_protection};
|
||||||
|
|
||||||
/// Message with private transaction encrypted
|
/// Message with private transaction encrypted
|
||||||
#[derive(Default, Debug, Clone, PartialEq, RlpEncodable, RlpDecodable, Eq)]
|
#[derive(Default, Debug, Clone, PartialEq, RlpEncodable, RlpDecodable, Eq)]
|
||||||
|
@ -25,7 +25,7 @@ use heapsize::HeapSizeOf;
|
|||||||
use ethkey::Signature;
|
use ethkey::Signature;
|
||||||
use messages::PrivateTransaction;
|
use messages::PrivateTransaction;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use transaction::{UnverifiedTransaction, SignedTransaction};
|
use types::transaction::{UnverifiedTransaction, SignedTransaction};
|
||||||
use txpool;
|
use txpool;
|
||||||
use txpool::{VerifiedTransaction, Verifier};
|
use txpool::{VerifiedTransaction, Verifier};
|
||||||
use error::{Error, ErrorKind};
|
use error::{Error, ErrorKind};
|
||||||
|
@ -16,14 +16,14 @@
|
|||||||
|
|
||||||
//! Contract for private transactions tests.
|
//! Contract for private transactions tests.
|
||||||
|
|
||||||
extern crate rustc_hex;
|
extern crate common_types as types;
|
||||||
extern crate ethcore;
|
extern crate ethcore;
|
||||||
extern crate ethkey;
|
|
||||||
extern crate keccak_hash as hash;
|
|
||||||
extern crate ethcore_io;
|
extern crate ethcore_io;
|
||||||
extern crate ethcore_logger;
|
extern crate ethcore_logger;
|
||||||
extern crate ethcore_private_tx;
|
extern crate ethcore_private_tx;
|
||||||
extern crate ethcore_transaction;
|
extern crate ethkey;
|
||||||
|
extern crate keccak_hash as hash;
|
||||||
|
extern crate rustc_hex;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
@ -31,14 +31,14 @@ extern crate log;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use rustc_hex::FromHex;
|
use rustc_hex::FromHex;
|
||||||
|
|
||||||
|
use types::ids::BlockId;
|
||||||
|
use types::transaction::{Transaction, Action};
|
||||||
use ethcore::CreateContractAddress;
|
use ethcore::CreateContractAddress;
|
||||||
use ethcore::account_provider::AccountProvider;
|
use ethcore::account_provider::AccountProvider;
|
||||||
use ethcore::client::BlockChainClient;
|
use ethcore::client::BlockChainClient;
|
||||||
use ethcore::client::BlockId;
|
|
||||||
use ethcore::executive::{contract_address};
|
use ethcore::executive::{contract_address};
|
||||||
use ethcore::miner::Miner;
|
use ethcore::miner::Miner;
|
||||||
use ethcore::test_helpers::{generate_dummy_client, push_block_with_transactions};
|
use ethcore::test_helpers::{generate_dummy_client, push_block_with_transactions};
|
||||||
use ethcore_transaction::{Transaction, Action};
|
|
||||||
use ethkey::{Secret, KeyPair, Signature};
|
use ethkey::{Secret, KeyPair, Signature};
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
|||||||
ansi_term = "0.10"
|
ansi_term = "0.10"
|
||||||
error-chain = { version = "0.12", default-features = false }
|
error-chain = { version = "0.12", default-features = false }
|
||||||
ethcore = { path = ".." }
|
ethcore = { path = ".." }
|
||||||
|
ethcore-blockchain = { path = "../blockchain" }
|
||||||
ethcore-io = { path = "../../util/io" }
|
ethcore-io = { path = "../../util/io" }
|
||||||
ethcore-private-tx = { path = "../private-tx" }
|
ethcore-private-tx = { path = "../private-tx" }
|
||||||
ethcore-sync = { path = "../sync" }
|
ethcore-sync = { path = "../sync" }
|
||||||
@ -16,6 +17,7 @@ log = "0.4"
|
|||||||
trace-time = "0.1"
|
trace-time = "0.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
ethcore-db = { path = "../db" }
|
||||||
ethcore = { path = "..", features = ["test-helpers"] }
|
ethcore = { path = "..", features = ["test-helpers"] }
|
||||||
tempdir = "0.3"
|
tempdir = "0.3"
|
||||||
kvdb-rocksdb = "0.1.3"
|
kvdb-rocksdb = "0.1.3"
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
extern crate ansi_term;
|
extern crate ansi_term;
|
||||||
extern crate ethcore;
|
extern crate ethcore;
|
||||||
|
extern crate ethcore_blockchain as blockchain;
|
||||||
extern crate ethcore_io as io;
|
extern crate ethcore_io as io;
|
||||||
extern crate ethcore_private_tx;
|
extern crate ethcore_private_tx;
|
||||||
extern crate ethcore_sync as sync;
|
extern crate ethcore_sync as sync;
|
||||||
@ -24,16 +25,17 @@ extern crate kvdb;
|
|||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate error_chain;
|
extern crate error_chain;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate trace_time;
|
extern crate trace_time;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
extern crate ethcore_db;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
extern crate tempdir;
|
extern crate tempdir;
|
||||||
|
|
||||||
|
|
||||||
mod error;
|
mod error;
|
||||||
mod service;
|
mod service;
|
||||||
mod stop_guard;
|
mod stop_guard;
|
||||||
|
@ -26,7 +26,7 @@ use io::{IoContext, TimerToken, IoHandler, IoService, IoError};
|
|||||||
use stop_guard::StopGuard;
|
use stop_guard::StopGuard;
|
||||||
|
|
||||||
use sync::PrivateTxHandler;
|
use sync::PrivateTxHandler;
|
||||||
use ethcore::{BlockChainDB, BlockChainDBHandler};
|
use blockchain::{BlockChainDB, BlockChainDBHandler};
|
||||||
use ethcore::client::{Client, ClientConfig, ChainNotify, ClientIoMessage};
|
use ethcore::client::{Client, ClientConfig, ChainNotify, ClientIoMessage};
|
||||||
use ethcore::miner::Miner;
|
use ethcore::miner::Miner;
|
||||||
use ethcore::snapshot::service::{Service as SnapshotService, ServiceParams as SnapServiceParams};
|
use ethcore::snapshot::service::{Service as SnapshotService, ServiceParams as SnapServiceParams};
|
||||||
@ -275,11 +275,11 @@ mod tests {
|
|||||||
|
|
||||||
use tempdir::TempDir;
|
use tempdir::TempDir;
|
||||||
|
|
||||||
|
use ethcore_db::NUM_COLUMNS;
|
||||||
use ethcore::account_provider::AccountProvider;
|
use ethcore::account_provider::AccountProvider;
|
||||||
use ethcore::client::ClientConfig;
|
use ethcore::client::ClientConfig;
|
||||||
use ethcore::miner::Miner;
|
use ethcore::miner::Miner;
|
||||||
use ethcore::spec::Spec;
|
use ethcore::spec::Spec;
|
||||||
use ethcore::db::NUM_COLUMNS;
|
|
||||||
use ethcore::test_helpers;
|
use ethcore::test_helpers;
|
||||||
use kvdb_rocksdb::{DatabaseConfig, CompactionProfile};
|
use kvdb_rocksdb::{DatabaseConfig, CompactionProfile};
|
||||||
use super::*;
|
use super::*;
|
||||||
|
@ -32,11 +32,11 @@ use ethstore::{
|
|||||||
random_string, SecretVaultRef, StoreAccountRef, OpaqueSecret,
|
random_string, SecretVaultRef, StoreAccountRef, OpaqueSecret,
|
||||||
};
|
};
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
use types::transaction::{Action, Transaction};
|
||||||
|
|
||||||
pub use ethstore::ethkey::Signature;
|
pub use ethstore::ethkey::Signature;
|
||||||
pub use ethstore::{Derivation, IndexDerivation, KeyFile};
|
pub use ethstore::{Derivation, IndexDerivation, KeyFile};
|
||||||
pub use hardware_wallet::{Error as HardwareError, HardwareWalletManager, KeyPath, TransactionInfo};
|
pub use hardware_wallet::{Error as HardwareError, HardwareWalletManager, KeyPath, TransactionInfo};
|
||||||
pub use super::transaction::{Action, Transaction};
|
|
||||||
|
|
||||||
/// Type of unlock.
|
/// Type of unlock.
|
||||||
#[derive(Clone, PartialEq)]
|
#[derive(Clone, PartialEq)]
|
||||||
|
@ -36,59 +36,58 @@ use std::collections::HashSet;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
|
use ethereum_types::{H256, U256, Address, Bloom};
|
||||||
|
|
||||||
use engines::EthEngine;
|
use engines::EthEngine;
|
||||||
use error::{Error, BlockError};
|
use error::{Error, BlockError};
|
||||||
use ethereum_types::{H256, U256, Address, Bloom};
|
|
||||||
use factory::Factories;
|
use factory::Factories;
|
||||||
use hash::keccak;
|
|
||||||
use header::{Header, ExtendedHeader};
|
|
||||||
use receipt::{Receipt, TransactionOutcome};
|
|
||||||
use rlp::{Rlp, RlpStream, Encodable, Decodable, DecoderError, encode_list};
|
|
||||||
use state_db::StateDB;
|
use state_db::StateDB;
|
||||||
use state::State;
|
use state::State;
|
||||||
use trace::Tracing;
|
use trace::Tracing;
|
||||||
use transaction::{UnverifiedTransaction, SignedTransaction, Error as TransactionError};
|
|
||||||
use triehash::ordered_trie_root;
|
use triehash::ordered_trie_root;
|
||||||
use unexpected::{Mismatch, OutOfBounds};
|
use unexpected::{Mismatch, OutOfBounds};
|
||||||
use verification::PreverifiedBlock;
|
use verification::PreverifiedBlock;
|
||||||
use vm::{EnvInfo, LastHashes};
|
use vm::{EnvInfo, LastHashes};
|
||||||
|
|
||||||
/// A block, encoded as it is on the block chain.
|
use hash::keccak;
|
||||||
#[derive(Default, Debug, Clone, PartialEq)]
|
use rlp::{RlpStream, Encodable, encode_list};
|
||||||
pub struct Block {
|
use types::transaction::{SignedTransaction, Error as TransactionError};
|
||||||
/// The header of this block.
|
use types::block::Block;
|
||||||
pub header: Header,
|
use types::header::{Header, ExtendedHeader};
|
||||||
/// The transactions in this block.
|
use types::receipt::{Receipt, TransactionOutcome};
|
||||||
pub transactions: Vec<UnverifiedTransaction>,
|
|
||||||
/// The uncles of this block.
|
/// Block that is ready for transactions to be added.
|
||||||
pub uncles: Vec<Header>,
|
///
|
||||||
|
/// It's a bit like a Vec<Transaction>, except that whenever a transaction is pushed, we execute it and
|
||||||
|
/// maintain the system `state()`. We also archive execution receipts in preparation for later block creation.
|
||||||
|
pub struct OpenBlock<'x> {
|
||||||
|
block: ExecutedBlock,
|
||||||
|
engine: &'x EthEngine,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Block {
|
/// Just like `OpenBlock`, except that we've applied `Engine::on_close_block`, finished up the non-seal header fields,
|
||||||
/// Get the RLP-encoding of the block with the seal.
|
/// and collected the uncles.
|
||||||
pub fn rlp_bytes(&self) -> Bytes {
|
///
|
||||||
let mut block_rlp = RlpStream::new_list(3);
|
/// There is no function available to push a transaction.
|
||||||
block_rlp.append(&self.header);
|
#[derive(Clone)]
|
||||||
block_rlp.append_list(&self.transactions);
|
pub struct ClosedBlock {
|
||||||
block_rlp.append_list(&self.uncles);
|
block: ExecutedBlock,
|
||||||
block_rlp.out()
|
unclosed_state: State<StateDB>,
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Decodable for Block {
|
/// Just like `ClosedBlock` except that we can't reopen it and it's faster.
|
||||||
fn decode(rlp: &Rlp) -> Result<Self, DecoderError> {
|
///
|
||||||
if rlp.as_raw().len() != rlp.payload_info()?.total() {
|
/// We actually store the post-`Engine::on_close_block` state, unlike in `ClosedBlock` where it's the pre.
|
||||||
return Err(DecoderError::RlpIsTooBig);
|
#[derive(Clone)]
|
||||||
}
|
pub struct LockedBlock {
|
||||||
if rlp.item_count()? != 3 {
|
block: ExecutedBlock,
|
||||||
return Err(DecoderError::RlpIncorrectListLen);
|
}
|
||||||
}
|
|
||||||
Ok(Block {
|
/// A block that has a valid seal.
|
||||||
header: rlp.val_at(0)?,
|
///
|
||||||
transactions: rlp.list_at(1)?,
|
/// The block's header has valid seal arguments. The block cannot be reversed into a `ClosedBlock` or `OpenBlock`.
|
||||||
uncles: rlp.list_at(2)?,
|
pub struct SealedBlock {
|
||||||
})
|
block: ExecutedBlock,
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An internal type for a block's common elements.
|
/// An internal type for a block's common elements.
|
||||||
@ -216,40 +215,6 @@ impl ::parity_machine::Transactions for ExecutedBlock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Block that is ready for transactions to be added.
|
|
||||||
///
|
|
||||||
/// It's a bit like a Vec<Transaction>, except that whenever a transaction is pushed, we execute it and
|
|
||||||
/// maintain the system `state()`. We also archive execution receipts in preparation for later block creation.
|
|
||||||
pub struct OpenBlock<'x> {
|
|
||||||
block: ExecutedBlock,
|
|
||||||
engine: &'x EthEngine,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Just like `OpenBlock`, except that we've applied `Engine::on_close_block`, finished up the non-seal header fields,
|
|
||||||
/// and collected the uncles.
|
|
||||||
///
|
|
||||||
/// There is no function available to push a transaction.
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct ClosedBlock {
|
|
||||||
block: ExecutedBlock,
|
|
||||||
unclosed_state: State<StateDB>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Just like `ClosedBlock` except that we can't reopen it and it's faster.
|
|
||||||
///
|
|
||||||
/// We actually store the post-`Engine::on_close_block` state, unlike in `ClosedBlock` where it's the pre.
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct LockedBlock {
|
|
||||||
block: ExecutedBlock,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A block that has a valid seal.
|
|
||||||
///
|
|
||||||
/// The block's header has valid seal arguments. The block cannot be reversed into a `ClosedBlock` or `OpenBlock`.
|
|
||||||
pub struct SealedBlock {
|
|
||||||
block: ExecutedBlock,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'x> OpenBlock<'x> {
|
impl<'x> OpenBlock<'x> {
|
||||||
/// Create a new `OpenBlock` ready for transaction pushing.
|
/// Create a new `OpenBlock` ready for transaction pushing.
|
||||||
pub fn new<'a>(
|
pub fn new<'a>(
|
||||||
@ -630,14 +595,15 @@ mod tests {
|
|||||||
use engines::EthEngine;
|
use engines::EthEngine;
|
||||||
use vm::LastHashes;
|
use vm::LastHashes;
|
||||||
use error::Error;
|
use error::Error;
|
||||||
use header::Header;
|
|
||||||
use factory::Factories;
|
use factory::Factories;
|
||||||
use state_db::StateDB;
|
use state_db::StateDB;
|
||||||
use views::BlockView;
|
|
||||||
use ethereum_types::Address;
|
use ethereum_types::Address;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use transaction::SignedTransaction;
|
|
||||||
use verification::queue::kind::blocks::Unverified;
|
use verification::queue::kind::blocks::Unverified;
|
||||||
|
use types::transaction::SignedTransaction;
|
||||||
|
use types::header::Header;
|
||||||
|
use types::view;
|
||||||
|
use types::views::BlockView;
|
||||||
|
|
||||||
/// Enact the block given by `block_bytes` using `engine` on the database `db` with given `parent` block header
|
/// Enact the block given by `block_bytes` using `engine` on the database `db` with given `parent` block header
|
||||||
fn enact_bytes(
|
fn enact_bytes(
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use blockchain::BlockChain;
|
|
||||||
use engines::{EthEngine, EpochVerifier};
|
use engines::{EthEngine, EpochVerifier};
|
||||||
use header::Header;
|
|
||||||
use machine::EthereumMachine;
|
use machine::EthereumMachine;
|
||||||
|
|
||||||
use rand::Rng;
|
use blockchain::BlockChain;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
use rand::Rng;
|
||||||
|
use types::header::Header;
|
||||||
|
|
||||||
// do "heavy" verification on ~1/50 blocks, randomly sampled.
|
// do "heavy" verification on ~1/50 blocks, randomly sampled.
|
||||||
const HEAVY_VERIFY_RATE: f32 = 0.02;
|
const HEAVY_VERIFY_RATE: f32 = 0.02;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use ethereum_types::{H256, U256};
|
use ethereum_types::{H256, U256};
|
||||||
use transaction::UnverifiedTransaction;
|
use types::transaction::UnverifiedTransaction;
|
||||||
use blockchain::ImportRoute;
|
use blockchain::ImportRoute;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
@ -14,25 +14,36 @@
|
|||||||
// 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 std::collections::{HashSet, BTreeMap, VecDeque};
|
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
use std::collections::{HashSet, BTreeMap, VecDeque};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::sync::atomic::{AtomicUsize, AtomicBool, Ordering as AtomicOrdering};
|
use std::sync::atomic::{AtomicUsize, AtomicBool, Ordering as AtomicOrdering};
|
||||||
use std::sync::{Arc, Weak};
|
use std::sync::{Arc, Weak};
|
||||||
use std::time::{Instant, Duration};
|
use std::time::{Instant, Duration};
|
||||||
|
|
||||||
// util
|
use blockchain::{BlockReceipts, BlockChain, BlockChainDB, BlockProvider, TreeRoute, ImportRoute, TransactionAddress, ExtrasInsert};
|
||||||
use hash::keccak;
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
|
use ethcore_miner::pool::VerifiedTransaction;
|
||||||
|
use ethereum_types::{H256, Address, U256};
|
||||||
|
use evm::Schedule;
|
||||||
|
use hash::keccak;
|
||||||
|
use io::IoChannel;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use journaldb;
|
use journaldb;
|
||||||
use trie::{TrieSpec, TrieFactory, Trie};
|
|
||||||
use kvdb::{DBValue, KeyValueDB, DBTransaction};
|
use kvdb::{DBValue, KeyValueDB, DBTransaction};
|
||||||
|
use parking_lot::{Mutex, RwLock};
|
||||||
|
use rand::OsRng;
|
||||||
|
use types::transaction::{self, LocalizedTransaction, UnverifiedTransaction, SignedTransaction, Action};
|
||||||
|
use trie::{TrieSpec, TrieFactory, Trie};
|
||||||
|
use types::ancestry_action::AncestryAction;
|
||||||
|
use types::encoded;
|
||||||
|
use types::filter::Filter;
|
||||||
|
use types::log_entry::LocalizedLogEntry;
|
||||||
|
use types::receipt::{Receipt, LocalizedReceipt};
|
||||||
|
use types::{BlockNumber, header::{Header, ExtendedHeader}};
|
||||||
|
use vm::{EnvInfo, LastHashes};
|
||||||
|
|
||||||
// other
|
|
||||||
use ethereum_types::{H256, Address, U256};
|
|
||||||
use block::{IsBlock, LockedBlock, Drain, ClosedBlock, OpenBlock, enact_verified, SealedBlock};
|
use block::{IsBlock, LockedBlock, Drain, ClosedBlock, OpenBlock, enact_verified, SealedBlock};
|
||||||
use blockchain::{BlockReceipts, BlockChain, BlockChainDB, BlockProvider, TreeRoute, ImportRoute, TransactionAddress, ExtrasInsert};
|
|
||||||
use client::ancient_import::AncientVerifier;
|
use client::ancient_import::AncientVerifier;
|
||||||
use client::{
|
use client::{
|
||||||
Nonce, Balance, ChainInfo, BlockInfo, CallContract, TransactionInfo,
|
Nonce, Balance, ChainInfo, BlockInfo, CallContract, TransactionInfo,
|
||||||
@ -48,37 +59,24 @@ use client::{
|
|||||||
IoClient, BadBlocks,
|
IoClient, BadBlocks,
|
||||||
};
|
};
|
||||||
use client::bad_blocks;
|
use client::bad_blocks;
|
||||||
use encoded;
|
|
||||||
use engines::{EthEngine, EpochTransition, ForkChoice};
|
use engines::{EthEngine, EpochTransition, ForkChoice};
|
||||||
use error::{
|
use error::{
|
||||||
ImportErrorKind, ExecutionError, CallError, BlockError,
|
ImportErrorKind, ExecutionError, CallError, BlockError,
|
||||||
QueueError, QueueErrorKind, Error as EthcoreError, EthcoreResult, ErrorKind as EthcoreErrorKind
|
QueueError, QueueErrorKind, Error as EthcoreError, EthcoreResult, ErrorKind as EthcoreErrorKind
|
||||||
};
|
};
|
||||||
use vm::{EnvInfo, LastHashes};
|
|
||||||
use evm::Schedule;
|
|
||||||
use executive::{Executive, Executed, TransactOptions, contract_address};
|
use executive::{Executive, Executed, TransactOptions, contract_address};
|
||||||
use factory::{Factories, VmFactory};
|
use factory::{Factories, VmFactory};
|
||||||
use header::{BlockNumber, Header, ExtendedHeader};
|
|
||||||
use io::IoChannel;
|
|
||||||
use log_entry::LocalizedLogEntry;
|
|
||||||
use miner::{Miner, MinerService};
|
use miner::{Miner, MinerService};
|
||||||
use ethcore_miner::pool::VerifiedTransaction;
|
|
||||||
use parking_lot::{Mutex, RwLock};
|
|
||||||
use rand::OsRng;
|
|
||||||
use receipt::{Receipt, LocalizedReceipt};
|
|
||||||
use snapshot::{self, io as snapshot_io, SnapshotClient};
|
use snapshot::{self, io as snapshot_io, SnapshotClient};
|
||||||
use spec::Spec;
|
use spec::Spec;
|
||||||
use state_db::StateDB;
|
|
||||||
use state::{self, State};
|
use state::{self, State};
|
||||||
use trace;
|
use state_db::StateDB;
|
||||||
use trace::{TraceDB, ImportRequest as TraceImportRequest, LocalizedTrace, Database as TraceDatabase};
|
use trace::{self, TraceDB, ImportRequest as TraceImportRequest, LocalizedTrace, Database as TraceDatabase};
|
||||||
use transaction::{self, LocalizedTransaction, UnverifiedTransaction, SignedTransaction, Transaction, Action};
|
use transaction_ext::Transaction;
|
||||||
use types::filter::Filter;
|
|
||||||
use types::ancestry_action::AncestryAction;
|
|
||||||
use verification;
|
|
||||||
use verification::{PreverifiedBlock, Verifier, BlockQueue};
|
|
||||||
use verification::queue::kind::blocks::Unverified;
|
|
||||||
use verification::queue::kind::BlockLike;
|
use verification::queue::kind::BlockLike;
|
||||||
|
use verification::queue::kind::blocks::Unverified;
|
||||||
|
use verification::{PreverifiedBlock, Verifier, BlockQueue};
|
||||||
|
use verification;
|
||||||
|
|
||||||
// re-export
|
// re-export
|
||||||
pub use types::blockchain_info::BlockChainInfo;
|
pub use types::blockchain_info::BlockChainInfo;
|
||||||
@ -1231,7 +1229,7 @@ impl Client {
|
|||||||
// from the null sender, with 50M gas.
|
// from the null sender, with 50M gas.
|
||||||
fn contract_call_tx(&self, block_id: BlockId, address: Address, data: Bytes) -> SignedTransaction {
|
fn contract_call_tx(&self, block_id: BlockId, address: Address, data: Bytes) -> SignedTransaction {
|
||||||
let from = Address::default();
|
let from = Address::default();
|
||||||
Transaction {
|
transaction::Transaction {
|
||||||
nonce: self.nonce(&from, block_id).unwrap_or_else(|| self.engine.account_start_nonce(0)),
|
nonce: self.nonce(&from, block_id).unwrap_or_else(|| self.engine.account_start_nonce(0)),
|
||||||
action: Action::Call(address),
|
action: Action::Call(address),
|
||||||
gas: U256::from(50_000_000),
|
gas: U256::from(50_000_000),
|
||||||
@ -2112,7 +2110,7 @@ impl BlockChainClient for Client {
|
|||||||
|
|
||||||
fn transact_contract(&self, address: Address, data: Bytes) -> Result<(), transaction::Error> {
|
fn transact_contract(&self, address: Address, data: Bytes) -> Result<(), transaction::Error> {
|
||||||
let authoring_params = self.importer.miner.authoring_params();
|
let authoring_params = self.importer.miner.authoring_params();
|
||||||
let transaction = Transaction {
|
let transaction = transaction::Transaction {
|
||||||
nonce: self.latest_nonce(&authoring_params.author),
|
nonce: self.latest_nonce(&authoring_params.author),
|
||||||
action: Action::Call(address),
|
action: Action::Call(address),
|
||||||
gas: self.importer.miner.sensible_gas_limit(),
|
gas: self.importer.miner.sensible_gas_limit(),
|
||||||
@ -2411,7 +2409,7 @@ impl super::traits::EngineClient for Client {
|
|||||||
BlockChainClient::block_number(self, id)
|
BlockChainClient::block_number(self, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn block_header(&self, id: BlockId) -> Option<::encoded::Header> {
|
fn block_header(&self, id: BlockId) -> Option<encoded::Header> {
|
||||||
BlockChainClient::block_header(self, id)
|
BlockChainClient::block_header(self, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2520,7 +2518,7 @@ mod tests {
|
|||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use kvdb::DBTransaction;
|
use kvdb::DBTransaction;
|
||||||
use blockchain::ExtrasInsert;
|
use blockchain::ExtrasInsert;
|
||||||
use encoded;
|
use types::encoded;
|
||||||
|
|
||||||
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;
|
||||||
@ -2579,9 +2577,9 @@ mod tests {
|
|||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use super::transaction_receipt;
|
use super::transaction_receipt;
|
||||||
use ethkey::KeyPair;
|
use ethkey::KeyPair;
|
||||||
use log_entry::{LogEntry, LocalizedLogEntry};
|
use types::log_entry::{LogEntry, LocalizedLogEntry};
|
||||||
use receipt::{Receipt, LocalizedReceipt, TransactionOutcome};
|
use types::receipt::{Receipt, LocalizedReceipt, TransactionOutcome};
|
||||||
use transaction::{Transaction, LocalizedTransaction, Action};
|
use types::transaction::{Transaction, LocalizedTransaction, Action};
|
||||||
|
|
||||||
// given
|
// given
|
||||||
let key = KeyPair::from_secret_slice(&keccak("test")).unwrap();
|
let key = KeyPair::from_secret_slice(&keccak("test")).unwrap();
|
||||||
|
@ -21,7 +21,8 @@ use std::sync::Arc;
|
|||||||
use ethereum_types::{H256, U256, H160};
|
use ethereum_types::{H256, U256, H160};
|
||||||
use {factory, journaldb, trie, kvdb_memorydb};
|
use {factory, journaldb, trie, kvdb_memorydb};
|
||||||
use kvdb::{self, KeyValueDB};
|
use kvdb::{self, KeyValueDB};
|
||||||
use {state, state_db, client, executive, trace, transaction, db, spec, pod_state, log_entry, receipt};
|
use {state, state_db, client, executive, trace, db, spec, pod_state};
|
||||||
|
use types::{log_entry, receipt, transaction};
|
||||||
use factory::Factories;
|
use factory::Factories;
|
||||||
use evm::{VMType, FinalizationResult};
|
use evm::{VMType, FinalizationResult};
|
||||||
use vm::{self, ActionParams};
|
use vm::{self, ActionParams};
|
||||||
|
@ -20,20 +20,35 @@ use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering as AtomicOrder};
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::collections::{HashMap, BTreeMap};
|
use std::collections::{HashMap, BTreeMap};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use itertools::Itertools;
|
|
||||||
use rustc_hex::FromHex;
|
use blockchain::{TreeRoute, BlockReceipts};
|
||||||
use hash::keccak;
|
use bytes::Bytes;
|
||||||
|
use db::{NUM_COLUMNS, COL_STATE};
|
||||||
|
use ethcore_miner::pool::VerifiedTransaction;
|
||||||
use ethereum_types::{H256, U256, Address};
|
use ethereum_types::{H256, U256, Address};
|
||||||
use parking_lot::RwLock;
|
use ethkey::{Generator, Random};
|
||||||
use journaldb;
|
use ethtrie;
|
||||||
|
use hash::keccak;
|
||||||
|
use itertools::Itertools;
|
||||||
use kvdb::DBValue;
|
use kvdb::DBValue;
|
||||||
use kvdb_memorydb;
|
use kvdb_memorydb;
|
||||||
use bytes::Bytes;
|
use parking_lot::RwLock;
|
||||||
use rlp::{Rlp, RlpStream};
|
use rlp::{Rlp, RlpStream};
|
||||||
use ethkey::{Generator, Random};
|
use rustc_hex::FromHex;
|
||||||
use ethcore_miner::pool::VerifiedTransaction;
|
use types::transaction::{self, Transaction, LocalizedTransaction, SignedTransaction, Action};
|
||||||
use transaction::{self, Transaction, LocalizedTransaction, SignedTransaction, Action};
|
use types::BlockNumber;
|
||||||
use blockchain::{TreeRoute, BlockReceipts};
|
use types::basic_account::BasicAccount;
|
||||||
|
use types::encoded;
|
||||||
|
use types::filter::Filter;
|
||||||
|
use types::header::Header;
|
||||||
|
use types::log_entry::LocalizedLogEntry;
|
||||||
|
use types::pruning_info::PruningInfo;
|
||||||
|
use types::receipt::{Receipt, LocalizedReceipt, TransactionOutcome};
|
||||||
|
use types::view;
|
||||||
|
use types::views::BlockView;
|
||||||
|
use vm::Schedule;
|
||||||
|
|
||||||
|
use block::{OpenBlock, SealedBlock, ClosedBlock};
|
||||||
use client::{
|
use client::{
|
||||||
Nonce, Balance, ChainInfo, BlockInfo, ReopenBlock, CallContract, TransactionInfo, RegistryInfo,
|
Nonce, Balance, ChainInfo, BlockInfo, ReopenBlock, CallContract, TransactionInfo, RegistryInfo,
|
||||||
PrepareOpenBlock, BlockChainClient, BlockChainInfo, BlockStatus, BlockId, Mode,
|
PrepareOpenBlock, BlockChainClient, BlockChainInfo, BlockStatus, BlockId, Mode,
|
||||||
@ -42,30 +57,18 @@ use client::{
|
|||||||
Call, StateClient, EngineInfo, AccountData, BlockChain, BlockProducer, SealedBlockImporter, IoClient,
|
Call, StateClient, EngineInfo, AccountData, BlockChain, BlockProducer, SealedBlockImporter, IoClient,
|
||||||
BadBlocks,
|
BadBlocks,
|
||||||
};
|
};
|
||||||
use db::{NUM_COLUMNS, COL_STATE};
|
use engines::EthEngine;
|
||||||
use header::{Header as BlockHeader, BlockNumber};
|
|
||||||
use filter::Filter;
|
|
||||||
use log_entry::LocalizedLogEntry;
|
|
||||||
use receipt::{Receipt, LocalizedReceipt, TransactionOutcome};
|
|
||||||
use error::{Error, EthcoreResult};
|
use error::{Error, EthcoreResult};
|
||||||
use vm::Schedule;
|
use executed::CallError;
|
||||||
|
use executive::Executed;
|
||||||
|
use journaldb;
|
||||||
use miner::{self, Miner, MinerService};
|
use miner::{self, Miner, MinerService};
|
||||||
use spec::Spec;
|
use spec::Spec;
|
||||||
use types::basic_account::BasicAccount;
|
use state::StateInfo;
|
||||||
use types::pruning_info::PruningInfo;
|
use state_db::StateDB;
|
||||||
|
use trace::LocalizedTrace;
|
||||||
use verification::queue::QueueInfo;
|
use verification::queue::QueueInfo;
|
||||||
use verification::queue::kind::blocks::Unverified;
|
use verification::queue::kind::blocks::Unverified;
|
||||||
use block::{OpenBlock, SealedBlock, ClosedBlock};
|
|
||||||
use executive::Executed;
|
|
||||||
use error::CallError;
|
|
||||||
use trace::LocalizedTrace;
|
|
||||||
use state_db::StateDB;
|
|
||||||
use header::Header;
|
|
||||||
use encoded;
|
|
||||||
use engines::EthEngine;
|
|
||||||
use ethtrie;
|
|
||||||
use state::StateInfo;
|
|
||||||
use views::BlockView;
|
|
||||||
|
|
||||||
/// Test client.
|
/// Test client.
|
||||||
pub struct TestBlockChainClient {
|
pub struct TestBlockChainClient {
|
||||||
@ -244,11 +247,11 @@ impl TestBlockChainClient {
|
|||||||
|
|
||||||
/// Add a block to test client.
|
/// Add a block to test client.
|
||||||
pub fn add_block<F>(&self, with: EachBlockWith, hook: F)
|
pub fn add_block<F>(&self, with: EachBlockWith, hook: F)
|
||||||
where F: Fn(BlockHeader) -> BlockHeader
|
where F: Fn(Header) -> Header
|
||||||
{
|
{
|
||||||
let n = self.numbers.read().len();
|
let n = self.numbers.read().len();
|
||||||
|
|
||||||
let mut header = BlockHeader::new();
|
let mut header = Header::new();
|
||||||
header.set_difficulty(From::from(n));
|
header.set_difficulty(From::from(n));
|
||||||
header.set_parent_hash(self.last_hash.read().clone());
|
header.set_parent_hash(self.last_hash.read().clone());
|
||||||
header.set_number(n as BlockNumber);
|
header.set_number(n as BlockNumber);
|
||||||
@ -260,7 +263,7 @@ impl TestBlockChainClient {
|
|||||||
let uncles = match with {
|
let uncles = match with {
|
||||||
EachBlockWith::Uncle | EachBlockWith::UncleAndTransaction => {
|
EachBlockWith::Uncle | EachBlockWith::UncleAndTransaction => {
|
||||||
let mut uncles = RlpStream::new_list(1);
|
let mut uncles = RlpStream::new_list(1);
|
||||||
let mut uncle_header = BlockHeader::new();
|
let mut uncle_header = Header::new();
|
||||||
uncle_header.set_difficulty(From::from(n));
|
uncle_header.set_difficulty(From::from(n));
|
||||||
uncle_header.set_parent_hash(self.last_hash.read().clone());
|
uncle_header.set_parent_hash(self.last_hash.read().clone());
|
||||||
uncle_header.set_number(n as BlockNumber);
|
uncle_header.set_number(n as BlockNumber);
|
||||||
@ -309,7 +312,7 @@ impl TestBlockChainClient {
|
|||||||
/// Make a bad block by setting invalid parent hash.
|
/// Make a bad block by setting invalid parent hash.
|
||||||
pub fn corrupt_block_parent(&self, n: BlockNumber) {
|
pub fn corrupt_block_parent(&self, n: BlockNumber) {
|
||||||
let hash = self.block_hash(BlockId::Number(n)).unwrap();
|
let hash = self.block_hash(BlockId::Number(n)).unwrap();
|
||||||
let mut header: BlockHeader = self.block_header(BlockId::Number(n)).unwrap().decode().expect("decoding failed");
|
let mut header: Header = self.block_header(BlockId::Number(n)).unwrap().decode().expect("decoding failed");
|
||||||
header.set_parent_hash(H256::from(42));
|
header.set_parent_hash(H256::from(42));
|
||||||
let mut rlp = RlpStream::new_list(3);
|
let mut rlp = RlpStream::new_list(3);
|
||||||
rlp.append(&header);
|
rlp.append(&header);
|
||||||
@ -935,7 +938,7 @@ impl super::traits::EngineClient for TestBlockChainClient {
|
|||||||
BlockChainClient::block_number(self, id)
|
BlockChainClient::block_number(self, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn block_header(&self, id: BlockId) -> Option<::encoded::Header> {
|
fn block_header(&self, id: BlockId) -> Option<encoded::Header> {
|
||||||
BlockChainClient::block_header(self, id)
|
BlockChainClient::block_header(self, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,10 @@
|
|||||||
|
|
||||||
//! Bridge between Tracedb and Blockchain.
|
//! Bridge between Tracedb and Blockchain.
|
||||||
|
|
||||||
use ethereum_types::H256;
|
|
||||||
use header::BlockNumber;
|
|
||||||
use trace::DatabaseExtras as TraceDatabaseExtras;
|
|
||||||
use blockchain::{BlockChain, BlockProvider, TransactionAddress};
|
use blockchain::{BlockChain, BlockProvider, TransactionAddress};
|
||||||
pub use types::trace_filter::Filter;
|
use ethereum_types::H256;
|
||||||
|
use trace::DatabaseExtras as TraceDatabaseExtras;
|
||||||
|
use types::BlockNumber;
|
||||||
|
|
||||||
impl TraceDatabaseExtras for BlockChain {
|
impl TraceDatabaseExtras for BlockChain {
|
||||||
fn block_hash(&self, block_number: BlockNumber) -> Option<H256> {
|
fn block_hash(&self, block_number: BlockNumber) -> Option<H256> {
|
||||||
|
@ -17,40 +17,39 @@
|
|||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use blockchain::{BlockReceipts, TreeRoute};
|
||||||
|
use bytes::Bytes;
|
||||||
|
use ethcore_miner::pool::VerifiedTransaction;
|
||||||
|
use ethereum_types::{H256, U256, Address};
|
||||||
|
use evm::Schedule;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
use kvdb::DBValue;
|
||||||
|
use types::transaction::{self, LocalizedTransaction, SignedTransaction};
|
||||||
|
use types::BlockNumber;
|
||||||
|
use types::basic_account::BasicAccount;
|
||||||
|
use types::block_status::BlockStatus;
|
||||||
|
use types::blockchain_info::BlockChainInfo;
|
||||||
|
use types::call_analytics::CallAnalytics;
|
||||||
|
use types::encoded;
|
||||||
|
use types::filter::Filter;
|
||||||
|
use types::header::Header;
|
||||||
|
use types::ids::*;
|
||||||
|
use types::log_entry::LocalizedLogEntry;
|
||||||
|
use types::pruning_info::PruningInfo;
|
||||||
|
use types::receipt::LocalizedReceipt;
|
||||||
|
use types::trace_filter::Filter as TraceFilter;
|
||||||
|
use vm::LastHashes;
|
||||||
|
|
||||||
use block::{OpenBlock, SealedBlock, ClosedBlock};
|
use block::{OpenBlock, SealedBlock, ClosedBlock};
|
||||||
use blockchain::{BlockReceipts, TreeRoute};
|
|
||||||
use client::Mode;
|
use client::Mode;
|
||||||
use encoded;
|
use engines::EthEngine;
|
||||||
use vm::LastHashes;
|
use error::{Error, EthcoreResult};
|
||||||
use error::{Error, CallError, EthcoreResult};
|
use executed::CallError;
|
||||||
use evm::Schedule;
|
|
||||||
use executive::Executed;
|
use executive::Executed;
|
||||||
use filter::Filter;
|
use state::StateInfo;
|
||||||
use header::{BlockNumber};
|
|
||||||
use log_entry::LocalizedLogEntry;
|
|
||||||
use receipt::LocalizedReceipt;
|
|
||||||
use trace::LocalizedTrace;
|
use trace::LocalizedTrace;
|
||||||
use transaction::{self, LocalizedTransaction, SignedTransaction};
|
|
||||||
use verification::queue::QueueInfo as BlockQueueInfo;
|
use verification::queue::QueueInfo as BlockQueueInfo;
|
||||||
use verification::queue::kind::blocks::Unverified;
|
use verification::queue::kind::blocks::Unverified;
|
||||||
use state::StateInfo;
|
|
||||||
use header::Header;
|
|
||||||
use engines::EthEngine;
|
|
||||||
|
|
||||||
use ethereum_types::{H256, U256, Address};
|
|
||||||
use ethcore_miner::pool::VerifiedTransaction;
|
|
||||||
use bytes::Bytes;
|
|
||||||
use kvdb::DBValue;
|
|
||||||
|
|
||||||
use types::ids::*;
|
|
||||||
use types::basic_account::BasicAccount;
|
|
||||||
use types::trace_filter::Filter as TraceFilter;
|
|
||||||
use types::call_analytics::CallAnalytics;
|
|
||||||
use types::blockchain_info::BlockChainInfo;
|
|
||||||
use types::block_status::BlockStatus;
|
|
||||||
use types::pruning_info::PruningInfo;
|
|
||||||
|
|
||||||
/// State information to be used during client query
|
/// State information to be used during client query
|
||||||
pub enum StateOrBlock {
|
pub enum StateOrBlock {
|
||||||
|
@ -34,7 +34,6 @@ use error::{Error, ErrorKind, BlockError};
|
|||||||
use ethjson;
|
use ethjson;
|
||||||
use machine::{AuxiliaryData, Call, EthereumMachine};
|
use machine::{AuxiliaryData, Call, EthereumMachine};
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use header::{Header, BlockNumber, ExtendedHeader};
|
|
||||||
use super::signer::EngineSigner;
|
use super::signer::EngineSigner;
|
||||||
use super::validator_set::{ValidatorSet, SimpleList, new_validator_set};
|
use super::validator_set::{ValidatorSet, SimpleList, new_validator_set};
|
||||||
use self::finality::RollingFinality;
|
use self::finality::RollingFinality;
|
||||||
@ -44,6 +43,8 @@ use itertools::{self, Itertools};
|
|||||||
use rlp::{encode, Decodable, DecoderError, Encodable, RlpStream, Rlp};
|
use rlp::{encode, Decodable, DecoderError, Encodable, RlpStream, Rlp};
|
||||||
use ethereum_types::{H256, H520, Address, U128, U256};
|
use ethereum_types::{H256, H520, Address, U128, U256};
|
||||||
use parking_lot::{Mutex, RwLock};
|
use parking_lot::{Mutex, RwLock};
|
||||||
|
use types::BlockNumber;
|
||||||
|
use types::header::{Header, ExtendedHeader};
|
||||||
use types::ancestry_action::AncestryAction;
|
use types::ancestry_action::AncestryAction;
|
||||||
use unexpected::{Mismatch, OutOfBounds};
|
use unexpected::{Mismatch, OutOfBounds};
|
||||||
|
|
||||||
@ -1528,7 +1529,7 @@ mod tests {
|
|||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use ethereum_types::{Address, H520, H256, U256};
|
use ethereum_types::{Address, H520, H256, U256};
|
||||||
use ethkey::Signature;
|
use ethkey::Signature;
|
||||||
use header::Header;
|
use types::header::Header;
|
||||||
use rlp::encode;
|
use rlp::encode;
|
||||||
use block::*;
|
use block::*;
|
||||||
use test_helpers::{
|
use test_helpers::{
|
||||||
@ -1537,7 +1538,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
use account_provider::AccountProvider;
|
use account_provider::AccountProvider;
|
||||||
use spec::Spec;
|
use spec::Spec;
|
||||||
use transaction::{Action, Transaction};
|
use types::transaction::{Action, Transaction};
|
||||||
use engines::{Seal, Engine, EngineError, EthEngine};
|
use engines::{Seal, Engine, EngineError, EthEngine};
|
||||||
use engines::validator_set::{TestSet, SimpleList};
|
use engines::validator_set::{TestSet, SimpleList};
|
||||||
use error::{Error, ErrorKind};
|
use error::{Error, ErrorKind};
|
||||||
|
@ -25,9 +25,9 @@ use block::*;
|
|||||||
use engines::{Engine, Seal, ConstructedVerifier, EngineError};
|
use engines::{Engine, Seal, ConstructedVerifier, EngineError};
|
||||||
use error::{BlockError, Error};
|
use error::{BlockError, Error};
|
||||||
use ethjson;
|
use ethjson;
|
||||||
use header::{Header, ExtendedHeader};
|
|
||||||
use client::EngineClient;
|
use client::EngineClient;
|
||||||
use machine::{AuxiliaryData, Call, EthereumMachine};
|
use machine::{AuxiliaryData, Call, EthereumMachine};
|
||||||
|
use types::header::{Header, ExtendedHeader};
|
||||||
use super::signer::EngineSigner;
|
use super::signer::EngineSigner;
|
||||||
use super::validator_set::{ValidatorSet, SimpleList, new_validator_set};
|
use super::validator_set::{ValidatorSet, SimpleList, new_validator_set};
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ mod tests {
|
|||||||
use block::*;
|
use block::*;
|
||||||
use test_helpers::get_temp_state_db;
|
use test_helpers::get_temp_state_db;
|
||||||
use account_provider::AccountProvider;
|
use account_provider::AccountProvider;
|
||||||
use header::Header;
|
use types::header::Header;
|
||||||
use spec::Spec;
|
use spec::Spec;
|
||||||
use engines::Seal;
|
use engines::Seal;
|
||||||
use tempdir::TempDir;
|
use tempdir::TempDir;
|
||||||
|
@ -95,7 +95,7 @@ mod tests {
|
|||||||
use ethereum_types::{H520, Address};
|
use ethereum_types::{H520, Address};
|
||||||
use test_helpers::get_temp_state_db;
|
use test_helpers::get_temp_state_db;
|
||||||
use spec::Spec;
|
use spec::Spec;
|
||||||
use header::Header;
|
use types::header::Header;
|
||||||
use block::*;
|
use block::*;
|
||||||
use engines::Seal;
|
use engines::Seal;
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ mod signer;
|
|||||||
mod validator_set;
|
mod validator_set;
|
||||||
|
|
||||||
pub mod block_reward;
|
pub mod block_reward;
|
||||||
pub mod epoch;
|
|
||||||
|
|
||||||
pub use self::authority_round::AuthorityRound;
|
pub use self::authority_round::AuthorityRound;
|
||||||
pub use self::basic_authority::BasicAuthority;
|
pub use self::basic_authority::BasicAuthority;
|
||||||
@ -32,20 +31,23 @@ pub use self::epoch::{EpochVerifier, Transition as EpochTransition};
|
|||||||
pub use self::instant_seal::{InstantSeal, InstantSealParams};
|
pub use self::instant_seal::{InstantSeal, InstantSealParams};
|
||||||
pub use self::null_engine::NullEngine;
|
pub use self::null_engine::NullEngine;
|
||||||
|
|
||||||
|
// TODO [ToDr] Remove re-export (#10130)
|
||||||
|
pub use types::engines::ForkChoice;
|
||||||
|
pub use types::engines::epoch;
|
||||||
|
|
||||||
use std::sync::{Weak, Arc};
|
use std::sync::{Weak, Arc};
|
||||||
use std::collections::{BTreeMap, HashMap};
|
use std::collections::{BTreeMap, HashMap};
|
||||||
use std::{fmt, error};
|
use std::{fmt, error};
|
||||||
|
|
||||||
use self::epoch::PendingTransition;
|
|
||||||
|
|
||||||
use account_provider::AccountProvider;
|
use account_provider::AccountProvider;
|
||||||
use builtin::Builtin;
|
use builtin::Builtin;
|
||||||
use vm::{EnvInfo, Schedule, CreateContractAddress, CallType, ActionValue};
|
use vm::{EnvInfo, Schedule, CreateContractAddress, CallType, ActionValue};
|
||||||
use error::Error;
|
use error::Error;
|
||||||
use header::{Header, BlockNumber};
|
use types::BlockNumber;
|
||||||
|
use types::header::Header;
|
||||||
use snapshot::SnapshotComponents;
|
use snapshot::SnapshotComponents;
|
||||||
use spec::CommonParams;
|
use spec::CommonParams;
|
||||||
use transaction::{self, UnverifiedTransaction, SignedTransaction};
|
use types::transaction::{self, UnverifiedTransaction, SignedTransaction};
|
||||||
|
|
||||||
use ethkey::{Password, Signature};
|
use ethkey::{Password, Signature};
|
||||||
use parity_machine::{Machine, LocalizedMachine as Localized, TotalScoredHeader};
|
use parity_machine::{Machine, LocalizedMachine as Localized, TotalScoredHeader};
|
||||||
@ -58,15 +60,6 @@ use types::ancestry_action::AncestryAction;
|
|||||||
/// As defined in https://github.com/ethereum/EIPs/pull/210
|
/// As defined in https://github.com/ethereum/EIPs/pull/210
|
||||||
pub const DEFAULT_BLOCKHASH_CONTRACT: &'static str = "73fffffffffffffffffffffffffffffffffffffffe33141561006a5760014303600035610100820755610100810715156100455760003561010061010083050761010001555b6201000081071515610064576000356101006201000083050761020001555b5061013e565b4360003512151561008457600060405260206040f361013d565b61010060003543031315156100a857610100600035075460605260206060f361013c565b6101006000350715156100c55762010000600035430313156100c8565b60005b156100ea576101006101006000350507610100015460805260206080f361013b565b620100006000350715156101095763010000006000354303131561010c565b60005b1561012f57610100620100006000350507610200015460a052602060a0f361013a565b600060c052602060c0f35b5b5b5b5b";
|
pub const DEFAULT_BLOCKHASH_CONTRACT: &'static str = "73fffffffffffffffffffffffffffffffffffffffe33141561006a5760014303600035610100820755610100810715156100455760003561010061010083050761010001555b6201000081071515610064576000356101006201000083050761020001555b5061013e565b4360003512151561008457600060405260206040f361013d565b61010060003543031315156100a857610100600035075460605260206060f361013c565b6101006000350715156100c55762010000600035430313156100c8565b60005b156100ea576101006101006000350507610100015460805260206080f361013b565b620100006000350715156101095763010000006000354303131561010c565b60005b1561012f57610100620100006000350507610200015460a052602060a0f361013a565b600060c052602060c0f35b5b5b5b5b";
|
||||||
|
|
||||||
/// Fork choice.
|
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
|
||||||
pub enum ForkChoice {
|
|
||||||
/// Choose the new block.
|
|
||||||
New,
|
|
||||||
/// Choose the current best block.
|
|
||||||
Old,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Voting errors.
|
/// Voting errors.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum EngineError {
|
pub enum EngineError {
|
||||||
@ -175,7 +168,7 @@ pub fn default_system_or_code_call<'a>(machine: &'a ::machine::EthereumMachine,
|
|||||||
pub type Headers<'a, H> = Fn(H256) -> Option<H> + 'a;
|
pub type Headers<'a, H> = Fn(H256) -> Option<H> + 'a;
|
||||||
|
|
||||||
/// Type alias for a function we can query pending transitions by block hash through.
|
/// Type alias for a function we can query pending transitions by block hash through.
|
||||||
pub type PendingTransitionStore<'a> = Fn(H256) -> Option<PendingTransition> + 'a;
|
pub type PendingTransitionStore<'a> = Fn(H256) -> Option<epoch::PendingTransition> + 'a;
|
||||||
|
|
||||||
/// Proof dependent on state.
|
/// Proof dependent on state.
|
||||||
pub trait StateDependentProof<M: Machine>: Send + Sync {
|
pub trait StateDependentProof<M: Machine>: Send + Sync {
|
||||||
|
@ -14,12 +14,12 @@
|
|||||||
// 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 ethereum_types::U256;
|
|
||||||
use engines::Engine;
|
use engines::Engine;
|
||||||
use engines::block_reward::{self, RewardKind};
|
use engines::block_reward::{self, RewardKind};
|
||||||
use header::BlockNumber;
|
use ethereum_types::U256;
|
||||||
use machine::WithRewards;
|
use machine::WithRewards;
|
||||||
use parity_machine::{Header, LiveBlock, WithBalances, TotalScoredHeader};
|
use parity_machine::{Header, LiveBlock, WithBalances, TotalScoredHeader};
|
||||||
|
use types::BlockNumber;
|
||||||
|
|
||||||
/// Params for a null engine.
|
/// Params for a null engine.
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
|
@ -21,11 +21,12 @@ use std::sync::Weak;
|
|||||||
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use ethereum_types::{H256, Address};
|
use ethereum_types::{H256, Address};
|
||||||
|
use machine::{AuxiliaryData, Call, EthereumMachine};
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
use types::BlockNumber;
|
||||||
|
use types::header::Header;
|
||||||
|
|
||||||
use client::EngineClient;
|
use client::EngineClient;
|
||||||
use header::{Header, BlockNumber};
|
|
||||||
use machine::{AuxiliaryData, Call, EthereumMachine};
|
|
||||||
|
|
||||||
use super::{ValidatorSet, SimpleList, SystemCall};
|
use super::{ValidatorSet, SimpleList, SystemCall};
|
||||||
use super::safe_contract::ValidatorSafeContract;
|
use super::safe_contract::ValidatorSafeContract;
|
||||||
@ -67,7 +68,7 @@ impl ValidatorContract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ValidatorSet for ValidatorContract {
|
impl ValidatorSet for ValidatorContract {
|
||||||
fn default_caller(&self, id: ::ids::BlockId) -> Box<Call> {
|
fn default_caller(&self, id: ::types::ids::BlockId) -> Box<Call> {
|
||||||
self.validators.default_caller(id)
|
self.validators.default_caller(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +140,7 @@ mod tests {
|
|||||||
use bytes::ToPretty;
|
use bytes::ToPretty;
|
||||||
use rlp::encode;
|
use rlp::encode;
|
||||||
use spec::Spec;
|
use spec::Spec;
|
||||||
use header::Header;
|
use types::header::Header;
|
||||||
use account_provider::AccountProvider;
|
use account_provider::AccountProvider;
|
||||||
use miner::MinerService;
|
use miner::MinerService;
|
||||||
use types::ids::BlockId;
|
use types::ids::BlockId;
|
||||||
|
@ -24,13 +24,16 @@ mod contract;
|
|||||||
mod multi;
|
mod multi;
|
||||||
|
|
||||||
use std::sync::Weak;
|
use std::sync::Weak;
|
||||||
use ids::BlockId;
|
|
||||||
use ethereum_types::{H256, Address};
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
|
use ethereum_types::{H256, Address};
|
||||||
use ethjson::spec::ValidatorSet as ValidatorSpec;
|
use ethjson::spec::ValidatorSet as ValidatorSpec;
|
||||||
use client::EngineClient;
|
|
||||||
use header::{Header, BlockNumber};
|
|
||||||
use machine::{AuxiliaryData, Call, EthereumMachine};
|
use machine::{AuxiliaryData, Call, EthereumMachine};
|
||||||
|
use types::BlockNumber;
|
||||||
|
use types::header::Header;
|
||||||
|
use types::ids::BlockId;
|
||||||
|
|
||||||
|
use client::EngineClient;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub use self::test::TestSet;
|
pub use self::test::TestSet;
|
||||||
|
@ -18,11 +18,14 @@
|
|||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::sync::Weak;
|
use std::sync::Weak;
|
||||||
|
|
||||||
|
use bytes::Bytes;
|
||||||
use ethereum_types::{H256, Address};
|
use ethereum_types::{H256, Address};
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use bytes::Bytes;
|
use types::BlockNumber;
|
||||||
use ids::BlockId;
|
use types::header::Header;
|
||||||
use header::{BlockNumber, Header};
|
use types::ids::BlockId;
|
||||||
|
|
||||||
use client::EngineClient;
|
use client::EngineClient;
|
||||||
use machine::{AuxiliaryData, Call, EthereumMachine};
|
use machine::{AuxiliaryData, Call, EthereumMachine};
|
||||||
use super::{SystemCall, ValidatorSet};
|
use super::{SystemCall, ValidatorSet};
|
||||||
@ -152,7 +155,7 @@ mod tests {
|
|||||||
use engines::EpochChange;
|
use engines::EpochChange;
|
||||||
use engines::validator_set::ValidatorSet;
|
use engines::validator_set::ValidatorSet;
|
||||||
use ethkey::Secret;
|
use ethkey::Secret;
|
||||||
use header::Header;
|
use types::header::Header;
|
||||||
use miner::MinerService;
|
use miner::MinerService;
|
||||||
use spec::Spec;
|
use spec::Spec;
|
||||||
use test_helpers::{generate_dummy_client_with_spec_and_accounts, generate_dummy_client_with_spec_and_data};
|
use test_helpers::{generate_dummy_client_with_spec_and_accounts, generate_dummy_client_with_spec_and_data};
|
||||||
|
@ -16,24 +16,26 @@
|
|||||||
|
|
||||||
/// Validator set maintained in a contract, updated using `getValidators` method.
|
/// Validator set maintained in a contract, updated using `getValidators` method.
|
||||||
|
|
||||||
|
use std::sync::{Weak, Arc};
|
||||||
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use client::EngineClient;
|
use ethabi::FunctionOutputDecoder;
|
||||||
use ethereum_types::{H256, U256, Address, Bloom};
|
use ethereum_types::{H256, U256, Address, Bloom};
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use header::Header;
|
|
||||||
use ids::BlockId;
|
|
||||||
use kvdb::DBValue;
|
use kvdb::DBValue;
|
||||||
use log_entry::LogEntry;
|
|
||||||
use machine::{AuxiliaryData, Call, EthereumMachine, AuxiliaryRequest};
|
|
||||||
use memory_cache::MemoryLruCache;
|
use memory_cache::MemoryLruCache;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use receipt::Receipt;
|
|
||||||
use rlp::{Rlp, RlpStream};
|
use rlp::{Rlp, RlpStream};
|
||||||
use std::sync::{Weak, Arc};
|
use types::header::Header;
|
||||||
|
use types::ids::BlockId;
|
||||||
|
use types::log_entry::LogEntry;
|
||||||
|
use types::receipt::Receipt;
|
||||||
|
use unexpected::Mismatch;
|
||||||
|
|
||||||
|
use client::EngineClient;
|
||||||
|
use machine::{AuxiliaryData, Call, EthereumMachine, AuxiliaryRequest};
|
||||||
use super::{SystemCall, ValidatorSet};
|
use super::{SystemCall, ValidatorSet};
|
||||||
use super::simple_list::SimpleList;
|
use super::simple_list::SimpleList;
|
||||||
use unexpected::Mismatch;
|
|
||||||
use ethabi::FunctionOutputDecoder;
|
|
||||||
|
|
||||||
use_contract!(validator_set, "res/contracts/validator_set.json");
|
use_contract!(validator_set, "res/contracts/validator_set.json");
|
||||||
|
|
||||||
@ -91,7 +93,7 @@ fn encode_first_proof(header: &Header, state_items: &[Vec<u8>]) -> Bytes {
|
|||||||
fn check_first_proof(machine: &EthereumMachine, contract_address: Address, old_header: Header, state_items: &[DBValue])
|
fn check_first_proof(machine: &EthereumMachine, contract_address: Address, old_header: Header, state_items: &[DBValue])
|
||||||
-> Result<Vec<Address>, String>
|
-> Result<Vec<Address>, String>
|
||||||
{
|
{
|
||||||
use transaction::{Action, Transaction};
|
use types::transaction::{Action, Transaction};
|
||||||
|
|
||||||
// TODO: match client contract_call_tx more cleanly without duplication.
|
// TODO: match client contract_call_tx more cleanly without duplication.
|
||||||
const PROVIDED_GAS: u64 = 50_000_000;
|
const PROVIDED_GAS: u64 = 50_000_000;
|
||||||
@ -343,7 +345,7 @@ impl ValidatorSet for ValidatorSafeContract {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn epoch_set(&self, first: bool, machine: &EthereumMachine, _number: ::header::BlockNumber, proof: &[u8])
|
fn epoch_set(&self, first: bool, machine: &EthereumMachine, _number: ::types::BlockNumber, proof: &[u8])
|
||||||
-> Result<(SimpleList, Option<H256>), ::error::Error>
|
-> Result<(SimpleList, Option<H256>), ::error::Error>
|
||||||
{
|
{
|
||||||
let rlp = Rlp::new(proof);
|
let rlp = Rlp::new(proof);
|
||||||
@ -444,7 +446,7 @@ mod tests {
|
|||||||
use types::ids::BlockId;
|
use types::ids::BlockId;
|
||||||
use spec::Spec;
|
use spec::Spec;
|
||||||
use account_provider::AccountProvider;
|
use account_provider::AccountProvider;
|
||||||
use transaction::{Transaction, Action};
|
use types::transaction::{Transaction, Action};
|
||||||
use client::{ChainInfo, BlockInfo, ImportBlock};
|
use client::{ChainInfo, BlockInfo, ImportBlock};
|
||||||
use ethkey::Secret;
|
use ethkey::Secret;
|
||||||
use miner::MinerService;
|
use miner::MinerService;
|
||||||
@ -532,10 +534,10 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn detects_bloom() {
|
fn detects_bloom() {
|
||||||
use header::Header;
|
|
||||||
use engines::EpochChange;
|
use engines::EpochChange;
|
||||||
use machine::AuxiliaryRequest;
|
use machine::AuxiliaryRequest;
|
||||||
use log_entry::LogEntry;
|
use types::header::Header;
|
||||||
|
use types::log_entry::LogEntry;
|
||||||
|
|
||||||
let client = generate_dummy_client_with_spec_and_accounts(Spec::new_validator_safe_contract, None);
|
let client = generate_dummy_client_with_spec_and_accounts(Spec::new_validator_safe_contract, None);
|
||||||
let engine = client.engine().clone();
|
let engine = client.engine().clone();
|
||||||
@ -571,7 +573,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn initial_contract_is_signal() {
|
fn initial_contract_is_signal() {
|
||||||
use header::Header;
|
use types::header::Header;
|
||||||
use engines::{EpochChange, Proof};
|
use engines::{EpochChange, Proof};
|
||||||
|
|
||||||
let client = generate_dummy_client_with_spec_and_accounts(Spec::new_validator_safe_contract, None);
|
let client = generate_dummy_client_with_spec_and_accounts(Spec::new_validator_safe_contract, None);
|
||||||
|
@ -20,7 +20,8 @@ use heapsize::HeapSizeOf;
|
|||||||
use ethereum_types::{H256, Address};
|
use ethereum_types::{H256, Address};
|
||||||
|
|
||||||
use machine::{AuxiliaryData, Call, EthereumMachine};
|
use machine::{AuxiliaryData, Call, EthereumMachine};
|
||||||
use header::{BlockNumber, Header};
|
use types::BlockNumber;
|
||||||
|
use types::header::Header;
|
||||||
use super::ValidatorSet;
|
use super::ValidatorSet;
|
||||||
|
|
||||||
/// Validator set containing a known set of addresses.
|
/// Validator set containing a known set of addresses.
|
||||||
@ -64,7 +65,7 @@ impl HeapSizeOf for SimpleList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ValidatorSet for SimpleList {
|
impl ValidatorSet for SimpleList {
|
||||||
fn default_caller(&self, _block_id: ::ids::BlockId) -> Box<Call> {
|
fn default_caller(&self, _block_id: ::types::ids::BlockId) -> Box<Call> {
|
||||||
Box::new(|_, _| Err("Simple list doesn't require calls.".into()))
|
Box::new(|_, _| Err("Simple list doesn't require calls.".into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,12 +19,14 @@
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering};
|
use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering};
|
||||||
use heapsize::HeapSizeOf;
|
|
||||||
use ethereum_types::{H256, Address};
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
|
use ethereum_types::{H256, Address};
|
||||||
|
use heapsize::HeapSizeOf;
|
||||||
|
use types::BlockNumber;
|
||||||
|
use types::header::Header;
|
||||||
|
|
||||||
use machine::{AuxiliaryData, Call, EthereumMachine};
|
use machine::{AuxiliaryData, Call, EthereumMachine};
|
||||||
use header::{Header, BlockNumber};
|
|
||||||
use super::{ValidatorSet, SimpleList};
|
use super::{ValidatorSet, SimpleList};
|
||||||
|
|
||||||
/// Set used for testing with a single validator.
|
/// Set used for testing with a single validator.
|
||||||
@ -57,7 +59,7 @@ impl HeapSizeOf for TestSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ValidatorSet for TestSet {
|
impl ValidatorSet for TestSet {
|
||||||
fn default_caller(&self, _block_id: ::ids::BlockId) -> Box<Call> {
|
fn default_caller(&self, _block_id: ::types::ids::BlockId) -> Box<Call> {
|
||||||
Box::new(|_, _| Err("Test set doesn't require calls.".into()))
|
Box::new(|_, _| Err("Test set doesn't require calls.".into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,18 +18,19 @@
|
|||||||
|
|
||||||
use std::{fmt, error};
|
use std::{fmt, error};
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
|
|
||||||
use ethereum_types::{H256, U256, Address, Bloom};
|
use ethereum_types::{H256, U256, Address, Bloom};
|
||||||
use snappy::InvalidInput;
|
|
||||||
use unexpected::{Mismatch, OutOfBounds};
|
|
||||||
use ethtrie::TrieError;
|
|
||||||
use io::*;
|
|
||||||
use header::BlockNumber;
|
|
||||||
use snapshot::Error as SnapshotError;
|
|
||||||
use engines::EngineError;
|
|
||||||
use ethkey::Error as EthkeyError;
|
use ethkey::Error as EthkeyError;
|
||||||
use account_provider::SignError as AccountsError;
|
use ethtrie::TrieError;
|
||||||
use transaction::Error as TransactionError;
|
|
||||||
use rlp;
|
use rlp;
|
||||||
|
use snappy::InvalidInput;
|
||||||
|
use snapshot::Error as SnapshotError;
|
||||||
|
use types::transaction::Error as TransactionError;
|
||||||
|
use types::BlockNumber;
|
||||||
|
use unexpected::{Mismatch, OutOfBounds};
|
||||||
|
|
||||||
|
use account_provider::SignError as AccountsError;
|
||||||
|
use engines::EngineError;
|
||||||
|
|
||||||
pub use executed::{ExecutionError, CallError};
|
pub use executed::{ExecutionError, CallError};
|
||||||
|
|
||||||
@ -165,7 +166,7 @@ error_chain! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreign_links {
|
foreign_links {
|
||||||
Channel(IoError) #[doc = "Io channel error"];
|
Channel(::io::IoError) #[doc = "Io channel error"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +225,7 @@ error_chain! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreign_links {
|
foreign_links {
|
||||||
Io(IoError) #[doc = "Io create error"];
|
Io(::io::IoError) #[doc = "Io create error"];
|
||||||
StdIo(::std::io::Error) #[doc = "Error concerning the Rust standard library's IO subsystem."];
|
StdIo(::std::io::Error) #[doc = "Error concerning the Rust standard library's IO subsystem."];
|
||||||
Trie(TrieError) #[doc = "Error concerning TrieDBs."];
|
Trie(TrieError) #[doc = "Error concerning TrieDBs."];
|
||||||
Execution(ExecutionError) #[doc = "Error concerning EVM code execution."];
|
Execution(ExecutionError) #[doc = "Error concerning EVM code execution."];
|
||||||
|
@ -14,21 +14,24 @@
|
|||||||
// 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 std::path::Path;
|
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
use std::path::Path;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use hash::{KECCAK_EMPTY_LIST_RLP};
|
|
||||||
use engines::block_reward::{self, BlockRewardContract, RewardKind};
|
|
||||||
use ethash::{self, quick_get_difficulty, slow_hash_block_number, EthashManager, OptimizeFor};
|
|
||||||
use ethereum_types::{H256, H64, U256};
|
use ethereum_types::{H256, H64, U256};
|
||||||
use unexpected::{OutOfBounds, Mismatch};
|
|
||||||
use block::*;
|
|
||||||
use error::{BlockError, Error};
|
|
||||||
use header::{Header, BlockNumber, ExtendedHeader};
|
|
||||||
use engines::{self, Engine};
|
|
||||||
use ethjson;
|
use ethjson;
|
||||||
|
use hash::{KECCAK_EMPTY_LIST_RLP};
|
||||||
use rlp::Rlp;
|
use rlp::Rlp;
|
||||||
|
use types::header::{Header, ExtendedHeader};
|
||||||
|
use types::BlockNumber;
|
||||||
|
use unexpected::{OutOfBounds, Mismatch};
|
||||||
|
|
||||||
|
use block::ExecutedBlock;
|
||||||
|
use engines::block_reward::{self, BlockRewardContract, RewardKind};
|
||||||
|
use engines::{self, Engine};
|
||||||
|
use error::{BlockError, Error};
|
||||||
|
use ethash::{self, quick_get_difficulty, slow_hash_block_number, EthashManager, OptimizeFor};
|
||||||
use machine::EthereumMachine;
|
use machine::EthereumMachine;
|
||||||
|
|
||||||
/// Number of blocks in an ethash snapshot.
|
/// Number of blocks in an ethash snapshot.
|
||||||
@ -482,7 +485,7 @@ mod tests {
|
|||||||
use block::*;
|
use block::*;
|
||||||
use test_helpers::get_temp_state_db;
|
use test_helpers::get_temp_state_db;
|
||||||
use error::{BlockError, Error, ErrorKind};
|
use error::{BlockError, Error, ErrorKind};
|
||||||
use header::Header;
|
use types::header::Header;
|
||||||
use spec::Spec;
|
use spec::Spec;
|
||||||
use engines::Engine;
|
use engines::Engine;
|
||||||
use super::super::{new_morden, new_mcip3_test, new_homestead_test_machine};
|
use super::super::{new_morden, new_mcip3_test, new_homestead_test_machine};
|
||||||
|
@ -180,7 +180,8 @@ mod tests {
|
|||||||
use state::*;
|
use state::*;
|
||||||
use super::*;
|
use super::*;
|
||||||
use test_helpers::get_temp_state_db;
|
use test_helpers::get_temp_state_db;
|
||||||
use views::BlockView;
|
use types::view;
|
||||||
|
use types::views::BlockView;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn ensure_db_good() {
|
fn ensure_db_good() {
|
||||||
|
@ -21,8 +21,8 @@ use bytes::Bytes;
|
|||||||
use ethtrie;
|
use ethtrie;
|
||||||
use vm;
|
use vm;
|
||||||
use trace::{VMTrace, FlatTrace};
|
use trace::{VMTrace, FlatTrace};
|
||||||
use log_entry::LogEntry;
|
use types::state_diff::StateDiff;
|
||||||
use state_diff::StateDiff;
|
use types::log_entry::LogEntry;
|
||||||
|
|
||||||
use std::{fmt, error};
|
use std::{fmt, error};
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ use hash::keccak;
|
|||||||
use ethereum_types::{H256, U256, U512, Address};
|
use ethereum_types::{H256, U256, U512, Address};
|
||||||
use bytes::{Bytes, BytesRef};
|
use bytes::{Bytes, BytesRef};
|
||||||
use state::{Backend as StateBackend, State, Substate, CleanupMode};
|
use state::{Backend as StateBackend, State, Substate, CleanupMode};
|
||||||
use error::ExecutionError;
|
use executed::ExecutionError;
|
||||||
use machine::EthereumMachine as Machine;
|
use machine::EthereumMachine as Machine;
|
||||||
use evm::{CallType, Finalize, FinalizationResult};
|
use evm::{CallType, Finalize, FinalizationResult};
|
||||||
use vm::{
|
use vm::{
|
||||||
@ -31,7 +31,8 @@ use vm::{
|
|||||||
use factory::VmFactory;
|
use factory::VmFactory;
|
||||||
use externalities::*;
|
use externalities::*;
|
||||||
use trace::{self, Tracer, VMTracer};
|
use trace::{self, Tracer, VMTracer};
|
||||||
use transaction::{Action, SignedTransaction};
|
use types::transaction::{Action, SignedTransaction};
|
||||||
|
use transaction_ext::Transaction;
|
||||||
use crossbeam;
|
use crossbeam;
|
||||||
pub use executed::{Executed, ExecutionResult};
|
pub use executed::{Executed, ExecutionResult};
|
||||||
|
|
||||||
@ -1179,7 +1180,7 @@ mod tests {
|
|||||||
use trace::trace;
|
use trace::trace;
|
||||||
use trace::{FlatTrace, Tracer, NoopTracer, ExecutiveTracer};
|
use trace::{FlatTrace, Tracer, NoopTracer, ExecutiveTracer};
|
||||||
use trace::{VMTrace, VMOperation, VMExecutedOperation, MemoryDiff, StorageDiff, VMTracer, NoopVMTracer, ExecutiveVMTracer};
|
use trace::{VMTrace, VMOperation, VMExecutedOperation, MemoryDiff, StorageDiff, VMTracer, NoopVMTracer, ExecutiveVMTracer};
|
||||||
use transaction::{Action, Transaction};
|
use types::transaction::{Action, Transaction};
|
||||||
|
|
||||||
fn make_frontier_machine(max_depth: usize) -> EthereumMachine {
|
fn make_frontier_machine(max_depth: usize) -> EthereumMachine {
|
||||||
let mut machine = ::ethereum::new_frontier_test_machine();
|
let mut machine = ::ethereum::new_frontier_test_machine();
|
||||||
|
@ -27,7 +27,7 @@ use vm::{
|
|||||||
Ext, ContractCreateResult, MessageCallResult, CreateContractAddress,
|
Ext, ContractCreateResult, MessageCallResult, CreateContractAddress,
|
||||||
ReturnData, TrapKind
|
ReturnData, TrapKind
|
||||||
};
|
};
|
||||||
use transaction::UNSIGNED_SENDER;
|
use types::transaction::UNSIGNED_SENDER;
|
||||||
use trace::{Tracer, VMTracer};
|
use trace::{Tracer, VMTracer};
|
||||||
|
|
||||||
/// Policy for handling output data on `RETURN` opcode.
|
/// Policy for handling output data on `RETURN` opcode.
|
||||||
@ -340,7 +340,7 @@ impl<'a, T: 'a, V: 'a, B: 'a> Ext for Externalities<'a, T, V, B>
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn log(&mut self, topics: Vec<H256>, data: &[u8]) -> vm::Result<()> {
|
fn log(&mut self, topics: Vec<H256>, data: &[u8]) -> vm::Result<()> {
|
||||||
use log_entry::LogEntry;
|
use types::log_entry::LogEntry;
|
||||||
|
|
||||||
if self.static_flag {
|
if self.static_flag {
|
||||||
return Err(vm::Error::MutableCallInStaticContext);
|
return Err(vm::Error::MutableCallInStaticContext);
|
||||||
|
@ -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 ethjson;
|
use ethjson;
|
||||||
use header::Header;
|
use types::header::Header;
|
||||||
use ethereum_types::U256;
|
use ethereum_types::U256;
|
||||||
use spec::Spec;
|
use spec::Spec;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ use pod_state::PodState;
|
|||||||
use trace;
|
use trace;
|
||||||
use client::{EvmTestClient, EvmTestError, TransactResult};
|
use client::{EvmTestClient, EvmTestError, TransactResult};
|
||||||
use ethjson;
|
use ethjson;
|
||||||
use transaction::SignedTransaction;
|
use types::transaction::SignedTransaction;
|
||||||
use vm::EnvInfo;
|
use vm::EnvInfo;
|
||||||
use super::SKIP_TEST_STATE;
|
use super::SKIP_TEST_STATE;
|
||||||
use super::HookType;
|
use super::HookType;
|
||||||
|
@ -17,10 +17,11 @@
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use super::test_common::*;
|
use super::test_common::*;
|
||||||
use client::EvmTestClient;
|
use client::EvmTestClient;
|
||||||
use header::Header;
|
|
||||||
use ethjson;
|
use ethjson;
|
||||||
use rlp::Rlp;
|
use rlp::Rlp;
|
||||||
use transaction::UnverifiedTransaction;
|
use types::header::Header;
|
||||||
|
use types::transaction::UnverifiedTransaction;
|
||||||
|
use transaction_ext::Transaction;
|
||||||
|
|
||||||
/// Run transaction jsontests on a given folder.
|
/// Run transaction jsontests on a given folder.
|
||||||
pub fn run_test_path<H: FnMut(&str, HookType)>(p: &Path, skip: &[&'static str], h: &mut H) {
|
pub fn run_test_path<H: FnMut(&str, HookType)>(p: &Path, skip: &[&'static str], h: &mut H) {
|
||||||
@ -67,7 +68,7 @@ fn do_json_test<H: FnMut(&str, HookType)>(json_data: &[u8], start_stop_hook: &mu
|
|||||||
|
|
||||||
let minimal = t.gas_required(&spec.engine.schedule(header.number())).into();
|
let minimal = t.gas_required(&spec.engine.schedule(header.number())).into();
|
||||||
if t.gas < minimal {
|
if t.gas < minimal {
|
||||||
return Err(::transaction::Error::InsufficientGas {
|
return Err(::types::transaction::Error::InsufficientGas {
|
||||||
minimal, got: t.gas,
|
minimal, got: t.gas,
|
||||||
}.into());
|
}.into());
|
||||||
}
|
}
|
||||||
|
@ -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/>.
|
||||||
|
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs, unused_extern_crates)]
|
||||||
|
|
||||||
//! Ethcore library
|
//! Ethcore library
|
||||||
//!
|
//!
|
||||||
@ -57,61 +57,65 @@
|
|||||||
// error_chain foreign_links.
|
// error_chain foreign_links.
|
||||||
#![recursion_limit="128"]
|
#![recursion_limit="128"]
|
||||||
|
|
||||||
extern crate blooms_db;
|
extern crate ansi_term;
|
||||||
extern crate bn;
|
extern crate bn;
|
||||||
extern crate byteorder;
|
extern crate byteorder;
|
||||||
extern crate crossbeam;
|
|
||||||
extern crate common_types as types;
|
extern crate common_types as types;
|
||||||
|
extern crate crossbeam;
|
||||||
|
extern crate ethabi;
|
||||||
extern crate ethash;
|
extern crate ethash;
|
||||||
|
extern crate ethcore_blockchain as blockchain;
|
||||||
extern crate ethcore_bloom_journal as bloom_journal;
|
extern crate ethcore_bloom_journal as bloom_journal;
|
||||||
extern crate parity_crypto;
|
extern crate ethcore_db as db;
|
||||||
extern crate ethcore_io as io;
|
extern crate ethcore_io as io;
|
||||||
extern crate parity_bytes as bytes;
|
|
||||||
extern crate ethcore_logger;
|
|
||||||
extern crate ethcore_miner;
|
extern crate ethcore_miner;
|
||||||
#[cfg(feature = "stratum")]
|
|
||||||
extern crate ethcore_stratum;
|
|
||||||
extern crate ethcore_transaction as transaction;
|
|
||||||
extern crate ethereum_types;
|
extern crate ethereum_types;
|
||||||
extern crate ethjson;
|
extern crate ethjson;
|
||||||
extern crate ethkey;
|
extern crate ethkey;
|
||||||
|
extern crate ethstore;
|
||||||
extern crate hashdb;
|
extern crate hashdb;
|
||||||
|
extern crate heapsize;
|
||||||
extern crate itertools;
|
extern crate itertools;
|
||||||
|
extern crate journaldb;
|
||||||
|
extern crate keccak_hash as hash;
|
||||||
|
extern crate keccak_hasher;
|
||||||
extern crate kvdb;
|
extern crate kvdb;
|
||||||
extern crate kvdb_memorydb;
|
extern crate kvdb_memorydb;
|
||||||
extern crate kvdb_rocksdb;
|
extern crate len_caching_lock;
|
||||||
extern crate lru_cache;
|
extern crate lru_cache;
|
||||||
extern crate num_cpus;
|
extern crate memory_cache;
|
||||||
|
extern crate memorydb;
|
||||||
extern crate num;
|
extern crate num;
|
||||||
|
extern crate num_cpus;
|
||||||
|
extern crate parity_bytes as bytes;
|
||||||
|
extern crate parity_crypto;
|
||||||
extern crate parity_machine;
|
extern crate parity_machine;
|
||||||
|
extern crate parity_snappy as snappy;
|
||||||
extern crate parking_lot;
|
extern crate parking_lot;
|
||||||
|
extern crate patricia_trie as trie;
|
||||||
|
extern crate patricia_trie_ethereum as ethtrie;
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
extern crate rayon;
|
extern crate rayon;
|
||||||
extern crate rlp;
|
extern crate rlp;
|
||||||
extern crate rlp_compress;
|
|
||||||
extern crate keccak_hash as hash;
|
|
||||||
extern crate keccak_hasher;
|
|
||||||
extern crate heapsize;
|
|
||||||
extern crate memorydb;
|
|
||||||
extern crate patricia_trie as trie;
|
|
||||||
extern crate patricia_trie_ethereum as ethtrie;
|
|
||||||
extern crate triehash_ethereum as triehash;
|
|
||||||
extern crate ansi_term;
|
|
||||||
extern crate unexpected;
|
|
||||||
extern crate parity_snappy as snappy;
|
|
||||||
extern crate ethabi;
|
|
||||||
extern crate rustc_hex;
|
extern crate rustc_hex;
|
||||||
|
extern crate serde;
|
||||||
extern crate stats;
|
extern crate stats;
|
||||||
|
extern crate triehash_ethereum as triehash;
|
||||||
|
extern crate unexpected;
|
||||||
extern crate using_queue;
|
extern crate using_queue;
|
||||||
extern crate vm;
|
extern crate vm;
|
||||||
extern crate wasm;
|
extern crate wasm;
|
||||||
extern crate memory_cache;
|
|
||||||
extern crate journaldb;
|
#[cfg(feature = "stratum")]
|
||||||
extern crate serde;
|
extern crate ethcore_stratum;
|
||||||
#[cfg(any(test, feature = "json-tests", feature = "test-helpers"))]
|
#[cfg(any(test, feature = "json-tests", feature = "test-helpers"))]
|
||||||
extern crate tempdir;
|
extern crate tempdir;
|
||||||
extern crate len_caching_lock;
|
#[cfg(any(test, feature = "json-tests"))]
|
||||||
|
extern crate ethcore_logger;
|
||||||
|
#[cfg(any(test, feature = "test-helpers"))]
|
||||||
|
extern crate kvdb_rocksdb;
|
||||||
|
#[cfg(any(test, feature = "test-helpers"))]
|
||||||
|
extern crate blooms_db;
|
||||||
|
|
||||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows", target_os = "android"))]
|
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows", target_os = "android"))]
|
||||||
extern crate hardware_wallet;
|
extern crate hardware_wallet;
|
||||||
@ -143,24 +147,18 @@ extern crate evm;
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
extern crate env_logger;
|
extern crate env_logger;
|
||||||
|
#[cfg(test)]
|
||||||
pub extern crate ethstore;
|
extern crate rlp_compress;
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
pub mod views;
|
|
||||||
|
|
||||||
pub mod account_provider;
|
pub mod account_provider;
|
||||||
pub mod block;
|
pub mod block;
|
||||||
pub mod builtin;
|
pub mod builtin;
|
||||||
pub mod client;
|
pub mod client;
|
||||||
pub mod db;
|
|
||||||
pub mod encoded;
|
|
||||||
pub mod engines;
|
pub mod engines;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod ethereum;
|
pub mod ethereum;
|
||||||
pub mod executed;
|
pub mod executed;
|
||||||
pub mod executive;
|
pub mod executive;
|
||||||
pub mod header;
|
|
||||||
pub mod machine;
|
pub mod machine;
|
||||||
pub mod miner;
|
pub mod miner;
|
||||||
pub mod pod_state;
|
pub mod pod_state;
|
||||||
@ -170,12 +168,11 @@ pub mod spec;
|
|||||||
pub mod state;
|
pub mod state;
|
||||||
pub mod state_db;
|
pub mod state_db;
|
||||||
pub mod trace;
|
pub mod trace;
|
||||||
|
pub mod transaction_ext;
|
||||||
pub mod verification;
|
pub mod verification;
|
||||||
|
|
||||||
mod cache_manager;
|
|
||||||
mod account_db;
|
mod account_db;
|
||||||
mod externalities;
|
mod externalities;
|
||||||
mod blockchain;
|
|
||||||
mod factory;
|
mod factory;
|
||||||
mod tx_filter;
|
mod tx_filter;
|
||||||
|
|
||||||
@ -186,8 +183,6 @@ pub mod json_tests;
|
|||||||
#[cfg(any(test, feature = "test-helpers"))]
|
#[cfg(any(test, feature = "test-helpers"))]
|
||||||
pub mod test_helpers;
|
pub mod test_helpers;
|
||||||
|
|
||||||
pub use types::*;
|
|
||||||
pub use executive::contract_address;
|
pub use executive::contract_address;
|
||||||
pub use evm::CreateContractAddress;
|
pub use evm::CreateContractAddress;
|
||||||
pub use blockchain::{BlockChainDB, BlockChainDBHandler};
|
|
||||||
pub use trie::TrieSpec;
|
pub use trie::TrieSpec;
|
||||||
|
@ -20,23 +20,24 @@ use std::collections::{BTreeMap, HashMap};
|
|||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use ethereum_types::{U256, H256, Address};
|
||||||
|
use rlp::Rlp;
|
||||||
|
use types::transaction::{self, SYSTEM_ADDRESS, UNSIGNED_SENDER, UnverifiedTransaction, SignedTransaction};
|
||||||
|
use types::BlockNumber;
|
||||||
|
use types::header::{Header, ExtendedHeader};
|
||||||
|
use vm::{CallType, ActionParams, ActionValue, ParamsType};
|
||||||
|
use vm::{EnvInfo, Schedule, CreateContractAddress};
|
||||||
|
|
||||||
use block::{ExecutedBlock, IsBlock};
|
use block::{ExecutedBlock, IsBlock};
|
||||||
use builtin::Builtin;
|
use builtin::Builtin;
|
||||||
use client::{BlockInfo, CallContract};
|
use client::{BlockInfo, CallContract};
|
||||||
use error::Error;
|
use error::Error;
|
||||||
use executive::Executive;
|
use executive::Executive;
|
||||||
use header::{BlockNumber, Header, ExtendedHeader};
|
|
||||||
use spec::CommonParams;
|
use spec::CommonParams;
|
||||||
use state::{CleanupMode, Substate};
|
use state::{CleanupMode, Substate};
|
||||||
use trace::{NoopTracer, NoopVMTracer, Tracer, ExecutiveTracer, RewardType, Tracing};
|
use trace::{NoopTracer, NoopVMTracer, Tracer, ExecutiveTracer, RewardType, Tracing};
|
||||||
use transaction::{self, SYSTEM_ADDRESS, UNSIGNED_SENDER, UnverifiedTransaction, SignedTransaction};
|
|
||||||
use tx_filter::TransactionFilter;
|
use tx_filter::TransactionFilter;
|
||||||
|
|
||||||
use ethereum_types::{U256, H256, Address};
|
|
||||||
use rlp::Rlp;
|
|
||||||
use vm::{CallType, ActionParams, ActionValue, ParamsType};
|
|
||||||
use vm::{EnvInfo, Schedule, CreateContractAddress};
|
|
||||||
|
|
||||||
/// Parity tries to round block.gas_limit to multiple of this constant
|
/// Parity tries to round block.gas_limit to multiple of this constant
|
||||||
pub const PARITY_GAS_LIMIT_DETERMINANT: U256 = U256([37, 0, 0, 0]);
|
pub const PARITY_GAS_LIMIT_DETERMINANT: U256 = U256([37, 0, 0, 0]);
|
||||||
|
|
||||||
@ -408,7 +409,7 @@ pub struct AuxiliaryData<'a> {
|
|||||||
/// The full block bytes, including the header.
|
/// The full block bytes, including the header.
|
||||||
pub bytes: Option<&'a [u8]>,
|
pub bytes: Option<&'a [u8]>,
|
||||||
/// The block receipts.
|
/// The block receipts.
|
||||||
pub receipts: Option<&'a [::receipt::Receipt]>,
|
pub receipts: Option<&'a [::types::receipt::Receipt]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Type alias for a function we can make calls through synchronously.
|
/// Type alias for a function we can make calls through synchronously.
|
||||||
@ -526,7 +527,7 @@ mod tests {
|
|||||||
Default::default(),
|
Default::default(),
|
||||||
ethparams,
|
ethparams,
|
||||||
);
|
);
|
||||||
let mut header = ::header::Header::new();
|
let mut header = ::types::header::Header::new();
|
||||||
header.set_number(15);
|
header.set_number(15);
|
||||||
|
|
||||||
let res = machine.verify_transaction_basic(&transaction, &header);
|
let res = machine.verify_transaction_basic(&transaction, &header);
|
||||||
@ -546,8 +547,8 @@ mod tests {
|
|||||||
ethparams,
|
ethparams,
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut parent = ::header::Header::new();
|
let mut parent = ::types::header::Header::new();
|
||||||
let mut header = ::header::Header::new();
|
let mut header = ::types::header::Header::new();
|
||||||
header.set_number(1);
|
header.set_number(1);
|
||||||
|
|
||||||
// this test will work for this constant only
|
// this test will work for this constant only
|
||||||
|
@ -21,39 +21,42 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
use ansi_term::Colour;
|
use ansi_term::Colour;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use engines::{EthEngine, Seal};
|
|
||||||
use error::{Error, ErrorKind, ExecutionError};
|
|
||||||
use ethcore_miner::gas_pricer::GasPricer;
|
use ethcore_miner::gas_pricer::GasPricer;
|
||||||
use ethcore_miner::pool::{self, TransactionQueue, VerifiedTransaction, QueueStatus, PrioritizationStrategy};
|
use ethcore_miner::pool::{self, TransactionQueue, VerifiedTransaction, QueueStatus, PrioritizationStrategy};
|
||||||
#[cfg(feature = "work-notify")]
|
#[cfg(feature = "work-notify")]
|
||||||
use ethcore_miner::work_notify::NotifyWork;
|
use ethcore_miner::work_notify::NotifyWork;
|
||||||
use ethereum_types::{H256, U256, Address};
|
use ethereum_types::{H256, U256, Address};
|
||||||
|
use ethkey::Password;
|
||||||
use io::IoChannel;
|
use io::IoChannel;
|
||||||
|
use miner::pool_client::{PoolClient, CachedNonceClient, NonceCache};
|
||||||
|
use miner;
|
||||||
use parking_lot::{Mutex, RwLock};
|
use parking_lot::{Mutex, RwLock};
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use transaction::{
|
use types::transaction::{
|
||||||
self,
|
self,
|
||||||
Action,
|
Action,
|
||||||
UnverifiedTransaction,
|
UnverifiedTransaction,
|
||||||
SignedTransaction,
|
SignedTransaction,
|
||||||
PendingTransaction,
|
PendingTransaction,
|
||||||
};
|
};
|
||||||
|
use types::BlockNumber;
|
||||||
|
use types::block::Block;
|
||||||
|
use types::header::Header;
|
||||||
|
use types::receipt::RichReceipt;
|
||||||
use using_queue::{UsingQueue, GetAction};
|
use using_queue::{UsingQueue, GetAction};
|
||||||
|
|
||||||
use account_provider::{AccountProvider, SignError as AccountError};
|
use account_provider::{AccountProvider, SignError as AccountError};
|
||||||
use block::{ClosedBlock, IsBlock, Block, SealedBlock};
|
use block::{ClosedBlock, IsBlock, SealedBlock};
|
||||||
use client::{
|
use client::{
|
||||||
BlockChain, ChainInfo, CallContract, BlockProducer, SealedBlockImporter, Nonce, TransactionInfo, TransactionId
|
BlockChain, ChainInfo, CallContract, BlockProducer, SealedBlockImporter, Nonce, TransactionInfo, TransactionId
|
||||||
};
|
};
|
||||||
use client::{BlockId, ClientIoMessage};
|
use client::{BlockId, ClientIoMessage};
|
||||||
|
use engines::{EthEngine, Seal};
|
||||||
|
use error::{Error, ErrorKind};
|
||||||
|
use executed::ExecutionError;
|
||||||
use executive::contract_address;
|
use executive::contract_address;
|
||||||
use header::{Header, BlockNumber};
|
|
||||||
use miner;
|
|
||||||
use miner::pool_client::{PoolClient, CachedNonceClient, NonceCache};
|
|
||||||
use receipt::RichReceipt;
|
|
||||||
use spec::Spec;
|
use spec::Spec;
|
||||||
use state::State;
|
use state::State;
|
||||||
use ethkey::Password;
|
|
||||||
|
|
||||||
/// Different possible definitions for pending transaction set.
|
/// Different possible definitions for pending transaction set.
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
@ -1284,13 +1287,13 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use ethkey::{Generator, Random};
|
use ethkey::{Generator, Random};
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use header::BlockNumber;
|
|
||||||
use rustc_hex::FromHex;
|
use rustc_hex::FromHex;
|
||||||
|
use types::BlockNumber;
|
||||||
|
|
||||||
use client::{TestBlockChainClient, EachBlockWith, ChainInfo, ImportSealedBlock};
|
use client::{TestBlockChainClient, EachBlockWith, ChainInfo, ImportSealedBlock};
|
||||||
use miner::{MinerService, PendingOrdering};
|
use miner::{MinerService, PendingOrdering};
|
||||||
use test_helpers::{generate_dummy_client, generate_dummy_client_with_spec_and_accounts};
|
use test_helpers::{generate_dummy_client, generate_dummy_client_with_spec_and_accounts};
|
||||||
use transaction::{Transaction};
|
use types::transaction::{Transaction};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_prepare_block_to_seal() {
|
fn should_prepare_block_to_seal() {
|
||||||
|
@ -33,21 +33,23 @@ use std::sync::Arc;
|
|||||||
use std::collections::{BTreeSet, BTreeMap};
|
use std::collections::{BTreeSet, BTreeMap};
|
||||||
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use ethereum_types::{H256, U256, Address};
|
|
||||||
use ethcore_miner::pool::{VerifiedTransaction, QueueStatus, local_transactions};
|
use ethcore_miner::pool::{VerifiedTransaction, QueueStatus, local_transactions};
|
||||||
|
use ethereum_types::{H256, U256, Address};
|
||||||
|
use ethkey::Password;
|
||||||
|
use types::transaction::{self, UnverifiedTransaction, SignedTransaction, PendingTransaction};
|
||||||
|
use types::BlockNumber;
|
||||||
|
use types::block::Block;
|
||||||
|
use types::header::Header;
|
||||||
|
use types::receipt::RichReceipt;
|
||||||
|
|
||||||
use block::{Block, SealedBlock};
|
use block::SealedBlock;
|
||||||
use client::{
|
use client::{
|
||||||
CallContract, RegistryInfo, ScheduleInfo,
|
CallContract, RegistryInfo, ScheduleInfo,
|
||||||
BlockChain, BlockProducer, SealedBlockImporter, ChainInfo,
|
BlockChain, BlockProducer, SealedBlockImporter, ChainInfo,
|
||||||
AccountData, Nonce,
|
AccountData, Nonce,
|
||||||
};
|
};
|
||||||
use error::Error;
|
use error::Error;
|
||||||
use header::{BlockNumber, Header};
|
|
||||||
use receipt::RichReceipt;
|
|
||||||
use transaction::{self, UnverifiedTransaction, SignedTransaction, PendingTransaction};
|
|
||||||
use state::StateInfo;
|
use state::StateInfo;
|
||||||
use ethkey::Password;
|
|
||||||
|
|
||||||
/// Provides methods to verify incoming external transactions
|
/// Provides methods to verify incoming external transactions
|
||||||
pub trait TransactionVerifierClient: Send + Sync
|
pub trait TransactionVerifierClient: Send + Sync
|
||||||
|
@ -25,19 +25,20 @@ use std::{
|
|||||||
use ethereum_types::{H256, U256, Address};
|
use ethereum_types::{H256, U256, Address};
|
||||||
use ethcore_miner::pool;
|
use ethcore_miner::pool;
|
||||||
use ethcore_miner::pool::client::NonceClient;
|
use ethcore_miner::pool::client::NonceClient;
|
||||||
use transaction::{
|
use types::transaction::{
|
||||||
self,
|
self,
|
||||||
UnverifiedTransaction,
|
UnverifiedTransaction,
|
||||||
SignedTransaction,
|
SignedTransaction,
|
||||||
};
|
};
|
||||||
|
use types::header::Header;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
|
||||||
use account_provider::AccountProvider;
|
use account_provider::AccountProvider;
|
||||||
use client::{TransactionId, BlockInfo, CallContract, Nonce};
|
use client::{TransactionId, BlockInfo, CallContract, Nonce};
|
||||||
use engines::EthEngine;
|
use engines::EthEngine;
|
||||||
use header::Header;
|
|
||||||
use miner;
|
use miner;
|
||||||
use miner::service_transaction_checker::ServiceTransactionChecker;
|
use miner::service_transaction_checker::ServiceTransactionChecker;
|
||||||
|
use transaction_ext::Transaction;
|
||||||
|
|
||||||
/// Cache for state nonces.
|
/// Cache for state nonces.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
//! A service transactions contract checker.
|
//! A service transactions contract checker.
|
||||||
|
|
||||||
use client::{RegistryInfo, CallContract, BlockId};
|
use client::{RegistryInfo, CallContract, BlockId};
|
||||||
use transaction::SignedTransaction;
|
use types::transaction::SignedTransaction;
|
||||||
use ethabi::FunctionOutputDecoder;
|
use ethabi::FunctionOutputDecoder;
|
||||||
|
|
||||||
use_contract!(service_transaction, "res/contracts/service_transaction.json");
|
use_contract!(service_transaction, "res/contracts/service_transaction.json");
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
//! Account state encoding and decoding
|
//! Account state encoding and decoding
|
||||||
|
|
||||||
use account_db::{AccountDB, AccountDBMut};
|
use account_db::{AccountDB, AccountDBMut};
|
||||||
use basic_account::BasicAccount;
|
use types::basic_account::BasicAccount;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use ethereum_types::{H256, U256};
|
use ethereum_types::{H256, U256};
|
||||||
use ethtrie::{TrieDB, TrieDBMut};
|
use ethtrie::{TrieDB, TrieDBMut};
|
||||||
@ -207,7 +207,7 @@ pub fn from_fat_rlp(
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use account_db::{AccountDB, AccountDBMut};
|
use account_db::{AccountDB, AccountDBMut};
|
||||||
use basic_account::BasicAccount;
|
use types::basic_account::BasicAccount;
|
||||||
use test_helpers::get_temp_state_db;
|
use test_helpers::get_temp_state_db;
|
||||||
use snapshot::tests::helpers::fill_storage;
|
use snapshot::tests::helpers::fill_storage;
|
||||||
|
|
||||||
|
@ -16,14 +16,14 @@
|
|||||||
|
|
||||||
//! Block RLP compression.
|
//! Block RLP compression.
|
||||||
|
|
||||||
use block::Block;
|
|
||||||
use header::Header;
|
|
||||||
use hash::keccak;
|
|
||||||
use views::BlockView;
|
|
||||||
use rlp::{DecoderError, RlpStream, Rlp};
|
|
||||||
use ethereum_types::H256;
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
|
use ethereum_types::H256;
|
||||||
|
use hash::keccak;
|
||||||
|
use rlp::{DecoderError, RlpStream, Rlp};
|
||||||
use triehash::ordered_trie_root;
|
use triehash::ordered_trie_root;
|
||||||
|
use types::block::Block;
|
||||||
|
use types::header::Header;
|
||||||
|
use types::views::BlockView;
|
||||||
|
|
||||||
const HEADER_FIELDS: usize = 8;
|
const HEADER_FIELDS: usize = 8;
|
||||||
const BLOCK_FIELDS: usize = 2;
|
const BLOCK_FIELDS: usize = 2;
|
||||||
@ -132,13 +132,14 @@ impl AbridgedBlock {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use views::BlockView;
|
|
||||||
use block::Block;
|
|
||||||
use super::AbridgedBlock;
|
use super::AbridgedBlock;
|
||||||
use transaction::{Action, Transaction};
|
|
||||||
|
|
||||||
use ethereum_types::{H256, U256, Address};
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
|
use ethereum_types::{H256, U256, Address};
|
||||||
|
use types::transaction::{Action, Transaction};
|
||||||
|
use types::block::Block;
|
||||||
|
use types::view;
|
||||||
|
use types::views::BlockView;
|
||||||
|
|
||||||
fn encode_block(b: &Block) -> Bytes {
|
fn encode_block(b: &Block) -> Bytes {
|
||||||
b.rlp_bytes()
|
b.rlp_bytes()
|
||||||
|
@ -24,21 +24,20 @@ use super::{SnapshotComponents, Rebuilder, ChunkSink};
|
|||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use blockchain::{BlockChain, BlockChainDB, BlockProvider};
|
|
||||||
use engines::{EthEngine, EpochVerifier, EpochTransition};
|
use engines::{EthEngine, EpochVerifier, EpochTransition};
|
||||||
use machine::EthereumMachine;
|
use machine::EthereumMachine;
|
||||||
use ids::BlockId;
|
|
||||||
use header::Header;
|
|
||||||
use receipt::Receipt;
|
|
||||||
use snapshot::{Error, ManifestData, Progress};
|
use snapshot::{Error, ManifestData, Progress};
|
||||||
|
|
||||||
use itertools::{Position, Itertools};
|
use blockchain::{BlockChain, BlockChainDB, BlockProvider};
|
||||||
use rlp::{RlpStream, Rlp};
|
|
||||||
use ethereum_types::{H256, U256};
|
|
||||||
use kvdb::KeyValueDB;
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use encoded;
|
use ethereum_types::{H256, U256};
|
||||||
|
use itertools::{Position, Itertools};
|
||||||
|
use kvdb::KeyValueDB;
|
||||||
|
use rlp::{RlpStream, Rlp};
|
||||||
|
use types::encoded;
|
||||||
|
use types::header::Header;
|
||||||
|
use types::ids::BlockId;
|
||||||
|
use types::receipt::Receipt;
|
||||||
|
|
||||||
/// Snapshot creation and restoration for PoA chains.
|
/// Snapshot creation and restoration for PoA chains.
|
||||||
/// Chunk format:
|
/// Chunk format:
|
||||||
@ -319,7 +318,7 @@ impl Rebuilder for ChunkRebuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if is_last_chunk {
|
if is_last_chunk {
|
||||||
use block::Block;
|
use types::block::Block;
|
||||||
|
|
||||||
let last_rlp = rlp.at(num_items - 1)?;
|
let last_rlp = rlp.at(num_items - 1)?;
|
||||||
let block = Block {
|
let block = Block {
|
||||||
|
@ -35,7 +35,7 @@ use kvdb::KeyValueDB;
|
|||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use rlp::{RlpStream, Rlp};
|
use rlp::{RlpStream, Rlp};
|
||||||
use rand::OsRng;
|
use rand::OsRng;
|
||||||
use encoded;
|
use types::encoded;
|
||||||
|
|
||||||
/// Snapshot creation and restoration for PoW chains.
|
/// Snapshot creation and restoration for PoW chains.
|
||||||
/// This includes blocks from the head of the chain as a
|
/// This includes blocks from the head of the chain as a
|
||||||
@ -250,7 +250,7 @@ impl Rebuilder for PowRebuilder {
|
|||||||
let pair = rlp.at(idx)?;
|
let pair = rlp.at(idx)?;
|
||||||
let abridged_rlp = pair.at(0)?.as_raw().to_owned();
|
let abridged_rlp = pair.at(0)?.as_raw().to_owned();
|
||||||
let abridged_block = AbridgedBlock::from_raw(abridged_rlp);
|
let abridged_block = AbridgedBlock::from_raw(abridged_rlp);
|
||||||
let receipts: Vec<::receipt::Receipt> = pair.list_at(1)?;
|
let receipts: Vec<::types::receipt::Receipt> = pair.list_at(1)?;
|
||||||
let receipts_root = ordered_trie_root(pair.at(1)?.iter().map(|r| r.as_raw()));
|
let receipts_root = ordered_trie_root(pair.at(1)?.iter().map(|r| r.as_raw()));
|
||||||
|
|
||||||
let block = abridged_block.to_block(parent_hash, cur_number, receipts_root)?;
|
let block = abridged_block.to_block(parent_hash, cur_number, receipts_root)?;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use ids::BlockId;
|
use types::ids::BlockId;
|
||||||
|
|
||||||
use ethereum_types::H256;
|
use ethereum_types::H256;
|
||||||
use ethtrie::TrieError;
|
use ethtrie::TrieError;
|
||||||
|
@ -28,8 +28,8 @@ use hash::{keccak, KECCAK_NULL_RLP, KECCAK_EMPTY};
|
|||||||
use account_db::{AccountDB, AccountDBMut};
|
use account_db::{AccountDB, AccountDBMut};
|
||||||
use blockchain::{BlockChain, BlockProvider};
|
use blockchain::{BlockChain, BlockProvider};
|
||||||
use engines::EthEngine;
|
use engines::EthEngine;
|
||||||
use header::Header;
|
use types::header::Header;
|
||||||
use ids::BlockId;
|
use types::ids::BlockId;
|
||||||
|
|
||||||
use ethereum_types::{H256, U256};
|
use ethereum_types::{H256, U256};
|
||||||
use hashdb::HashDB;
|
use hashdb::HashDB;
|
||||||
|
@ -33,7 +33,7 @@ use engines::EthEngine;
|
|||||||
use error::{Error, ErrorKind as SnapshotErrorKind};
|
use error::{Error, ErrorKind as SnapshotErrorKind};
|
||||||
use snapshot::{Error as SnapshotError};
|
use snapshot::{Error as SnapshotError};
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use ids::BlockId;
|
use types::ids::BlockId;
|
||||||
|
|
||||||
use io::IoChannel;
|
use io::IoChannel;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ use std::sync::Arc;
|
|||||||
use hash::{KECCAK_NULL_RLP};
|
use hash::{KECCAK_NULL_RLP};
|
||||||
|
|
||||||
use account_db::AccountDBMut;
|
use account_db::AccountDBMut;
|
||||||
use basic_account::BasicAccount;
|
use types::basic_account::BasicAccount;
|
||||||
use blockchain::{BlockChain, BlockChainDB};
|
use blockchain::{BlockChain, BlockChainDB};
|
||||||
use client::{Client, ChainInfo};
|
use client::{Client, ChainInfo};
|
||||||
use engines::EthEngine;
|
use engines::EthEngine;
|
||||||
@ -142,7 +142,7 @@ pub fn compare_dbs(one: &HashDB<KeccakHasher, DBValue>, two: &HashDB<KeccakHashe
|
|||||||
/// Take a snapshot from the given client into a temporary file.
|
/// Take a snapshot from the given client into a temporary file.
|
||||||
/// Return a snapshot reader for it.
|
/// Return a snapshot reader for it.
|
||||||
pub fn snap(client: &Client) -> (Box<SnapshotReader>, TempDir) {
|
pub fn snap(client: &Client) -> (Box<SnapshotReader>, TempDir) {
|
||||||
use ids::BlockId;
|
use types::ids::BlockId;
|
||||||
|
|
||||||
let tempdir = TempDir::new("").unwrap();
|
let tempdir = TempDir::new("").unwrap();
|
||||||
let path = tempdir.path().join("file");
|
let path = tempdir.path().join("file");
|
||||||
|
@ -26,7 +26,7 @@ use ethkey::Secret;
|
|||||||
use snapshot::tests::helpers as snapshot_helpers;
|
use snapshot::tests::helpers as snapshot_helpers;
|
||||||
use spec::Spec;
|
use spec::Spec;
|
||||||
use test_helpers::generate_dummy_client_with_spec_and_accounts;
|
use test_helpers::generate_dummy_client_with_spec_and_accounts;
|
||||||
use transaction::{Transaction, Action, SignedTransaction};
|
use types::transaction::{Transaction, Action, SignedTransaction};
|
||||||
use tempdir::TempDir;
|
use tempdir::TempDir;
|
||||||
|
|
||||||
use ethereum_types::Address;
|
use ethereum_types::Address;
|
||||||
|
@ -22,7 +22,7 @@ use std::sync::Arc;
|
|||||||
use tempdir::TempDir;
|
use tempdir::TempDir;
|
||||||
use blockchain::BlockProvider;
|
use blockchain::BlockProvider;
|
||||||
use client::{Client, ClientConfig, ImportBlock, BlockInfo};
|
use client::{Client, ClientConfig, ImportBlock, BlockInfo};
|
||||||
use ids::BlockId;
|
use types::ids::BlockId;
|
||||||
use snapshot::io::{PackedReader, PackedWriter, SnapshotReader, SnapshotWriter};
|
use snapshot::io::{PackedReader, PackedWriter, SnapshotReader, SnapshotWriter};
|
||||||
use snapshot::service::{Service, ServiceParams};
|
use snapshot::service::{Service, ServiceParams};
|
||||||
use snapshot::{chunk_state, chunk_secondary, ManifestData, Progress, SnapshotService, RestorationStatus};
|
use snapshot::{chunk_state, chunk_secondary, ManifestData, Progress, SnapshotService, RestorationStatus};
|
||||||
@ -153,7 +153,7 @@ fn guards_delete_folders() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn keep_ancient_blocks() {
|
fn keep_ancient_blocks() {
|
||||||
::env_logger::init().ok();
|
::env_logger::try_init().ok();
|
||||||
|
|
||||||
// Test variables
|
// Test variables
|
||||||
const NUM_BLOCKS: u64 = 500;
|
const NUM_BLOCKS: u64 = 500;
|
||||||
@ -272,7 +272,7 @@ fn keep_ancient_blocks() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn recover_aborted_recovery() {
|
fn recover_aborted_recovery() {
|
||||||
::env_logger::init().ok();
|
::env_logger::try_init().ok();
|
||||||
|
|
||||||
const NUM_BLOCKS: u32 = 400;
|
const NUM_BLOCKS: u32 = 400;
|
||||||
let gas_prices = vec![1.into(), 2.into(), 3.into(), 999.into()];
|
let gas_prices = vec![1.into(), 2.into(), 3.into(), 999.into()];
|
||||||
|
@ -20,7 +20,7 @@ use std::sync::Arc;
|
|||||||
use std::sync::atomic::AtomicBool;
|
use std::sync::atomic::AtomicBool;
|
||||||
use hash::{KECCAK_NULL_RLP, keccak};
|
use hash::{KECCAK_NULL_RLP, keccak};
|
||||||
|
|
||||||
use basic_account::BasicAccount;
|
use types::basic_account::BasicAccount;
|
||||||
use snapshot::account;
|
use snapshot::account;
|
||||||
use snapshot::{chunk_state, Error as SnapshotError, Progress, StateRebuilder, SNAPSHOT_SUBPARTS};
|
use snapshot::{chunk_state, Error as SnapshotError, Progress, StateRebuilder, SNAPSHOT_SUBPARTS};
|
||||||
use snapshot::io::{PackedReader, PackedWriter, SnapshotReader, SnapshotWriter};
|
use snapshot::io::{PackedReader, PackedWriter, SnapshotReader, SnapshotWriter};
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use client::{BlockInfo, Client, ChainNotify, NewBlocks, ClientIoMessage};
|
use client::{BlockInfo, Client, ChainNotify, NewBlocks, ClientIoMessage};
|
||||||
use ids::BlockId;
|
use types::ids::BlockId;
|
||||||
|
|
||||||
use io::IoChannel;
|
use io::IoChannel;
|
||||||
use ethereum_types::H256;
|
use ethereum_types::H256;
|
||||||
|
@ -29,10 +29,12 @@ use memorydb::MemoryDB;
|
|||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use rlp::{Rlp, RlpStream};
|
use rlp::{Rlp, RlpStream};
|
||||||
use rustc_hex::{FromHex, ToHex};
|
use rustc_hex::{FromHex, ToHex};
|
||||||
|
use types::BlockNumber;
|
||||||
|
use types::encoded;
|
||||||
|
use types::header::Header;
|
||||||
use vm::{EnvInfo, CallType, ActionValue, ActionParams, ParamsType};
|
use vm::{EnvInfo, CallType, ActionValue, ActionParams, ParamsType};
|
||||||
|
|
||||||
use builtin::Builtin;
|
use builtin::Builtin;
|
||||||
use encoded;
|
|
||||||
use engines::{
|
use engines::{
|
||||||
EthEngine, NullEngine, InstantSeal, InstantSealParams, BasicAuthority,
|
EthEngine, NullEngine, InstantSeal, InstantSealParams, BasicAuthority,
|
||||||
AuthorityRound, DEFAULT_BLOCKHASH_CONTRACT
|
AuthorityRound, DEFAULT_BLOCKHASH_CONTRACT
|
||||||
@ -40,7 +42,6 @@ use engines::{
|
|||||||
use error::Error;
|
use error::Error;
|
||||||
use executive::Executive;
|
use executive::Executive;
|
||||||
use factory::Factories;
|
use factory::Factories;
|
||||||
use header::{BlockNumber, Header};
|
|
||||||
use machine::EthereumMachine;
|
use machine::EthereumMachine;
|
||||||
use pod_state::PodState;
|
use pod_state::PodState;
|
||||||
use spec::Genesis;
|
use spec::Genesis;
|
||||||
@ -840,7 +841,7 @@ impl Spec {
|
|||||||
/// initialize genesis epoch data, using in-memory database for
|
/// initialize genesis epoch data, using in-memory database for
|
||||||
/// 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 types::transaction::{Action, Transaction};
|
||||||
use journaldb;
|
use journaldb;
|
||||||
use kvdb_memorydb;
|
use kvdb_memorydb;
|
||||||
|
|
||||||
@ -989,8 +990,9 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use state::State;
|
use state::State;
|
||||||
use test_helpers::get_temp_state_db;
|
use test_helpers::get_temp_state_db;
|
||||||
use views::BlockView;
|
|
||||||
use tempdir::TempDir;
|
use tempdir::TempDir;
|
||||||
|
use types::view;
|
||||||
|
use types::views::BlockView;
|
||||||
|
|
||||||
// https://github.com/paritytech/parity-ethereum/issues/1840
|
// https://github.com/paritytech/parity-ethereum/issues/1840
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -31,7 +31,7 @@ use ethtrie::{TrieFactory, TrieDB, SecTrieDB, Result as TrieResult};
|
|||||||
use pod_account::*;
|
use pod_account::*;
|
||||||
use rlp::{RlpStream, encode};
|
use rlp::{RlpStream, encode};
|
||||||
use lru_cache::LruCache;
|
use lru_cache::LruCache;
|
||||||
use basic_account::BasicAccount;
|
use types::basic_account::BasicAccount;
|
||||||
|
|
||||||
use std::cell::{RefCell, Cell};
|
use std::cell::{RefCell, Cell};
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ use std::fmt;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use hash::{KECCAK_NULL_RLP, KECCAK_EMPTY};
|
use hash::{KECCAK_NULL_RLP, KECCAK_EMPTY};
|
||||||
|
|
||||||
use receipt::{Receipt, TransactionOutcome};
|
use types::receipt::{Receipt, TransactionOutcome};
|
||||||
use machine::EthereumMachine as Machine;
|
use machine::EthereumMachine as Machine;
|
||||||
use vm::EnvInfo;
|
use vm::EnvInfo;
|
||||||
use error::Error;
|
use error::Error;
|
||||||
@ -38,7 +38,7 @@ use pod_state::{self, PodState};
|
|||||||
use types::basic_account::BasicAccount;
|
use types::basic_account::BasicAccount;
|
||||||
use executed::{Executed, ExecutionError};
|
use executed::{Executed, ExecutionError};
|
||||||
use types::state_diff::StateDiff;
|
use types::state_diff::StateDiff;
|
||||||
use transaction::SignedTransaction;
|
use types::transaction::SignedTransaction;
|
||||||
use state_db::StateDB;
|
use state_db::StateDB;
|
||||||
use factory::VmFactory;
|
use factory::VmFactory;
|
||||||
|
|
||||||
@ -1316,7 +1316,7 @@ mod tests {
|
|||||||
use machine::EthereumMachine;
|
use machine::EthereumMachine;
|
||||||
use vm::EnvInfo;
|
use vm::EnvInfo;
|
||||||
use spec::*;
|
use spec::*;
|
||||||
use transaction::*;
|
use types::transaction::*;
|
||||||
use ethcore_logger::init_log;
|
use ethcore_logger::init_log;
|
||||||
use trace::{FlatTrace, TraceError, trace};
|
use trace::{FlatTrace, TraceError, trace};
|
||||||
use evm::CallType;
|
use evm::CallType;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
//! Execution environment substate.
|
//! Execution environment substate.
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use ethereum_types::Address;
|
use ethereum_types::Address;
|
||||||
use log_entry::LogEntry;
|
use types::log_entry::LogEntry;
|
||||||
use evm::{Schedule, CleanDustMode};
|
use evm::{Schedule, CleanDustMode};
|
||||||
use super::CleanupMode;
|
use super::CleanupMode;
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ impl Substate {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::Substate;
|
use super::Substate;
|
||||||
use log_entry::LogEntry;
|
use types::log_entry::LogEntry;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn created() {
|
fn created() {
|
||||||
|
@ -26,13 +26,14 @@ use db::COL_ACCOUNT_BLOOM;
|
|||||||
use ethereum_types::{H256, Address};
|
use ethereum_types::{H256, Address};
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use hashdb::HashDB;
|
use hashdb::HashDB;
|
||||||
use keccak_hasher::KeccakHasher;
|
|
||||||
use header::BlockNumber;
|
|
||||||
use journaldb::JournalDB;
|
use journaldb::JournalDB;
|
||||||
|
use keccak_hasher::KeccakHasher;
|
||||||
use kvdb::{KeyValueDB, DBTransaction, DBValue};
|
use kvdb::{KeyValueDB, DBTransaction, DBValue};
|
||||||
use lru_cache::LruCache;
|
use lru_cache::LruCache;
|
||||||
use memory_cache::MemoryLruCache;
|
use memory_cache::MemoryLruCache;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
use types::BlockNumber;
|
||||||
|
|
||||||
use state::{self, Account};
|
use state::{self, Account};
|
||||||
|
|
||||||
/// Value used to initialize bloom bitmap size.
|
/// Value used to initialize bloom bitmap size.
|
||||||
|
@ -19,32 +19,35 @@
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::{fs, io};
|
use std::{fs, io};
|
||||||
use account_provider::AccountProvider;
|
|
||||||
use ethereum_types::{H256, U256, Address};
|
|
||||||
use block::{OpenBlock, Drain};
|
|
||||||
use blockchain::{BlockChain, BlockChainDB, BlockChainDBHandler, Config as BlockChainConfig, ExtrasInsert};
|
use blockchain::{BlockChain, BlockChainDB, BlockChainDBHandler, Config as BlockChainConfig, ExtrasInsert};
|
||||||
|
use blooms_db;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use client::{Client, ClientConfig, ChainInfo, ImportBlock, ChainNotify, ChainMessageType, PrepareOpenBlock};
|
use ethereum_types::{H256, U256, Address};
|
||||||
use ethkey::KeyPair;
|
use ethkey::KeyPair;
|
||||||
use evm::Factory as EvmFactory;
|
use evm::Factory as EvmFactory;
|
||||||
use factory::Factories;
|
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use header::Header;
|
use io::IoChannel;
|
||||||
use io::*;
|
|
||||||
use miner::Miner;
|
|
||||||
use parking_lot::RwLock;
|
|
||||||
use rlp::{self, RlpStream};
|
|
||||||
use spec::Spec;
|
|
||||||
use state_db::StateDB;
|
|
||||||
use state::*;
|
|
||||||
use transaction::{Action, Transaction, SignedTransaction};
|
|
||||||
use views::BlockView;
|
|
||||||
use blooms_db;
|
|
||||||
use kvdb::KeyValueDB;
|
use kvdb::KeyValueDB;
|
||||||
use kvdb_rocksdb::{self, Database, DatabaseConfig};
|
use kvdb_rocksdb::{self, Database, DatabaseConfig};
|
||||||
|
use parking_lot::RwLock;
|
||||||
|
use rlp::{self, RlpStream};
|
||||||
use tempdir::TempDir;
|
use tempdir::TempDir;
|
||||||
|
use types::transaction::{Action, Transaction, SignedTransaction};
|
||||||
|
use types::encoded;
|
||||||
|
use types::header::Header;
|
||||||
|
use types::view;
|
||||||
|
use types::views::BlockView;
|
||||||
|
|
||||||
|
use account_provider::AccountProvider;
|
||||||
|
use block::{OpenBlock, Drain};
|
||||||
|
use client::{Client, ClientConfig, ChainInfo, ImportBlock, ChainNotify, ChainMessageType, PrepareOpenBlock};
|
||||||
|
use factory::Factories;
|
||||||
|
use miner::Miner;
|
||||||
|
use spec::Spec;
|
||||||
|
use state::*;
|
||||||
|
use state_db::StateDB;
|
||||||
use verification::queue::kind::blocks::Unverified;
|
use verification::queue::kind::blocks::Unverified;
|
||||||
use encoded;
|
|
||||||
|
|
||||||
/// Creates test block with corresponding header
|
/// Creates test block with corresponding header
|
||||||
pub fn create_test_block(header: &Header) -> Bytes {
|
pub fn create_test_block(header: &Header) -> Bytes {
|
||||||
|
61
ethcore/src/tests/blockchain.rs
Normal file
61
ethcore/src/tests/blockchain.rs
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// Parity is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use blockchain::BlockProvider;
|
||||||
|
|
||||||
|
use test_helpers::{
|
||||||
|
generate_dummy_blockchain,
|
||||||
|
generate_dummy_blockchain_with_extra,
|
||||||
|
generate_dummy_empty_blockchain,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_contain_arbitrary_block_sequence() {
|
||||||
|
let bc = generate_dummy_blockchain(50);
|
||||||
|
assert_eq!(bc.best_block_number(), 49);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_collect_garbage() {
|
||||||
|
let bc = generate_dummy_blockchain(3000);
|
||||||
|
|
||||||
|
assert_eq!(bc.best_block_number(), 2999);
|
||||||
|
let best_hash = bc.best_block_hash();
|
||||||
|
let mut block_header = bc.block_header_data(&best_hash);
|
||||||
|
|
||||||
|
while !block_header.is_none() {
|
||||||
|
block_header = bc.block_header_data(&block_header.unwrap().parent_hash());
|
||||||
|
}
|
||||||
|
assert!(bc.cache_size().blocks > 1024 * 1024);
|
||||||
|
|
||||||
|
for _ in 0..2 {
|
||||||
|
bc.collect_garbage();
|
||||||
|
}
|
||||||
|
assert!(bc.cache_size().blocks < 1024 * 1024);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_contain_arbitrary_block_sequence_with_extra() {
|
||||||
|
let bc = generate_dummy_blockchain_with_extra(25);
|
||||||
|
assert_eq!(bc.best_block_number(), 24);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_contain_only_genesis_block() {
|
||||||
|
let bc = generate_dummy_empty_blockchain();
|
||||||
|
assert_eq!(bc.best_block_number(), 0);
|
||||||
|
}
|
||||||
|
|
@ -16,27 +16,29 @@
|
|||||||
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use ethereum_types::{U256, Address};
|
||||||
|
use ethkey::KeyPair;
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use io::IoChannel;
|
use io::IoChannel;
|
||||||
use client::{BlockChainClient, Client, ClientConfig, BlockId, ChainInfo, BlockInfo, PrepareOpenBlock, ImportSealedBlock, ImportBlock};
|
use tempdir::TempDir;
|
||||||
use state::{self, State, CleanupMode};
|
use types::transaction::{PendingTransaction, Transaction, Action, Condition};
|
||||||
use executive::{Executive, TransactOptions};
|
use types::filter::Filter;
|
||||||
use ethereum;
|
use types::view;
|
||||||
|
use types::views::BlockView;
|
||||||
|
|
||||||
use block::IsBlock;
|
use block::IsBlock;
|
||||||
|
use client::{BlockChainClient, Client, ClientConfig, BlockId, ChainInfo, BlockInfo, PrepareOpenBlock, ImportSealedBlock, ImportBlock};
|
||||||
|
use ethereum;
|
||||||
|
use executive::{Executive, TransactOptions};
|
||||||
|
use miner::{Miner, PendingOrdering, MinerService};
|
||||||
|
use spec::Spec;
|
||||||
|
use state::{self, State, CleanupMode};
|
||||||
use test_helpers::{
|
use test_helpers::{
|
||||||
|
self,
|
||||||
generate_dummy_client, push_blocks_to_client, get_test_client_with_blocks, get_good_dummy_block_seq,
|
generate_dummy_client, push_blocks_to_client, get_test_client_with_blocks, get_good_dummy_block_seq,
|
||||||
generate_dummy_client_with_data, get_good_dummy_block, get_bad_state_dummy_block
|
generate_dummy_client_with_data, get_good_dummy_block, get_bad_state_dummy_block
|
||||||
};
|
};
|
||||||
use types::filter::Filter;
|
|
||||||
use ethereum_types::{U256, Address};
|
|
||||||
use miner::{Miner, PendingOrdering};
|
|
||||||
use spec::Spec;
|
|
||||||
use views::BlockView;
|
|
||||||
use ethkey::KeyPair;
|
|
||||||
use transaction::{PendingTransaction, Transaction, Action, Condition};
|
|
||||||
use miner::MinerService;
|
|
||||||
use tempdir::TempDir;
|
|
||||||
use test_helpers;
|
|
||||||
use verification::queue::kind::blocks::Unverified;
|
use verification::queue::kind::blocks::Unverified;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -24,7 +24,7 @@ use executive::Executive;
|
|||||||
use state::Substate;
|
use state::Substate;
|
||||||
use test_helpers::get_temp_state_with_factory;
|
use test_helpers::get_temp_state_with_factory;
|
||||||
use trace::{NoopVMTracer, NoopTracer};
|
use trace::{NoopVMTracer, NoopTracer};
|
||||||
use transaction::SYSTEM_ADDRESS;
|
use types::transaction::SYSTEM_ADDRESS;
|
||||||
|
|
||||||
use rustc_hex::FromHex;
|
use rustc_hex::FromHex;
|
||||||
|
|
||||||
|
@ -15,5 +15,6 @@
|
|||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
mod client;
|
mod client;
|
||||||
|
mod blockchain;
|
||||||
mod evm;
|
mod evm;
|
||||||
mod trace;
|
mod trace;
|
||||||
|
@ -26,14 +26,15 @@ use client::*;
|
|||||||
use test_helpers::get_temp_state_db;
|
use test_helpers::get_temp_state_db;
|
||||||
use client::{BlockChainClient, Client, ClientConfig};
|
use client::{BlockChainClient, Client, ClientConfig};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use header::Header;
|
|
||||||
use miner::Miner;
|
use miner::Miner;
|
||||||
use transaction::{Action, Transaction};
|
use types::transaction::{Action, Transaction};
|
||||||
use views::BlockView;
|
|
||||||
use trace::{RewardType, LocalizedTrace};
|
use trace::{RewardType, LocalizedTrace};
|
||||||
use trace::trace::Action::Reward;
|
use trace::trace::Action::Reward;
|
||||||
use test_helpers;
|
use test_helpers;
|
||||||
use verification::queue::kind::blocks::Unverified;
|
use verification::queue::kind::blocks::Unverified;
|
||||||
|
use types::header::Header;
|
||||||
|
use types::view;
|
||||||
|
use types::views::BlockView;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_trace_block_and_uncle_reward() {
|
fn can_trace_block_and_uncle_reward() {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user