From 10657d96c4c4b35ee0d986e5c618bb35b0353b50 Mon Sep 17 00:00:00 2001 From: Afri Schoedon <5chdn@users.noreply.github.com> Date: Tue, 15 Jan 2019 23:05:56 +0100 Subject: [PATCH] backports for 2.3.0 beta (#10164) * version: mark 2.3 track beta * version: mark update critical on all networks * Ping nodes from discovery (#10167) * Fix _cannot recursively call into `Core`_ issue (#10144) * Change igd to github:maufl/rust-igd * Run `igd::search_gateway_from_timeout` from own thread * Handle the case for contract creation on an empty but exist account with storage items (#10065) * Add is_base_storage_root_unchanged * Fix compile, use a shortcut for check, and remove ignored tests * Add a warn! * Update ethereum/tests to v6.0.0-beta.2 * grumble: use {:#x} instead of 0x{:x} Co-Authored-By: sorpaas * version: bump fork blocks for kovan and foundation (#10186) * pull constantinople on ethereum network (#10189) * ethcore: pull constantinople on ethereum network * version: mark update as critical * ethcore: remove constantinople alltogether from chain spec * version: revert fork block for ethereum --- Cargo.lock | 65 +++++++------ ethcore/res/ethereum/foundation.json | 12 +-- ethcore/res/ethereum/tests | 2 +- .../res/ethereum/tests-issues/currents.json | 44 +-------- ethcore/src/externalities.rs | 7 +- ethcore/src/state/account.rs | 5 + ethcore/src/state/mod.rs | 7 ++ util/network-devp2p/src/discovery.rs | 93 +++++++++++++++---- util/network-devp2p/src/ip_utils.rs | 66 +++++++------ util/version/Cargo.toml | 6 +- 10 files changed, 169 insertions(+), 138 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 29e0f174bf5..6b4b2f3e7df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -405,7 +405,7 @@ dependencies = [ "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -419,7 +419,7 @@ dependencies = [ "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -432,7 +432,7 @@ dependencies = [ "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -539,7 +539,7 @@ name = "docopt" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", @@ -561,7 +561,7 @@ dependencies = [ "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lunarity-lexer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -715,7 +715,7 @@ dependencies = [ "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-rocksdb 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "len-caching-lock 0.1.1", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -864,7 +864,7 @@ dependencies = [ "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1008,7 +1008,7 @@ dependencies = [ "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-rocksdb 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.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)", "parity-crypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1135,7 +1135,7 @@ dependencies = [ "edit-distance 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)", "ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "memzero 0.1.0", "parity-crypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1214,7 +1214,7 @@ dependencies = [ "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)", "keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "memory-cache 0.1.0", "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1353,7 +1353,7 @@ name = "fs-swap" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1455,7 +1455,7 @@ name = "handlebars" version = "0.32.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "pest_derive 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1809,7 +1809,7 @@ dependencies = [ "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "globset 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 9.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-2.2)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1912,11 +1912,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lazy_static" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "lazycell" @@ -2249,7 +2246,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2365,7 +2362,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2666,7 +2663,7 @@ dependencies = [ "ethcore-sync 1.12.0", "ethereum-types 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2734,7 +2731,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3131,7 +3128,7 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3218,11 +3215,11 @@ dependencies = [ [[package]] name = "ring" -version = "0.13.2" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3253,7 +3250,7 @@ name = "rlp_compress" version = "0.1.0" dependencies = [ "elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3330,7 +3327,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", "sct 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "webpki 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3369,7 +3366,7 @@ name = "sct" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ring 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3652,7 +3649,7 @@ name = "thread_local" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3794,7 +3791,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4109,7 +4106,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4123,7 +4120,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "if_chain 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4231,7 +4228,7 @@ name = "webpki" version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ring 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4486,7 +4483,7 @@ dependencies = [ "checksum kvdb-memorydb 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45bcdf5eb083602cff61a6f8438dce2a7900d714e893fc48781c39fb119d37aa" "checksum kvdb-rocksdb 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "06cf755dc587839ba34d3cbe3f12b6ad55850fbcdfe67336157a021a1a5c43ae" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" -"checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7" +"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" "checksum lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddba4c30a78328befecec92fc94970e53b3ae385827d28620f0f5bb2493081e0" "checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" "checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2" @@ -4589,7 +4586,7 @@ dependencies = [ "checksum regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d" "checksum relay 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1576e382688d7e9deecea24417e350d3062d97e32e45d70b1cde65994ff1489a" "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" -"checksum ring 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe642b9dd1ba0038d78c4a3999d1ee56178b4d415c1e1fbaba83b06dce012f0" +"checksum ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a" "checksum rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "524c5ad554859785dfc8469df3ed5e0b5784d4d335877ed47c8d90fc0eb238fe" "checksum rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16d1effe9845d54f90e7be8420ee49e5c94623140b97ee4bc6fb5bfddb745720" "checksum rpassword 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b273c91bd242ca03ad6d71c143b6f17a48790e61f21a6c78568fa2b6774a24a4" diff --git a/ethcore/res/ethereum/foundation.json b/ethcore/res/ethereum/foundation.json index 2522a09ae25..69f150fad61 100644 --- a/ethcore/res/ethereum/foundation.json +++ b/ethcore/res/ethereum/foundation.json @@ -9,8 +9,7 @@ "durationLimit": "0xd", "blockReward": { "0x0": "0x4563918244f40000", - "0x42ae50": "0x29a2241af62c0000", - "0x6c0840": "0x1bc16d674ec80000" + "0x42ae50": "0x29a2241af62c0000" }, "homesteadTransition": "0x118c30", "daoHardforkTransition": "0x1d4c00", @@ -135,8 +134,7 @@ ], "eip100bTransition": "0x42ae50", "difficultyBombDelays": { - "0x42ae50": "0x2dc6c0", - "0x6c0840": "0x1e8480" + "0x42ae50": "0x2dc6c0" } } } @@ -160,11 +158,7 @@ "eip140Transition": "0x42ae50", "eip211Transition": "0x42ae50", "eip214Transition": "0x42ae50", - "eip658Transition": "0x42ae50", - "eip145Transition": "0x6c0840", - "eip1014Transition": "0x6c0840", - "eip1052Transition": "0x6c0840", - "eip1283Transition": "0x6c0840" + "eip658Transition": "0x42ae50" }, "genesis": { "seal": { diff --git a/ethcore/res/ethereum/tests b/ethcore/res/ethereum/tests index 2cd62aeec11..420f443477c 160000 --- a/ethcore/res/ethereum/tests +++ b/ethcore/res/ethereum/tests @@ -1 +1 @@ -Subproject commit 2cd62aeec11da29766b30d500f2b9a96f1f28cf0 +Subproject commit 420f443477caa8516f1f9ee8122fafc3415c0f34 diff --git a/ethcore/res/ethereum/tests-issues/currents.json b/ethcore/res/ethereum/tests-issues/currents.json index 2ece034d098..d4d3f5e3aae 100644 --- a/ethcore/res/ethereum/tests-issues/currents.json +++ b/ethcore/res/ethereum/tests-issues/currents.json @@ -1,42 +1,4 @@ -{ "block": - [ - { - "reference": "None", - "comment": "This failing test is deemed skippable. Could not happen on a mainnet.", - "failing": "GeneralStateTest_stCreate2", - "subtests": ["RevertInCreateInInitCreate2_d0g0v0_Constantinople"] - }, - { - "reference": "None", - "comment": "This failing test is deemed skippable. Could not happen on a mainnet.", - "failing": "GeneralStateTest_stRevertTest", - "subtests": ["RevertInCreateInInit_d0g0v0_Constantinople"] - } - ], - "state": - [ - { - "reference": "None", - "comment": "This failing test is deemed skippable. Could not happen on a mainnet.", - "failing": "stCreate2Test", - "subtests": { - "RevertInCreateInInitCreate2": { - "subnumbers": ["1"], - "chain": "Constantinople (test)" - } - } - }, - { - "reference": "None", - "comment": "This failing test is deemed skippable. Could not happen on a mainnet.", - "failing": "stRevertTest", - "subtests": { - "RevertInCreateInInit": { - "subnumbers": ["1"], - "chain": "Constantinople (test)" - } - } - } - - ] +{ + "block": [], + "state": [] } diff --git a/ethcore/src/externalities.rs b/ethcore/src/externalities.rs index 0cda8ac875a..a2f35b6ded8 100644 --- a/ethcore/src/externalities.rs +++ b/ethcore/src/externalities.rs @@ -116,7 +116,12 @@ impl<'a, T: 'a, V: 'a, B: 'a> Ext for Externalities<'a, T, V, B> where T: Tracer, V: VMTracer, B: StateBackend { fn initial_storage_at(&self, key: &H256) -> vm::Result { - self.state.checkpoint_storage_at(0, &self.origin_info.address, key).map(|v| v.unwrap_or(H256::zero())).map_err(Into::into) + if self.state.is_base_storage_root_unchanged(&self.origin_info.address)? { + self.state.checkpoint_storage_at(0, &self.origin_info.address, key).map(|v| v.unwrap_or(H256::zero())).map_err(Into::into) + } else { + warn!(target: "externalities", "Detected existing account {:#x} where a forced contract creation happened.", self.origin_info.address); + Ok(H256::zero()) + } } fn storage_at(&self, key: &H256) -> vm::Result { diff --git a/ethcore/src/state/account.rs b/ethcore/src/state/account.rs index d4a42dd31a1..e4553b906f3 100644 --- a/ethcore/src/state/account.rs +++ b/ethcore/src/state/account.rs @@ -451,6 +451,11 @@ impl Account { } } + /// Whether the base storage root of this account is unchanged. + pub fn is_base_storage_root_unchanged(&self) -> bool { + self.original_storage_cache.is_none() + } + /// Storage root where the account changes are based upon. pub fn base_storage_root(&self) -> H256 { self.storage_root diff --git a/ethcore/src/state/mod.rs b/ethcore/src/state/mod.rs index 8a46c7e1d17..2939c972971 100644 --- a/ethcore/src/state/mod.rs +++ b/ethcore/src/state/mod.rs @@ -539,6 +539,13 @@ impl State { |a| a.as_ref().map_or(self.account_start_nonce, |account| *account.nonce())) } + /// Whether the base storage root of an account remains unchanged. + pub fn is_base_storage_root_unchanged(&self, a: &Address) -> TrieResult { + Ok(self.ensure_cached(a, RequireCache::None, true, + |a| a.as_ref().map(|account| account.is_base_storage_root_unchanged()))? + .unwrap_or(true)) + } + /// Get the storage root of account `a`. pub fn storage_root(&self, a: &Address) -> TrieResult> { self.ensure_cached(a, RequireCache::None, true, diff --git a/util/network-devp2p/src/discovery.rs b/util/network-devp2p/src/discovery.rs index 980531ba2f1..f6eaf494b99 100644 --- a/util/network-devp2p/src/discovery.rs +++ b/util/network-devp2p/src/discovery.rs @@ -53,12 +53,15 @@ const REQUEST_BACKOFF: [Duration; 4] = [ Duration::from_secs(64) ]; +const NODE_LAST_SEEN_TIMEOUT: Duration = Duration::from_secs(24*60*60); + #[derive(Clone, Debug)] pub struct NodeEntry { pub id: NodeId, pub endpoint: NodeEndpoint, } +#[derive(Debug)] pub struct BucketEntry { pub address: NodeEntry, pub id_hash: H256, @@ -89,6 +92,12 @@ struct FindNodeRequest { answered: bool, } +#[derive(Clone, Copy)] +enum PingReason { + Default, + FromDiscoveryRequest(NodeId) +} + struct PingRequest { // Time when the request was sent sent_at: Instant, @@ -99,8 +108,10 @@ struct PingRequest { // The hash Parity used to respond with (until rev 01f825b0e1f1c4c420197b51fc801cbe89284b29) #[deprecated()] deprecated_echo_hash: H256, + reason: PingReason } +#[derive(Debug)] pub struct NodeBucket { nodes: VecDeque, //sorted by last active } @@ -178,7 +189,7 @@ impl<'a> Discovery<'a> { if self.node_buckets[dist].nodes.iter().any(|n| n.id_hash == id_hash) { return; } - self.try_ping(e); + self.try_ping(e, PingReason::Default); } } @@ -221,7 +232,7 @@ impl<'a> Discovery<'a> { } else { None } }; if let Some(node) = ping { - self.try_ping(node); + self.try_ping(node, PingReason::Default); } Some(TableUpdates { added: added_map, removed: HashSet::new() }) } @@ -244,7 +255,7 @@ impl<'a> Discovery<'a> { fn update_new_nodes(&mut self) { while self.in_flight_pings.len() < MAX_NODES_PING { match self.adding_nodes.pop() { - Some(next) => self.try_ping(next), + Some(next) => self.try_ping(next, PingReason::Default), None => break, } } @@ -298,7 +309,7 @@ impl<'a> Discovery<'a> { None // a and b are equal, so log distance is -inf } - fn try_ping(&mut self, node: NodeEntry) { + fn try_ping(&mut self, node: NodeEntry, reason: PingReason) { if !self.is_allowed(&node) { trace!(target: "discovery", "Node {:?} not allowed", node); return; @@ -313,7 +324,7 @@ impl<'a> Discovery<'a> { } if self.in_flight_pings.len() < MAX_NODES_PING { - self.ping(&node) + self.ping(&node, reason) .unwrap_or_else(|e| { warn!(target: "discovery", "Error sending Ping packet: {:?}", e); }); @@ -322,7 +333,7 @@ impl<'a> Discovery<'a> { } } - fn ping(&mut self, node: &NodeEntry) -> Result<(), Error> { + fn ping(&mut self, node: &NodeEntry, reason: PingReason) -> Result<(), Error> { let mut rlp = RlpStream::new_list(4); rlp.append(&PROTOCOL_VERSION); self.public_endpoint.to_rlp_list(&mut rlp); @@ -336,6 +347,7 @@ impl<'a> Discovery<'a> { node: node.clone(), echo_hash: hash, deprecated_echo_hash: old_parity_hash, + reason: reason }); trace!(target: "discovery", "Sent Ping to {:?} ; node_id={:#x}", &node.endpoint, node.id); @@ -514,7 +526,7 @@ impl<'a> Discovery<'a> { if request.deprecated_echo_hash == echo_hash { trace!(target: "discovery", "Got Pong from an old parity-ethereum version."); } - Some(request.node.clone()) + Some((request.node.clone(), request.reason.clone())) } }; @@ -528,7 +540,10 @@ impl<'a> Discovery<'a> { }, }; - if let Some(node) = expected_node { + if let Some((node, ping_reason)) = expected_node { + if let PingReason::FromDiscoveryRequest(target) = ping_reason { + self.respond_with_discovery(target, &node)?; + } Ok(self.update_node(node)) } else { debug!(target: "discovery", "Got unexpected Pong from {:?} ; request not found", &from); @@ -536,21 +551,59 @@ impl<'a> Discovery<'a> { } } - fn on_find_node(&mut self, rlp: &Rlp, _node: &NodeId, from: &SocketAddr) -> Result, Error> { + fn on_find_node(&mut self, rlp: &Rlp, node_id: &NodeId, from: &SocketAddr) -> Result, Error> { trace!(target: "discovery", "Got FindNode from {:?}", &from); let target: NodeId = rlp.val_at(0)?; let timestamp: u64 = rlp.val_at(1)?; self.check_timestamp(timestamp)?; + + let node = NodeEntry { + id: node_id.clone(), + endpoint: NodeEndpoint { + address: *from, + udp_port: from.port() + } + }; + + if self.is_a_valid_known_node(&node) { + self.respond_with_discovery(target, &node)?; + } else { + // Make sure the request source is actually there and responds to pings before actually responding + self.try_ping(node, PingReason::FromDiscoveryRequest(target)); + } + Ok(None) + } + + fn is_a_valid_known_node(&self, node: &NodeEntry) -> bool { + let id_hash = keccak(node.id); + let dist = match Discovery::distance(&self.id_hash, &id_hash) { + Some(dist) => dist, + None => { + debug!(target: "discovery", "Got an incoming discovery request from self: {:?}", node); + return false; + } + }; + + let bucket = &self.node_buckets[dist]; + if let Some(known_node) = bucket.nodes.iter().find(|n| n.address.id == node.id) { + debug!(target: "discovery", "Found a known node in a bucket when processing discovery: {:?}/{:?}", known_node, node); + (known_node.address.endpoint == node.endpoint) && (known_node.last_seen.elapsed() < NODE_LAST_SEEN_TIMEOUT) + } else { + false + } + } + + fn respond_with_discovery(&mut self, target: NodeId, node: &NodeEntry) -> Result<(), Error> { let nearest = self.nearest_node_entries(&target); if nearest.is_empty() { - return Ok(None); + return Ok(()); } let mut packets = Discovery::prepare_neighbours_packets(&nearest); for p in packets.drain(..) { - self.send_packet(PACKET_NEIGHBOURS, from, &p)?; + self.send_packet(PACKET_NEIGHBOURS, &node.endpoint.address, &p)?; } - trace!(target: "discovery", "Sent {} Neighbours to {:?}", nearest.len(), &from); - Ok(None) + trace!(target: "discovery", "Sent {} Neighbours to {:?}", nearest.len(), &node.endpoint); + Ok(()) } fn prepare_neighbours_packets(nearest: &[NodeEntry]) -> Vec { @@ -825,7 +878,7 @@ mod tests { } // After 4 discovery rounds, the first one should have learned about the rest. - for _round in 0 .. 4 { + for _round in 0 .. 5 { discovery_handlers[0].round(); let mut continue_loop = true; @@ -833,9 +886,9 @@ mod tests { continue_loop = false; // Process all queued messages. - for i in 0 .. 5 { - let src = discovery_handlers[i].public_endpoint.address.clone(); - while let Some(datagram) = discovery_handlers[i].dequeue_send() { + for i in 0 .. 20 { + let src = discovery_handlers[i%5].public_endpoint.address.clone(); + while let Some(datagram) = discovery_handlers[i%5].dequeue_send() { let dest = discovery_handlers.iter_mut() .find(|disc| datagram.address == disc.public_endpoint.address) .unwrap(); @@ -927,14 +980,14 @@ mod tests { let mut discovery = Discovery { request_backoff: &request_backoff, ..discovery }; for _ in 0..2 { - discovery.ping(&node_entries[101]).unwrap(); + discovery.ping(&node_entries[101], PingReason::Default).unwrap(); let num_nodes = total_bucket_nodes(&discovery.node_buckets); discovery.check_expired(Instant::now() + PING_TIMEOUT); let removed = num_nodes - total_bucket_nodes(&discovery.node_buckets); assert_eq!(removed, 0); } - discovery.ping(&node_entries[101]).unwrap(); + discovery.ping(&node_entries[101], PingReason::Default).unwrap(); let num_nodes = total_bucket_nodes(&discovery.node_buckets); discovery.check_expired(Instant::now() + PING_TIMEOUT); let removed = num_nodes - total_bucket_nodes(&discovery.node_buckets); @@ -1121,7 +1174,7 @@ mod tests { let mut discovery1 = Discovery::new(&key1, ep1.clone(), IpFilter::default()); let mut discovery2 = Discovery::new(&key2, ep2.clone(), IpFilter::default()); - discovery1.ping(&NodeEntry { id: discovery2.id, endpoint: ep2.clone() }).unwrap(); + discovery1.ping(&NodeEntry { id: discovery2.id, endpoint: ep2.clone() }, PingReason::Default).unwrap(); let ping_data = discovery1.dequeue_send().unwrap(); assert!(!discovery1.any_sends_queued()); let data = &ping_data.payload[(32 + 65)..]; diff --git a/util/network-devp2p/src/ip_utils.rs b/util/network-devp2p/src/ip_utils.rs index a0834466a7a..306f283934a 100644 --- a/util/network-devp2p/src/ip_utils.rs +++ b/util/network-devp2p/src/ip_utils.rs @@ -40,7 +40,7 @@ pub trait SocketAddrExt { fn is_documentation_s(&self) -> bool { false } fn is_global_multicast(&self) -> bool { false } fn is_other_multicast(&self) -> bool { false } - + fn is_reserved(&self) -> bool; fn is_usable_public(&self) -> bool; fn is_usable_private(&self) -> bool; @@ -50,38 +50,38 @@ pub trait SocketAddrExt { impl SocketAddrExt for Ipv4Addr { fn is_global_s(&self) -> bool { - !self.is_private() && - !self.is_loopback() && + !self.is_private() && + !self.is_loopback() && !self.is_link_local() && - !self.is_broadcast() && + !self.is_broadcast() && !self.is_documentation() } - // Used for communications between a service provider and its subscribers when using a carrier-grade NAT + // Used for communications between a service provider and its subscribers when using a carrier-grade NAT // see: https://en.wikipedia.org/wiki/Reserved_IP_addresses fn is_shared_space(&self) -> bool { - *self >= Ipv4Addr::new(100, 64, 0, 0) && + *self >= Ipv4Addr::new(100, 64, 0, 0) && *self <= Ipv4Addr::new(100, 127, 255, 255) } // Used for the IANA IPv4 Special Purpose Address Registry // see: https://en.wikipedia.org/wiki/Reserved_IP_addresses fn is_special_purpose(&self) -> bool { - *self >= Ipv4Addr::new(192, 0, 0, 0) && + *self >= Ipv4Addr::new(192, 0, 0, 0) && *self <= Ipv4Addr::new(192, 0, 0, 255) } // Used for testing of inter-network communications between two separate subnets // see: https://en.wikipedia.org/wiki/Reserved_IP_addresses fn is_benchmarking(&self) -> bool { - *self >= Ipv4Addr::new(198, 18, 0, 0) && + *self >= Ipv4Addr::new(198, 18, 0, 0) && *self <= Ipv4Addr::new(198, 19, 255, 255) } // Reserved for future use // see: https://en.wikipedia.org/wiki/Reserved_IP_addresses fn is_future_use(&self) -> bool { - *self >= Ipv4Addr::new(240, 0, 0, 0) && + *self >= Ipv4Addr::new(240, 0, 0, 0) && *self <= Ipv4Addr::new(255, 255, 255, 254) } @@ -102,7 +102,7 @@ impl SocketAddrExt for Ipv4Addr { !self.is_reserved() && !self.is_private() } - + fn is_usable_private(&self) -> bool { self.is_private() } @@ -118,7 +118,7 @@ impl SocketAddrExt for Ipv4Addr { impl SocketAddrExt for Ipv6Addr { fn is_global_s(&self) -> bool { self.is_global_multicast() || - (!self.is_loopback() && + (!self.is_loopback() && !self.is_unique_local_s() && !self.is_unicast_link_local_s() && !self.is_documentation_s() && @@ -134,7 +134,7 @@ impl SocketAddrExt for Ipv6Addr { fn is_unicast_link_local_s(&self) -> bool { (self.segments()[0] & 0xffc0) == 0xfe80 } - + // reserved for documentation (2001:db8::/32). fn is_documentation_s(&self) -> bool { (self.segments()[0] == 0x2001) && (self.segments()[1] == 0xdb8) @@ -160,7 +160,7 @@ impl SocketAddrExt for Ipv6Addr { !self.is_reserved() && !self.is_unique_local_s() } - + fn is_usable_private(&self) -> bool { self.is_unique_local_s() } @@ -194,7 +194,7 @@ impl SocketAddrExt for IpAddr { IpAddr::V6(ref ip) => ip.is_usable_public(), } } - + fn is_usable_private(&self) -> bool { match *self { IpAddr::V4(ref ip) => ip.is_usable_private(), @@ -308,7 +308,15 @@ pub fn select_public_address(port: u16) -> SocketAddr { pub fn map_external_address(local: &NodeEndpoint) -> Option { if let SocketAddr::V4(ref local_addr) = local.address { - match search_gateway_from_timeout(*local_addr.ip(), Duration::new(5, 0)) { + let local_ip = *local_addr.ip(); + let search_gateway_child = ::std::thread::spawn(move || { + search_gateway_from_timeout(local_ip, Duration::new(5, 0)) + }); + let gateway_result = match search_gateway_child.join() { + Err(_) => return None, + Ok(gateway_result) => gateway_result, + }; + match gateway_result { Err(ref err) => debug!("Gateway search error: {}", err), Ok(gateway) => { match gateway.get_external_ip() { @@ -425,32 +433,32 @@ fn ipv4_future_use() { fn ipv4_usable_public() { assert!(!Ipv4Addr::new(0,0,0,0).is_usable_public()); // unspecified assert!(Ipv4Addr::new(0,0,0,1).is_usable_public()); - + assert!(Ipv4Addr::new(9,255,255,255).is_usable_public()); assert!(!Ipv4Addr::new(10,0,0,0).is_usable_public()); // private intra-network assert!(!Ipv4Addr::new(10,255,255,255).is_usable_public()); // private intra-network assert!(Ipv4Addr::new(11,0,0,0).is_usable_public()); - + assert!(Ipv4Addr::new(100, 63, 255, 255).is_usable_public()); - assert!(!Ipv4Addr::new(100, 64, 0, 0).is_usable_public()); // shared space + assert!(!Ipv4Addr::new(100, 64, 0, 0).is_usable_public()); // shared space assert!(!Ipv4Addr::new(100, 127, 255, 255).is_usable_public()); // shared space assert!(Ipv4Addr::new(100, 128, 0, 0).is_usable_public()); - + assert!(Ipv4Addr::new(126,255,255,255).is_usable_public()); assert!(!Ipv4Addr::new(127,0,0,0).is_usable_public()); // loopback assert!(!Ipv4Addr::new(127,255,255,255).is_usable_public()); // loopback assert!(Ipv4Addr::new(128,0,0,0).is_usable_public()); - + assert!(Ipv4Addr::new(169,253,255,255).is_usable_public()); assert!(!Ipv4Addr::new(169,254,0,0).is_usable_public()); // link-local assert!(!Ipv4Addr::new(169,254,255,255).is_usable_public()); // link-local assert!(Ipv4Addr::new(169,255,0,0).is_usable_public()); - + assert!(Ipv4Addr::new(172,15,255,255).is_usable_public()); assert!(!Ipv4Addr::new(172,16,0,0).is_usable_public()); // private intra-network assert!(!Ipv4Addr::new(172,31,255,255).is_usable_public()); // private intra-network assert!(Ipv4Addr::new(172,32,255,255).is_usable_public()); - + assert!(Ipv4Addr::new(191,255,255,255).is_usable_public()); assert!(!Ipv4Addr::new(192,0,0,0).is_usable_public()); // special purpose assert!(!Ipv4Addr::new(192,0,0,255).is_usable_public()); // special purpose @@ -458,19 +466,19 @@ fn ipv4_usable_public() { assert!(Ipv4Addr::new(192,0,1,255).is_usable_public()); assert!(!Ipv4Addr::new(192,0,2,0).is_usable_public()); // documentation - assert!(!Ipv4Addr::new(192,0,2,255).is_usable_public()); // documentation + assert!(!Ipv4Addr::new(192,0,2,255).is_usable_public()); // documentation assert!(Ipv4Addr::new(192,0,3,0).is_usable_public()); - + assert!(Ipv4Addr::new(192,167,255,255).is_usable_public()); assert!(!Ipv4Addr::new(192,168,0,0).is_usable_public()); // private intra-network assert!(!Ipv4Addr::new(192,168,255,255).is_usable_public()); // private intra-network assert!(Ipv4Addr::new(192,169,0,0).is_usable_public()); - + assert!(Ipv4Addr::new(198,17,255,255).is_usable_public()); assert!(!Ipv4Addr::new(198,18,0,0).is_usable_public()); // benchmarking assert!(!Ipv4Addr::new(198,19,255,255).is_usable_public()); // benchmarking assert!(Ipv4Addr::new(198,20,0,0).is_usable_public()); - + assert!(Ipv4Addr::new(198,51,99,255).is_usable_public()); assert!(!Ipv4Addr::new(198,51,100,0).is_usable_public()); // documentation assert!(!Ipv4Addr::new(198,51,100,255).is_usable_public()); // documentation @@ -485,7 +493,7 @@ fn ipv4_usable_public() { assert!(!Ipv4Addr::new(224,0,0,0).is_usable_public()); // multicast assert!(!Ipv4Addr::new(239, 255, 255, 255).is_usable_public()); // multicast assert!(!Ipv4Addr::new(240, 0, 0, 0).is_usable_public()); // future use - assert!(!Ipv4Addr::new(255, 255, 255, 254).is_usable_public()); // future use + assert!(!Ipv4Addr::new(255, 255, 255, 254).is_usable_public()); // future use assert!(!Ipv4Addr::new(255, 255, 255, 255).is_usable_public()); // limited broadcast } @@ -495,12 +503,12 @@ fn ipv4_usable_private() { assert!(Ipv4Addr::new(10,0,0,0).is_usable_private()); // private intra-network assert!(Ipv4Addr::new(10,255,255,255).is_usable_private()); // private intra-network assert!(!Ipv4Addr::new(11,0,0,0).is_usable_private()); - + assert!(!Ipv4Addr::new(172,15,255,255).is_usable_private()); assert!(Ipv4Addr::new(172,16,0,0).is_usable_private()); // private intra-network assert!(Ipv4Addr::new(172,31,255,255).is_usable_private()); // private intra-network assert!(!Ipv4Addr::new(172,32,255,255).is_usable_private()); - + assert!(!Ipv4Addr::new(192,167,255,255).is_usable_private()); assert!(Ipv4Addr::new(192,168,0,0).is_usable_private()); // private intra-network assert!(Ipv4Addr::new(192,168,255,255).is_usable_private()); // private intra-network diff --git a/util/version/Cargo.toml b/util/version/Cargo.toml index f309c3b04c8..093c61fde30 100644 --- a/util/version/Cargo.toml +++ b/util/version/Cargo.toml @@ -10,15 +10,15 @@ build = "build.rs" [package.metadata] # This versions track. Should be changed to `stable` or `beta` when on respective branches. # Used by auto-updater and for Parity version string. -track = "nightly" +track = "beta" # Network specific settings, used ONLY by auto-updater. # Latest supported fork blocks. # Indicates a critical release in this track (i.e. consensus issue). [package.metadata.networks] -foundation = { forkBlock = 4370000, critical = false } +foundation = { forkBlock = 4370000, critical = true } ropsten = { forkBlock = 4230000, critical = false } -kovan = { forkBlock = 6600000, critical = false } +kovan = { forkBlock = 9200000, critical = true } [dependencies] parity-bytes = "0.1"