From 6a44a0cf95928087a45d73c1f1b47d787829b7a4 Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Mon, 10 Apr 2017 13:35:57 +0200 Subject: [PATCH] [beta] Backports (#5434) * v1.6.6 * Strict validation transitions (#4988) * ability to make validation stricter * fix consensus * remove logger * Fix eth_sign showing as wallet account (#5309) * defaultProps for account * Pass signing account * Update tests for Connect(...) * Add new seed nodes (#5345) * Kovan warp sync fixed --- Cargo.lock | 79 ++++++++++++------- Cargo.toml | 2 +- ethcore/res/ethereum/classic.json | 4 +- ethcore/res/ethereum/kovan.json | 2 +- ethcore/src/block.rs | 10 +++ ethcore/src/client/client.rs | 8 +- ethcore/src/engines/authority_round.rs | 9 ++- ethcore/src/spec/spec.rs | 4 +- ethcore/src/state/mod.rs | 2 +- ethcore/src/verification/canon_verifier.rs | 4 +- ethcore/src/verification/noop_verifier.rs | 2 +- ethcore/src/verification/verification.rs | 4 +- ethcore/src/verification/verifier.rs | 2 +- .../RequestPending/requestPending.spec.js | 2 +- .../components/SignRequest/signRequest.js | 25 +++++- .../SignRequest/signRequest.spec.js | 52 ++++++++++-- .../transactionPendingForm.js | 3 +- json/src/spec/params.rs | 4 +- mac/Parity.pkgproj | 2 +- mac/Parity/Info.plist | 2 +- nsis/installer.nsi | 2 +- sync/Cargo.toml | 3 +- sync/src/blocks.rs | 30 ++++--- sync/src/chain.rs | 8 +- sync/src/lib.rs | 1 + util/Cargo.toml | 2 +- 26 files changed, 189 insertions(+), 79 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c79516b54..ac0aeea6b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ [root] name = "parity" -version = "1.6.5" +version = "1.6.6" dependencies = [ "ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "app_dirs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -23,7 +23,7 @@ dependencies = [ "ethcore-secretstore 1.0.0", "ethcore-signer 1.6.0", "ethcore-stratum 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "ethsync 1.6.0", "evmbin 0.1.0", "fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -394,7 +394,7 @@ dependencies = [ "ethcore-ipc-codegen 1.6.0", "ethcore-ipc-nano 1.6.0", "ethcore-stratum 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "ethjson 0.1.0", "ethkey 0.2.0", "ethstore 0.1.0", @@ -444,7 +444,7 @@ dependencies = [ "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-devtools 1.6.0", "ethcore-rpc 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "fetch 0.1.0", "futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)", @@ -492,7 +492,7 @@ name = "ethcore-ipc" version = "1.6.0" dependencies = [ "ethcore-devtools 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git?branch=parity-1.7)", "semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -539,7 +539,7 @@ dependencies = [ "ethcore-ipc 1.6.0", "ethcore-ipc-codegen 1.6.0", "ethcore-ipc-nano 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "nanomsg 0.5.1 (git+https://github.com/ethcore/nanomsg.rs.git?branch=parity-1.7)", "semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -554,13 +554,13 @@ dependencies = [ "ethcore-ipc 1.6.0", "ethcore-ipc-codegen 1.6.0", "ethcore-network 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.1.0", - "smallvec 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "stats 0.1.0", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -570,7 +570,7 @@ name = "ethcore-logger" version = "1.6.0" dependencies = [ "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "isatty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -586,7 +586,7 @@ dependencies = [ "bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-devtools 1.6.0", "ethcore-io 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "ethcrypto 0.1.0", "ethkey 0.2.0", "igd 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -614,7 +614,7 @@ dependencies = [ "ethcore-io 1.6.0", "ethcore-ipc 1.6.0", "ethcore-light 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "ethcrypto 0.1.0", "ethjson 0.1.0", "ethkey 0.2.0", @@ -649,7 +649,7 @@ dependencies = [ "ethcore-ipc 1.6.0", "ethcore-ipc-codegen 1.6.0", "ethcore-ipc-nano 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "ethcrypto 0.1.0", "ethkey 0.2.0", "hyper 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -667,7 +667,7 @@ dependencies = [ "ethcore-devtools 1.6.0", "ethcore-io 1.6.0", "ethcore-rpc 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-dapps-glue 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -686,7 +686,7 @@ dependencies = [ "ethcore-ipc 1.6.0", "ethcore-ipc-codegen 1.6.0", "ethcore-ipc-nano 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", "jsonrpc-macros 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", @@ -700,7 +700,7 @@ dependencies = [ [[package]] name = "ethcore-util" -version = "1.6.5" +version = "1.6.6" dependencies = [ "ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", @@ -749,7 +749,7 @@ dependencies = [ name = "ethjson" version = "0.1.0" dependencies = [ - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -777,7 +777,7 @@ version = "0.1.0" dependencies = [ "docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-devtools 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "ethcrypto 0.1.0", "ethkey 0.2.0", "itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -791,7 +791,7 @@ dependencies = [ "serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -810,14 +810,15 @@ dependencies = [ "ethcore-ipc-nano 1.6.0", "ethcore-light 1.6.0", "ethcore-network 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "ethkey 0.2.0", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.1.0", - "semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -827,7 +828,7 @@ version = "0.1.0" dependencies = [ "docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1055,7 +1056,7 @@ version = "1.6.0" dependencies = [ "ethcore-ipc 1.6.0", "ethcore-ipc-codegen 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1622,7 +1623,7 @@ name = "parity-hash-fetch" version = "1.6.0" dependencies = [ "ethabi 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "fetch 0.1.0", "futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1639,7 +1640,7 @@ version = "1.6.0" dependencies = [ "cid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "hyper 0.10.0-a.0 (git+https://github.com/ethcore/hyper)", "jsonrpc-http-server 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", "mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1653,7 +1654,7 @@ version = "0.1.0" dependencies = [ "ethcore 1.6.0", "ethcore-io 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "ethkey 0.2.0", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.1.0", @@ -1676,7 +1677,7 @@ version = "1.4.0" dependencies = [ "ethcore-rpc 1.6.0", "ethcore-signer 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 6.0.0 (git+https://github.com/ethcore/jsonrpc.git)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1720,7 +1721,7 @@ dependencies = [ "ethcore 1.6.0", "ethcore-ipc 1.6.0", "ethcore-ipc-codegen 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "ethsync 1.6.0", "ipc-common-types 1.6.0", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1997,7 +1998,7 @@ version = "1.4.0" dependencies = [ "ethcore-bigint 0.1.2", "ethcore-rpc 1.6.0", - "ethcore-util 1.6.5", + "ethcore-util 1.6.6", "futures 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "parity-rpc-client 1.4.0", "rpassword 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2097,6 +2098,14 @@ dependencies = [ "semver-parser 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "semver" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "semver-parser" version = "0.6.1" @@ -2106,6 +2115,11 @@ dependencies = [ "regex 0.1.68 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "serde" version = "0.9.6" @@ -2209,8 +2223,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "smallvec" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "solicit" @@ -2743,7 +2760,9 @@ dependencies = [ "checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" "checksum semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2d5b7638a1f03815d94e88cb3b3c08e87f0db4d683ef499d1836aaf70a45623f" "checksum semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae2ff60ecdb19c255841c066cbfa5f8c2a4ada1eb3ae47c77ab6667128da71f5" +"checksum semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537" "checksum semver-parser 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e88e43a5a74dd2a11707f9c21dfd4a423c66bd871df813227bb0a3e78f3a1ae9" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum serde 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0ae9a3c8b07c09dbe43022486d55a18c629a0618d2241e49829aaef9b6d862f9" "checksum serde_codegen_internals 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c3172bf2940b975c0e4f6ab42a511c0a4407d4f46ccef87a9d3615db5c26fa96" "checksum serde_derive 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ecc6e0379ca933ece58302d2d3034443f06fbf38fd535857c1dc516195cbc3bf" @@ -2758,7 +2777,7 @@ dependencies = [ "checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23" "checksum smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "fcc8d19212aacecf95e4a7a2179b26f7aeb9732a915cf01f05b0d3e044865410" "checksum smallvec 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c8cbcd6df1e117c2210e13ab5109635ad68a929fcbb8964dc965b76cb5ee013" -"checksum smallvec 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a3c84984c278afe61a46e19868e8b23e2ee3be5b3cc6dea6edad4893bc6c841" +"checksum smallvec 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dca03f2f42500a9ef8ac0d16183dff8bed40e3dcf98f9d4147928548d5c4236e" "checksum solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "172382bac9424588d7840732b250faeeef88942e37b6e35317dce98cafdd75b2" "checksum spmc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "93bdab61c1a413e591c4d17388ffa859eaff2df27f1e13a5ec8b716700605adf" "checksum stable-heap 0.1.0 (git+https://github.com/carllerche/stable-heap?rev=3c5cd1ca47)" = "" diff --git a/Cargo.toml b/Cargo.toml index 1dbcba4d5..ef73d6a8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "Parity Ethereum client" name = "parity" -version = "1.6.5" +version = "1.6.6" license = "GPL-3.0" authors = ["Parity Technologies "] diff --git a/ethcore/res/ethereum/classic.json b/ethcore/res/ethereum/classic.json index 33c954f2c..f6d30c4d6 100644 --- a/ethcore/res/ethereum/classic.json +++ b/ethcore/res/ethereum/classic.json @@ -53,7 +53,9 @@ "enode://5fbfb426fbb46f8b8c1bd3dd140f5b511da558cd37d60844b525909ab82e13a25ee722293c829e52cb65c2305b1637fa9a2ea4d6634a224d5f400bfe244ac0de@162.243.55.45:30303", "enode://42d8f29d1db5f4b2947cd5c3d76c6d0d3697e6b9b3430c3d41e46b4bb77655433aeedc25d4b4ea9d8214b6a43008ba67199374a9b53633301bca0cd20c6928ab@104.155.176.151:30303", "enode://814920f1ec9510aa9ea1c8f79d8b6e6a462045f09caa2ae4055b0f34f7416fca6facd3dd45f1cf1673c0209e0503f02776b8ff94020e98b6679a0dc561b4eba0@104.154.136.117:30303", - "enode://72e445f4e89c0f476d404bc40478b0df83a5b500d2d2e850e08eb1af0cd464ab86db6160d0fde64bd77d5f0d33507ae19035671b3c74fec126d6e28787669740@104.198.71.200:30303" + "enode://72e445f4e89c0f476d404bc40478b0df83a5b500d2d2e850e08eb1af0cd464ab86db6160d0fde64bd77d5f0d33507ae19035671b3c74fec126d6e28787669740@104.198.71.200:30303", + "enode://39abab9d2a41f53298c0c9dc6bbca57b0840c3ba9dccf42aa27316addc1b7e56ade32a0a9f7f52d6c5db4fe74d8824bcedfeaecf1a4e533cacb71cf8100a9442@144.76.238.49:30303", + "enode://f50e675a34f471af2438b921914b5f06499c7438f3146f6b8936f1faeb50b8a91d0d0c24fb05a66f05865cd58c24da3e664d0def806172ddd0d4c5bdbf37747e@144.76.238.49:30306" ], "accounts": { "0000000000000000000000000000000000000001": { "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } }, diff --git a/ethcore/res/ethereum/kovan.json b/ethcore/res/ethereum/kovan.json index 715fc75c7..01ea9956a 100644 --- a/ethcore/res/ethereum/kovan.json +++ b/ethcore/res/ethereum/kovan.json @@ -33,7 +33,7 @@ "maximumExtraDataSize": "0x20", "minGasLimit": "0x1388", "networkID" : "0x2A", - "validateReceipts" : false + "validateReceiptsTransition" : 1000000 }, "genesis": { "seal": { diff --git a/ethcore/src/block.rs b/ethcore/src/block.rs index fe31a8b7d..e1d0a1a89 100644 --- a/ethcore/src/block.rs +++ b/ethcore/src/block.rs @@ -493,6 +493,16 @@ impl LockedBlock { _ => Ok(SealedBlock { block: s.block, uncle_bytes: s.uncle_bytes }), } } + + /// Remove state root from transaction receipts to make them EIP-98 compatible. + pub fn strip_receipts(self) -> LockedBlock { + let mut block = self; + for receipt in &mut block.block.receipts { + receipt.state_root = None; + } + block.block.header.set_receipts_root(ordered_trie_root(block.block.receipts.iter().map(|r| r.rlp_bytes().to_vec()))); + block + } } impl Drain for LockedBlock { diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index ba36e176f..c0d65dd46 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -375,12 +375,16 @@ impl Client { let db = self.state_db.lock().boxed_clone_canon(header.parent_hash()); let enact_result = enact_verified(block, engine, self.tracedb.read().tracing_enabled(), db, &parent, last_hashes, self.factories.clone()); - let locked_block = enact_result.map_err(|e| { + let mut locked_block = enact_result.map_err(|e| { warn!(target: "client", "Block import failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e); })?; + if header.number() < self.engine().params().validate_receipts_transition && header.receipts_root() != locked_block.block().header().receipts_root() { + locked_block = locked_block.strip_receipts(); + } + // Final Verification - if let Err(e) = self.verifier.verify_block_final(header, locked_block.block().header(), self.engine().params().validate_receipts) { + if let Err(e) = self.verifier.verify_block_final(header, locked_block.block().header()) { warn!(target: "client", "Stage 4 block verification failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e); return Err(()); } diff --git a/ethcore/src/engines/authority_round.rs b/ethcore/src/engines/authority_round.rs index a4dc34ac1..a8b29cf41 100644 --- a/ethcore/src/engines/authority_round.rs +++ b/ethcore/src/engines/authority_round.rs @@ -305,13 +305,17 @@ impl Engine for AuthorityRound { Err(From::from(BlockError::InvalidSealArity( Mismatch { expected: self.seal_fields(), found: header.seal().len() } ))) + } else if header.number() >= self.validate_score_transition && *header.difficulty() >= U256::from(U128::max_value()) { + Err(From::from(BlockError::DifficultyOutOfBounds( + OutOfBounds { min: None, max: Some(U256::from(U128::max_value())), found: *header.difficulty() } + ))) } else { Ok(()) } } fn verify_block_unordered(&self, _header: &Header, _block: Option<&[u8]>) -> Result<(), Error> { - Ok(()) + Ok(()) } /// Do the validator and gas limit validation. @@ -338,7 +342,8 @@ impl Engine for AuthorityRound { } // Check if parent is from a previous step. - if step == header_step(parent)? { + let parent_step = header_step(parent)?; + if step == parent_step { trace!(target: "engine", "Multiple blocks proposed for step {}.", step); self.validators.report_malicious(header.author()); Err(EngineError::DoubleVote(header.author().clone()))?; diff --git a/ethcore/src/spec/spec.rs b/ethcore/src/spec/spec.rs index 8a1de711b..ec26a45d8 100644 --- a/ethcore/src/spec/spec.rs +++ b/ethcore/src/spec/spec.rs @@ -56,7 +56,7 @@ pub struct CommonParams { /// Number of first block where EIP-98 rules begin. pub eip98_transition: BlockNumber, /// Validate block receipts root. - pub validate_receipts: bool, + pub validate_receipts_transition: u64, } impl From for CommonParams { @@ -70,7 +70,7 @@ impl From for CommonParams { min_gas_limit: p.min_gas_limit.into(), fork_block: if let (Some(n), Some(h)) = (p.fork_block, p.fork_hash) { Some((n.into(), h.into())) } else { None }, eip98_transition: p.eip98_transition.map_or(0, Into::into), - validate_receipts: p.validate_receipts.unwrap_or(true), + validate_receipts_transition: p.validate_receipts_transition.map_or(0, Into::into), } } } diff --git a/ethcore/src/state/mod.rs b/ethcore/src/state/mod.rs index ebac907aa..ced6fd415 100644 --- a/ethcore/src/state/mod.rs +++ b/ethcore/src/state/mod.rs @@ -546,7 +546,7 @@ impl State { // TODO uncomment once to_pod() works correctly. // trace!("Applied transaction. Diff:\n{}\n", state_diff::diff_pod(&old, &self.to_pod())); - let state_root = if env_info.number < engine.params().eip98_transition { + let state_root = if env_info.number < engine.params().eip98_transition || env_info.number < engine.params().validate_receipts_transition { self.commit()?; Some(self.root().clone()) } else { diff --git a/ethcore/src/verification/canon_verifier.rs b/ethcore/src/verification/canon_verifier.rs index 67d7e0e85..849f7caad 100644 --- a/ethcore/src/verification/canon_verifier.rs +++ b/ethcore/src/verification/canon_verifier.rs @@ -31,7 +31,7 @@ impl Verifier for CanonVerifier { verification::verify_block_family(header, bytes, engine, bc) } - fn verify_block_final(&self, expected: &Header, got: &Header, receipts: bool) -> Result<(), Error> { - verification::verify_block_final(expected, got, receipts) + fn verify_block_final(&self, expected: &Header, got: &Header) -> Result<(), Error> { + verification::verify_block_final(expected, got) } } diff --git a/ethcore/src/verification/noop_verifier.rs b/ethcore/src/verification/noop_verifier.rs index b60dbed2e..2fcd877f5 100644 --- a/ethcore/src/verification/noop_verifier.rs +++ b/ethcore/src/verification/noop_verifier.rs @@ -31,7 +31,7 @@ impl Verifier for NoopVerifier { Ok(()) } - fn verify_block_final(&self, _expected: &Header, _got: &Header, _receipts: bool) -> Result<(), Error> { + fn verify_block_final(&self, _expected: &Header, _got: &Header) -> Result<(), Error> { Ok(()) } } diff --git a/ethcore/src/verification/verification.rs b/ethcore/src/verification/verification.rs index c2c932066..34a4ccbd0 100644 --- a/ethcore/src/verification/verification.rs +++ b/ethcore/src/verification/verification.rs @@ -178,7 +178,7 @@ pub fn verify_block_family(header: &Header, bytes: &[u8], engine: &Engine, bc: & } /// Phase 4 verification. Check block information against transaction enactment results, -pub fn verify_block_final(expected: &Header, got: &Header, check_receipts: bool) -> Result<(), Error> { +pub fn verify_block_final(expected: &Header, got: &Header) -> Result<(), Error> { if expected.gas_used() != got.gas_used() { return Err(From::from(BlockError::InvalidGasUsed(Mismatch { expected: expected.gas_used().clone(), found: got.gas_used().clone() }))) } @@ -188,7 +188,7 @@ pub fn verify_block_final(expected: &Header, got: &Header, check_receipts: bool) if expected.state_root() != got.state_root() { return Err(From::from(BlockError::InvalidStateRoot(Mismatch { expected: expected.state_root().clone(), found: got.state_root().clone() }))) } - if check_receipts && expected.receipts_root() != got.receipts_root() { + if expected.receipts_root() != got.receipts_root() { return Err(From::from(BlockError::InvalidReceiptsRoot(Mismatch { expected: expected.receipts_root().clone(), found: got.receipts_root().clone() }))) } Ok(()) diff --git a/ethcore/src/verification/verifier.rs b/ethcore/src/verification/verifier.rs index 9f0173003..e5dabd392 100644 --- a/ethcore/src/verification/verifier.rs +++ b/ethcore/src/verification/verifier.rs @@ -26,5 +26,5 @@ pub trait Verifier: Send + Sync { /// Verify a block relative to its parent and uncles. fn verify_block_family(&self, header: &Header, bytes: &[u8], engine: &Engine, bc: &BlockProvider) -> Result<(), Error>; /// Do a final verification check for an enacted header vs its expected counterpart. - fn verify_block_final(&self, expected: &Header, got: &Header, receipts: bool) -> Result<(), Error>; + fn verify_block_final(&self, expected: &Header, got: &Header) -> Result<(), Error>; } diff --git a/js/src/views/Signer/components/RequestPending/requestPending.spec.js b/js/src/views/Signer/components/RequestPending/requestPending.spec.js index 686c23b67..130a9d319 100644 --- a/js/src/views/Signer/components/RequestPending/requestPending.spec.js +++ b/js/src/views/Signer/components/RequestPending/requestPending.spec.js @@ -92,7 +92,7 @@ describe('views/Signer/RequestPending', () => { }); it('renders SignRequest component', () => { - expect(component.find('SignRequest')).to.have.length(1); + expect(component.find('Connect(SignRequest)')).to.have.length(1); }); }); diff --git a/js/src/views/Signer/components/SignRequest/signRequest.js b/js/src/views/Signer/components/SignRequest/signRequest.js index 373262d41..e638fecde 100644 --- a/js/src/views/Signer/components/SignRequest/signRequest.js +++ b/js/src/views/Signer/components/SignRequest/signRequest.js @@ -14,9 +14,10 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . +import { observer } from 'mobx-react'; import React, { Component, PropTypes } from 'react'; import { FormattedMessage } from 'react-intl'; -import { observer } from 'mobx-react'; +import { connect } from 'react-redux'; import Account from '../Account'; import TransactionPendingForm from '../TransactionPendingForm'; @@ -36,12 +37,13 @@ function isAscii (data) { } @observer -export default class SignRequest extends Component { +class SignRequest extends Component { static contextTypes = { api: PropTypes.object }; static propTypes = { + accounts: PropTypes.object.isRequired, address: PropTypes.string.isRequired, data: PropTypes.string.isRequired, id: PropTypes.object.isRequired, @@ -152,7 +154,10 @@ export default class SignRequest extends Component { } renderActions () { - const { address, focus, isFinished, status } = this.props; + const { accounts, address, focus, isFinished, status } = this.props; + const account = Object + .values(accounts) + .find((account) => address === account.address.toLowerCase()); if (isFinished) { if (status === 'confirmed') { @@ -182,6 +187,7 @@ export default class SignRequest extends Component { return ( { + return { + personal: { + accounts: {} + } + }; + } + }; +} + +function render () { + reduxStore = createReduxStore(); + signerStore = createSignerStore(); + + component = shallow( + , + { + context: { + store: reduxStore + } + } + ).find('SignRequest').shallow(); + + return component; +} describe('views/Signer/components/SignRequest', () => { + beforeEach(() => { + render(); + }); + it('renders', () => { - expect(shallow( - , - )).to.be.ok; + expect(component).to.be.ok; }); }); diff --git a/js/src/views/Signer/components/TransactionPendingForm/transactionPendingForm.js b/js/src/views/Signer/components/TransactionPendingForm/transactionPendingForm.js index 193eab9f4..73e3bb7ef 100644 --- a/js/src/views/Signer/components/TransactionPendingForm/transactionPendingForm.js +++ b/js/src/views/Signer/components/TransactionPendingForm/transactionPendingForm.js @@ -25,7 +25,7 @@ import styles from './transactionPendingForm.css'; export default class TransactionPendingForm extends Component { static propTypes = { - account: PropTypes.object.isRequired, + account: PropTypes.object, address: PropTypes.string.isRequired, disabled: PropTypes.bool, isSending: PropTypes.bool.isRequired, @@ -36,6 +36,7 @@ export default class TransactionPendingForm extends Component { }; static defaultProps = { + account: {}, focus: false }; diff --git a/json/src/spec/params.rs b/json/src/spec/params.rs index 1b2622316..aa2c15da4 100644 --- a/json/src/spec/params.rs +++ b/json/src/spec/params.rs @@ -54,8 +54,8 @@ pub struct Params { #[serde(rename="eip98Transition")] pub eip98_transition: Option, /// See `CommonParams` docs. - #[serde(rename="validateReceipts")] - pub validate_receipts: Option, + #[serde(rename="validateReceiptsTransition")] + pub validate_receipts_transition: Option, } #[cfg(test)] diff --git a/mac/Parity.pkgproj b/mac/Parity.pkgproj index deedb7187..ba0e46f0e 100755 --- a/mac/Parity.pkgproj +++ b/mac/Parity.pkgproj @@ -462,7 +462,7 @@ OVERWRITE_PERMISSIONS VERSION - 1.6.5 + 1.6.6 UUID 2DCD5B81-7BAF-4DA1-9251-6274B089FD36 diff --git a/mac/Parity/Info.plist b/mac/Parity/Info.plist index 56e623905..a0e9d15c7 100644 --- a/mac/Parity/Info.plist +++ b/mac/Parity/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.6.5 + 1.6.6 CFBundleVersion 1 LSApplicationCategoryType diff --git a/nsis/installer.nsi b/nsis/installer.nsi index 75dd73dac..7b7bb03f6 100644 --- a/nsis/installer.nsi +++ b/nsis/installer.nsi @@ -10,7 +10,7 @@ !define DESCRIPTION "Fast, light, robust Ethereum implementation" !define VERSIONMAJOR 1 !define VERSIONMINOR 6 -!define VERSIONBUILD 5 +!define VERSIONBUILD 6 !define ARGS "--warp" !define FIRST_START_ARGS "ui --warp --mode=passive" diff --git a/sync/Cargo.toml b/sync/Cargo.toml index 5fa635760..8ee8a1066 100644 --- a/sync/Cargo.toml +++ b/sync/Cargo.toml @@ -25,7 +25,8 @@ time = "0.1.34" rand = "0.3.13" heapsize = "0.3" ethcore-ipc = { path = "../ipc/rpc" } -semver = "0.5" +semver = "0.6" +smallvec = { version = "0.3", features = ["heapsizeof"] } ethcore-ipc-nano = { path = "../ipc/nano" } ethcore-devtools = { path = "../devtools" } ethkey = { path = "../ethkey" } diff --git a/sync/src/blocks.rs b/sync/src/blocks.rs index d7b0062da..b1daf11e8 100644 --- a/sync/src/blocks.rs +++ b/sync/src/blocks.rs @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . +use std::collections::hash_map::Entry; +use smallvec::SmallVec; use util::*; use rlp::*; use network::NetworkError; @@ -21,6 +23,8 @@ use ethcore::header::Header as BlockHeader; known_heap_size!(0, HeaderId); +type SmallHashVec = SmallVec<[H256; 1]>; + /// Block data with optional body. struct SyncBlock { header: Bytes, @@ -64,8 +68,8 @@ pub struct BlockCollection { parents: HashMap, /// Used to map body to header. header_ids: HashMap, - /// Used to map receipts root to header. - receipt_ids: HashMap, + /// Used to map receipts root to headers. + receipt_ids: HashMap, /// First block in `blocks`. head: Option, /// Set of block header hashes being downloaded @@ -202,7 +206,7 @@ impl BlockCollection { } } } - for h in self.receipt_ids.values() { + for h in self.receipt_ids.values().flat_map(|hashes| hashes) { if needed_receipts.len() >= count { break; } @@ -366,23 +370,26 @@ impl BlockCollection { let receipts = UntrustedRlp::new(&r); ordered_trie_root(receipts.iter().map(|r| r.as_raw().to_vec())) //TODO: get rid of vectors here }; - match self.receipt_ids.get(&receipt_root).cloned() { - Some(h) => { - self.receipt_ids.remove(&receipt_root); + match self.receipt_ids.entry(receipt_root) { + Entry::Occupied(mut entry) => { + let h = entry.get_mut().pop().expect("Empty vectors are not allowed in insert_receipt; qed"); + if entry.get().is_empty() { + entry.remove(); + } self.downloading_receipts.remove(&h); match self.blocks.get_mut(&h) { Some(ref mut block) => { trace!(target: "sync", "Got receipt {}", h); - block.receipts = Some(r); + block.receipts = Some(r.clone()); Ok(()) }, None => { - warn!("Got receipt with no header {}", h); + debug!("Got receipt with no header {}", h); Err(NetworkError::BadProtocol) } } } - None => { + _ => { trace!(target: "sync", "Ignored unknown/stale block receipt {:?}", receipt_root); Err(NetworkError::BadProtocol) } @@ -429,10 +436,7 @@ impl BlockCollection { let receipts_stream = RlpStream::new_list(0); block.receipts = Some(receipts_stream.out()); } else { - if self.receipt_ids.contains_key(&receipt_root) { - warn!(target: "sync", "Duplicate receipt root {:?}, block: {:?}", receipt_root, hash); - } - self.receipt_ids.insert(receipt_root, hash.clone()); + self.receipt_ids.entry(receipt_root).or_insert_with(|| SmallHashVec::new()).push(hash.clone()); } } diff --git a/sync/src/chain.rs b/sync/src/chain.rs index 714b50dc3..6aca99fc5 100644 --- a/sync/src/chain.rs +++ b/sync/src/chain.rs @@ -379,6 +379,8 @@ pub struct ChainSync { transactions_stats: TransactionsStats, /// Enable ancient block downloading download_old_blocks: bool, + /// Enable warp sync. + enable_warp_sync: bool, } type RlpResponseResult = Result, PacketDecodeError>; @@ -403,6 +405,7 @@ impl ChainSync { snapshot: Snapshot::new(), sync_start_time: None, transactions_stats: TransactionsStats::default(), + enable_warp_sync: config.warp_sync, }; sync.update_targets(chain); sync @@ -501,7 +504,10 @@ impl ChainSync { } fn maybe_start_snapshot_sync(&mut self, io: &mut SyncIo) { - if self.state != SyncState::WaitingPeers { + if !self.enable_warp_sync { + return; + } + if self.state != SyncState::WaitingPeers && self.state != SyncState::Blocks && self.state != SyncState::Waiting { return; } // Make sure the snapshot block is not too far away from best block and network best block and diff --git a/sync/src/lib.rs b/sync/src/lib.rs index 6cd4fade5..b51c157be 100644 --- a/sync/src/lib.rs +++ b/sync/src/lib.rs @@ -35,6 +35,7 @@ extern crate time; extern crate rand; extern crate semver; extern crate parking_lot; +extern crate smallvec; extern crate rlp; extern crate ethcore_light as light; diff --git a/util/Cargo.toml b/util/Cargo.toml index 17b762305..9e09b0c3f 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -3,7 +3,7 @@ description = "Ethcore utility library" homepage = "http://parity.io" license = "GPL-3.0" name = "ethcore-util" -version = "1.6.5" +version = "1.6.6" authors = ["Parity Technologies "] build = "build.rs"