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. --- .../modexpRandomInput_d0g0v0Filler.json | 6 +-- .../modexpRandomInput_d0g1v0Filler.json | 6 +-- .../modexpRandomInput_d1g0v0Filler.json | 8 ++-- .../modexpRandomInput_d1g1v0Filler.json | 6 +-- .../modexpRandomInput_d2g0v0Filler.json | 55 ++++++++++++++++++++++ .../modexpRandomInput_d2g1v0Filler.json | 55 ++++++++++++++++++++++ 6 files changed, 123 insertions(+), 13 deletions(-) create mode 100644 src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d2g0v0Filler.json create mode 100644 src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d2g1v0Filler.json (limited to 'src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2') diff --git a/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d0g0v0Filler.json b/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d0g0v0Filler.json index c4c88cb72..7676c7b61 100644 --- a/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d0g0v0Filler.json +++ b/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d0g0v0Filler.json @@ -11,11 +11,11 @@ "transactions" : [ { "data" : "0x00000000000000000000000000000000000000000000000000000000000000e300000000000000000000000000000000000000000000000000", - "gasLimit" : "0x01adb0", + "gasLimit" : "0x0ad570", "gasPrice" : "0x01", "nonce" : "0x00", - "r" : "0xf9207991cd3c80532e96a7d42ec3c587119e0b7d1a2efa9520e1a0a7679d24fe", - "s" : "0x6878ac7c44e52d45931dba9f46af422795290550f3ce2b3c3699fc38bf5d01e3", + "r" : "0x41fd5511dbb403047bc5498f30d75f2dd2fdeac98a103807c31900eb17bc10ef", + "s" : "0x0bb0349ba6a48b040494133fba7cdcf86ab4ab130f0a570fea91569622e9612f", "to" : "0x0000000000000000000000000000000000000005", "v" : "0x1b", "value" : "0x00" diff --git a/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d0g1v0Filler.json b/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d0g1v0Filler.json index 341d07329..99576447a 100644 --- a/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d0g1v0Filler.json +++ b/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d0g1v0Filler.json @@ -11,11 +11,11 @@ "transactions" : [ { "data" : "0x00000000000000000000000000000000000000000000000000000000000000e300000000000000000000000000000000000000000000000000", - "gasLimit" : "0x030d40", + "gasLimit" : "0x6acfc0", "gasPrice" : "0x01", "nonce" : "0x00", - "r" : "0x9d6574ed8338a7a502721de6f4ea15756c0b4ceedc035d2d27123f2ebafbd3ad", - "s" : "0x16fe50db6ffae05cf22d7253da75020d212a942ca3257c8de6981b5eb1fed118", + "r" : "0xb0f96af4a341d9a1346fdd37f633eb5017ff95d6312b4cbd7533a21dfecb3302", + "s" : "0x1b4b565910d9767b232e0d39d3bd997fa95a02093269bb15d22239d4135fefeb", "to" : "0x0000000000000000000000000000000000000005", "v" : "0x1c", "value" : "0x00" diff --git a/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d1g0v0Filler.json b/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d1g0v0Filler.json index f60774e40..053cc4474 100644 --- a/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d1g0v0Filler.json +++ b/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d1g0v0Filler.json @@ -11,13 +11,13 @@ "transactions" : [ { "data" : "0x00000000008000000000000000000000000000000000000000000000000000000000000400000000000000000000000a", - "gasLimit" : "0x01adb0", + "gasLimit" : "0x0ad570", "gasPrice" : "0x01", "nonce" : "0x00", - "r" : "0xae2d1d1f18f64abcf824eefb326271c7ebb264cc937d8113bb70f57131f00e32", - "s" : "0x357aa48004b6fcd243d26f98e58da74e1066519306d464b01934089ca293b9be", + "r" : "0x7f92f6c87aa5aae5de02f4fef7b8625a4705dcc83101f5064e85d0451d6f7061", + "s" : "0x17646ae6179dc3564553aa73ff108c14e72d191c147bfa38b4885b7b88548c23", "to" : "0x0000000000000000000000000000000000000005", - "v" : "0x1c", + "v" : "0x1b", "value" : "0x00" } ], diff --git a/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d1g1v0Filler.json b/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d1g1v0Filler.json index 1782501ca..ad835e9a0 100644 --- a/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d1g1v0Filler.json +++ b/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d1g1v0Filler.json @@ -11,11 +11,11 @@ "transactions" : [ { "data" : "0x00000000008000000000000000000000000000000000000000000000000000000000000400000000000000000000000a", - "gasLimit" : "0x030d40", + "gasLimit" : "0x6acfc0", "gasPrice" : "0x01", "nonce" : "0x00", - "r" : "0x49c4572c88fb154ace62e09d8ceebfd7df34d4a7642fbb418d4a1ef275960577", - "s" : "0x21a786ac84b27576174ec3e3370e49d6b95ae5efad187ff5e78bad37b0161396", + "r" : "0x1146ab4d2425f6d4771a02c80223b8ba38e236b06b08062041b6d173137dac48", + "s" : "0x60be39d14b2fd099aaca849e4785dbc283612fb335239c3d37056afc9edfe998", "to" : "0x0000000000000000000000000000000000000005", "v" : "0x1b", "value" : "0x00" diff --git a/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d2g0v0Filler.json b/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d2g0v0Filler.json new file mode 100644 index 000000000..3bf706dd8 --- /dev/null +++ b/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d2g0v0Filler.json @@ -0,0 +1,55 @@ +{ + "modexpRandomInput_d2g0v0" : { + "blocks" : [ + { + "blockHeaderPremine" : { + "difficulty" : "0x020000", + "gasLimit" : "0x05f5e100", + "timestamp" : "0x03e8", + "updatePoW" : "1" + }, + "transactions" : [ + { + "data" : "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001147000000000000000000000000000000000000000000000000000000000061660350000000000000000000000000000000000000000000000000000000000000008", + "gasLimit" : "0x0ad570", + "gasPrice" : "0x01", + "nonce" : "0x00", + "r" : "0xa61dd9f5a65cd90ee4caf2b2660743384f5777328b536d21851d94fc8bc17b7e", + "s" : "0x135b6e1801f3a2b34b301dd8667e859b58a4b876c7d506b242957a3b33e9f77d", + "to" : "0x0000000000000000000000000000000000000005", + "v" : "0x1c", + "value" : "0x00" + } + ], + "uncleHeaders" : [ + ] + } + ], + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "3535353535353535353535353535353535353535", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "0x05f5e100", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x03b6", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x3635c9adc5dea00000", + "code" : "", + "nonce" : "0x00", + "storage" : { + } + } + } + } +} \ No newline at end of file diff --git a/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d2g1v0Filler.json b/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d2g1v0Filler.json new file mode 100644 index 000000000..0c98bc0f4 --- /dev/null +++ b/src/BlockchainTestsFiller/GeneralStateTests/stPreCompiledContracts2/modexpRandomInput_d2g1v0Filler.json @@ -0,0 +1,55 @@ +{ + "modexpRandomInput_d2g1v0" : { + "blocks" : [ + { + "blockHeaderPremine" : { + "difficulty" : "0x020000", + "gasLimit" : "0x05f5e100", + "timestamp" : "0x03e8", + "updatePoW" : "1" + }, + "transactions" : [ + { + "data" : "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001147000000000000000000000000000000000000000000000000000000000061660350000000000000000000000000000000000000000000000000000000000000008", + "gasLimit" : "0x6acfc0", + "gasPrice" : "0x01", + "nonce" : "0x00", + "r" : "0xb37d77a66c3e92e5bc6ce02c5cf681dc209534afb388b763837cff9400b6a69b", + "s" : "0x08d5cbe47b56954f8a061cfe20c4144f5331587210444a3d0d8b6cbc21869c", + "to" : "0x0000000000000000000000000000000000000005", + "v" : "0x1b", + "value" : "0x00" + } + ], + "uncleHeaders" : [ + ] + } + ], + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "3535353535353535353535353535353535353535", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "0x05f5e100", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x03b6", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x3635c9adc5dea00000", + "code" : "", + "nonce" : "0x00", + "storage" : { + } + } + } + } +} \ No newline at end of file -- cgit