From dd38573a2805edee2997c7a6856e63a577dc4198 Mon Sep 17 00:00:00 2001 From: "adria0.eth" <5526331+adria0@users.noreply.github.com> Date: Thu, 10 Sep 2020 08:04:14 +0200 Subject: [PATCH] Update ethereum/tests --- Cargo.lock | 60 +++--- ethcore/Cargo.toml | 3 +- ethcore/res/ethereum/berlin_test.json | 204 ++++++++++++++++++ ...yzantium_to_constantinoplefixat5_test.json | 108 ++++++++++ ethcore/res/ethereum/runner/full.json | 9 + ethcore/res/ethereum/tests | 2 +- ethcore/src/client/evm_test_client.rs | 8 +- ethcore/src/ethereum/mod.rs | 13 ++ ethcore/src/executive.rs | 26 ++- ethcore/src/json_tests/chain.rs | 5 + ethcore/src/json_tests/difficulty.rs | 4 + ethcore/src/json_tests/executive.rs | 4 + ethcore/src/json_tests/mod.rs | 2 +- ethcore/src/json_tests/runner.rs | 5 +- ethcore/src/json_tests/state.rs | 4 + ethcore/src/json_tests/test_common.rs | 11 + ethcore/src/json_tests/transaction.rs | 4 + ethcore/src/json_tests/trie.rs | 4 + ethcore/src/spec/spec.rs | 68 +++--- json/src/spec/spec.rs | 2 + rpc/src/v1/tests/eth.rs | 23 +- rpc/src/v1/tests/mod.rs | 2 +- 22 files changed, 495 insertions(+), 76 deletions(-) create mode 100644 ethcore/res/ethereum/berlin_test.json create mode 100644 ethcore/res/ethereum/byzantium_to_constantinoplefixat5_test.json diff --git a/Cargo.lock b/Cargo.lock index c1d3ec145..0252b6f48 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -405,7 +405,7 @@ dependencies = [ "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -429,7 +429,7 @@ dependencies = [ "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -621,7 +621,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -650,7 +650,7 @@ dependencies = [ "keccak-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lunarity-lexer 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", @@ -688,7 +688,7 @@ dependencies = [ "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -830,7 +830,7 @@ dependencies = [ "ethkey 0.3.0", "evm 0.1.0", "fetch 0.1.0", - "globset 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "globset 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (git+https://github.com/cheme/heapsize.git?branch=ec-macfix)", "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -856,6 +856,7 @@ dependencies = [ "patricia-trie-ethereum 0.1.0", "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.9 (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", @@ -874,7 +875,7 @@ dependencies = [ "unexpected 0.1.0", "using_queue 0.1.0", "vm 0.1.0", - "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "wasm 0.1.0", ] @@ -1001,7 +1002,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1556,14 +1557,14 @@ dependencies = [ [[package]] name = "globset" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", "bstr 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1977,7 +1978,7 @@ version = "14.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "globset 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "globset 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 14.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2070,7 +2071,7 @@ dependencies = [ "num_cpus 1.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-rocksdb 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2165,7 +2166,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", "utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2617,7 +2618,7 @@ dependencies = [ "parity-version 2.5.13", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "registrar 0.0.1", "rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rpassword 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3357,13 +3358,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.3.1" +version = "1.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3384,7 +3385,7 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.12" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -3934,6 +3935,14 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "thread_local" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "threadpool" version = "1.7.1" @@ -4436,7 +4445,7 @@ 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.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4452,7 +4461,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", "validator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4490,7 +4499,7 @@ dependencies = [ [[package]] name = "walkdir" -version = "2.2.9" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4782,7 +4791,7 @@ dependencies = [ "checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" "checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" "checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407" -"checksum globset 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "925aa2cac82d8834e2b2a4415b6f6879757fb5c0928fc445ae76461a12eed8f2" +"checksum globset 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7ad1da430bd7281dde2576f44c84cc3f0f7b475e7202cd503042dff01a8c8120" "checksum h2 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" "checksum hamming 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65043da274378d68241eb9a8f8f8aa54e349136f7b8e12f63e3ef44043cc30e1" "checksum hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1b03501f6e1a2a97f1618879aba3156f14ca2847faa530c4e28859638bd11483" @@ -4941,10 +4950,10 @@ dependencies = [ "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" "checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384" -"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd" +"checksum regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" "checksum regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "92b73c2a1770c255c240eaa4ee600df1704a38dc3feaa6e949e7fcd4f8dc09f9" "checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7" -"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716" +"checksum regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)" = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" "checksum relay 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1576e382688d7e9deecea24417e350d3062d97e32e45d70b1cde65994ff1489a" "checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" "checksum ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)" = "426bc186e3e95cac1e4a4be125a4aca7e84c2d616ffc02244eef36e2a60a093c" @@ -5008,6 +5017,7 @@ dependencies = [ "checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693" "checksum thread-id 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" +"checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" "checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum timer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "31d42176308937165701f50638db1c31586f183f1aab416268216577aec7306b" @@ -5063,7 +5073,7 @@ dependencies = [ "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum vergen 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c3365f36c57e5df714a34be40902b27a992eeddb9996eca52d0584611cf885d" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" -"checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" +"checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" "checksum want 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a05d9d966753fa4b5c8db73fcab5eed4549cfe0e1e4e66911e5564a0085c35d1" "checksum want 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6395efa4784b027708f7451087e647ec73cc74f5d9bc2e418404248d679a230" "checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d" diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index 38df20e10..202e36761 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -56,6 +56,7 @@ trie-db = "0.11.0" patricia-trie-ethereum = { path = "../util/patricia-trie-ethereum" } rand = "0.4" rayon = "1.1" +regex = "1.3.9" rlp = { version = "0.3.0", features = ["ethereum"] } rlp_derive = { path = "../util/rlp-derive" } rustc-hex = "1.0" @@ -71,7 +72,7 @@ triehash-ethereum = { version = "0.2", path = "../util/triehash-ethereum" } unexpected = { path = "../util/unexpected" } using_queue = { path = "../miner/using-queue" } vm = { path = "vm" } -walkdir = "2" +walkdir = "2.3" wasm = { path = "wasm" } [dev-dependencies] diff --git a/ethcore/res/ethereum/berlin_test.json b/ethcore/res/ethereum/berlin_test.json new file mode 100644 index 000000000..fc3458649 --- /dev/null +++ b/ethcore/res/ethereum/berlin_test.json @@ -0,0 +1,204 @@ +{ + "name": "Istanbul (test)", + "engine": { + "Ethash": { + "params": { + "minimumDifficulty": "0x020000", + "difficultyBoundDivisor": "0x0800", + "durationLimit": "0x0d", + "blockReward": "0x1BC16D674EC80000", + "homesteadTransition": "0x0", + "eip100bTransition": "0x0", + "difficultyBombDelays": { + "0": 5000000 + } + } + } + }, + "params": { + "gasLimitBoundDivisor": "0x0400", + "registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b", + "accountStartNonce": "0x00", + "maximumExtraDataSize": "0x20", + "minGasLimit": "0x1388", + "networkID" : "0x1", + "maxCodeSize": 24576, + "maxCodeSizeTransition": "0x0", + "eip150Transition": "0x0", + "eip160Transition": "0x0", + "eip161abcTransition": "0x0", + "eip161dTransition": "0x0", + "eip140Transition": "0x0", + "eip211Transition": "0x0", + "eip214Transition": "0x0", + "eip155Transition": "0x0", + "eip658Transition": "0x0", + "eip145Transition": "0x0", + "eip1014Transition": "0x0", + "eip1052Transition": "0x0", + "eip1283Transition": "0x0", + "eip1283DisableTransition": "0x0", + "eip1283ReenableTransition": "0x0", + "eip1344Transition": "0x0", + "eip1706Transition": "0x0", + "eip1884Transition": "0x0", + "eip2028Transition": "0x0", + "eip2315Transition": "0x0" + + }, + "genesis": { + "seal": { + "ethereum": { + "nonce": "0x0000000000000042", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000" + } + }, + "difficulty": "0x400000000", + "author": "0x0000000000000000000000000000000000000000", + "timestamp": "0x00", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa", + "gasLimit": "0x1388" + }, + "accounts": { + "0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } }, + "0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } }, + "0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } }, + "0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } }, + "0000000000000000000000000000000000000005": { "builtin": { "name": "modexp", "activate_at": "0x00", "pricing": { "modexp": { "divisor": 20 } } } }, + "0000000000000000000000000000000000000006": { + "builtin": { + "name": "alt_bn128_add", + "pricing": { + "0": { + "price": { "alt_bn128_const_operations": { "price": 500 }} + }, + "0": { + "info": "EIP 1108 transition", + "price": { "alt_bn128_const_operations": { "price": 150 }} + } + } + } + }, + "0000000000000000000000000000000000000007": { + "builtin": { + "name": "alt_bn128_mul", + "pricing": { + "0": { + "price": { "alt_bn128_const_operations": { "price": 40000 }} + }, + "0": { + "info": "EIP 1108 transition", + "price": { "alt_bn128_const_operations": { "price": 6000 }} + } + } + } + }, + "0000000000000000000000000000000000000008": { + "builtin": { + "name": "alt_bn128_pairing", + "pricing": { + "0": { + "price": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 }} + }, + "0": { + "info": "EIP 1108 transition", + "price": { "alt_bn128_pairing": { "base": 45000, "pair": 34000 }} + } + } + } + }, + "0000000000000000000000000000000000000009": { + "builtin": { + "name": "blake2_f", + "activate_at": "0x00", + "pricing": { + "blake2_f": { + "gas_per_round": 1 + } + } + } + }, + "000000000000000000000000000000000000000a": { + "builtin": { + "name": "bls12_381_g1_add", + "activate_at": "0", + "pricing": { + "bls12_const_operations": { "price": 600 } + } + } + }, + "000000000000000000000000000000000000000b": { + "builtin": { + "name": "bls12_381_g1_mul", + "activate_at": "0", + "pricing": { + "bls12_const_operations": { "price": 12000 } + } + } + }, + "000000000000000000000000000000000000000c": { + "builtin": { + "name": "bls12_381_g1_multiexp", + "activate_at": "0", + "pricing": { + "bls12_g1_multiexp": { "base": 12000 } + } + } + }, + "000000000000000000000000000000000000000d": { + "builtin": { + "name": "bls12_381_g2_add", + "activate_at": "0", + "pricing": { + "bls12_const_operations": { "price": 4500 } + } + } + }, + "000000000000000000000000000000000000000e": { + "builtin": { + "name": "bls12_381_g2_mul", + "activate_at": "0", + "pricing": { + "bls12_const_operations": { "price": 55000 } + } + } + }, + "000000000000000000000000000000000000000f": { + "builtin": { + "name": "bls12_381_g2_multiexp", + "activate_at": "0", + "pricing": { + "bls12_g2_multiexp": { "base": 55000 } + } + } + }, + "0000000000000000000000000000000000000010": { + "builtin": { + "name": "bls12_381_pairing", + "activate_at": "0", + "pricing": { + "bls12_pairing": { "base": 115000, "pair": 23000 } + } + } + }, + "0000000000000000000000000000000000000011": { + "builtin": { + "name": "bls12_381_fp_to_g1", + "activate_at": "0", + "pricing": { + "bls12_const_operations": { "price": 5500 } + } + } + }, + "0000000000000000000000000000000000000012": { + "builtin": { + "name": "bls12_381_fp2_to_g2", + "activate_at": "0", + "pricing": { + "bls12_const_operations": { "price": 110000 } + } + } + } + } +} diff --git a/ethcore/res/ethereum/byzantium_to_constantinoplefixat5_test.json b/ethcore/res/ethereum/byzantium_to_constantinoplefixat5_test.json new file mode 100644 index 000000000..3aa42605c --- /dev/null +++ b/ethcore/res/ethereum/byzantium_to_constantinoplefixat5_test.json @@ -0,0 +1,108 @@ +{ + "name": "Byzantium to Constantinople (test)", + "engine": { + "Ethash": { + "params": { + "minimumDifficulty": "0x020000", + "difficultyBoundDivisor": "0x0800", + "durationLimit": "0x0d", + "blockReward": { + "0x0": "0x29A2241AF62C0000", + "0x5": "0x1BC16D674EC80000" + }, + "homesteadTransition": "0x0", + "eip100bTransition": "0x0", + "difficultyBombDelays": { + "0": 3000000 + } + } + } + }, + "params": { + "gasLimitBoundDivisor": "0x0400", + "registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b", + "accountStartNonce": "0x00", + "maximumExtraDataSize": "0x20", + "minGasLimit": "0x1388", + "networkID" : "0x1", + "maxCodeSize": 24576, + "maxCodeSizeTransition": "0x0", + "eip150Transition": "0x0", + "eip160Transition": "0x0", + "eip161abcTransition": "0x0", + "eip161dTransition": "0x0", + "eip140Transition": "0x0", + "eip211Transition": "0x0", + "eip214Transition": "0x0", + "eip155Transition": "0x0", + "eip658Transition": "0x0", + "eip145Transition": "0x5", + "eip1014Transition": "0x5", + "eip1052Transition": "0x5", + "eip1283Transition": "0x5" , + "eip1283DisableTransition": "0x5" + }, + "genesis": { + "seal": { + "ethereum": { + "nonce": "0x0000000000000042", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000" + } + }, + "difficulty": "0x400000000", + "author": "0x0000000000000000000000000000000000000000", + "timestamp": "0x00", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa", + "gasLimit": "0x1388" + }, + "accounts": { + "0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } }, + "0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } }, + "0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } }, + "0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } }, + "0000000000000000000000000000000000000005": { "builtin": { "name": "modexp", "activate_at": "0x00", "pricing": { "modexp": { "divisor": 20 } } } }, + "0000000000000000000000000000000000000006": { + "builtin": { + "name": "alt_bn128_add", + "pricing": { + "0": { + "price": { "alt_bn128_const_operations": { "price": 500 }} + }, + "0x7fffffffffffff": { + "info": "EIP 1108 transition", + "price": { "alt_bn128_const_operations": { "price": 150 }} + } + } + } + }, + "0000000000000000000000000000000000000007": { + "builtin": { + "name": "alt_bn128_mul", + "pricing": { + "0": { + "price": { "alt_bn128_const_operations": { "price": 40000 }} + }, + "0x7fffffffffffff": { + "info": "EIP 1108 transition", + "price": { "alt_bn128_const_operations": { "price": 6000 }} + } + } + } + }, + "0000000000000000000000000000000000000008": { + "builtin": { + "name": "alt_bn128_pairing", + "pricing": { + "0": { + "price": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 }} + }, + "0x7fffffffffffff": { + "info": "EIP 1108 transition", + "price": { "alt_bn128_pairing": { "base": 45000, "pair": 34000 }} + } + } + } + } + } +} diff --git a/ethcore/res/ethereum/runner/full.json b/ethcore/res/ethereum/runner/full.json index 2d7e98a2a..58c25e658 100644 --- a/ethcore/res/ethereum/runner/full.json +++ b/ethcore/res/ethereum/runner/full.json @@ -3,6 +3,10 @@ { "path": "res/ethereum/tests/BlockchainTests", "skip" : [] + }, + { + "path": "res/ethereum/tests/LegacyTests/Constantinople/BlockchainTests", + "skip" : [] } ], "state": [ @@ -10,6 +14,11 @@ "path": "res/ethereum/tests/GeneralStateTests", "skip" : [] + }, + { + "path": "res/ethereum/tests//LegacyTests/Constantinople/GeneralStateTests", + "skip" : [] + } ], "difficulty": [ diff --git a/ethcore/res/ethereum/tests b/ethcore/res/ethereum/tests index 725dbc73a..66a55cd42 160000 --- a/ethcore/res/ethereum/tests +++ b/ethcore/res/ethereum/tests @@ -1 +1 @@ -Subproject commit 725dbc73a54649e22a00330bd0f4d6699a5060e5 +Subproject commit 66a55cd42f63845e34767504d0a7a62b452a7e7a diff --git a/ethcore/src/client/evm_test_client.rs b/ethcore/src/client/evm_test_client.rs index 256f12c87..d7c6afd87 100644 --- a/ethcore/src/client/evm_test_client.rs +++ b/ethcore/src/client/evm_test_client.rs @@ -104,10 +104,14 @@ impl<'a> EvmTestClient<'a> { ForkSpec::ConstantinopleFix => Some(ethereum::new_constantinople_fix_test()), ForkSpec::Istanbul => Some(ethereum::new_istanbul_test()), ForkSpec::EIP158ToByzantiumAt5 => Some(ethereum::new_transition_test()), + ForkSpec::ByzantiumToConstantinopleFixAt5 => { + Some(ethereum::new_byzantium_to_constantinoplefixat5_test()) + } + ForkSpec::Berlin => Some(ethereum::new_berlin_test()), ForkSpec::FrontierToHomesteadAt5 | ForkSpec::HomesteadToDaoAt5 - | ForkSpec::HomesteadToEIP150At5 => None, - ForkSpec::ByzantiumToConstantinopleAt5 => None, + | ForkSpec::HomesteadToEIP150At5 + | ForkSpec::ByzantiumToConstantinopleAt5 => None, } } diff --git a/ethcore/src/ethereum/mod.rs b/ethcore/src/ethereum/mod.rs index 46d834d36..a5732dcd4 100644 --- a/ethcore/src/ethereum/mod.rs +++ b/ethcore/src/ethereum/mod.rs @@ -271,6 +271,19 @@ pub fn new_istanbul_test() -> Spec { ) } +/// Create a new BizantiumToConstaninopleFixAt5 era spec. +pub fn new_byzantium_to_constantinoplefixat5_test() -> Spec { + load( + None, + include_bytes!("../../res/ethereum/byzantium_to_constantinoplefixat5_test.json"), + ) +} + +/// Create a new Foundation Berlin era spec. +pub fn new_berlin_test() -> Spec { + load(None, include_bytes!("../../res/ethereum/berlin_test.json")) +} + /// Create a new Musicoin-MCIP3-era spec. pub fn new_mcip3_test() -> Spec { load(None, include_bytes!("../../res/ethereum/mcip3_test.json")) diff --git a/ethcore/src/executive.rs b/ethcore/src/executive.rs index 7a619bc27..b6d307532 100644 --- a/ethcore/src/executive.rs +++ b/ethcore/src/executive.rs @@ -51,6 +51,16 @@ const STACK_SIZE_ENTRY_OVERHEAD: usize = 100 * 1024; /// Entry stack overhead prior to execution. const STACK_SIZE_ENTRY_OVERHEAD: usize = 20 * 1024; +#[cfg(any(test, feature = "test-helpers"))] +/// Precompile that can never be prunned from state trie (0x3, only in tests) +const UNPRUNABLE_PRECOMPILE_ADDRESS: Option
= Some(ethereum_types::H160([ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, +])); + +#[cfg(not(any(test, feature = "test-helpers")))] +/// Precompile that can never be prunned from state trie (none) +const UNPRUNABLE_PRECOMPILE_ADDRESS: Option
= None; + /// Returns new address created from address, nonce, and code hash pub fn contract_address( address_scheme: CreateContractAddress, @@ -441,6 +451,11 @@ impl<'a> CallCreateExecutive<'a> { | Ok(FinalizationResult { apply_state: false, .. }) => { + if let Some(addr) = UNPRUNABLE_PRECOMPILE_ADDRESS { + if un_substate.touched.contains(&addr) { + substate.touched.insert(addr); + } + } state.revert_to_checkpoint(); } Ok(_) | Err(vm::Error::Internal(_)) => { @@ -553,9 +568,18 @@ impl<'a> CallCreateExecutive<'a> { }) } } else { + // We need balance > 0 in precompiles to be EIP161 compliant, see PR#11597. + // Since RIPEMD160 was removed in mainnet block #2686351, this is activated only in + // tests to check this specific irregular state transition. + if let Some(unprunable_addr) = UNPRUNABLE_PRECOMPILE_ADDRESS { + if unprunable_addr != params.code_address + && state.balance(¶ms.code_address)?.is_zero() + { + substate.touched.remove(¶ms.code_address); + } + } // just drain the whole gas state.revert_to_checkpoint(); - Err(vm::Error::OutOfGas) } }; diff --git a/ethcore/src/json_tests/chain.rs b/ethcore/src/json_tests/chain.rs index decbf9370..d6ddd2139 100644 --- a/ethcore/src/json_tests/chain.rs +++ b/ethcore/src/json_tests/chain.rs @@ -135,10 +135,15 @@ pub fn json_chain_test( let mut failed = Vec::new(); for (name, blockchain) in tests.into_iter() { + if !super::debug_include_test(&name) { + continue; + } + let skip_test = test .skip .iter() .any(|block_test| block_test.names.contains(&name)); + if skip_test { info!(" SKIPPED {:?} {:?}", name, blockchain.network); continue; diff --git a/ethcore/src/json_tests/difficulty.rs b/ethcore/src/json_tests/difficulty.rs index 53b432e73..51804f92c 100644 --- a/ethcore/src/json_tests/difficulty.rs +++ b/ethcore/src/json_tests/difficulty.rs @@ -37,6 +37,10 @@ pub fn json_difficulty_test( let engine = &spec.engine; for (name, test) in tests.into_iter() { + if !super::debug_include_test(&name) { + continue; + } + start_stop_hook(&name, HookType::OnStart); let mut parent_header = Header::new(); diff --git a/ethcore/src/json_tests/executive.rs b/ethcore/src/json_tests/executive.rs index c65783cf9..de7d8f92f 100644 --- a/ethcore/src/json_tests/executive.rs +++ b/ethcore/src/json_tests/executive.rs @@ -252,6 +252,10 @@ pub fn json_executive_test( let mut failed = Vec::new(); for (name, vm) in tests.into_iter() { + if !super::debug_include_test(&name) { + continue; + } + start_stop_hook(&format!("{}", name), HookType::OnStart); let mut fail = false; diff --git a/ethcore/src/json_tests/mod.rs b/ethcore/src/json_tests/mod.rs index 99fb33be5..061b06b69 100644 --- a/ethcore/src/json_tests/mod.rs +++ b/ethcore/src/json_tests/mod.rs @@ -27,5 +27,5 @@ mod trie; pub use self::{ executive::json_executive_test, - test_common::{find_json_files_recursive, HookType}, + test_common::{debug_include_test, find_json_files_recursive, HookType}, }; diff --git a/ethcore/src/json_tests/runner.rs b/ethcore/src/json_tests/runner.rs index 283dec8b1..18bad4a7f 100644 --- a/ethcore/src/json_tests/runner.rs +++ b/ethcore/src/json_tests/runner.rs @@ -236,7 +236,10 @@ fn ethereum_json_tests() { let runner = TestRunner::load(content.as_slice()).expect("cannot load ethereum tests spec file"); println!("----------------------------------------------------"); - let result = runner.run(); + let result = match std::env::var_os("TEST_DEBUG") { + Some(_) => runner.run_without_par(), + _ => runner.run(), + }; println!("----------------------------------------------------"); flushln!( "SUCCESS: {} FAILED: {} {:?}", diff --git a/ethcore/src/json_tests/state.rs b/ethcore/src/json_tests/state.rs index 8308926f6..ec309fafa 100644 --- a/ethcore/src/json_tests/state.rs +++ b/ethcore/src/json_tests/state.rs @@ -56,6 +56,10 @@ pub fn json_chain_test( let mut failed = Vec::new(); for (name, test) in tests.into_iter() { + if !super::debug_include_test(&name) { + continue; + } + start_stop_hook(&name, HookType::OnStart); { diff --git a/ethcore/src/json_tests/test_common.rs b/ethcore/src/json_tests/test_common.rs index bba800014..fcab916d5 100644 --- a/ethcore/src/json_tests/test_common.rs +++ b/ethcore/src/json_tests/test_common.rs @@ -35,3 +35,14 @@ pub fn find_json_files_recursive(path: &PathBuf) -> Vec { .map(DirEntry::into_path) .collect::>() } + +pub fn debug_include_test(name: &str) -> bool { + match std::env::var_os("TEST_DEBUG") { + Some(s) => s.to_string_lossy().split_terminator(",").any(|expr| { + regex::Regex::new(expr) + .expect("invalid regex expression in TEST_DEBUG") + .is_match(name) + }), + _ => true, + } +} diff --git a/ethcore/src/json_tests/transaction.rs b/ethcore/src/json_tests/transaction.rs index 6d8d503cd..c01a15740 100644 --- a/ethcore/src/json_tests/transaction.rs +++ b/ethcore/src/json_tests/transaction.rs @@ -37,6 +37,10 @@ pub fn json_transaction_test( )); let mut failed = Vec::new(); for (name, test) in tests.into_iter() { + if !super::debug_include_test(&name) { + continue; + } + start_stop_hook(&name, HookType::OnStart); println!(" - tx: {} ", name); diff --git a/ethcore/src/json_tests/trie.rs b/ethcore/src/json_tests/trie.rs index 3048a773a..a0dc44ca5 100644 --- a/ethcore/src/json_tests/trie.rs +++ b/ethcore/src/json_tests/trie.rs @@ -36,6 +36,10 @@ pub fn json_trie_test( let mut failed = vec![]; for (name, test) in tests.into_iter() { + if !super::debug_include_test(&name) { + continue; + } + start_stop_hook(&name, HookType::OnStart); let mut memdb = journaldb::new_memory_db(); diff --git a/ethcore/src/spec/spec.rs b/ethcore/src/spec/spec.rs index fc94d0473..fc7e241f3 100644 --- a/ethcore/src/spec/spec.rs +++ b/ethcore/src/spec/spec.rs @@ -657,45 +657,49 @@ impl Spec { gas_limit: U256::max_value(), }; - let from = Address::default(); - for &(ref address, ref constructor) in self.constructors.iter() { - trace!(target: "spec", "run_constructors: Creating a contract at {}.", address); - trace!(target: "spec", " .. root before = {}", state.root()); - let params = ActionParams { - code_address: address.clone(), - code_hash: Some(keccak(constructor)), - address: address.clone(), - sender: from.clone(), - origin: from.clone(), - gas: U256::max_value(), - gas_price: Default::default(), - value: ActionValue::Transfer(Default::default()), - code: Some(Arc::new(constructor.clone())), - data: None, - call_type: CallType::None, - params_type: ParamsType::Embedded, - }; + if !self.constructors.is_empty() { + let from = Address::default(); + for &(ref address, ref constructor) in self.constructors.iter() { + trace!(target: "spec", "run_constructors: Creating a contract at {}.", address); + trace!(target: "spec", " .. root before = {}", state.root()); + let params = ActionParams { + code_address: address.clone(), + code_hash: Some(keccak(constructor)), + address: address.clone(), + sender: from.clone(), + origin: from.clone(), + gas: U256::max_value(), + gas_price: Default::default(), + value: ActionValue::Transfer(Default::default()), + code: Some(Arc::new(constructor.clone())), + data: None, + call_type: CallType::None, + params_type: ParamsType::Embedded, + }; - let mut substate = Substate::new(); + let mut substate = Substate::new(); - { - let machine = self.engine.machine(); - let schedule = machine.schedule(env_info.number); - let mut exec = Executive::new(&mut state, &env_info, &machine, &schedule); - if let Err(e) = - exec.create(params, &mut substate, &mut NoopTracer, &mut NoopVMTracer) { - warn!(target: "spec", "Genesis constructor execution at {} failed: {}.", address, e); + let machine = self.engine.machine(); + let schedule = machine.schedule(env_info.number); + let mut exec = Executive::new(&mut state, &env_info, &machine, &schedule); + if let Err(e) = + exec.create(params, &mut substate, &mut NoopTracer, &mut NoopVMTracer) + { + warn!(target: "spec", "Genesis constructor execution at {} failed: {}.", address, e); + } } - } - if let Err(e) = state.commit() { - warn!(target: "spec", "Genesis constructor trie commit at {} failed: {}.", address, e); - } + if let Err(e) = state.commit() { + warn!(target: "spec", "Genesis constructor trie commit at {} failed: {}.", address, e); + } - trace!(target: "spec", " .. root after = {}", state.root()); + trace!(target: "spec", " .. root after = {}", state.root()); + } + } else { + state.populate_from(self.genesis_state().to_owned()); + state.commit()?; } - state.drop() }; diff --git a/json/src/spec/spec.rs b/json/src/spec/spec.rs index 930b1081c..df4ffe1ee 100644 --- a/json/src/spec/spec.rs +++ b/json/src/spec/spec.rs @@ -36,6 +36,8 @@ pub enum ForkSpec { HomesteadToDaoAt5, HomesteadToEIP150At5, ByzantiumToConstantinopleAt5, + ByzantiumToConstantinopleFixAt5, + Berlin, } /// Spec deserialization. diff --git a/rpc/src/v1/tests/eth.rs b/rpc/src/v1/tests/eth.rs index ecdc9fc85..d93a17ee6 100644 --- a/rpc/src/v1/tests/eth.rs +++ b/rpc/src/v1/tests/eth.rs @@ -173,13 +173,14 @@ impl EthTester { #[test] fn harness_works() { - let chain: BlockChain = extract_chain!("BlockchainTests/bcWalletTest/wallet2outOf3txs"); + let chain: BlockChain = + extract_chain!("BlockchainTests/ValidBlocks/bcWalletTest/wallet2outOf3txs"); let _ = EthTester::from_chain(&chain); } #[test] fn eth_get_balance() { - let chain = extract_chain!("BlockchainTests/bcWalletTest/wallet2outOf3txs"); + let chain = extract_chain!("BlockchainTests/ValidBlocks/bcWalletTest/wallet2outOf3txs"); let tester = EthTester::from_chain(&chain); // final account state let req_latest = r#"{ @@ -211,7 +212,7 @@ fn eth_get_balance() { #[test] fn eth_get_proof() { - let chain = extract_chain!("BlockchainTests/bcWalletTest/wallet2outOf3txs"); + let chain = extract_chain!("BlockchainTests/ValidBlocks/bcWalletTest/wallet2outOf3txs"); let tester = EthTester::from_chain(&chain); // final account state let req_latest = r#"{ @@ -248,7 +249,7 @@ fn eth_get_proof() { #[test] fn eth_block_number() { - let chain = extract_chain!("BlockchainTests/bcGasPricerTest/RPC_API_Test"); + let chain = extract_chain!("BlockchainTests/ValidBlocks/bcGasPricerTest/RPC_API_Test"); let tester = EthTester::from_chain(&chain); let req_number = r#"{ "jsonrpc": "2.0", @@ -266,7 +267,7 @@ fn eth_block_number() { #[test] fn eth_get_block() { - let chain = extract_chain!("BlockchainTests/bcGasPricerTest/RPC_API_Test"); + let chain = extract_chain!("BlockchainTests/ValidBlocks/bcGasPricerTest/RPC_API_Test"); let tester = EthTester::from_chain(&chain); let req_block = r#"{"method":"eth_getBlockByNumber","params":["0x0",false],"id":1,"jsonrpc":"2.0"}"#; @@ -280,13 +281,13 @@ fn eth_get_block() { #[test] fn eth_get_block_by_hash() { - let chain = extract_chain!("BlockchainTests/bcGasPricerTest/RPC_API_Test"); + let chain = extract_chain!("BlockchainTests/ValidBlocks/bcGasPricerTest/RPC_API_Test"); let tester = EthTester::from_chain(&chain); // We're looking for block number 4 from "RPC_API_Test_Frontier" - let req_block = r#"{"method":"eth_getBlockByHash","params":["0xaddb9e39795e9e041c936b88a2577802569f34afded0948707b074caa3163a87",false],"id":1,"jsonrpc":"2.0"}"#; + let req_block = r#"{"method":"eth_getBlockByHash","params":["0x088987877b431b8156c79c4b1c9543a8747531e5acaebca8f5d516cb3b35b0f2",false],"id":1,"jsonrpc":"2.0"}"#; - let res_block = r#"{"jsonrpc":"2.0","result":{"author":"0x8888f1f195afa192cfee860698584c030f4c9db1","difficulty":"0x20080","extraData":"0x","gasLimit":"0x1dd7ea0","gasUsed":"0x5458","hash":"0xaddb9e39795e9e041c936b88a2577802569f34afded0948707b074caa3163a87","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x8888f1f195afa192cfee860698584c030f4c9db1","mixHash":"0x713b0b31f6e72d8cb7367eaf59447ea531f209fc80e6379edd9f8d3bb73931c4","nonce":"0x4534b406bc23b86d","number":"0x4","parentHash":"0x17567aa5995b703736e32972289d68af50543acc4d56d37e8ad1fea7252cac4a","receiptsRoot":"0x7ed8026cf72ed0e98e6fd53ab406e51ffd34397d9da0052494ff41376fda7b5f","sealFields":["0xa0713b0b31f6e72d8cb7367eaf59447ea531f209fc80e6379edd9f8d3bb73931c4","0x884534b406bc23b86d"],"sha3Uncles":"0xe588a44b3e320e72e70b32b531f3ac0d432e756120135ae8fe5fa10895196b40","size":"0x661","stateRoot":"0x68805721294e365020aca15ed56c360d9dc2cf03cbeff84c9b84b8aed023bfb5","timestamp":"0x5bbdf772","totalDifficulty":"0xa00c0","transactions":["0xb094b9dc356dbb8b256402c6d5709288066ad6a372c90c9c516f14277545fd58"],"transactionsRoot":"0x97a593d8d7e15b57f5c6bb25bc6c325463ef99f874bc08a78656c3ab5cb23262","uncles":["0x86b48f5186c4b0882d3dca7977aa37840008832ef092f8ef797019dc74bfa8c7","0x2da9d062c11d536f0f1cc2a4e0111597c79926958d0fc26ae1a2d07d1a3bf47d"]},"id":1}"#; + let res_block = r#"{"jsonrpc":"2.0","result":{"author":"0x8888f1f195afa192cfee860698584c030f4c9db1","difficulty":"0x200c0","extraData":"0x","gasLimit":"0x1dd7ea0","gasUsed":"0x5458","hash":"0x088987877b431b8156c79c4b1c9543a8747531e5acaebca8f5d516cb3b35b0f2","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x8888f1f195afa192cfee860698584c030f4c9db1","mixHash":"0xeb709bc3b92c8f28ffa3d4ad7558689316cfbf599ac9541d9f3e79d31b0b9af6","nonce":"0x6ab72973b649825d","number":"0x4","parentHash":"0x095303ee87197430f9bf30ecd09735a11ab78db59abf67a36d4ada73f96800b9","receiptsRoot":"0x7ed8026cf72ed0e98e6fd53ab406e51ffd34397d9da0052494ff41376fda7b5f","sealFields":["0xa0eb709bc3b92c8f28ffa3d4ad7558689316cfbf599ac9541d9f3e79d31b0b9af6","0x886ab72973b649825d"],"sha3Uncles":"0xb9cf7d3adde9f960e6c2510c1a7d35e94223db71277463ef8dc94f8afbe44403","size":"0x661","stateRoot":"0x68805721294e365020aca15ed56c360d9dc2cf03cbeff84c9b84b8aed023bfb5","timestamp":"0x5db6f5a1","totalDifficulty":"0xa0180","transactions":["0xb094b9dc356dbb8b256402c6d5709288066ad6a372c90c9c516f14277545fd58"],"transactionsRoot":"0x97a593d8d7e15b57f5c6bb25bc6c325463ef99f874bc08a78656c3ab5cb23262","uncles":["0xffa20f3c2eafd8a4def16b2742e576280282c1476a8307ac6ff5a8a1eac99cdf","0x67faba5ff44f91127c12823a820ab5456252afa3397d08b2781fe308fb1c8359"]},"id":1}"#; assert_eq!( tester.handler.handle_request_sync(req_block).unwrap(), res_block @@ -595,15 +596,15 @@ fn starting_nonce_test() { register_test!( eth_transaction_count_1, verify_transaction_counts, - "BlockchainTests/bcWalletTest/wallet2outOf3txs" + "BlockchainTests/ValidBlocks/bcWalletTest/wallet2outOf3txs" ); register_test!( eth_transaction_count_2, verify_transaction_counts, - "BlockchainTests/bcTotalDifficultyTest/sideChainWithMoreTransactions" + "BlockchainTests/ValidBlocks/bcTotalDifficultyTest/sideChainWithMoreTransactions" ); register_test!( eth_transaction_count_3, verify_transaction_counts, - "BlockchainTests/bcGasPricerTest/RPC_API_Test" + "BlockchainTests/ValidBlocks/bcGasPricerTest/RPC_API_Test" ); diff --git a/rpc/src/v1/tests/mod.rs b/rpc/src/v1/tests/mod.rs index 5a841ba1c..e693b842a 100644 --- a/rpc/src/v1/tests/mod.rs +++ b/rpc/src/v1/tests/mod.rs @@ -31,7 +31,7 @@ pub mod helpers; macro_rules! extract_chain { (iter $file:expr) => {{ const RAW_DATA: &'static [u8] = - include_bytes!(concat!("../../../../ethcore/res/ethereum/tests/", $file, ".json")); + include_bytes!(concat!("../../../../ethcore/res/ethereum/tests/LegacyTests/Constantinople/", $file, ".json")); ::ethjson::blockchain::Test::load(RAW_DATA).unwrap().into_iter() }};