From 6030be247fbcb2fab4c724f7221d3664feae48a2 Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Mon, 18 Sep 2017 18:39:58 +0200 Subject: Add a test that fails before https://github.com/ethereum/cpp-ethereum/pull/4482 This PR adds a test on ecpairing where g1 is invalid while g2 is zero. cpp-ethereum before PR 4482 accidentially returned some answer in this case. It should throw. --- ...ne_point_with_g2_zero_and_g1_invalidFiller.json | 275 +++++++++++++++++++++ 1 file changed, 275 insertions(+) create mode 100644 src/GeneralStateTestsFiller/stZeroKnowledge/ecpairing_one_point_with_g2_zero_and_g1_invalidFiller.json (limited to 'src') diff --git a/src/GeneralStateTestsFiller/stZeroKnowledge/ecpairing_one_point_with_g2_zero_and_g1_invalidFiller.json b/src/GeneralStateTestsFiller/stZeroKnowledge/ecpairing_one_point_with_g2_zero_and_g1_invalidFiller.json new file mode 100644 index 000000000..7e351ca97 --- /dev/null +++ b/src/GeneralStateTestsFiller/stZeroKnowledge/ecpairing_one_point_with_g2_zero_and_g1_invalidFiller.json @@ -0,0 +1,275 @@ +{ + "ecpairing_one_point_with_g2_zero_and_g1_invalid": { + "env": { + "currentCoinbase": "0x3535353535353535353535353535353535353535", + "currentDifficulty": "0x020000", + "currentGasLimit": "0x5f5e100", + "currentNumber": "0x01", + "currentTimestamp": "1000", + "previousHash": "0xc6745cf3cada515bbfb9573261c82547e0b8f9e3d5dd382e464704a84e47b5ad" + }, + "pre": { + "24143873e0e0815fdcbcffdbe09c979cbf9ad013": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + }, + "0000000000000000000000000000000000000001": { + "storage": {}, + "nonce": "0", + "balance": "1", + "code": "0x" + }, + "dceceaf3fc5c0a63d195d69b1a90011b7b19650d": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + }, + "c305c901078781c232a2a521c2af7980f8385ee9": { + "storage": { + "0x00": "0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6" + }, + "nonce": "1", + "balance": "0", + "code": "0x600035601c52740100000000000000000000000000000000000000006020526fffffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff000000000000000000000000000000016060527402540be3fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffdabf41c00000000000000000000000002540be40060a0526330c8d1da600051141561012c576107806004356004013511151558576004356004013560200160043560040161014037602061092061014051610160600060086305f5e0fff11558576020610900526109006040806109608284600060046018f150505061096080516020820120905060005561096060206020820352604081510160206001820306601f820103905060208203f350005b" + }, + "0000000000000000000000000000000000000005": { + "storage": {}, + "nonce": "0", + "balance": "1", + "code": "0x" + }, + "0000000000000000000000000000000000000008": { + "storage": {}, + "nonce": "0", + "balance": "1", + "code": "0x" + }, + "13cbb8d99c6c4e0f2728c7d72606e78a29c4e224": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + }, + "0000000000000000000000000000000000000003": { + "storage": {}, + "nonce": "0", + "balance": "1", + "code": "0x" + }, + "82a978b3f5962a5b0957d9ee9eef472ee55b42f1": { + "storage": {}, + "nonce": "6", + "balance": "999999999999007220", + "code": "0x" + }, + "0000000000000000000000000000000000000006": { + "storage": {}, + "nonce": "0", + "balance": "1", + "code": "0x" + }, + "0000000000000000000000000000000000000007": { + "storage": {}, + "nonce": "0", + "balance": "1", + "code": "0x" + }, + "598443f1880ef585b21f1d7585bd0577402861e5": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + }, + "7d577a597b2742b498cb5cf0c26cdcd726d39e6e": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + }, + "0000000000000000000000000000000000000004": { + "storage": {}, + "nonce": "0", + "balance": "1", + "code": "0x" + }, + "e0fc04fa2d34a66b779fd5cee748268032a146c0": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + }, + "0000000000000000000000000000000000000002": { + "storage": {}, + "nonce": "0", + "balance": "1", + "code": "0x" + }, + "77db2bebba79db42a978f896968f4afce746ea1f": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + }, + "10a1c1cb95c92ec31d3f22c66eef1d9f3f258c6b": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + }, + "90f0b1ebbba1c1936aff7aaf20a7878ff9e04b6c": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + } + }, + "transaction": { + "data": [ + "0x30c8d1da000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ], + "gasLimit": [ + "0x38c68", "90000", "110000", "200000" + ], + "gasPrice": "0x1", + "nonce": "0x6", + "secretKey": "0x044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", + "to": "0xc305c901078781c232a2a521c2af7980f8385ee9", + "value": [ + "0x" + ] + }, + "expect": [ + { + "indexes": { + "data": 0, + "gas": 0, + "value": 0 + }, + "network": [ + "Byzantium" + ], + "result": { + "24143873e0e0815fdcbcffdbe09c979cbf9ad013": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + }, + "0000000000000000000000000000000000000001": { + "storage": {}, + "nonce": "0", + "balance": "1", + "code": "0x" + }, + "dceceaf3fc5c0a63d195d69b1a90011b7b19650d": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + }, + "c305c901078781c232a2a521c2af7980f8385ee9": { + "storage": { + "0x00": "0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6" + }, + "nonce": "1", + "balance": "0", + "code": "0x600035601c52740100000000000000000000000000000000000000006020526fffffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff000000000000000000000000000000016060527402540be3fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffdabf41c00000000000000000000000002540be40060a0526330c8d1da600051141561012c576107806004356004013511151558576004356004013560200160043560040161014037602061092061014051610160600060086305f5e0fff11558576020610900526109006040806109608284600060046018f150505061096080516020820120905060005561096060206020820352604081510160206001820306601f820103905060208203f350005b" + }, + "0000000000000000000000000000000000000005": { + "storage": {}, + "nonce": "0", + "balance": "1", + "code": "0x" + }, + "0000000000000000000000000000000000000008": { + "storage": {}, + "nonce": "0", + "balance": "1", + "code": "0x" + }, + "13cbb8d99c6c4e0f2728c7d72606e78a29c4e224": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + }, + "0000000000000000000000000000000000000003": { + "storage": {}, + "nonce": "0", + "balance": "1", + "code": "0x" + }, + "82a978b3f5962a5b0957d9ee9eef472ee55b42f1": { + "storage": {}, + "nonce": "7", + "code": "0x" + }, + "0000000000000000000000000000000000000006": { + "storage": {}, + "nonce": "0", + "balance": "1", + "code": "0x" + }, + "0000000000000000000000000000000000000007": { + "storage": {}, + "nonce": "0", + "balance": "1", + "code": "0x" + }, + "598443f1880ef585b21f1d7585bd0577402861e5": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + }, + "7d577a597b2742b498cb5cf0c26cdcd726d39e6e": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + }, + "0000000000000000000000000000000000000004": { + "storage": {}, + "nonce": "0", + "balance": "1", + "code": "0x" + }, + "e0fc04fa2d34a66b779fd5cee748268032a146c0": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + }, + "0000000000000000000000000000000000000002": { + "storage": {}, + "nonce": "0", + "balance": "1", + "code": "0x" + }, + "77db2bebba79db42a978f896968f4afce746ea1f": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + }, + "10a1c1cb95c92ec31d3f22c66eef1d9f3f258c6b": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + }, + "90f0b1ebbba1c1936aff7aaf20a7878ff9e04b6c": { + "storage": {}, + "nonce": "0", + "balance": "1000000000000000000", + "code": "0x" + } + } + } + ], + "explanation": "Puts the given data into the ECPAIRING precompile" + } +} -- cgit v1.2.3 From 56b751c7ba69ebd9f6328c33c8df9d7b09644966 Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Tue, 19 Sep 2017 12:43:33 +0200 Subject: Update the comment --- .../ecpairing_one_point_with_g2_zero_and_g1_invalidFiller.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/GeneralStateTestsFiller/stZeroKnowledge/ecpairing_one_point_with_g2_zero_and_g1_invalidFiller.json b/src/GeneralStateTestsFiller/stZeroKnowledge/ecpairing_one_point_with_g2_zero_and_g1_invalidFiller.json index 7e351ca97..1c9da738b 100644 --- a/src/GeneralStateTestsFiller/stZeroKnowledge/ecpairing_one_point_with_g2_zero_and_g1_invalidFiller.json +++ b/src/GeneralStateTestsFiller/stZeroKnowledge/ecpairing_one_point_with_g2_zero_and_g1_invalidFiller.json @@ -1,5 +1,8 @@ { "ecpairing_one_point_with_g2_zero_and_g1_invalid": { + "_info" : { + "comment" : "Use the ecpairing checker with one point, where g1 is not on the curve but g2 is zero. cpp-ethereum once had a bug in this case; as soon as cpp-ethereum recognized g2 zero, it returned something without checking the validity of g1" + }, "env": { "currentCoinbase": "0x3535353535353535353535353535353535353535", "currentDifficulty": "0x020000", @@ -269,7 +272,6 @@ } } } - ], - "explanation": "Puts the given data into the ECPAIRING precompile" + ] } } -- cgit v1.2.3