From 00b058ad25c514501a7d1625c12d066455c4818a Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Tue, 21 Apr 2015 17:09:32 +0200 Subject: [PATCH 01/28] avoid stack overflow and div by zero From 40125469256a17348fe9b8cd58cc8d59d16914b6 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Tue, 21 Apr 2015 18:00:12 +0200 Subject: [PATCH 02/28] add gasPrice tests From 5f0de0523da8c864e43f60e4eb5193b5095e48cf Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Wed, 22 Apr 2015 12:17:00 +0200 Subject: [PATCH 03/28] fix StateLoader --- bcRPC_API_TestFiller.json | 579 -------------------------------------- 1 file changed, 579 deletions(-) delete mode 100644 bcRPC_API_TestFiller.json diff --git a/bcRPC_API_TestFiller.json b/bcRPC_API_TestFiller.json deleted file mode 100644 index b31f1fa48..000000000 --- a/bcRPC_API_TestFiller.json +++ /dev/null @@ -1,579 +0,0 @@ -{ - "RPC_API_Test" : { - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "131072", - "extraData" : "0x42", - "gasLimit" : "3141592", - "gasUsed" : "0", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "nonce" : "0x0102030405060708", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000000", - "nonce" : "0", - "code" : "", - "storage": {} - } - }, - "blocks" : [ - { - "transactions" : [ - { - "data" : "create contract: 6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "data" : "0x5b5b610705806100106000396000f3006000357c010000000000000000000000000000000000000000000000000000000090048063102accc11461012c57806312a7b9141461013a5780631774e6461461014c5780631e26fd331461015d5780631f9030371461016e578063343a875d1461018057806338cc4831146101955780634e7ad367146101bd57806357cb2fc4146101cb57806365538c73146101e057806368895979146101ee57806376bc21d9146102005780639a19a9531461020e5780639dc2c8f51461021f578063a53b1c1e1461022d578063a67808571461023e578063b61c05031461024c578063c2b12a731461025a578063d2282dc51461026b578063e30081a01461027c578063e8beef5b1461028d578063f38b06001461029b578063f5b53e17146102a9578063fd408767146102bb57005b6101346104d6565b60006000f35b61014261039b565b8060005260206000f35b610157600435610326565b60006000f35b6101686004356102c9565b60006000f35b610176610442565b8060005260206000f35b6101886103d3565b8060ff1660005260206000f35b61019d610413565b8073ffffffffffffffffffffffffffffffffffffffff1660005260206000f35b6101c56104c5565b60006000f35b6101d36103b7565b8060000b60005260206000f35b6101e8610454565b60006000f35b6101f6610401565b8060005260206000f35b61020861051f565b60006000f35b6102196004356102e5565b60006000f35b610227610693565b60006000f35b610238600435610342565b60006000f35b610246610484565b60006000f35b610254610493565b60006000f35b61026560043561038d565b60006000f35b610276600435610350565b60006000f35b61028760043561035e565b60006000f35b6102956105b4565b60006000f35b6102a3610547565b60006000f35b6102b16103ef565b8060005260206000f35b6102c3610600565b60006000f35b80600060006101000a81548160ff021916908302179055505b50565b80600060016101000a81548160ff02191690837f01000000000000000000000000000000000000000000000000000000000000009081020402179055505b50565b80600060026101000a81548160ff021916908302179055505b50565b806001600050819055505b50565b806002600050819055505b50565b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b50565b806004600050819055505b50565b6000600060009054906101000a900460ff1690506103b4565b90565b6000600060019054906101000a900460000b90506103d0565b90565b6000600060029054906101000a900460ff1690506103ec565b90565b600060016000505490506103fe565b90565b60006002600050549050610410565b90565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061043f565b90565b60006004600050549050610451565b90565b7f65c9ac8011e286e89d02a269890f41d67ca2cc597b2c76c7c69321ff492be5806000602a81526020016000a15b565b6000602a81526020016000a05b565b60017f81933b308056e7e85668661dcd102b1f22795b4431f9cf4625794f381c271c6b6000602a81526020016000a25b565b60016000602a81526020016000a15b565b3373ffffffffffffffffffffffffffffffffffffffff1660017f0e216b62efbb97e751a2ce09f607048751720397ecfb9eef1e48a6644948985b6000602a81526020016000a35b565b3373ffffffffffffffffffffffffffffffffffffffff1660016000602a81526020016000a25b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660017f317b31292193c2a4f561cc40a95ea0d97a2733f14af6d6d59522473e1f3ae65f6000602a81526020016000a45b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660016000602a81526020016000a35b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660017fd5f0a30e4be0c6be577a71eceb7464245a796a7e6a55c0d971837b250de05f4e60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe98152602001602a81526020016000a45b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff16600160007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe98152602001602a81526020016000a35b56", - "gasLimit" : "3141592", - "gasPrice" : "1", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "getBool", - "data" : "0x12a7b914", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "1", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "getInt8", - "data" : "0x57cb2fc4", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "2", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "getUint8", - "data" : "0x343a875d", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "3", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "a94f5374fce5edbc8e2a8697c15331677e6ebf0b", - "difficulty" : "131072", - "extraData" : "0x", - "gasLimit" : "3141592", - "gasUsed" : "0", - "hash" : "9de9879b6a81d1b6c4993c63c90a3c9d1e775f14572694778e828bc64972ae04", - "mixHash" : "b557f905d29ed0fca99d65d0adcce698dee97cf72a13c7cd8d7a7826b8eee770", - "nonce" : "18a524c1790fa83b", - "number" : "2", - "parentHash" : "6134fc6b5d99ee03c4aab1592640f6f9dcbc850668d75d631aee34989b938fae", - "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "ff640b30d613c35dad43e3693329e1b1ee6350f989cf46a288025a1cbfdab9cd", - "timestamp" : "0x54c98c82", - "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "bcde5374fce5edbc8e2a8697c15331677e6ebf0b", - "difficulty" : "131072", - "extraData" : "0x", - "gasLimit" : "3141592", - "gasUsed" : "0", - "hash" : "9de9879b6a81d1b6c4993c63c90a3c9d1e775f14572694778e828bc64972ae04", - "mixHash" : "b557f905d29ed0fca99d65d0adcce698dee97cf72a13c7cd8d7a7826b8eee770", - "nonce" : "18a524c1790fa83b", - "number" : "2", - "parentHash" : "6134fc6b5d99ee03c4aab1592640f6f9dcbc850668d75d631aee34989b938fae", - "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "ff640b30d613c35dad43e3693329e1b1ee6350f989cf46a288025a1cbfdab9cd", - "timestamp" : "0x54c98c82", - "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - } - ] - }, - { - "transactions" : [ - { - "data" : "getInt256", - "data" : "0xf5b53e17", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "4", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "getUint256", - "data" : "0x68895979", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "5", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "getAddress", - "data" : "0x38cc4831", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "6", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "getBytes32", - "data" : "0x1f903037", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "7", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "setBool", - "data" : "0x1e26fd330000000000000000000000000000000000000000000000000000000000000001", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "8", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "setBool", - "data" : "0x1e26fd330000000000000000000000000000000000000000000000000000000000000001", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "9", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "setInt8", - "data" : "0x9a19a953fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "10", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "setUint8", - "data" : "0x1774e6460000000000000000000000000000000000000000000000000000000000000008", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "11", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "setInt256", - "data" : "0xa53b1c1effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "12", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "setUint256", - "data" : "0xd2282dc5ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "13", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "setAddress", - "data" : "0xe30081a0aabbccffffffffffffffffffffffffffffffffffffffffffffffffffffffffee", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "14", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "setBytes32", - "data" : "0xc2b12a73aabbccffffffffffffffffffffffffffffffffffffffffffffffffffffffffee", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "15", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "getInt8", - "data" : "0x57cb2fc4", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "16", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "getUint8", - "data" : "0x343a875d", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "17", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "getInt256", - "data" : "0xf5b53e17", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "18", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "getUint256", - "data" : "0x68895979", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "19", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "getAddress", - "data" : "0x38cc4831", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "20", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "getBytes32", - "data" : "0x1f903037", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "21", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "log0", - "data" : "0x65538c73", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "22", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "log0a", - "data" : "0xa6780857", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "23", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "log1", - "data" : "0xb61c0503", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "24", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "log1a", - "data" : "0x4e7ad367", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "25", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "log2", - "data" : "0x102accc1", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "26", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "log2a", - "data" : "0x76bc21d9", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "27", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "log3", - "data" : "0xf38b0600", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "28", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "log3a", - "data" : "0xe8beef5b", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "29", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "log4", - "data" : "0xfd408767", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "30", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - { - "transactions" : [ - { - "data" : "log4a", - "data" : "0x9dc2c8f5", - "gasLimit" : "314159", - "gasPrice" : "1", - "nonce" : "31", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - } - ] - } -} From a26416fcef6db427254269300bf506681eaa22ed Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Wed, 22 Apr 2015 16:53:03 +0200 Subject: [PATCH 04/28] really nice scientific gasPricer From 14be125a99c24f13882181a3fc4b0f7fce3d8a4a Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Wed, 22 Apr 2015 16:59:14 +0200 Subject: [PATCH 05/28] style From 228ce4cec1988c9441f85bbe2949b889f16d8c22 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Thu, 23 Apr 2015 10:48:32 +0200 Subject: [PATCH 06/28] optimization - higher precision and single gas price handling From ad3bc70a49631e03ab2694260b56be2ad324b049 Mon Sep 17 00:00:00 2001 From: winsvega Date: Sat, 18 Apr 2015 14:57:45 +0300 Subject: [PATCH 07/28] New Transaction Tests From 3bac2652593efd82ba76f2318ac8f6baf11f5854 Mon Sep 17 00:00:00 2001 From: winsvega Date: Sun, 19 Apr 2015 18:41:47 +0300 Subject: [PATCH 08/28] transaction tests From bab28758c242cdda5ed2b3131e9e74906c462886 Mon Sep 17 00:00:00 2001 From: winsvega Date: Mon, 20 Apr 2015 19:14:04 +0300 Subject: [PATCH 09/28] New Transaction Tests From 60cd8630565ead2fbc812587f726afbd96e89a2f Mon Sep 17 00:00:00 2001 From: winsvega Date: Thu, 23 Apr 2015 13:06:31 +0300 Subject: [PATCH 10/28] newtests: new rs value test From 5b77cf9d0ffbe18ae8bd8f5f0827d3f6e339258e Mon Sep 17 00:00:00 2001 From: winsvega Date: Thu, 23 Apr 2015 20:14:13 +0300 Subject: [PATCH 11/28] newtests: r=s transaction test From f86e682af19f85b6e1271466d14332226325fb18 Mon Sep 17 00:00:00 2001 From: winsvega Date: Fri, 24 Apr 2015 15:59:07 +0300 Subject: [PATCH 12/28] newtests: Transaction Data Zerobytes From 393fc81deabfd8cb9511f8be5d63005b6b98ed97 Mon Sep 17 00:00:00 2001 From: winsvega Date: Thu, 16 Apr 2015 19:40:31 +0300 Subject: [PATCH 13/28] BlockWeight: blockchain test refactoring From bd08a2bbe23238edb3a25b0f345e8a38f3283e3a Mon Sep 17 00:00:00 2001 From: winsvega Date: Tue, 21 Apr 2015 23:10:55 +0300 Subject: [PATCH 14/28] BlockWeight: tests refactoring --- TestHelper.cpp | 80 ++++++++++++++++++++++++++++++++------------------ TestHelper.h | 8 +++++ 2 files changed, 60 insertions(+), 28 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index 724bcaf61..8ea70ed1c 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -137,7 +137,7 @@ json_spirit::mObject& ImportTest::makeAllFieldsHex(json_spirit::mObject& _o) str = value.get_str(); else continue; - _o[key] = (str.substr(0, 2) == "0x") ? str : "0x" + toHex(toCompactBigEndian(toInt(str), 1)); + _o[key] = (str.substr(0, 2) == "0x") ? str : jsonHex(toInt(str)); } return _o; } @@ -327,7 +327,7 @@ void ImportTest::checkExpectedState(State const& _stateExpect, State const& _sta void ImportTest::exportTest(bytes const& _output, State const& _statePost) { // export output - m_TestObject["out"] = "0x" + toHex(_output); + m_TestObject["out"] = jsonHex(_output); // export logs m_TestObject["logs"] = exportLog(_statePost.pending().size() ? _statePost.log(0) : LogEntries()); @@ -344,7 +344,7 @@ void ImportTest::exportTest(bytes const& _output, State const& _statePost) // export post state m_TestObject["post"] = fillJsonWithState(_statePost); - m_TestObject["postStateRoot"] = toHex(_statePost.rootHash().asBytes()); + m_TestObject["postStateRoot"] = jsonHex(_statePost.rootHash().asBytes()); // export pre state m_TestObject["pre"] = fillJsonWithState(m_statePre); @@ -352,29 +352,72 @@ void ImportTest::exportTest(bytes const& _output, State const& _statePost) m_TestObject["transaction"] = makeAllFieldsHex(m_TestObject["transaction"].get_obj()); } +std::string jsonHash(h256 const& _value) { return toString(_value); } +std::string jsonHash(Nonce const& _value) { return toString(_value); } +std::string jsonHash(LogBloom const& _value) { return toString(_value); } +std::string jsonHash(Address const& _value) { return toString(_value); } +std::string jsonHex(bytesConstRef _code) { return "0x" + toHex(_code); } +std::string jsonHex(bytes const& _code) { return "0x" + toHex(_code); } +std::string jsonHex(u256 const& _value, bool _nonempty) +{ + return "0x" + toHex(toCompactBigEndian(_value, _nonempty ? 1 : 0)); +} + +json_spirit::mObject fillJsonWithTransaction(Transaction _txn) +{ + json_spirit::mObject txObject; + txObject["nonce"] = jsonHex(_txn.nonce()); + txObject["data"] = jsonHex(_txn.data()); + txObject["gasLimit"] = jsonHex(_txn.gas()); + txObject["gasPrice"] = jsonHex(_txn.gasPrice()); + txObject["r"] = jsonHex(_txn.signature().r); + txObject["s"] = jsonHex(_txn.signature().s); + txObject["v"] = jsonHex(_txn.signature().v + 27); + txObject["to"] = _txn.isCreation() ? "" : jsonHash(_txn.receiveAddress()); + txObject["value"] = jsonHex(_txn.value()); + return txObject; +} + json_spirit::mObject fillJsonWithState(State _state) { - // export pre state json_spirit::mObject oState; - for (auto const& a: _state.addresses()) { json_spirit::mObject o; - o["balance"] = "0x" + toHex(toCompactBigEndian(_state.balance(a.first), 1)); - o["nonce"] = "0x" + toHex(toCompactBigEndian(_state.transactionsFrom(a.first), 1)); + o["balance"] = jsonHex(_state.balance(a.first)); + o["nonce"] = jsonHex(_state.transactionsFrom(a.first)); { json_spirit::mObject store; for (auto const& s: _state.storage(a.first)) - store["0x"+toHex(toCompactBigEndian(s.first))] = "0x"+toHex(toCompactBigEndian(s.second)); + store[jsonHex(s.first)] = jsonHex(s.second); o["storage"] = store; } - o["code"] = "0x" + toHex(_state.code(a.first)); + o["code"] = jsonHex(_state.code(a.first)); oState[toString(a.first)] = o; } return oState; } +json_spirit::mArray exportLog(eth::LogEntries _logs) +{ + json_spirit::mArray ret; + if (_logs.size() == 0) return ret; + for (LogEntry const& l: _logs) + { + json_spirit::mObject o; + o["address"] = jsonHash(l.address); + json_spirit::mArray topics; + for (auto const& t: l.topics) + topics.push_back(toString(t)); + o["topics"] = topics; + o["data"] = jsonHex(l.data); + o["bloom"] = jsonHash(l.bloom()); + ret.push_back(o); + } + return ret; +} + u256 toInt(json_spirit::mValue const& _v) { switch (_v.type()) @@ -455,25 +498,6 @@ LogEntries importLog(json_spirit::mArray& _a) return logEntries; } -json_spirit::mArray exportLog(eth::LogEntries _logs) -{ - json_spirit::mArray ret; - if (_logs.size() == 0) return ret; - for (LogEntry const& l: _logs) - { - json_spirit::mObject o; - o["address"] = toString(l.address); - json_spirit::mArray topics; - for (auto const& t: l.topics) - topics.push_back(toString(t)); - o["topics"] = topics; - o["data"] = "0x" + toHex(l.data); - o["bloom"] = toString(l.bloom()); - ret.push_back(o); - } - return ret; -} - void checkOutput(bytes const& _output, json_spirit::mObject& _o) { int j = 0; diff --git a/TestHelper.h b/TestHelper.h index bf4cdc16e..1e09cf69d 100644 --- a/TestHelper.h +++ b/TestHelper.h @@ -161,6 +161,14 @@ void userDefinedTest(std::string testTypeFlag, std::function void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs) From 01905a33820a70567876213d0c4791b72165a340 Mon Sep 17 00:00:00 2001 From: winsvega Date: Wed, 22 Apr 2015 00:54:53 +0300 Subject: [PATCH 15/28] Blockweight: rebase + comments From 37ed74ab6e3cb6fbd74d645ae8d63b914e47abd7 Mon Sep 17 00:00:00 2001 From: winsvega Date: Wed, 22 Apr 2015 16:46:13 +0300 Subject: [PATCH 16/28] blockweight: random test windows fix attempt 1 From 5d35f71350b925fbd4da999f8db1c811b3f3757d Mon Sep 17 00:00:00 2001 From: winsvega Date: Thu, 23 Apr 2015 02:43:35 +0300 Subject: [PATCH 17/28] BlockWeight: toCompactHex refactoring --- TestHelper.cpp | 50 +++++++++++++++++++------------------------------- TestHelper.h | 7 ------- 2 files changed, 19 insertions(+), 38 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index 8ea70ed1c..0aa508c23 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -137,7 +137,7 @@ json_spirit::mObject& ImportTest::makeAllFieldsHex(json_spirit::mObject& _o) str = value.get_str(); else continue; - _o[key] = (str.substr(0, 2) == "0x") ? str : jsonHex(toInt(str)); + _o[key] = (str.substr(0, 2) == "0x") ? str : toHex(toInt(str), HexPrefix::Add); } return _o; } @@ -327,7 +327,7 @@ void ImportTest::checkExpectedState(State const& _stateExpect, State const& _sta void ImportTest::exportTest(bytes const& _output, State const& _statePost) { // export output - m_TestObject["out"] = jsonHex(_output); + m_TestObject["out"] = "0x" + toString(_output); // export logs m_TestObject["logs"] = exportLog(_statePost.pending().size() ? _statePost.log(0) : LogEntries()); @@ -344,7 +344,7 @@ void ImportTest::exportTest(bytes const& _output, State const& _statePost) // export post state m_TestObject["post"] = fillJsonWithState(_statePost); - m_TestObject["postStateRoot"] = jsonHex(_statePost.rootHash().asBytes()); + m_TestObject["postStateRoot"] = toString(_statePost.rootHash().asBytes()); // export pre state m_TestObject["pre"] = fillJsonWithState(m_statePre); @@ -352,29 +352,18 @@ void ImportTest::exportTest(bytes const& _output, State const& _statePost) m_TestObject["transaction"] = makeAllFieldsHex(m_TestObject["transaction"].get_obj()); } -std::string jsonHash(h256 const& _value) { return toString(_value); } -std::string jsonHash(Nonce const& _value) { return toString(_value); } -std::string jsonHash(LogBloom const& _value) { return toString(_value); } -std::string jsonHash(Address const& _value) { return toString(_value); } -std::string jsonHex(bytesConstRef _code) { return "0x" + toHex(_code); } -std::string jsonHex(bytes const& _code) { return "0x" + toHex(_code); } -std::string jsonHex(u256 const& _value, bool _nonempty) -{ - return "0x" + toHex(toCompactBigEndian(_value, _nonempty ? 1 : 0)); -} - json_spirit::mObject fillJsonWithTransaction(Transaction _txn) { json_spirit::mObject txObject; - txObject["nonce"] = jsonHex(_txn.nonce()); - txObject["data"] = jsonHex(_txn.data()); - txObject["gasLimit"] = jsonHex(_txn.gas()); - txObject["gasPrice"] = jsonHex(_txn.gasPrice()); - txObject["r"] = jsonHex(_txn.signature().r); - txObject["s"] = jsonHex(_txn.signature().s); - txObject["v"] = jsonHex(_txn.signature().v + 27); - txObject["to"] = _txn.isCreation() ? "" : jsonHash(_txn.receiveAddress()); - txObject["value"] = jsonHex(_txn.value()); + txObject["nonce"] = toCompactHex(_txn.nonce(), HexPrefix::Add); + txObject["data"] = "0x"+toString(_txn.data()); + txObject["gasLimit"] = toCompactHex(_txn.gas(), HexPrefix::Add); + txObject["gasPrice"] = toCompactHex(_txn.gasPrice(), HexPrefix::Add); + txObject["r"] = toCompactHex(_txn.signature().r, HexPrefix::Add); + txObject["s"] = toCompactHex(_txn.signature().s, HexPrefix::Add); + txObject["v"] = toCompactHex(_txn.signature().v + 27, HexPrefix::Add); + txObject["to"] = _txn.isCreation() ? "" : toString(_txn.receiveAddress()); + txObject["value"] = toCompactHex(_txn.value(), HexPrefix::Add); return txObject; } @@ -384,16 +373,15 @@ json_spirit::mObject fillJsonWithState(State _state) for (auto const& a: _state.addresses()) { json_spirit::mObject o; - o["balance"] = jsonHex(_state.balance(a.first)); - o["nonce"] = jsonHex(_state.transactionsFrom(a.first)); + o["balance"] = toCompactHex(_state.balance(a.first), HexPrefix::Add); + o["nonce"] = toCompactHex(_state.transactionsFrom(a.first), HexPrefix::Add); { json_spirit::mObject store; for (auto const& s: _state.storage(a.first)) - store[jsonHex(s.first)] = jsonHex(s.second); + store[toCompactHex(s.first, HexPrefix::Add)] = toCompactHex(s.second, HexPrefix::Add); o["storage"] = store; } - o["code"] = jsonHex(_state.code(a.first)); - + o["code"] = "0x" + toString(_state.code(a.first)); oState[toString(a.first)] = o; } return oState; @@ -406,13 +394,13 @@ json_spirit::mArray exportLog(eth::LogEntries _logs) for (LogEntry const& l: _logs) { json_spirit::mObject o; - o["address"] = jsonHash(l.address); + o["address"] = toString(l.address); json_spirit::mArray topics; for (auto const& t: l.topics) topics.push_back(toString(t)); o["topics"] = topics; - o["data"] = jsonHex(l.data); - o["bloom"] = jsonHash(l.bloom()); + o["data"] = "0x" + toString(l.data); + o["bloom"] = toString(l.bloom()); ret.push_back(o); } return ret; diff --git a/TestHelper.h b/TestHelper.h index 1e09cf69d..10e76aa96 100644 --- a/TestHelper.h +++ b/TestHelper.h @@ -162,13 +162,6 @@ RLPStream createRLPStreamFromTransactionFields(json_spirit::mObject& _tObj); eth::LastHashes lastHashes(u256 _currentBlockNumber); json_spirit::mObject fillJsonWithState(eth::State _state); json_spirit::mObject fillJsonWithTransaction(eth::Transaction _txn); -std::string jsonHash(dev::eth::LogBloom const& _value); -std::string jsonHash(Address const& _value); -std::string jsonHash(dev::eth::Nonce const& _value); -std::string jsonHash(h256 const& _value); -std::string jsonHex(u256 const& _value, bool _nonempty = true); -std::string jsonHex(bytesConstRef _code); -std::string jsonHex(bytes const& _code); template void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs) From a5535ec86f9cd0f5db4b961936a1c3af7cf042b4 Mon Sep 17 00:00:00 2001 From: winsvega Date: Thu, 23 Apr 2015 03:42:45 +0300 Subject: [PATCH 18/28] BlockWeight: data fix refactoring --- TestHelper.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index 0aa508c23..69ad7dba0 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -327,7 +327,7 @@ void ImportTest::checkExpectedState(State const& _stateExpect, State const& _sta void ImportTest::exportTest(bytes const& _output, State const& _statePost) { // export output - m_TestObject["out"] = "0x" + toString(_output); + m_TestObject["out"] = toHex(_output, 2, HexPrefix::Add); // export logs m_TestObject["logs"] = exportLog(_statePost.pending().size() ? _statePost.log(0) : LogEntries()); @@ -356,7 +356,7 @@ json_spirit::mObject fillJsonWithTransaction(Transaction _txn) { json_spirit::mObject txObject; txObject["nonce"] = toCompactHex(_txn.nonce(), HexPrefix::Add); - txObject["data"] = "0x"+toString(_txn.data()); + txObject["data"] = toHex(_txn.data(), 2, HexPrefix::Add); txObject["gasLimit"] = toCompactHex(_txn.gas(), HexPrefix::Add); txObject["gasPrice"] = toCompactHex(_txn.gasPrice(), HexPrefix::Add); txObject["r"] = toCompactHex(_txn.signature().r, HexPrefix::Add); @@ -381,7 +381,7 @@ json_spirit::mObject fillJsonWithState(State _state) store[toCompactHex(s.first, HexPrefix::Add)] = toCompactHex(s.second, HexPrefix::Add); o["storage"] = store; } - o["code"] = "0x" + toString(_state.code(a.first)); + o["code"] = toHex(_state.code(a.first), 2, HexPrefix::Add); oState[toString(a.first)] = o; } return oState; @@ -399,7 +399,7 @@ json_spirit::mArray exportLog(eth::LogEntries _logs) for (auto const& t: l.topics) topics.push_back(toString(t)); o["topics"] = topics; - o["data"] = "0x" + toString(l.data); + o["data"] = toHex(l.data, 2, HexPrefix::Add); o["bloom"] = toString(l.bloom()); ret.push_back(o); } From f1722d0f0aa1a769d425a330e40ffc09815a2c42 Mon Sep 17 00:00:00 2001 From: winsvega Date: Thu, 23 Apr 2015 03:50:27 +0300 Subject: [PATCH 19/28] BlockWeight: jsonrpc fix refactoring From d872539b1fd74452137309ac94fbb89e4faf6f43 Mon Sep 17 00:00:00 2001 From: winsvega Date: Thu, 23 Apr 2015 13:09:23 +0300 Subject: [PATCH 20/28] blockweight: stateroot is hash --- TestHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index 69ad7dba0..b8e320e48 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -344,7 +344,7 @@ void ImportTest::exportTest(bytes const& _output, State const& _statePost) // export post state m_TestObject["post"] = fillJsonWithState(_statePost); - m_TestObject["postStateRoot"] = toString(_statePost.rootHash().asBytes()); + m_TestObject["postStateRoot"] = toHex(_statePost.rootHash().asBytes()); // export pre state m_TestObject["pre"] = fillJsonWithState(m_statePre); From 1580c38d667b3bdf4a01c878aae20efceb58e27a Mon Sep 17 00:00:00 2001 From: winsvega Date: Thu, 23 Apr 2015 17:57:59 +0300 Subject: [PATCH 21/28] blockweight: allfields to compact Hex fix --- TestHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index b8e320e48..57ec0566d 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -137,7 +137,7 @@ json_spirit::mObject& ImportTest::makeAllFieldsHex(json_spirit::mObject& _o) str = value.get_str(); else continue; - _o[key] = (str.substr(0, 2) == "0x") ? str : toHex(toInt(str), HexPrefix::Add); + _o[key] = (str.substr(0, 2) == "0x") ? str : toCompactHex(toInt(str), HexPrefix::Add); } return _o; } From cfe24c3c2a60d59c0075e82fed044232baec4974 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 24 Apr 2015 11:42:30 +0200 Subject: [PATCH 22/28] Try to keep source location during optimization. --- libsolidity/SolidityOptimizer.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/libsolidity/SolidityOptimizer.cpp b/libsolidity/SolidityOptimizer.cpp index af9b51467..ceb9c68d9 100644 --- a/libsolidity/SolidityOptimizer.cpp +++ b/libsolidity/SolidityOptimizer.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -84,9 +85,20 @@ public: AssemblyItems getCSE(AssemblyItems const& _input) { + // add dummy locations to each item so that we can check that they are not deleted + AssemblyItems input = _input; + for (AssemblyItem& item: input) + item.setLocation(SourceLocation(1, 3, make_shared(""))); + eth::CommonSubexpressionEliminator cse; - BOOST_REQUIRE(cse.feedItems(_input.begin(), _input.end()) == _input.end()); - return cse.getOptimizedItems(); + BOOST_REQUIRE(cse.feedItems(input.begin(), input.end()) == input.end()); + AssemblyItems output = cse.getOptimizedItems(); + + for (AssemblyItem const& item: output) + { + BOOST_CHECK(item == Instruction::POP || !item.getLocation().isEmpty()); + } + return output; } void checkCSE(AssemblyItems const& _input, AssemblyItems const& _expectation) From 18475f8ae148ee797fbd649eb5bf7a870ed9957c Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Thu, 16 Apr 2015 15:19:25 +0200 Subject: [PATCH 23/28] test for resalts --- libsolidity/SolidityABIJSON.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/libsolidity/SolidityABIJSON.cpp b/libsolidity/SolidityABIJSON.cpp index f0e54a940..1ba0dc7bc 100644 --- a/libsolidity/SolidityABIJSON.cpp +++ b/libsolidity/SolidityABIJSON.cpp @@ -495,6 +495,27 @@ BOOST_AUTO_TEST_CASE(empty_name_return_parameter) checkInterface(sourceCode, interface); } +BOOST_AUTO_TEST_CASE(constructor_abi) +{ + char const* sourceCode = R"( + contract test { + function test() { + } + })"; + + char const* interface = R"(" + [ + { + "constant" : false, + "inputs" : [], + "name" : "test", + "outputs" : [], + "type" : "constructor" + } + ])"; + checkInterface(sourceCode, interface); +} + BOOST_AUTO_TEST_SUITE_END() } From 9b956e809df8b84ce9ecfe866fe14473f4bbeece Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Fri, 17 Apr 2015 15:26:12 +0200 Subject: [PATCH 24/28] fixed the output of the test --- libsolidity/SolidityABIJSON.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/libsolidity/SolidityABIJSON.cpp b/libsolidity/SolidityABIJSON.cpp index 1ba0dc7bc..de2af1d27 100644 --- a/libsolidity/SolidityABIJSON.cpp +++ b/libsolidity/SolidityABIJSON.cpp @@ -499,19 +499,18 @@ BOOST_AUTO_TEST_CASE(constructor_abi) { char const* sourceCode = R"( contract test { - function test() { + function test() { } })"; - char const* interface = R"(" - [ - { - "constant" : false, - "inputs" : [], - "name" : "test", - "outputs" : [], - "type" : "constructor" - } + char const* interface = R"([ + { + "constant" : false, + "inputs" : [], + "name" : "test", + "outputs" : [], + "type" : "constructor" + } ])"; checkInterface(sourceCode, interface); } From 5b07f1133029e04c6db8510d80634d606e9d0e8e Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Wed, 22 Apr 2015 17:00:22 +0200 Subject: [PATCH 25/28] changed the implementation --- libsolidity/SolidityABIJSON.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libsolidity/SolidityABIJSON.cpp b/libsolidity/SolidityABIJSON.cpp index de2af1d27..f9ecb7d9c 100644 --- a/libsolidity/SolidityABIJSON.cpp +++ b/libsolidity/SolidityABIJSON.cpp @@ -505,11 +505,8 @@ BOOST_AUTO_TEST_CASE(constructor_abi) char const* interface = R"([ { - "constant" : false, - "inputs" : [], - "name" : "test", - "outputs" : [], - "type" : "constructor" + "inputs" : [], + "type" : "constructor" } ])"; checkInterface(sourceCode, interface); From 21ced7e9c5123255dae9da0ba7a09e7545df6383 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Wed, 22 Apr 2015 18:53:58 +0200 Subject: [PATCH 26/28] changed the test so constructor will have input parameters --- libsolidity/SolidityABIJSON.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/libsolidity/SolidityABIJSON.cpp b/libsolidity/SolidityABIJSON.cpp index f9ecb7d9c..26d0110b8 100644 --- a/libsolidity/SolidityABIJSON.cpp +++ b/libsolidity/SolidityABIJSON.cpp @@ -499,14 +499,27 @@ BOOST_AUTO_TEST_CASE(constructor_abi) { char const* sourceCode = R"( contract test { - function test() { + function test(uint param1, test param2, bool param3) {} } - })"; + )"; char const* interface = R"([ { - "inputs" : [], - "type" : "constructor" + "inputs": [ + { + "name": "param1", + "type": "uint256" + }, + { + "name": "param2", + "type": "address" + }, + { + "name": "param3", + "type": "bool" + } + ], + "type": "constructor" } ])"; checkInterface(sourceCode, interface); From f843161bd97eabec7a3939bc6998337dfd22e319 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 27 Apr 2015 19:22:53 +0200 Subject: [PATCH 27/28] Full ICAP implementation (Direct, Indirect-ETH, Indirect-XET). --- webthreestubclient.h | 626 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 626 insertions(+) create mode 100644 webthreestubclient.h diff --git a/webthreestubclient.h b/webthreestubclient.h new file mode 100644 index 000000000..51d556eec --- /dev/null +++ b/webthreestubclient.h @@ -0,0 +1,626 @@ +/** + * This file is generated by jsonrpcstub, DO NOT CHANGE IT MANUALLY! + */ + +#ifndef JSONRPC_CPP_STUB_WEBTHREESTUBCLIENT_H_ +#define JSONRPC_CPP_STUB_WEBTHREESTUBCLIENT_H_ + +#include + +class WebThreeStubClient : public jsonrpc::Client +{ + public: + WebThreeStubClient(jsonrpc::IClientConnector &conn, jsonrpc::clientVersion_t type = jsonrpc::JSONRPC_CLIENT_V2) : jsonrpc::Client(conn, type) {} + + std::string web3_sha3(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("web3_sha3",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string web3_clientVersion() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->CallMethod("web3_clientVersion",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string net_version() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->CallMethod("net_version",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string net_peerCount() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->CallMethod("net_peerCount",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + bool net_listening() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->CallMethod("net_listening",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_protocolVersion() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->CallMethod("eth_protocolVersion",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_hashrate() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->CallMethod("eth_hashrate",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_coinbase() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->CallMethod("eth_coinbase",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + bool eth_mining() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->CallMethod("eth_mining",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_gasPrice() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->CallMethod("eth_gasPrice",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + Json::Value eth_accounts() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->CallMethod("eth_accounts",p); + if (result.isArray()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_blockNumber() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->CallMethod("eth_blockNumber",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_getBalance(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + p.append(param2); + Json::Value result = this->CallMethod("eth_getBalance",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_getStorageAt(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + p.append(param2); + p.append(param3); + Json::Value result = this->CallMethod("eth_getStorageAt",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_getTransactionCount(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + p.append(param2); + Json::Value result = this->CallMethod("eth_getTransactionCount",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_getBlockTransactionCountByHash(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_getBlockTransactionCountByHash",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_getBlockTransactionCountByNumber(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_getBlockTransactionCountByNumber",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_getUncleCountByBlockHash(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_getUncleCountByBlockHash",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_getUncleCountByBlockNumber(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_getUncleCountByBlockNumber",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_getCode(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + p.append(param2); + Json::Value result = this->CallMethod("eth_getCode",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_sendTransaction(const Json::Value& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_sendTransaction",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_call(const Json::Value& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + p.append(param2); + Json::Value result = this->CallMethod("eth_call",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + bool eth_flush() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->CallMethod("eth_flush",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + Json::Value eth_getBlockByHash(const std::string& param1, bool param2) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + p.append(param2); + Json::Value result = this->CallMethod("eth_getBlockByHash",p); + if (result.isObject()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + Json::Value eth_getBlockByNumber(const std::string& param1, bool param2) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + p.append(param2); + Json::Value result = this->CallMethod("eth_getBlockByNumber",p); + if (result.isObject()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + Json::Value eth_getTransactionByHash(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_getTransactionByHash",p); + if (result.isObject()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + Json::Value eth_getTransactionByBlockHashAndIndex(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + p.append(param2); + Json::Value result = this->CallMethod("eth_getTransactionByBlockHashAndIndex",p); + if (result.isObject()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + Json::Value eth_getTransactionByBlockNumberAndIndex(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + p.append(param2); + Json::Value result = this->CallMethod("eth_getTransactionByBlockNumberAndIndex",p); + if (result.isObject()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + Json::Value eth_getUncleByBlockHashAndIndex(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + p.append(param2); + Json::Value result = this->CallMethod("eth_getUncleByBlockHashAndIndex",p); + if (result.isObject()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + Json::Value eth_getUncleByBlockNumberAndIndex(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + p.append(param2); + Json::Value result = this->CallMethod("eth_getUncleByBlockNumberAndIndex",p); + if (result.isObject()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + Json::Value eth_getCompilers() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->CallMethod("eth_getCompilers",p); + if (result.isArray()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_compileLLL(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_compileLLL",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_compileSerpent(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_compileSerpent",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_compileSolidity(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_compileSolidity",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_newFilter",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_newBlockFilter(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_newBlockFilter",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + bool eth_uninstallFilter(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_uninstallFilter",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + Json::Value eth_getFilterChanges(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_getFilterChanges",p); + if (result.isArray()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + Json::Value eth_getFilterLogs(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_getFilterLogs",p); + if (result.isArray()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + Json::Value eth_getLogs(const Json::Value& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_getLogs",p); + if (result.isArray()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + Json::Value eth_getWork() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->CallMethod("eth_getWork",p); + if (result.isArray()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + bool eth_submitWork(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + p.append(param2); + p.append(param3); + Json::Value result = this->CallMethod("eth_submitWork",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_register(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_register",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + bool eth_unregister(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_unregister",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + Json::Value eth_fetchQueuedTransactions(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_fetchQueuedTransactions",p); + if (result.isArray()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string eth_signTransaction(const Json::Value& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_signTransaction",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + Json::Value eth_inspectTransaction(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_inspectTransaction",p); + if (result.isObject()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + bool eth_injectTransaction(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("eth_injectTransaction",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + bool db_put(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + p.append(param2); + p.append(param3); + Json::Value result = this->CallMethod("db_put",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string db_get(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + p.append(param2); + Json::Value result = this->CallMethod("db_get",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + bool shh_post(const Json::Value& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("shh_post",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string shh_newIdentity() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->CallMethod("shh_newIdentity",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + bool shh_hasIdentity(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("shh_hasIdentity",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string shh_newGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + p.append(param2); + Json::Value result = this->CallMethod("shh_newGroup",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string shh_addToGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + p.append(param2); + Json::Value result = this->CallMethod("shh_addToGroup",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + std::string shh_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("shh_newFilter",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + bool shh_uninstallFilter(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("shh_uninstallFilter",p); + if (result.isBool()) + return result.asBool(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + Json::Value shh_getFilterChanges(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("shh_getFilterChanges",p); + if (result.isArray()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } + Json::Value shh_getMessages(const std::string& param1) throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p.append(param1); + Json::Value result = this->CallMethod("shh_getMessages",p); + if (result.isArray()) + return result; + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } +}; + +#endif //JSONRPC_CPP_STUB_WEBTHREESTUBCLIENT_H_ From 50644d2e1054c39f4abf5decf8a3cd8ad196fb06 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 27 Apr 2015 23:30:28 +0200 Subject: [PATCH 28/28] Tidy and conformalise the toHex API. --- TestHelper.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index 57ec0566d..eecf6f80d 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -137,7 +137,7 @@ json_spirit::mObject& ImportTest::makeAllFieldsHex(json_spirit::mObject& _o) str = value.get_str(); else continue; - _o[key] = (str.substr(0, 2) == "0x") ? str : toCompactHex(toInt(str), HexPrefix::Add); + _o[key] = (str.substr(0, 2) == "0x") ? str : toCompactHex(toInt(str), HexPrefix::Add, 1); } return _o; } @@ -355,15 +355,15 @@ void ImportTest::exportTest(bytes const& _output, State const& _statePost) json_spirit::mObject fillJsonWithTransaction(Transaction _txn) { json_spirit::mObject txObject; - txObject["nonce"] = toCompactHex(_txn.nonce(), HexPrefix::Add); + txObject["nonce"] = toCompactHex(_txn.nonce(), HexPrefix::Add, 1); txObject["data"] = toHex(_txn.data(), 2, HexPrefix::Add); - txObject["gasLimit"] = toCompactHex(_txn.gas(), HexPrefix::Add); - txObject["gasPrice"] = toCompactHex(_txn.gasPrice(), HexPrefix::Add); - txObject["r"] = toCompactHex(_txn.signature().r, HexPrefix::Add); - txObject["s"] = toCompactHex(_txn.signature().s, HexPrefix::Add); - txObject["v"] = toCompactHex(_txn.signature().v + 27, HexPrefix::Add); + txObject["gasLimit"] = toCompactHex(_txn.gas(), HexPrefix::Add, 1); + txObject["gasPrice"] = toCompactHex(_txn.gasPrice(), HexPrefix::Add, 1); + txObject["r"] = toCompactHex(_txn.signature().r, HexPrefix::Add, 1); + txObject["s"] = toCompactHex(_txn.signature().s, HexPrefix::Add, 1); + txObject["v"] = toCompactHex(_txn.signature().v + 27, HexPrefix::Add, 1); txObject["to"] = _txn.isCreation() ? "" : toString(_txn.receiveAddress()); - txObject["value"] = toCompactHex(_txn.value(), HexPrefix::Add); + txObject["value"] = toCompactHex(_txn.value(), HexPrefix::Add, 1); return txObject; } @@ -373,12 +373,12 @@ json_spirit::mObject fillJsonWithState(State _state) for (auto const& a: _state.addresses()) { json_spirit::mObject o; - o["balance"] = toCompactHex(_state.balance(a.first), HexPrefix::Add); - o["nonce"] = toCompactHex(_state.transactionsFrom(a.first), HexPrefix::Add); + o["balance"] = toCompactHex(_state.balance(a.first), HexPrefix::Add, 1); + o["nonce"] = toCompactHex(_state.transactionsFrom(a.first), HexPrefix::Add, 1); { json_spirit::mObject store; for (auto const& s: _state.storage(a.first)) - store[toCompactHex(s.first, HexPrefix::Add)] = toCompactHex(s.second, HexPrefix::Add); + store[toCompactHex(s.first, HexPrefix::Add, 1)] = toCompactHex(s.second, HexPrefix::Add, 1); o["storage"] = store; } o["code"] = toHex(_state.code(a.first), 2, HexPrefix::Add);