From 62076d55cf393c1877397320d0b0ebb3bc9f1dd9 Mon Sep 17 00:00:00 2001 From: meows Date: Mon, 27 Jul 2020 06:54:51 -0500 Subject: [PATCH 1/8] params/parity.json.d/sync-parity-remote.sh: update test configs file path Updates to work with their refactoring dir system. Signed-off-by: meows params/parity.json.d/sync-parity-remote.sh: !squashme - test-spec filepath rename Signed-off-by: meows --- params/parity.json.d/sync-parity-remote.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/params/parity.json.d/sync-parity-remote.sh b/params/parity.json.d/sync-parity-remote.sh index e0f855a9e305..3f791bb71167 100755 --- a/params/parity.json.d/sync-parity-remote.sh +++ b/params/parity.json.d/sync-parity-remote.sh @@ -14,16 +14,16 @@ if [[ ! $(pwd) =~ go-ethereum$ ]]; then fi specs=( - "frontier_test" - "homestead_test" - "eip150_test" - "eip161_test" - "eip210_test" - "byzantium_test" - "constantinople_test" - "st_peters_test" - "istanbul_test" - "transition_test" + "test-specs/frontier_test" + "test-specs/homestead_test" + "test-specs/eip150_test" + "test-specs/eip161_test" + "test-specs/eip210_test" + "test-specs/byzantium_test" + "test-specs/constantinople_test" + "test-specs/st_peters_test" + "test-specs/istanbul_test" + "test-specs/transition_test" "foundation" "goerli" @@ -40,7 +40,7 @@ specs=( for spec_name in "${specs[@]}"; do echo "Fetching $spec_name..." - curl -q https://raw.githubusercontent.com/paritytech/parity-ethereum/master/ethcore/res/ethereum/"$spec_name".json > ./params/parity.json.d/"$spec_name".json + curl -q https://raw.githubusercontent.com/paritytech/parity-ethereum/master/ethcore/res/ethereum/"$spec_name".json > ./params/parity.json.d/"$(basename ${spec_name})".json done curl -q https://api.github.com/repos/paritytech/parity-ethereum/git/refs/heads/master | jq .object.sha | sed 's/"//g' > ./params/parity.json.d/commit.txt From dee6484456b8c9f434ff69f17eeea832bba49cf2 Mon Sep 17 00:00:00 2001 From: meows Date: Mon, 27 Jul 2020 06:55:51 -0500 Subject: [PATCH 2/8] params/parity.json.d/sync-parity-remote.sh: remove classic network from parity-available configs They removed ETC configurations from their defaults. https://github.com/openethereum/openethereum/pull/11821 Signed-off-by: meows --- params/parity.json.d/sync-parity-remote.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/params/parity.json.d/sync-parity-remote.sh b/params/parity.json.d/sync-parity-remote.sh index 3f791bb71167..a63e97a42c73 100755 --- a/params/parity.json.d/sync-parity-remote.sh +++ b/params/parity.json.d/sync-parity-remote.sh @@ -29,11 +29,7 @@ specs=( "goerli" "rinkeby" "ropsten" - - "classic" - "mordor" - "kotti" - + "mix" "musicoin" ) From 2903538ff6189d83d273b08b492b1fca4cedcb32 Mon Sep 17 00:00:00 2001 From: meows Date: Mon, 27 Jul 2020 07:04:24 -0500 Subject: [PATCH 3/8] params/parity.json.d/sync-parity-remote.sh: fix renamed test spec files Signed-off-by: meows --- params/parity.json.d/sync-parity-remote.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/params/parity.json.d/sync-parity-remote.sh b/params/parity.json.d/sync-parity-remote.sh index a63e97a42c73..00a07cad345f 100755 --- a/params/parity.json.d/sync-parity-remote.sh +++ b/params/parity.json.d/sync-parity-remote.sh @@ -21,15 +21,15 @@ specs=( "test-specs/eip210_test" "test-specs/byzantium_test" "test-specs/constantinople_test" - "test-specs/st_peters_test" + "test-specs/constantinople_fix_test" "test-specs/istanbul_test" - "test-specs/transition_test" + "test-specs/eip158_to_byzantiumat5_test.json" "foundation" "goerli" "rinkeby" "ropsten" - + "mix" "musicoin" ) From ede1bda4922ec714bb37b7ef4cfc0ca974501c6f Mon Sep 17 00:00:00 2001 From: meows Date: Mon, 27 Jul 2020 07:04:49 -0500 Subject: [PATCH 4/8] params/parity.json.d/constantinople_fix_test.json,params/parity.json.d/eip158_to_byzantiumat5_test.json.json,params/parity.json.d/foundation.json,params/parity.json.d/ropsten.json,params/parity.json.d/transition_test.json: sync parity configs Signed-off-by: meows --- ...test.json => constantinople_fix_test.json} | 0 .../eip158_to_byzantiumat5_test.json.json | 1 + params/parity.json.d/foundation.json | 89 ++++++++++++++- params/parity.json.d/ropsten.json | 1 - params/parity.json.d/transition_test.json | 104 ------------------ 5 files changed, 85 insertions(+), 110 deletions(-) rename params/parity.json.d/{st_peters_test.json => constantinople_fix_test.json} (100%) create mode 100644 params/parity.json.d/eip158_to_byzantiumat5_test.json.json delete mode 100644 params/parity.json.d/transition_test.json diff --git a/params/parity.json.d/st_peters_test.json b/params/parity.json.d/constantinople_fix_test.json similarity index 100% rename from params/parity.json.d/st_peters_test.json rename to params/parity.json.d/constantinople_fix_test.json diff --git a/params/parity.json.d/eip158_to_byzantiumat5_test.json.json b/params/parity.json.d/eip158_to_byzantiumat5_test.json.json new file mode 100644 index 000000000000..1becba2bb0a8 --- /dev/null +++ b/params/parity.json.d/eip158_to_byzantiumat5_test.json.json @@ -0,0 +1 @@ +404: Not Found \ No newline at end of file diff --git a/params/parity.json.d/foundation.json b/params/parity.json.d/foundation.json index 69a37701f772..bdf8f1168e40 100644 --- a/params/parity.json.d/foundation.json +++ b/params/parity.json.d/foundation.json @@ -4766,10 +4766,6 @@ ] }, "nodes": [ - "enode://81863f47e9bd652585d3f78b4b2ee07b93dad603fd9bc3c293e1244250725998adc88da0cef48f1de89b15ab92b15db8f43dc2b6fb8fbd86a6f217a1dd886701@193.70.55.37:30303", - "enode://4afb3a9137a88267c02651052cf6fb217931b8c78ee058bb86643542a4e2e0a8d24d47d871654e1b78a276c363f3c1bc89254a973b00adc359c9e9a48f140686@144.217.139.5:30303", - "enode://c16d390b32e6eb1c312849fe12601412313165df1a705757d671296f1ac8783c5cff09eab0118ac1f981d7148c85072f0f26407e5c68598f3ad49209fade404d@139.99.51.203:30303", - "enode://4faf867a2e5e740f9b874e7c7355afee58a2d1ace79f7b692f1d553a1134eddbeb5f9210dd14dc1b774a46fd5f063a8bc1fa90579e13d9d18d1f59bac4a4b16b@139.99.160.213:30303", "enode://d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666@18.138.108.67:30303", "enode://22a8232c3abc76a16ae9d6c3b164f98775fe226f0917b0ca871128a74a8e9630b458460865bab457221f1d448dd9791d24c4e5d88786180ac185df813a68d4de@3.209.45.79:30303", "enode://ca6de62fce278f96aea6ec5a2daadb877e51651247cb96ee310a318def462913b653963c155a0ef6c7d50048bba6e6cea881130857413d9f50a621546b590758@34.255.23.113:30303", @@ -4779,7 +4775,9 @@ "enode://715171f50508aba88aecd1250af392a45a330af91d7b90701c436b618c86aaa1589c9184561907bebbb56439b8f8787bc01f49a7c77276c58c1b09822d75e8e8@52.231.165.108:30303", "enode://5d6d7cd20d6da4bb83a1d28cadb5d409b64edf314c0335df658c1a54e32c7c4a7ab7823d57c39b6a757556e68ff1df17c748b698544a55cb488b52479a92b60f@104.42.217.25:30303", "enode://68f46370191198b71a1595dd453c489bbfe28036a9951fc0397fabd1b77462930b3c5a5359b20e99677855939be47b39fc8edcf1e9ff2522a922b86d233bf2df@144.217.153.76:30303", - "enode://ffed6382e05ee42854d862f08e4e39b8452c50a5a5d399072c40f9a0b2d4ad34b0eb5312455ad8bcf0dcb4ce969dc89a9a9fd00183eaf8abf46bbcc59dc6e9d5@51.195.3.238:30303" + "enode://ffed6382e05ee42854d862f08e4e39b8452c50a5a5d399072c40f9a0b2d4ad34b0eb5312455ad8bcf0dcb4ce969dc89a9a9fd00183eaf8abf46bbcc59dc6e9d5@51.195.3.238:30303", + "enode://b47b197244c054d385f25d7740b33cc7e2a74d6f715befad2b789fd3e3594bb1c8dd2ca2faf1a3bf6b4c9ec03e53b52301f722a2316b78976be03ccbe703c581@54.37.94.238:30303", + "enode://5f7d0794c464b2fcd514d41e16e4b535a98ac792a71ca9667c7cef35595dc34c9a1b793c0622554cf87f34006942abb526af7d2e37d715ac32ed02170556cce2@51.161.101.207:30303" ], "accounts": { "0x0000000000000000000000000000000000000001": { @@ -4890,6 +4888,87 @@ } } }, + "000000000000000000000000000000000000000a": { + "builtin": { + "name": "bls12_381_g1_add", + "activate_at": "0x7fffffffffffff", + "pricing": { + "bls12_const_operations": { "price": 600 } + } + } + }, + "000000000000000000000000000000000000000b": { + "builtin": { + "name": "bls12_381_g1_mul", + "activate_at": "0x7fffffffffffff", + "pricing": { + "bls12_const_operations": { "price": 12000 } + } + } + }, + "000000000000000000000000000000000000000c": { + "builtin": { + "name": "bls12_381_g1_multiexp", + "activate_at": "0x7fffffffffffff", + "pricing": { + "bls12_g1_multiexp": { "base": 12000 } + } + } + }, + "000000000000000000000000000000000000000d": { + "builtin": { + "name": "bls12_381_g2_add", + "activate_at": "0x7fffffffffffff", + "pricing": { + "bls12_const_operations": { "price": 4500 } + } + } + }, + "000000000000000000000000000000000000000e": { + "builtin": { + "name": "bls12_381_g2_mul", + "activate_at": "0x7fffffffffffff", + "pricing": { + "bls12_const_operations": { "price": 55000 } + } + } + }, + "000000000000000000000000000000000000000f": { + "builtin": { + "name": "bls12_381_g2_multiexp", + "activate_at": "0x7fffffffffffff", + "pricing": { + "bls12_g2_multiexp": { "base": 55000 } + } + } + }, + "0000000000000000000000000000000000000010": { + "builtin": { + "name": "bls12_381_pairing", + "activate_at": "0x7fffffffffffff", + "pricing": { + "bls12_pairing": { "base": 115000, "pair": 23000 } + } + } + }, + "0000000000000000000000000000000000000011": { + "builtin": { + "name": "bls12_381_fp_to_g1", + "activate_at": "0x7fffffffffffff", + "pricing": { + "bls12_const_operations": { "price": 5500 } + } + } + }, + "0000000000000000000000000000000000000012": { + "builtin": { + "name": "bls12_381_fp2_to_g2", + "activate_at": "0x7fffffffffffff", + "pricing": { + "bls12_const_operations": { "price": 110000 } + } + } + }, "0x3282791d6fd713f1e94f4bfd565eaa78b3a0599d": { "balance": "0x487a9a304539440000" }, diff --git a/params/parity.json.d/ropsten.json b/params/parity.json.d/ropsten.json index 8d37b294a954..d877a28c2c9e 100644 --- a/params/parity.json.d/ropsten.json +++ b/params/parity.json.d/ropsten.json @@ -3591,7 +3591,6 @@ ] }, "nodes": [ - "enode://d6cb8cba18828397e22e8852324af7e970b57cadbbd94aba6124790d1895728311b1f274e45d44a7a22b4276726903130a11ac2de19af5bc9294998f948eaad4@144.217.72.209:30303", "enode://94c15d1b9e2fe7ce56e458b9a3b672ef11894ddedd0c6f247e0f1d3487f52b66208fb4aeb8179fce6e3a749ea93ed147c37976d67af557508d199d9594c35f09@192.81.208.223:30303", "enode://30b7ab30a01c124a6cceca36863ece12c4f5fa68e3ba9b0b51407ccc002eeed3b3102d20a88f1c1d3c3154e2449317b8ef95090e77b312d5cc39354f86d5d606@52.176.7.10:30303", "enode://865a63255b3bb68023b6bffd5095118fcc13e79dcf014fe4e47e065c350c7cc72af2e53eff895f11ba1bbb6a2b33271c1116ee870f266618eadfc2e78aa7349c@52.176.100.77:30303", diff --git a/params/parity.json.d/transition_test.json b/params/parity.json.d/transition_test.json deleted file mode 100644 index ea26ade2fbe4..000000000000 --- a/params/parity.json.d/transition_test.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "name": "Transition consensus test spec template", - "engine": { - "Ethash": { - "params": { - "minimumDifficulty": "0x020000", - "difficultyBoundDivisor": "0x0800", - "durationLimit": "0x0d", - "blockReward": { - "0x0": "0x4563918244F40000", - "0x5": "0x29A2241AF62C0000" - }, - "homesteadTransition": "0", - "eip100bTransition": "5", - "difficultyBombDelays": { - "5": 3000000 - } - } - } - }, - "params": { - "gasLimitBoundDivisor": "0x0400", - "registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b", - "accountStartNonce": "0x00", - "maximumExtraDataSize": "0x20", - "minGasLimit": "0x1388", - "networkID" : "0x1", - "maxCodeSize": 24576, - "maxCodeSizeTransition": "0", - "eip150Transition": "0", - "eip155Transition": "0", - "eip160Transition": "0", - "eip161abcTransition": "0", - "eip161dTransition": "0", - "eip98Transition": "5", - "eip140Transition": "5", - "eip211Transition": "5", - "eip214Transition": "5", - "eip658Transition": "5" - }, - "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": "0x5", "pricing": { "modexp": { "divisor": 20 } } } }, - "0000000000000000000000000000000000000006": { - "builtin": { - "name": "alt_bn128_add", - "pricing": { - "5": { - "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": { - "5": { - "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": { - "5": { - "price": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 }} - }, - "0x7fffffffffffff": { - "info": "EIP 1108 transition", - "price": { "alt_bn128_pairing": { "base": 45000, "pair": 34000 }} - } - } - } - } - } -} From b20704a6726db7a8bdb5309207c028d4f4355412 Mon Sep 17 00:00:00 2001 From: meows Date: Mon, 27 Jul 2020 07:07:58 -0500 Subject: [PATCH 5/8] tests: update test spec filenames in test suite Files were renamed at openethereum/openethereum. The generated tests will need to be regenerated as well, since they include the filenames and shasums of the test spec files. Signed-off-by: meows params/parity.json.d/sync-parity-remote.sh: !squashme - fix typo in test name Signed-off-by: meows tests: !squashme fix typo in generate config:file map Signed-off-by: meows params/parity.json.d/eip158_to_byzantiumat5_test.json,params/parity.json.d/eip158_to_byzantiumat5_test.json.json: !squashme fix filepath for parity byzantiumat5 test" Signed-off-by: meows --- .../eip158_to_byzantiumat5_test.json | 104 ++++++++++++++++++ .../eip158_to_byzantiumat5_test.json.json | 1 - params/parity.json.d/sync-parity-remote.sh | 2 +- tests/params.go | 4 +- 4 files changed, 107 insertions(+), 4 deletions(-) create mode 100644 params/parity.json.d/eip158_to_byzantiumat5_test.json delete mode 100644 params/parity.json.d/eip158_to_byzantiumat5_test.json.json diff --git a/params/parity.json.d/eip158_to_byzantiumat5_test.json b/params/parity.json.d/eip158_to_byzantiumat5_test.json new file mode 100644 index 000000000000..cd90afa7503a --- /dev/null +++ b/params/parity.json.d/eip158_to_byzantiumat5_test.json @@ -0,0 +1,104 @@ +{ + "name": "EIP158 to byzantium (test)", + "engine": { + "Ethash": { + "params": { + "minimumDifficulty": "0x020000", + "difficultyBoundDivisor": "0x0800", + "durationLimit": "0x0d", + "blockReward": { + "0x0": "0x4563918244F40000", + "0x5": "0x29A2241AF62C0000" + }, + "homesteadTransition": "0", + "eip100bTransition": "5", + "difficultyBombDelays": { + "5": 3000000 + } + } + } + }, + "params": { + "gasLimitBoundDivisor": "0x0400", + "registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b", + "accountStartNonce": "0x00", + "maximumExtraDataSize": "0x20", + "minGasLimit": "0x1388", + "networkID" : "0x1", + "maxCodeSize": 24576, + "maxCodeSizeTransition": "0", + "eip150Transition": "0", + "eip155Transition": "0", + "eip160Transition": "0", + "eip161abcTransition": "0", + "eip161dTransition": "0", + "eip98Transition": "5", + "eip140Transition": "5", + "eip211Transition": "5", + "eip214Transition": "5", + "eip658Transition": "5" + }, + "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": "0x5", "pricing": { "modexp": { "divisor": 20 } } } }, + "0000000000000000000000000000000000000006": { + "builtin": { + "name": "alt_bn128_add", + "pricing": { + "5": { + "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": { + "5": { + "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": { + "5": { + "price": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 }} + }, + "0x7fffffffffffff": { + "info": "EIP 1108 transition", + "price": { "alt_bn128_pairing": { "base": 45000, "pair": 34000 }} + } + } + } + } + } +} diff --git a/params/parity.json.d/eip158_to_byzantiumat5_test.json.json b/params/parity.json.d/eip158_to_byzantiumat5_test.json.json deleted file mode 100644 index 1becba2bb0a8..000000000000 --- a/params/parity.json.d/eip158_to_byzantiumat5_test.json.json +++ /dev/null @@ -1 +0,0 @@ -404: Not Found \ No newline at end of file diff --git a/params/parity.json.d/sync-parity-remote.sh b/params/parity.json.d/sync-parity-remote.sh index 00a07cad345f..0cb9b125e84d 100755 --- a/params/parity.json.d/sync-parity-remote.sh +++ b/params/parity.json.d/sync-parity-remote.sh @@ -23,7 +23,7 @@ specs=( "test-specs/constantinople_test" "test-specs/constantinople_fix_test" "test-specs/istanbul_test" - "test-specs/eip158_to_byzantiumat5_test.json" + "test-specs/eip158_to_byzantiumat5_test" "foundation" "goerli" diff --git a/tests/params.go b/tests/params.go index 347ba408a6a6..56104a9a9fd7 100644 --- a/tests/params.go +++ b/tests/params.go @@ -58,8 +58,8 @@ var MapForkNameChainspecFileState = map[string]string{ "EIP158": "eip161_test.json", "Byzantium": "byzantium_test.json", "Constantinople": "constantinople_test.json", - "ConstantinopleFix": "st_peters_test.json", - "EIP158ToByzantiumAt5": "transition_test.json", + "ConstantinopleFix": "constantinople_fix_test.json", + "EIP158ToByzantiumAt5": "eip158_to_byzantiumat5_test.json", "Istanbul": "istanbul_test.json", "ETC_Atlantis": "classic_atlantis_test.json", "ETC_Agharta": "classic_agharta_test.json", From 2b286534296258aafd0a86a4917049c361a074d5 Mon Sep 17 00:00:00 2001 From: meows Date: Mon, 27 Jul 2020 07:20:19 -0500 Subject: [PATCH 6/8] tests: log extra debug information in case of configuration failure Signed-off-by: meows --- tests/params.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/params.go b/tests/params.go index 56104a9a9fd7..3a842ab65e08 100644 --- a/tests/params.go +++ b/tests/params.go @@ -210,7 +210,7 @@ func init() { if wde != nil { panic(wde) } - panic(fmt.Sprintf("failed to find chainspec, wd: %s", wd)) + panic(fmt.Sprintf("failed to find chainspec, wd: %s, config: %v/file: %v", wd, k, v)) } else if err != nil { panic(err) } From 4b8d352866a17c987617ad890f2fcacaf9637614 Mon Sep 17 00:00:00 2001 From: meows Date: Mon, 27 Jul 2020 07:25:12 -0500 Subject: [PATCH 7/8] tests/testdata: bump submodule to latest core-geth tests branch Regenerated tests included the latest changes from openethereum/openethereum. These changes were renamings of test spec files, transition_test -> eip158_to_byzantiumat5 and st_peters -> constantinople_fix Signed-off-by: meows --- tests/testdata | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testdata b/tests/testdata index 44905c4e54d0..72bdca9504c7 160000 --- a/tests/testdata +++ b/tests/testdata @@ -1 +1 @@ -Subproject commit 44905c4e54d030b0cc9fc873820474f302e9f74c +Subproject commit 72bdca9504c73ea4b017451fa90f3b6d527730f9 From 5089becdd006ca8ca45d029bea95133252c8f534 Mon Sep 17 00:00:00 2001 From: meows Date: Mon, 27 Jul 2020 09:03:51 -0500 Subject: [PATCH 8/8] parity: add parity eip2537 configurator implementation Install support for OpenEthereum data type for EIP2537 configuration feature. EIP2537 adds 9 precompiles for BLS12-381 curve. Signed-off-by: meows parity: (lint) goimports -w Signed-off-by: meows parity: !squashme fix typo Signed-off-by: meows --- params/types/parity/parity.go | 18 ++ params/types/parity/parity_configurator.go | 178 ++++++++++++++++-- .../types/parity/parity_configurator_test.go | 48 +++++ 3 files changed, 224 insertions(+), 20 deletions(-) diff --git a/params/types/parity/parity.go b/params/types/parity/parity.go index c7ede244c071..e0927df68f6a 100644 --- a/params/types/parity/parity.go +++ b/params/types/parity/parity.go @@ -314,6 +314,11 @@ type ParityChainSpecPricing struct { // Blake2F is the price per round of Blake2 compression Blake2F *ParityChainSpecBlakePricing `json:"blake2_f,omitempty"` + + BLS12ConstOperation *ParityChainSpecBLS12ConstOperationPricing `json:"bls12_const_operations,omitempty"` + BLS12G1MultiExp *ParityChainSpecBLS12MultiExpPricing `json:"bls12_g1_multiexp,omitempty"` + BLS12G2MultiExp *ParityChainSpecBLS12MultiExpPricing `json:"bls12_g2_multiexp,omitempty"` + BLS12Pairing *ParityChainSpecBLS12PairingPricing `json:"bls12_pairing,omitempty"` } type ParityChainSpecLinearPricing struct { @@ -341,6 +346,19 @@ type ParityChainSpecBlakePricing struct { GasPerRound uint64 `json:"gas_per_round"` } +type ParityChainSpecBLS12ConstOperationPricing struct { + Price uint64 `json:"price"` +} + +type ParityChainSpecBLS12MultiExpPricing struct { + Base uint64 `json:"base"` +} + +type ParityChainSpecBLS12PairingPricing struct { + Base uint64 `json:"base"` + Pair uint64 `json:"pair"` +} + func (spec *ParityChainSpec) GetPrecompile(address common.Address, pricing ParityChainSpecPricing) *ParityU64 { if spec.Accounts == nil { return nil diff --git a/params/types/parity/parity_configurator.go b/params/types/parity/parity_configurator.go index cc2bb057f505..2b135a5b1b54 100644 --- a/params/types/parity/parity_configurator.go +++ b/params/types/parity/parity_configurator.go @@ -459,30 +459,168 @@ func (spec *ParityChainSpec) SetEIP1108Transition(n *uint64) error { return nil } -func (c *ParityChainSpec) GetECIP1080Transition() *uint64 { - return c.Params.ECIP1080Transition.Uint64P() -} - -func (c *ParityChainSpec) SetECIP1080Transition(n *uint64) error { - c.Params.ECIP1080Transition = new(ParityU64).SetUint64(n) - return nil -} - -func (c *ParityChainSpec) GetEIP1706Transition() *uint64 { - return c.Params.EIP1706Transition.Uint64P() // FIXME when+if upstream implements -} +func (spec *ParityChainSpec) GetECIP1080Transition() *uint64 { + return spec.Params.ECIP1080Transition.Uint64P() +} + +func (spec *ParityChainSpec) SetECIP1080Transition(n *uint64) error { + spec.Params.ECIP1080Transition = new(ParityU64).SetUint64(n) + return nil +} + +func (spec *ParityChainSpec) GetEIP1706Transition() *uint64 { + return spec.Params.EIP1706Transition.Uint64P() // FIXME when+if upstream implements +} + +func (spec *ParityChainSpec) SetEIP1706Transition(n *uint64) error { + spec.Params.EIP1706Transition = new(ParityU64).SetUint64(n) + return nil +} + +// GetEIP2537Transition returns the EIP2537 activation, if any. +// https://eips.ethereum.org/EIPS/eip-2537 +func (spec *ParityChainSpec) GetEIP2537Transition() *uint64 { + var eip2537Precompiles = map[string]*uint64{ + "bls12_381_g1_add": spec.GetPrecompile(common.BytesToAddress([]byte{0xa}), + ParityChainSpecPricing{ + BLS12ConstOperation: &ParityChainSpecBLS12ConstOperationPricing{ + Price: 600, + }, + }).Uint64P(), + "bls12_381_g1_mul": spec.GetPrecompile(common.BytesToAddress([]byte{0xb}), + ParityChainSpecPricing{ + BLS12ConstOperation: &ParityChainSpecBLS12ConstOperationPricing{ + Price: 12000, + }, + }).Uint64P(), + "bls12_381_g1_multiexp": spec.GetPrecompile(common.BytesToAddress([]byte{0xc}), + ParityChainSpecPricing{ + BLS12G1MultiExp: &ParityChainSpecBLS12MultiExpPricing{ + Base: 12000, + }, + }).Uint64P(), + "bls12_381_g2_add": spec.GetPrecompile(common.BytesToAddress([]byte{0xd}), + ParityChainSpecPricing{ + BLS12ConstOperation: &ParityChainSpecBLS12ConstOperationPricing{ + Price: 4500, + }, + }).Uint64P(), + "bls12_381_g2_mul": spec.GetPrecompile(common.BytesToAddress([]byte{0xe}), + ParityChainSpecPricing{ + BLS12ConstOperation: &ParityChainSpecBLS12ConstOperationPricing{ + Price: 55000, + }, + }).Uint64P(), + "bls12_381_g2_multiexp": spec.GetPrecompile(common.BytesToAddress([]byte{0xf}), + ParityChainSpecPricing{ + BLS12G2MultiExp: &ParityChainSpecBLS12MultiExpPricing{ + Base: 55000, + }, + }).Uint64P(), + "bls12_381_pairing": spec.GetPrecompile(common.BytesToAddress([]byte{0x10}), + ParityChainSpecPricing{ + BLS12Pairing: &ParityChainSpecBLS12PairingPricing{ + Base: 115000, + Pair: 23000, + }, + }).Uint64P(), + "bls12_381_fp_to_g1": spec.GetPrecompile(common.BytesToAddress([]byte{0x11}), + ParityChainSpecPricing{ + BLS12ConstOperation: &ParityChainSpecBLS12ConstOperationPricing{ + Price: 5500, + }, + }).Uint64P(), + "bls12_381_fp2_to_g2": spec.GetPrecompile(common.BytesToAddress([]byte{0x12}), + ParityChainSpecPricing{ + BLS12ConstOperation: &ParityChainSpecBLS12ConstOperationPricing{ + Price: 110000, + }, + }).Uint64P(), + } -func (c *ParityChainSpec) SetEIP1706Transition(n *uint64) error { - c.Params.EIP1706Transition = new(ParityU64).SetUint64(n) - return nil + var activation *uint64 + for _, v := range eip2537Precompiles { + if v == nil { + return nil + } + if activation == nil { + activation = v + continue + } + if *v != *activation { + return nil + } + } + return activation } -func (c *ParityChainSpec) GetEIP2537Transition() *uint64 { - return c.Params.EIP2537Transition.Uint64P() // FIXME when+if upstream implements -} +func (spec *ParityChainSpec) SetEIP2537Transition(n *uint64) error { + type setter struct { + name string + pricing ParityChainSpecPricing + } + var eip2537Precompiles = []setter{ + {"bls12_381_g1_add", + ParityChainSpecPricing{ + BLS12ConstOperation: &ParityChainSpecBLS12ConstOperationPricing{ + Price: 600, + }, + }}, + {"bls12_381_g1_mul", + ParityChainSpecPricing{ + BLS12ConstOperation: &ParityChainSpecBLS12ConstOperationPricing{ + Price: 12000, + }, + }}, + {"bls12_381_g1_multiexp", + ParityChainSpecPricing{ + BLS12G1MultiExp: &ParityChainSpecBLS12MultiExpPricing{ + Base: 12000, + }, + }}, + {"bls12_381_g2_add", + ParityChainSpecPricing{ + BLS12ConstOperation: &ParityChainSpecBLS12ConstOperationPricing{ + Price: 4500, + }, + }}, + {"bls12_381_g2_mul", + ParityChainSpecPricing{ + BLS12ConstOperation: &ParityChainSpecBLS12ConstOperationPricing{ + Price: 55000, + }, + }}, + {"bls12_381_g2_multiexp", + ParityChainSpecPricing{ + BLS12G2MultiExp: &ParityChainSpecBLS12MultiExpPricing{ + Base: 55000, + }, + }}, + {"bls12_381_pairing", + ParityChainSpecPricing{ + BLS12Pairing: &ParityChainSpecBLS12PairingPricing{ + Base: 115000, + Pair: 23000, + }, + }}, + {"bls12_381_fp_to_g1", + ParityChainSpecPricing{ + BLS12ConstOperation: &ParityChainSpecBLS12ConstOperationPricing{ + Price: 5500, + }, + }}, + {"bls12_381_fp2_to_g2", + ParityChainSpecPricing{ + BLS12ConstOperation: &ParityChainSpecBLS12ConstOperationPricing{ + Price: 110000, + }, + }}, + } -func (c *ParityChainSpec) SetEIP2537Transition(n *uint64) error { - c.Params.EIP2537Transition = new(ParityU64).SetUint64(n) + var addr uint8 = 0xa // EIP2537 BLS precompiles occupy 0xa:0x12 (9 total) + for i, v := range eip2537Precompiles { + spec.SetPrecompile2(common.BytesToAddress([]byte{addr + uint8(i)}), v.name, n, v.pricing) + } return nil } diff --git a/params/types/parity/parity_configurator_test.go b/params/types/parity/parity_configurator_test.go index b081ba33fc60..801fbd60caed 100644 --- a/params/types/parity/parity_configurator_test.go +++ b/params/types/parity/parity_configurator_test.go @@ -17,6 +17,8 @@ package parity import ( + "encoding/json" + "io/ioutil" "testing" "github.com/ethereum/go-ethereum/common/math" @@ -57,3 +59,49 @@ func TestParityChainSpec_GetSetUint64(t *testing.T) { t.Error("not right answer") } } + +func TestParityChainSpec_GetEIP2537(t *testing.T) { + specFile := "../../parity.json.d/foundation.json" + b, err := ioutil.ReadFile(specFile) + if err != nil { + t.Fatalf("read file: %v", err) + } + spec := &ParityChainSpec{} + err = json.Unmarshal(b, spec) + if err != nil { + t.Fatalf("unmarshal: %v", err) + } + activateNumberRaw := "0x7fffffffffffff" + var activateNumber = new(math.HexOrDecimal256) + err = activateNumber.UnmarshalText([]byte(activateNumberRaw)) + if err != nil { + t.Fatalf("unmarshal text: %v", err) + } + t.Logf("activate number: %v raw=%v", activateNumber.ToInt(), activateNumberRaw) + + eip2537activation := spec.GetEIP2537Transition() + if eip2537activation == nil { + t.Fatal("nil activation") + } + if *eip2537activation != activateNumber.ToInt().Uint64() { + t.Fatal("wrong activation") + } +} + +func TestParityChainSpec_SetEIP2537(t *testing.T) { + spec := &ParityChainSpec{} + activateAt := uint64(42) + err := spec.SetEIP2537Transition(&activateAt) + if err != nil { + t.Fatalf("set: %v", err) + } + got := spec.GetEIP2537Transition() + if got == nil || *got != activateAt { + b, err := json.MarshalIndent(spec, "", " ") + if err != nil { + t.Fatalf("marshal: %v", err) + } + t.Log(string(b)) + t.Fatalf("empty got") + } +}