From ba6a35c1f3f2b992279f3072e5f983522a64a5c9 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Fri, 13 Oct 2017 13:57:25 +0300 Subject: fuzzed test modexp input --- .../modexpRandomInputFiller.json | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/GeneralStateTestsFiller/stPreCompiledContracts2/modexpRandomInputFiller.json (limited to 'src/GeneralStateTestsFiller/stPreCompiledContracts2/modexpRandomInputFiller.json') diff --git a/src/GeneralStateTestsFiller/stPreCompiledContracts2/modexpRandomInputFiller.json b/src/GeneralStateTestsFiller/stPreCompiledContracts2/modexpRandomInputFiller.json new file mode 100644 index 000000000..d520f3635 --- /dev/null +++ b/src/GeneralStateTestsFiller/stPreCompiledContracts2/modexpRandomInputFiller.json @@ -0,0 +1,68 @@ +{ + "modexpRandomInput": { + "_info" : { + "comment" : "Fuzzed input discovered by Guido" + }, + "env": { + "currentCoinbase": "0x3535353535353535353535353535353535353535", + "currentDifficulty": "0x020000", + "currentGasLimit": "0x5f5e100", + "currentNumber": "0x1", + "currentTimestamp": "1000", + "previousHash": "0xc6745cf3cada515bbfb9573261c82547e0b8f9e3d5dd382e464704a84e47b5ad" + }, + "expect": [ + { + "indexes" : { + "data" : 0, + "gas" : 0, + "value" : -1 + }, + "network" : ["Byzantium"], + "result" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "999999999999999977128" + } + } + }, + { + "indexes" : { + "data" : 1, + "gas" : 0, + "value" : -1 + }, + "network" : ["Byzantium"], + "result" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "999999999999999890000" + } + } + } + ], + "pre": { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000000000000000000000", + "code" : "", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction": { + "data": [ +"0x00000000000000000000000000000000000000000000000000000000000000e300000000000000000000000000000000000000000000000000", +"0x00000000008000000000000000000000000000000000000000000000000000000000000400000000000000000000000a" + ], + "gasLimit": [ + "110000", "200000" + ], + "gasPrice": "1", + "nonce": "0", + "secretKey": "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to": "0x0000000000000000000000000000000000000005", + "value": [ + "0x" + ] + } + } +} -- cgit v1.2.3 From 6e80effa947d9581e5ef8c4e02a45725f5af4346 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Fri, 13 Oct 2017 15:34:21 +0300 Subject: modexp input test Consensus big in Parity: gas calculation of modexp is subject to overflow for certain inputs. Found via manual review. A case was found where consensus issue could be achieved in ~500K gas. --- .../modexpRandomInputFiller.json | 24 +++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'src/GeneralStateTestsFiller/stPreCompiledContracts2/modexpRandomInputFiller.json') diff --git a/src/GeneralStateTestsFiller/stPreCompiledContracts2/modexpRandomInputFiller.json b/src/GeneralStateTestsFiller/stPreCompiledContracts2/modexpRandomInputFiller.json index d520f3635..bc6f3057a 100644 --- a/src/GeneralStateTestsFiller/stPreCompiledContracts2/modexpRandomInputFiller.json +++ b/src/GeneralStateTestsFiller/stPreCompiledContracts2/modexpRandomInputFiller.json @@ -25,7 +25,7 @@ } } }, - { + { "indexes" : { "data" : 1, "gas" : 0, @@ -34,7 +34,20 @@ "network" : ["Byzantium"], "result" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "999999999999999890000" + "balance" : "999999999999999290000" + } + } + }, + { + "indexes" : { + "data" : 2, + "gas" : 1, + "value" : -1 + }, + "network" : ["Byzantium"], + "result" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "999999999999993000000" } } } @@ -51,15 +64,16 @@ "transaction": { "data": [ "0x00000000000000000000000000000000000000000000000000000000000000e300000000000000000000000000000000000000000000000000", -"0x00000000008000000000000000000000000000000000000000000000000000000000000400000000000000000000000a" +"0x00000000008000000000000000000000000000000000000000000000000000000000000400000000000000000000000a", +"0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001147000000000000000000000000000000000000000000000000000000000061660350000000000000000000000000000000000000000000000000000000000000008" ], "gasLimit": [ - "110000", "200000" + "710000", "7000000" ], "gasPrice": "1", "nonce": "0", "secretKey": "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to": "0x0000000000000000000000000000000000000005", + "to": "0x0000000000000000000000000000000000000005", "value": [ "0x" ] -- cgit v1.2.3