From dd743d9779b7db6efc0deabc67bd0bb735cddf19 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Tue, 19 Sep 2023 15:47:25 +0800 Subject: [PATCH 01/13] simulators/ethereum: drop graphql testcases Signed-off-by: jsvisa --- .../graphql/testcases/01_eth_blockNumber.json | 13 ---- .../graphql/testcases/02_eth_call_Block8.json | 16 ----- .../testcases/03_eth_call_BlockLatest.json | 16 ----- .../04_eth_estimateGas_contractDeploy.json | 11 ---- .../05_eth_estimateGas_noParams.json | 11 ---- .../06_eth_estimateGas_transfer.json | 11 ---- .../graphql/testcases/07_eth_gasPrice.json | 17 ----- .../testcases/08_eth_getBalance_0x19.json | 14 ---- ..._getBalance_invalidAccountBlockNumber.json | 13 ---- ...0_eth_getBalance_invalidAccountLatest.json | 13 ---- .../testcases/11_eth_getBalance_latest.json | 14 ---- .../12_eth_getBalance_toobig_bn.json | 32 ---------- .../13_eth_getBalance_without_addr.json | 21 ------ .../testcases/14_eth_getBlock_byHash.json | 34 ---------- .../15_eth_getBlock_byHashInvalid.json | 24 ------- .../testcases/16_eth_getBlock_byNumber.json | 44 ------------- .../17_eth_getBlock_byNumberInvalid.json | 31 --------- .../18_eth_getBlock_wrongParams.json | 26 -------- ...9_eth_getBlockTransactionCount_byHash.json | 15 ----- ...eth_getBlockTransactionCount_byNumber.json | 33 ---------- .../testcases/21_eth_getCode_noCode.json | 14 ---- .../graphql/testcases/22_eth_getCode.json | 14 ---- .../testcases/23_eth_getLogs_matchTopic.json | 22 ------- .../testcases/24_eth_getLogs_range.json | 40 ------------ ..._getStorageAt_illegalRangeGreaterThan.json | 15 ----- .../testcases/26_eth_getStorageAt.json | 15 ----- ...th_getTransaction_byBlockHashAndIndex.json | 20 ------ ..._getTransaction_byBlockNumberAndIndex.json | 20 ------ ...nsaction_byBlockNumberAndInvalidIndex.json | 14 ---- .../30_eth_getTransaction_byHash.json | 64 ------------------- .../31_eth_getTransaction_byHashNull.json | 13 ---- .../testcases/32_eth_getTransactionCount.json | 13 ---- .../33_eth_getTransactionReceipt.json | 52 --------------- ...h_sendRawTransaction_contractCreation.json | 9 --- .../graphql/testcases/35_graphql_pending.json | 27 -------- ...36_eth_sendRawTransaction_messageCall.json | 10 --- ...37_eth_sendRawTransaction_nonceTooLow.json | 26 -------- ..._eth_sendRawTransaction_transferEther.json | 9 --- ...endRawTransaction_unsignedTransaction.json | 26 -------- .../graphql/testcases/40_eth_syncing.json | 11 ---- .../testcases/41_graphql_blocks_byFrom.json | 22 ------- .../testcases/42_graphql_blocks_byRange.json | 40 ------------ .../43_graphql_blocks_byWrongRange.json | 26 -------- .../testcases/44_getBlock_byHexNumber.json | 14 ---- .../testcases/45_eth_getLogs_range_hex.json | 22 ------- .../46_transaction_fromByHexBlockNumber.json | 18 ------ .../47_block_withdrawals_pre_shanghai.json | 15 ----- .../testcases/48_block_withdrawals.json | 20 ------ .../testcases/49_get_type2Transaction.json | 19 ------ .../testcases/50_eth_getBlock_shanghai.json | 29 --------- 50 files changed, 1068 deletions(-) delete mode 100644 simulators/ethereum/graphql/testcases/01_eth_blockNumber.json delete mode 100644 simulators/ethereum/graphql/testcases/02_eth_call_Block8.json delete mode 100644 simulators/ethereum/graphql/testcases/03_eth_call_BlockLatest.json delete mode 100644 simulators/ethereum/graphql/testcases/04_eth_estimateGas_contractDeploy.json delete mode 100644 simulators/ethereum/graphql/testcases/05_eth_estimateGas_noParams.json delete mode 100644 simulators/ethereum/graphql/testcases/06_eth_estimateGas_transfer.json delete mode 100644 simulators/ethereum/graphql/testcases/07_eth_gasPrice.json delete mode 100644 simulators/ethereum/graphql/testcases/08_eth_getBalance_0x19.json delete mode 100644 simulators/ethereum/graphql/testcases/09_eth_getBalance_invalidAccountBlockNumber.json delete mode 100644 simulators/ethereum/graphql/testcases/10_eth_getBalance_invalidAccountLatest.json delete mode 100644 simulators/ethereum/graphql/testcases/11_eth_getBalance_latest.json delete mode 100644 simulators/ethereum/graphql/testcases/12_eth_getBalance_toobig_bn.json delete mode 100644 simulators/ethereum/graphql/testcases/13_eth_getBalance_without_addr.json delete mode 100644 simulators/ethereum/graphql/testcases/14_eth_getBlock_byHash.json delete mode 100644 simulators/ethereum/graphql/testcases/15_eth_getBlock_byHashInvalid.json delete mode 100644 simulators/ethereum/graphql/testcases/16_eth_getBlock_byNumber.json delete mode 100644 simulators/ethereum/graphql/testcases/17_eth_getBlock_byNumberInvalid.json delete mode 100644 simulators/ethereum/graphql/testcases/18_eth_getBlock_wrongParams.json delete mode 100644 simulators/ethereum/graphql/testcases/19_eth_getBlockTransactionCount_byHash.json delete mode 100644 simulators/ethereum/graphql/testcases/20_eth_getBlockTransactionCount_byNumber.json delete mode 100644 simulators/ethereum/graphql/testcases/21_eth_getCode_noCode.json delete mode 100644 simulators/ethereum/graphql/testcases/22_eth_getCode.json delete mode 100644 simulators/ethereum/graphql/testcases/23_eth_getLogs_matchTopic.json delete mode 100644 simulators/ethereum/graphql/testcases/24_eth_getLogs_range.json delete mode 100644 simulators/ethereum/graphql/testcases/25_eth_getStorageAt_illegalRangeGreaterThan.json delete mode 100644 simulators/ethereum/graphql/testcases/26_eth_getStorageAt.json delete mode 100644 simulators/ethereum/graphql/testcases/27_eth_getTransaction_byBlockHashAndIndex.json delete mode 100644 simulators/ethereum/graphql/testcases/28_eth_getTransaction_byBlockNumberAndIndex.json delete mode 100644 simulators/ethereum/graphql/testcases/29_eth_getTransaction_byBlockNumberAndInvalidIndex.json delete mode 100644 simulators/ethereum/graphql/testcases/30_eth_getTransaction_byHash.json delete mode 100644 simulators/ethereum/graphql/testcases/31_eth_getTransaction_byHashNull.json delete mode 100644 simulators/ethereum/graphql/testcases/32_eth_getTransactionCount.json delete mode 100644 simulators/ethereum/graphql/testcases/33_eth_getTransactionReceipt.json delete mode 100644 simulators/ethereum/graphql/testcases/34_eth_sendRawTransaction_contractCreation.json delete mode 100644 simulators/ethereum/graphql/testcases/35_graphql_pending.json delete mode 100644 simulators/ethereum/graphql/testcases/36_eth_sendRawTransaction_messageCall.json delete mode 100644 simulators/ethereum/graphql/testcases/37_eth_sendRawTransaction_nonceTooLow.json delete mode 100644 simulators/ethereum/graphql/testcases/38_eth_sendRawTransaction_transferEther.json delete mode 100644 simulators/ethereum/graphql/testcases/39_eth_sendRawTransaction_unsignedTransaction.json delete mode 100644 simulators/ethereum/graphql/testcases/40_eth_syncing.json delete mode 100644 simulators/ethereum/graphql/testcases/41_graphql_blocks_byFrom.json delete mode 100644 simulators/ethereum/graphql/testcases/42_graphql_blocks_byRange.json delete mode 100644 simulators/ethereum/graphql/testcases/43_graphql_blocks_byWrongRange.json delete mode 100644 simulators/ethereum/graphql/testcases/44_getBlock_byHexNumber.json delete mode 100644 simulators/ethereum/graphql/testcases/45_eth_getLogs_range_hex.json delete mode 100644 simulators/ethereum/graphql/testcases/46_transaction_fromByHexBlockNumber.json delete mode 100644 simulators/ethereum/graphql/testcases/47_block_withdrawals_pre_shanghai.json delete mode 100644 simulators/ethereum/graphql/testcases/48_block_withdrawals.json delete mode 100644 simulators/ethereum/graphql/testcases/49_get_type2Transaction.json delete mode 100644 simulators/ethereum/graphql/testcases/50_eth_getBlock_shanghai.json diff --git a/simulators/ethereum/graphql/testcases/01_eth_blockNumber.json b/simulators/ethereum/graphql/testcases/01_eth_blockNumber.json deleted file mode 100644 index 8ff5d2aa9e..0000000000 --- a/simulators/ethereum/graphql/testcases/01_eth_blockNumber.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "request": - "{ block { number } }", - - "responses": [{ - "data" : { - "block" : { - "number" : "0x21" - } - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/02_eth_call_Block8.json b/simulators/ethereum/graphql/testcases/02_eth_call_Block8.json deleted file mode 100644 index fdcac0dee6..0000000000 --- a/simulators/ethereum/graphql/testcases/02_eth_call_Block8.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "request": "{block(number :8) {number call (data : {from : \"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\", to: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\", data :\"0x12a7b914\"}){data status}}}" - , - "responses":[{ - "data" : { - "block" : { - "number" : "0x8", - "call" : { - "data" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "status" : "0x1" - } - } - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/03_eth_call_BlockLatest.json b/simulators/ethereum/graphql/testcases/03_eth_call_BlockLatest.json deleted file mode 100644 index b3a19b2699..0000000000 --- a/simulators/ethereum/graphql/testcases/03_eth_call_BlockLatest.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "request": "{block {number call (data : {from : \"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\", to: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\", data :\"0x12a7b914\"}){data status}}}" - , - "responses":[{ - "data" : { - "block" : { - "number" : "0x21", - "call" : { - "data" : "0x0000000000000000000000000000000000000000000000000000000000000001", - "status" : "0x1" - } - } - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/04_eth_estimateGas_contractDeploy.json b/simulators/ethereum/graphql/testcases/04_eth_estimateGas_contractDeploy.json deleted file mode 100644 index e478559af5..0000000000 --- a/simulators/ethereum/graphql/testcases/04_eth_estimateGas_contractDeploy.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "request" :"{block(number: 32) {estimateGas (data: {from :\"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\", data :\"0x608060405234801561001057600080fd5b50610157806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633bdab8bf146100515780639ae97baa14610068575b600080fd5b34801561005d57600080fd5b5061006661007f565b005b34801561007457600080fd5b5061007d6100b9565b005b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60016040518082815260200191505060405180910390a1565b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60026040518082815260200191505060405180910390a17fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60036040518082815260200191505060405180910390a15600a165627a7a7230582010ddaa52e73a98c06dbcd22b234b97206c1d7ed64a7c048e10c2043a3d2309cb0029\"})}}", - "responses":[{ - "data" : { - "block" : { - "estimateGas" : "0x1b551" - } - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/05_eth_estimateGas_noParams.json b/simulators/ethereum/graphql/testcases/05_eth_estimateGas_noParams.json deleted file mode 100644 index 9eb5656b58..0000000000 --- a/simulators/ethereum/graphql/testcases/05_eth_estimateGas_noParams.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "request" :"{block(number: 32) { estimateGas(data:{}) }}", - "responses":[{ - "data" : { - "block" : { - "estimateGas" : "0x5208" - } - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/06_eth_estimateGas_transfer.json b/simulators/ethereum/graphql/testcases/06_eth_estimateGas_transfer.json deleted file mode 100644 index c35dbadf46..0000000000 --- a/simulators/ethereum/graphql/testcases/06_eth_estimateGas_transfer.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "request" :"{block{estimateGas (data: {from :\"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\", to :\"0x8888f1f195afa192cfee860698584c030f4c9db1\"})}}", - "responses":[{ - "data" : { - "block" : { - "estimateGas" : "0x5208" - } - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/07_eth_gasPrice.json b/simulators/ethereum/graphql/testcases/07_eth_gasPrice.json deleted file mode 100644 index e54d5b2800..0000000000 --- a/simulators/ethereum/graphql/testcases/07_eth_gasPrice.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "request": - "{ gasPrice }", - "responses": [ - { - "data" : { - "gasPrice" : "0x10" - } - }, - { - "data" : { - "gasPrice" : "0x1" - } - } - ], - "statusCode": 200 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/08_eth_getBalance_0x19.json b/simulators/ethereum/graphql/testcases/08_eth_getBalance_0x19.json deleted file mode 100644 index 6e17cfb97b..0000000000 --- a/simulators/ethereum/graphql/testcases/08_eth_getBalance_0x19.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "request": "{block (number : 25) {account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance } }}", - "responses": [{ - "data": { - "block": { - "account": { - "balance": "0xfa" - } - } - } - }], - "statusCode": 200 -} - diff --git a/simulators/ethereum/graphql/testcases/09_eth_getBalance_invalidAccountBlockNumber.json b/simulators/ethereum/graphql/testcases/09_eth_getBalance_invalidAccountBlockNumber.json deleted file mode 100644 index e22db98583..0000000000 --- a/simulators/ethereum/graphql/testcases/09_eth_getBalance_invalidAccountBlockNumber.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "request": "{block (number: 25) {account(address: \"0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef\") { balance } }}", - "responses": [{ - "data": { - "block": { - "account": { - "balance": "0x0" - } - } - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/10_eth_getBalance_invalidAccountLatest.json b/simulators/ethereum/graphql/testcases/10_eth_getBalance_invalidAccountLatest.json deleted file mode 100644 index 885795588e..0000000000 --- a/simulators/ethereum/graphql/testcases/10_eth_getBalance_invalidAccountLatest.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "request": "{block{account(address: \"0xdeaff00ddeaff00ddeaff00ddeaff00ddeaff00d\") { balance } }}", - "responses": [{ - "data": { - "block": { - "account": { - "balance": "0x0" - } - } - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/11_eth_getBalance_latest.json b/simulators/ethereum/graphql/testcases/11_eth_getBalance_latest.json deleted file mode 100644 index 6dfdb27d9a..0000000000 --- a/simulators/ethereum/graphql/testcases/11_eth_getBalance_latest.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "request": "{block{account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance } }}", - "responses":[{ - "data": { - "block": { - "account": { - "balance": "0x140" - } - } - } - }], - "statusCode": 200 -} - diff --git a/simulators/ethereum/graphql/testcases/12_eth_getBalance_toobig_bn.json b/simulators/ethereum/graphql/testcases/12_eth_getBalance_toobig_bn.json deleted file mode 100644 index 39d4c98b00..0000000000 --- a/simulators/ethereum/graphql/testcases/12_eth_getBalance_toobig_bn.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "request": "{block (number: 33) {account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance } }}", - "responses": [{ - "errors": [ - { - "message": "Exception while fetching data (/account) : Invalid params", - "locations": [ - { - "line": 1, - "column": 2 - } - ], - "path": [ - "account" - ], - "extensions": { - "errorCode": -32602, - "errorMessage": "Invalid params", - "classification": "DataFetchingException" - } - } - ], - "data": null - }, - { - "data": { - "block": null - } - }], - "statusCode": 400 -} - diff --git a/simulators/ethereum/graphql/testcases/13_eth_getBalance_without_addr.json b/simulators/ethereum/graphql/testcases/13_eth_getBalance_without_addr.json deleted file mode 100644 index 54bb700d1c..0000000000 --- a/simulators/ethereum/graphql/testcases/13_eth_getBalance_without_addr.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "request": "{block{account { balance } }}", - "responses": [{ - "errors": [ - { - "message": "Validation error of type MissingFieldArgument: Missing field argument address @ 'account'", - "locations": [ - { - "line": 1, - "column": 2 - } - ], - "extensions": { - "classification": "ValidationError" - } - } - ] - }], - "statusCode": 400 -} - diff --git a/simulators/ethereum/graphql/testcases/14_eth_getBlock_byHash.json b/simulators/ethereum/graphql/testcases/14_eth_getBlock_byHash.json deleted file mode 100644 index decf15c17a..0000000000 --- a/simulators/ethereum/graphql/testcases/14_eth_getBlock_byHash.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "request": - - "{block (hash : \"0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6\") {number transactions{hash} timestamp difficulty totalDifficulty gasUsed gasLimit hash nonce ommerCount logsBloom mixHash ommerHash extraData stateRoot receiptsRoot transactionCount transactionsRoot}} ", - - - "responses": [{ - "data" : { - "block" : { - "number" : "0x1e", - "transactions" : [ { - "hash" : "0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4" - } ], - "timestamp" : "0x561bc336", - "difficulty" : "0x20740", - "totalDifficulty" : "0x3e6cc0", - "gasUsed" : "0x5c21", - "gasLimit" : "0x2fefd8", - "hash" : "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6", - "nonce" : "0x5c321bd9e9f040f1", - "ommerCount" : "0x0", - "logsBloom" : "0x00000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000080000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000400000000000000000200000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000800000000040000000000000000000000000000000000000000010000000000000000000000000", - "mixHash" : "0x6ce1c4afb4f85fefd1b0ed966b20cd248f08d9a5b0df773f75c6c2f5cc237b7c", - "ommerHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "extraData" : "0x", - "stateRoot" : "0xdb46d6bb168130fe2cb60b4b24346137b5741f11283e0d7edace65c5f5466b2e", - "receiptsRoot" : "0x88b3b304b058b39791c26fdb94a05cc16ce67cf8f84f7348cb3c60c0ff342d0d", - "transactionCount" : "0x1", - "transactionsRoot" : "0x5a8d5d966b48e1331ae19eb459eb28882cdc7654e615d37774b79204e875dc01" - } - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/15_eth_getBlock_byHashInvalid.json b/simulators/ethereum/graphql/testcases/15_eth_getBlock_byHashInvalid.json deleted file mode 100644 index a53a108341..0000000000 --- a/simulators/ethereum/graphql/testcases/15_eth_getBlock_byHashInvalid.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "request": "{block (hash : \"0x123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0\") {number } }", - "responses": [{ - "errors": [ - { - "message": "Exception while fetching data (/block) : Block hash 0x123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0 was not found", - "locations": [ - { - "line": 1, - "column": 2 - } - ], - "path": [ - "block" - ], - "extensions": { - "classification": "DataFetchingException" - } - } - ], - "data": null - }], - "statusCode": 400 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/16_eth_getBlock_byNumber.json b/simulators/ethereum/graphql/testcases/16_eth_getBlock_byNumber.json deleted file mode 100644 index 34244dbc5c..0000000000 --- a/simulators/ethereum/graphql/testcases/16_eth_getBlock_byNumber.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "request": - - "{block (number : 30) {transactions{hash} timestamp difficulty totalDifficulty gasUsed gasLimit hash nonce ommerCount logsBloom mixHash ommerHash extraData stateRoot receiptsRoot transactionCount transactionsRoot ommers{hash} ommerAt(index : 1){hash} miner{address} account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\"){balance} parent{hash} }} ", - - - "responses":[{ - "data" : { - "block" : { - "transactions" : [ { - "hash" : "0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4" - } ], - "timestamp" : "0x561bc336", - "difficulty" : "0x20740", - "totalDifficulty" : "0x3e6cc0", - "gasUsed" : "0x5c21", - "gasLimit" : "0x2fefd8", - "hash" : "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6", - "nonce" : "0x5c321bd9e9f040f1", - "ommerCount" : "0x0", - "logsBloom" : "0x00000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000080000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000400000000000000000200000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000800000000040000000000000000000000000000000000000000010000000000000000000000000", - "mixHash" : "0x6ce1c4afb4f85fefd1b0ed966b20cd248f08d9a5b0df773f75c6c2f5cc237b7c", - "ommerHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "extraData" : "0x", - "stateRoot" : "0xdb46d6bb168130fe2cb60b4b24346137b5741f11283e0d7edace65c5f5466b2e", - "receiptsRoot" : "0x88b3b304b058b39791c26fdb94a05cc16ce67cf8f84f7348cb3c60c0ff342d0d", - "transactionCount" : "0x1", - "transactionsRoot" : "0x5a8d5d966b48e1331ae19eb459eb28882cdc7654e615d37774b79204e875dc01", - "ommers" : [ ], - "ommerAt" : null, - "miner" : { - "address" : "0x8888f1f195afa192cfee860698584c030f4c9db1" - }, - "account" : { - "balance" : "0x12c" - }, - "parent" : { - "hash" : "0xf8cfa377bd766cdf22edb388dd08cc149e85d24f2796678c835f3c54ab930803" - } - } - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/17_eth_getBlock_byNumberInvalid.json b/simulators/ethereum/graphql/testcases/17_eth_getBlock_byNumberInvalid.json deleted file mode 100644 index 90eefbaf91..0000000000 --- a/simulators/ethereum/graphql/testcases/17_eth_getBlock_byNumberInvalid.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "request": "{block (number: 88888888) {number }} ", - "responses": [ - { - "errors": [ - { - "message": "Exception while fetching data (/block) : Block number 88888888 was not found", - "locations": [ - { - "line": 1, - "column": 2 - } - ], - "path": [ - "block" - ], - "extensions": { - "classification": "DataFetchingException" - } - } - ], - "data": null - }, - { - "data": { - "block": null - } - } - ], - "statusCode": 400 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/18_eth_getBlock_wrongParams.json b/simulators/ethereum/graphql/testcases/18_eth_getBlock_wrongParams.json deleted file mode 100644 index f2e7f663af..0000000000 --- a/simulators/ethereum/graphql/testcases/18_eth_getBlock_wrongParams.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "request": "{block (number: \"0x03\", hash : \"0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6\") {number transactions{hash} timestamp difficulty totalDifficulty gasUsed gasLimit hash nonce ommerCount logsBloom mixHash ommerHash extraData stateRoot receiptsRoot transactionCount transactionsRoot}} ", - "responses": [{ - "errors": [ - { - "message": "Exception while fetching data (/block) : Invalid params", - "locations": [ - { - "line": 1, - "column": 2 - } - ], - "path": [ - "block" - ], - "extensions": { - "errorCode": -32602, - "errorMessage": "Invalid params", - "classification": "DataFetchingException" - } - } - ], - "data": null - }], - "statusCode": 400 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/19_eth_getBlockTransactionCount_byHash.json b/simulators/ethereum/graphql/testcases/19_eth_getBlockTransactionCount_byHash.json deleted file mode 100644 index 3a31866f19..0000000000 --- a/simulators/ethereum/graphql/testcases/19_eth_getBlockTransactionCount_byHash.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "request": - - "{block (hash : \"0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6\") {transactionCount}} ", - - - "responses": [{ - "data" : { - "block" : { - "transactionCount" : "0x1" - } - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/20_eth_getBlockTransactionCount_byNumber.json b/simulators/ethereum/graphql/testcases/20_eth_getBlockTransactionCount_byNumber.json deleted file mode 100644 index 4573355dae..0000000000 --- a/simulators/ethereum/graphql/testcases/20_eth_getBlockTransactionCount_byNumber.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "request": - - "{block (number : 30) {transactions{hash} timestamp difficulty totalDifficulty gasUsed gasLimit hash nonce ommerCount logsBloom mixHash ommerHash extraData stateRoot receiptsRoot transactionCount transactionsRoot}} ", - - - "responses": [{ - "data" : { - "block" : { - "transactions" : [ { - "hash" : "0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4" - } ], - "timestamp" : "0x561bc336", - "difficulty" : "0x20740", - "totalDifficulty" : "0x3e6cc0", - "gasUsed" : "0x5c21", - "gasLimit" : "0x2fefd8", - "hash" : "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6", - "nonce" : "0x5c321bd9e9f040f1", - "ommerCount" : "0x0", - "logsBloom" : "0x00000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000080000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000400000000000000000200000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000800000000040000000000000000000000000000000000000000010000000000000000000000000", - "mixHash" : "0x6ce1c4afb4f85fefd1b0ed966b20cd248f08d9a5b0df773f75c6c2f5cc237b7c", - "ommerHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "extraData" : "0x", - "stateRoot" : "0xdb46d6bb168130fe2cb60b4b24346137b5741f11283e0d7edace65c5f5466b2e", - "receiptsRoot" : "0x88b3b304b058b39791c26fdb94a05cc16ce67cf8f84f7348cb3c60c0ff342d0d", - "transactionCount" : "0x1", - "transactionsRoot" : "0x5a8d5d966b48e1331ae19eb459eb28882cdc7654e615d37774b79204e875dc01" - } - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/21_eth_getCode_noCode.json b/simulators/ethereum/graphql/testcases/21_eth_getCode_noCode.json deleted file mode 100644 index f70d77d1d1..0000000000 --- a/simulators/ethereum/graphql/testcases/21_eth_getCode_noCode.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "request" : "{block{ account(address: \"0x8888f1f195afa192cfee860698584c030f4c9db1\") { code } }}", - - "responses": [{ - "data": { - "block": { - "account": { - "code": "0x" - } - } - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/22_eth_getCode.json b/simulators/ethereum/graphql/testcases/22_eth_getCode.json deleted file mode 100644 index e8babeb9bf..0000000000 --- a/simulators/ethereum/graphql/testcases/22_eth_getCode.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "request" : "{block{ account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { code } }}", - - "responses": [{ - "data": { - "block": { - "account": { - "code": "0x6000357c010000000000000000000000000000000000000000000000000000000090048063102accc11461012c57806312a7b9141461013a5780631774e6461461014c5780631e26fd331461015d5780631f9030371461016e578063343a875d1461018057806338cc4831146101955780634e7ad367146101bd57806357cb2fc4146101cb57806365538c73146101e057806368895979146101ee57806376bc21d9146102005780639a19a9531461020e5780639dc2c8f51461021f578063a53b1c1e1461022d578063a67808571461023e578063b61c05031461024c578063c2b12a731461025a578063d2282dc51461026b578063e30081a01461027c578063e8beef5b1461028d578063f38b06001461029b578063f5b53e17146102a9578063fd408767146102bb57005b6101346104d6565b60006000f35b61014261039b565b8060005260206000f35b610157600435610326565b60006000f35b6101686004356102c9565b60006000f35b610176610442565b8060005260206000f35b6101886103d3565b8060ff1660005260206000f35b61019d610413565b8073ffffffffffffffffffffffffffffffffffffffff1660005260206000f35b6101c56104c5565b60006000f35b6101d36103b7565b8060000b60005260206000f35b6101e8610454565b60006000f35b6101f6610401565b8060005260206000f35b61020861051f565b60006000f35b6102196004356102e5565b60006000f35b610227610693565b60006000f35b610238600435610342565b60006000f35b610246610484565b60006000f35b610254610493565b60006000f35b61026560043561038d565b60006000f35b610276600435610350565b60006000f35b61028760043561035e565b60006000f35b6102956105b4565b60006000f35b6102a3610547565b60006000f35b6102b16103ef565b8060005260206000f35b6102c3610600565b60006000f35b80600060006101000a81548160ff021916908302179055505b50565b80600060016101000a81548160ff02191690837f01000000000000000000000000000000000000000000000000000000000000009081020402179055505b50565b80600060026101000a81548160ff021916908302179055505b50565b806001600050819055505b50565b806002600050819055505b50565b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b50565b806004600050819055505b50565b6000600060009054906101000a900460ff1690506103b4565b90565b6000600060019054906101000a900460000b90506103d0565b90565b6000600060029054906101000a900460ff1690506103ec565b90565b600060016000505490506103fe565b90565b60006002600050549050610410565b90565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061043f565b90565b60006004600050549050610451565b90565b7f65c9ac8011e286e89d02a269890f41d67ca2cc597b2c76c7c69321ff492be5806000602a81526020016000a15b565b6000602a81526020016000a05b565b60017f81933b308056e7e85668661dcd102b1f22795b4431f9cf4625794f381c271c6b6000602a81526020016000a25b565b60016000602a81526020016000a15b565b3373ffffffffffffffffffffffffffffffffffffffff1660017f0e216b62efbb97e751a2ce09f607048751720397ecfb9eef1e48a6644948985b6000602a81526020016000a35b565b3373ffffffffffffffffffffffffffffffffffffffff1660016000602a81526020016000a25b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660017f317b31292193c2a4f561cc40a95ea0d97a2733f14af6d6d59522473e1f3ae65f6000602a81526020016000a45b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660016000602a81526020016000a35b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660017fd5f0a30e4be0c6be577a71eceb7464245a796a7e6a55c0d971837b250de05f4e60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe98152602001602a81526020016000a45b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff16600160007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe98152602001602a81526020016000a35b56" - } - } - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/23_eth_getLogs_matchTopic.json b/simulators/ethereum/graphql/testcases/23_eth_getLogs_matchTopic.json deleted file mode 100644 index cf7f6e4b15..0000000000 --- a/simulators/ethereum/graphql/testcases/23_eth_getLogs_matchTopic.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "request": "{ block(number: 23) { logs( filter: { topics : [[\"0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b\", \"0x65c9ac8011e286e89d02a269890f41d67ca2cc597b2c76c7c69321ff492be580\"]]}) { index topics data account{address} transaction{hash} } } }", - "responses": [{ - "data" : { - "block" : { - "logs" : [ { - "index" : "0x0", - "topics" : [ "0x65c9ac8011e286e89d02a269890f41d67ca2cc597b2c76c7c69321ff492be580" ], - "data" : "0x000000000000000000000000000000000000000000000000000000000000002a", - "account" : { - "address" : "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f" - }, - "transaction" : { - "hash" : "0x97a385bf570ced7821c6495b3877ddd2afd5c452f350f0d4876e98d9161389c6" - } - } ] - } - } - }], - - "statusCode": 200 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/24_eth_getLogs_range.json b/simulators/ethereum/graphql/testcases/24_eth_getLogs_range.json deleted file mode 100644 index 6b04466744..0000000000 --- a/simulators/ethereum/graphql/testcases/24_eth_getLogs_range.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "request": "{ logs( filter: { fromBlock:20, toBlock: 24, topics : [], addresses : []}) { index topics data account{address} transaction{hash block {number}} } }", - "responses": [{ - "data": { - "logs": [ - { - "index": "0x0", - "topics": [ - "0x65c9ac8011e286e89d02a269890f41d67ca2cc597b2c76c7c69321ff492be580" - ], - "data": "0x000000000000000000000000000000000000000000000000000000000000002a", - "account": { - "address": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f" - }, - "transaction": { - "hash": "0x97a385bf570ced7821c6495b3877ddd2afd5c452f350f0d4876e98d9161389c6", - "block": { - "number": "0x17" - } - } - }, - { - "index": "0x0", - "topics": [], - "data": "0x000000000000000000000000000000000000000000000000000000000000002a", - "account": { - "address": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f" - }, - "transaction": { - "hash": "0x5ecd942096ab3f70c5bcc8f3a98f88c4ff0a3bd986417df9948eb1819db76d0e", - "block": { - "number": "0x18" - } - } - } - ] - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/25_eth_getStorageAt_illegalRangeGreaterThan.json b/simulators/ethereum/graphql/testcases/25_eth_getStorageAt_illegalRangeGreaterThan.json deleted file mode 100644 index 4995192765..0000000000 --- a/simulators/ethereum/graphql/testcases/25_eth_getStorageAt_illegalRangeGreaterThan.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "request": "{block{ account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { storage(slot: \"0x0000000000000000000000000000000000000000000000000000000000000021\") } }}", - "responses": [ - { - "data": { - "block": { - "account": { - "storage": "0x0000000000000000000000000000000000000000000000000000000000000000" - } - } - } - } - ], - "statusCode": 200 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/26_eth_getStorageAt.json b/simulators/ethereum/graphql/testcases/26_eth_getStorageAt.json deleted file mode 100644 index 57ae719114..0000000000 --- a/simulators/ethereum/graphql/testcases/26_eth_getStorageAt.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "request": "{block{ account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { storage(slot: \"0x0000000000000000000000000000000000000000000000000000000000000004\") } }}", - "responses": [ - { - "data": { - "block": { - "account": { - "storage": "0xaabbccffffffffffffffffffffffffffffffffffffffffffffffffffffffffee" - } - } - } - } - ], - "statusCode": 200 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/27_eth_getTransaction_byBlockHashAndIndex.json b/simulators/ethereum/graphql/testcases/27_eth_getTransaction_byBlockHashAndIndex.json deleted file mode 100644 index a445305c3c..0000000000 --- a/simulators/ethereum/graphql/testcases/27_eth_getTransaction_byBlockHashAndIndex.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "request": - - "{ block(hash: \"0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6\") { transactionAt(index: 0) {block{hash} hash } } }", - - "responses":[{ - "data" : { - "block" : { - "transactionAt" : { - "block" : { - "hash" : "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6" - }, - "hash" : "0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4" - } - } - } - }], - - "statusCode": 200 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/28_eth_getTransaction_byBlockNumberAndIndex.json b/simulators/ethereum/graphql/testcases/28_eth_getTransaction_byBlockNumberAndIndex.json deleted file mode 100644 index 00a41f132d..0000000000 --- a/simulators/ethereum/graphql/testcases/28_eth_getTransaction_byBlockNumberAndIndex.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "request": - - "{ block(number: 30) { transactionAt(index: 0) {block{hash} hash} } }", - - "responses":[{ - "data" : { - "block" : { - "transactionAt" : { - "block" : { - "hash" : "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6" - }, - "hash" : "0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4" - } - } - } - }], - - "statusCode": 200 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/29_eth_getTransaction_byBlockNumberAndInvalidIndex.json b/simulators/ethereum/graphql/testcases/29_eth_getTransaction_byBlockNumberAndInvalidIndex.json deleted file mode 100644 index f7dd2b9529..0000000000 --- a/simulators/ethereum/graphql/testcases/29_eth_getTransaction_byBlockNumberAndInvalidIndex.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "request": - - "{ block(number: 30) { transactionAt(index: 1) {block{hash} hash} } }", - - "responses":[{ - "data" : { - "block" : { - "transactionAt" : null - } - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/30_eth_getTransaction_byHash.json b/simulators/ethereum/graphql/testcases/30_eth_getTransaction_byHash.json deleted file mode 100644 index b5607f0fbd..0000000000 --- a/simulators/ethereum/graphql/testcases/30_eth_getTransaction_byHash.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "request": "{transaction (hash : \"0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4\") { block{hash} gas gasPrice hash inputData nonce index value from {address} to {address} logs{index} status createdContract{address} } } ", - "responses": [ - { - "data": { - "transaction": { - "block": { - "hash": "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6" - }, - "gas": "0x4cb2f", - "gasPrice": "0x1", - "hash": "0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4", - "inputData": "0xe8beef5b", - "nonce": "0x1d", - "index": "0x0", - "value": "0xa", - "from": { - "address": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" - }, - "to": { - "address": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f" - }, - "logs": [ - { - "index": "0x0" - } - ], - "status": null, - "createdContract": null - } - } - }, - { - "data": { - "transaction": { - "block": { - "hash": "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6" - }, - "createdContract": null, - "from": { - "address": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" - }, - "gas": "0x4cb2f", - "gasPrice": "0x1", - "hash": "0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4", - "index": 0, - "inputData": "0xe8beef5b", - "logs": [ - { - "index": 0 - } - ], - "nonce": "0x1d", - "status": "0x0", - "to": { - "address": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f" - }, - "value": "0xa" - } - } - } - ], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/31_eth_getTransaction_byHashNull.json b/simulators/ethereum/graphql/testcases/31_eth_getTransaction_byHashNull.json deleted file mode 100644 index cf238cb74e..0000000000 --- a/simulators/ethereum/graphql/testcases/31_eth_getTransaction_byHashNull.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "request": - - "{transaction (hash : \"0xffc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4\") { block{hash} gas gasPrice hash inputData nonce index value }} ", - - - "responses": [{ - "data" : { - "transaction" : null - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/32_eth_getTransactionCount.json b/simulators/ethereum/graphql/testcases/32_eth_getTransactionCount.json deleted file mode 100644 index 7234ea96b1..0000000000 --- a/simulators/ethereum/graphql/testcases/32_eth_getTransactionCount.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "request": "{block{ account(address: \"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\") { transactionCount } }}", - "responses": [{ - "data": { - "block": { - "account": { - "transactionCount": "0x21" - } - } - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/33_eth_getTransactionReceipt.json b/simulators/ethereum/graphql/testcases/33_eth_getTransactionReceipt.json deleted file mode 100644 index e481c1d7ee..0000000000 --- a/simulators/ethereum/graphql/testcases/33_eth_getTransactionReceipt.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "request": "{ transaction(hash: \"0x812742182a79a8e67733edc58cfa3767aa2d7ad06439d156ddbbb33e3403b4ed\") {block{hash logsBloom} hash createdContract{address} cumulativeGasUsed gas gasUsed logs{topics} from{address} to{address} index } }", - "responses": [ - { - "data": { - "transaction": { - "block": { - "hash": "0x10aaf14a53caf27552325374429d3558398a36d3682ede6603c2c6511896e9f9", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" - }, - "createdContract": { - "address": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f" - }, - "cumulativeGasUsed": "0x78674", - "from": { - "address": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" - }, - "gas": "0x2fefd8", - "gasUsed": "0x78674", - "hash": "0x812742182a79a8e67733edc58cfa3767aa2d7ad06439d156ddbbb33e3403b4ed", - "index": "0x0", - "logs": [], - "to": null - } - } - }, - { - "data": { - "transaction": { - "block": { - "hash": "0x10aaf14a53caf27552325374429d3558398a36d3682ede6603c2c6511896e9f9", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" - }, - "createdContract": { - "address": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f" - }, - "cumulativeGasUsed": "0x78674", - "from": { - "address": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" - }, - "gas": "0x2fefd8", - "gasUsed": "0x78674", - "hash": "0x812742182a79a8e67733edc58cfa3767aa2d7ad06439d156ddbbb33e3403b4ed", - "index": 0, - "logs": [], - "to": null - } - } - } - ], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/34_eth_sendRawTransaction_contractCreation.json b/simulators/ethereum/graphql/testcases/34_eth_sendRawTransaction_contractCreation.json deleted file mode 100644 index 2f710211aa..0000000000 --- a/simulators/ethereum/graphql/testcases/34_eth_sendRawTransaction_contractCreation.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "request" : "mutation { sendRawTransaction(data: \"0xf901ca3285174876e800830fffff8080b90177608060405234801561001057600080fd5b50610157806100206000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633bdab8bf146100515780639ae97baa14610068575b600080fd5b34801561005d57600080fd5b5061006661007f565b005b34801561007457600080fd5b5061007d6100b9565b005b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60016040518082815260200191505060405180910390a1565b7fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60026040518082815260200191505060405180910390a17fa53887c1eed04528e23301f55ad49a91634ef5021aa83a97d07fd16ed71c039a60036040518082815260200191505060405180910390a15600a165627a7a7230582010ddaa52e73a98c06dbcd22b234b97206c1d7ed64a7c048e10c2043a3d2309cb00291ca05d71c687073e23402e59853d85c587f6eebc735082f40a450e407451b42ee2a4a07d4f2db1717dc9be745b991962193fa0d5f6059b9c92350dba3efe3a99df6b52\") }", - "responses":[{ - "data" : { - "sendRawTransaction" : "0xf9a25e1d6202e9ea1d984f76939e9bb3609bfb9aea2541ae8a629270343fbb2f" - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/35_graphql_pending.json b/simulators/ethereum/graphql/testcases/35_graphql_pending.json deleted file mode 100644 index 7aceb90647..0000000000 --- a/simulators/ethereum/graphql/testcases/35_graphql_pending.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "request": - "{ pending { transactionCount transactions { nonce gas } account(address:\"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance} estimateGas(data:{}) call (data : {from : \"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\", to: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\", data :\"0x12a7b914\"}){data status}} }", - - "responses": [{ - "data": { - "pending": { - "transactionCount": "0x1", - "transactions": [ - { - "nonce": "0x32", - "gas": "0xfffff" - } - ], - "account": { - "balance": "0x140" - }, - "estimateGas": "0x5208", - "call": { - "data": "0x0000000000000000000000000000000000000000000000000000000000000001", - "status": "0x1" - } - } - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/36_eth_sendRawTransaction_messageCall.json b/simulators/ethereum/graphql/testcases/36_eth_sendRawTransaction_messageCall.json deleted file mode 100644 index e5eace1ff7..0000000000 --- a/simulators/ethereum/graphql/testcases/36_eth_sendRawTransaction_messageCall.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "request" : "mutation { sendRawTransaction(data: \"0xf8693785174876e800830fffff94450b61224a7df4d8a70f3e20d4fd6a6380b920d180843bdab8bf1ba054b00220864ab58246bbe0a6f6d50166f9bd0ba3f1711912f79c073da6368ca5a04f84bc3231ee4406b8ceb8740d6d8d1900f87b67b9f4a0a38bc55062121a94c6\") }", - "responses":[{ - "data" : { - "sendRawTransaction" : "0x6ad12f495251471d1834852623c2eeb2cb04d2fb9e1a5d6cff481cfec7b233a8" - } - }], - - "statusCode": 200 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/37_eth_sendRawTransaction_nonceTooLow.json b/simulators/ethereum/graphql/testcases/37_eth_sendRawTransaction_nonceTooLow.json deleted file mode 100644 index 5d677670fc..0000000000 --- a/simulators/ethereum/graphql/testcases/37_eth_sendRawTransaction_nonceTooLow.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "request": "mutation { sendRawTransaction(data: \"0xf86410018304cb2f946295ee1b4f6dd65047762f924ecd367c17eabf8f0a8457cb2fc41ca0060dc80554e845b572ab6b88dab08f7491f83b4405fea2f067a80b3742127fb0a0246160f01d027a0335be590d443335ecb2cf5d9f9589c8efffa4acbda4acafea\") }", - "responses": [{ - "errors": [ - { - "message": "Exception while fetching data (/sendRawTransaction) : Nonce too low", - "locations": [ - { - "line": 1, - "column": 12 - } - ], - "path": [ - "sendRawTransaction" - ], - "extensions": { - "errorCode": -32001, - "errorMessage": "Nonce too low", - "classification": "DataFetchingException" - } - } - ], - "data": null - }], - "statusCode": 400 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/38_eth_sendRawTransaction_transferEther.json b/simulators/ethereum/graphql/testcases/38_eth_sendRawTransaction_transferEther.json deleted file mode 100644 index 466d22f7f6..0000000000 --- a/simulators/ethereum/graphql/testcases/38_eth_sendRawTransaction_transferEther.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "request" : "mutation { sendRawTransaction(data: \"0xf86d3785174876e801830222e0945aae326516b4f8fe08074b7e972e40a713048d628829a2241af62c0000801ca077d36666ce36d433b6f1ac62eafe7a232354c83ad2293cfcc2445a86bcd08b4da04b8bd0918d440507ab81d47cf562addaa15a1d28ac701989f5141c8da49615d0\") }", - "responses":[{ - "data" : { - "sendRawTransaction" : "0x772b6d5c64b9798865d6dfa35ba44d181abd96a448f8ab7ea9e9631cabb7b290" - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/39_eth_sendRawTransaction_unsignedTransaction.json b/simulators/ethereum/graphql/testcases/39_eth_sendRawTransaction_unsignedTransaction.json deleted file mode 100644 index 30b83680aa..0000000000 --- a/simulators/ethereum/graphql/testcases/39_eth_sendRawTransaction_unsignedTransaction.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "request": "mutation { sendRawTransaction(data: \"0xed0a85174876e800830222e0945aae326516b4f8fe08074b7e972e40a713048d62880de0b6b3a7640000801c8080\") }", - "responses": [{ - "errors": [ - { - "message": "Exception while fetching data (/sendRawTransaction) : Invalid params", - "locations": [ - { - "line": 1, - "column": 12 - } - ], - "path": [ - "sendRawTransaction" - ], - "extensions": { - "errorCode": -32602, - "errorMessage": "Invalid params", - "classification": "DataFetchingException" - } - } - ], - "data": null - }], - "statusCode": 400 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/40_eth_syncing.json b/simulators/ethereum/graphql/testcases/40_eth_syncing.json deleted file mode 100644 index 3c9a1997c3..0000000000 --- a/simulators/ethereum/graphql/testcases/40_eth_syncing.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "request": - "{ syncing {startingBlock currentBlock highestBlock } }", - - "responses": [{ - "data" : { - "syncing" : null - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/41_graphql_blocks_byFrom.json b/simulators/ethereum/graphql/testcases/41_graphql_blocks_byFrom.json deleted file mode 100644 index 020f787807..0000000000 --- a/simulators/ethereum/graphql/testcases/41_graphql_blocks_byFrom.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "request": "{ blocks(from:30) { number } }", - "responses": [{ - "data": { - "blocks": [ - { - "number": "0x1e" - }, - { - "number": "0x1f" - }, - { - "number": "0x20" - }, - { - "number": "0x21" - } - ] - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/42_graphql_blocks_byRange.json b/simulators/ethereum/graphql/testcases/42_graphql_blocks_byRange.json deleted file mode 100644 index 1552e2de42..0000000000 --- a/simulators/ethereum/graphql/testcases/42_graphql_blocks_byRange.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "request": - - "{blocks (from : 30, to: 32) { number gasUsed gasLimit hash nonce stateRoot receiptsRoot transactionCount }} ", - - - "responses":[{ - "data" : { - "blocks" : [ { - "number" : "0x1e", - "gasUsed" : "0x5c21", - "gasLimit" : "0x2fefd8", - "hash" : "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6", - "nonce" : "0x5c321bd9e9f040f1", - "stateRoot" : "0xdb46d6bb168130fe2cb60b4b24346137b5741f11283e0d7edace65c5f5466b2e", - "receiptsRoot" : "0x88b3b304b058b39791c26fdb94a05cc16ce67cf8f84f7348cb3c60c0ff342d0d", - "transactionCount" : "0x1" - }, { - "number" : "0x1f", - "gasUsed" : "0x5eef", - "gasLimit" : "0x2fefd8", - "hash" : "0x0f765087745aa259d9e5ac39c367c57432a16ed98e3b0d81c5b51d10f301dc49", - "nonce" : "0xd3a27a3001616468", - "stateRoot" : "0xa80997cf804269d64f2479baf535cf8f9090b70fbf515741c6995564f1e678bd", - "receiptsRoot" : "0x2440c44a3f75ad8b0425a73e7be2f61a5171112465cfd14e62e735b56d7178e6", - "transactionCount" : "0x1" - }, { - "number" : "0x20", - "gasUsed" : "0x5c99", - "gasLimit" : "0x2fefd8", - "hash" : "0x71d59849ddd98543bdfbe8548f5eed559b07b8aaf196369f39134500eab68e53", - "nonce" : "0xdb063000b00e8026", - "stateRoot" : "0xf65f3dd13f72f5fa5607a5224691419969b4f4bae7a00a6cdb853f2ca9eeb1be", - "receiptsRoot" : "0xa50a7e67e833f4502524371ee462ccbcc6c6cabd2aeb1555c56150007a53183c", - "transactionCount" : "0x1" - } ] - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/43_graphql_blocks_byWrongRange.json b/simulators/ethereum/graphql/testcases/43_graphql_blocks_byWrongRange.json deleted file mode 100644 index 32e3f2c6c1..0000000000 --- a/simulators/ethereum/graphql/testcases/43_graphql_blocks_byWrongRange.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "request": "{blocks (from : \"0x1e\", to: \"0x1c\") { number gasUsed gasLimit hash nonce stateRoot receiptsRoot transactionCount }} ", - "responses": [{ - "errors": [ - { - "message": "Exception while fetching data (/blocks) : Invalid params", - "locations": [ - { - "line": 1, - "column": 2 - } - ], - "path": [ - "blocks" - ], - "extensions": { - "errorCode": -32602, - "errorMessage": "Invalid params", - "classification": "DataFetchingException" - } - } - ], - "data": null - }], - "statusCode": 400 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/44_getBlock_byHexNumber.json b/simulators/ethereum/graphql/testcases/44_getBlock_byHexNumber.json deleted file mode 100644 index 0d4e0ed79e..0000000000 --- a/simulators/ethereum/graphql/testcases/44_getBlock_byHexNumber.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "request": "{block (number : \"0x1e\") { gasUsed gasLimit hash }} ", - - "responses":[{ - "data" : { - "block" : { - "gasUsed" : "0x5c21", - "gasLimit" : "0x2fefd8", - "hash" : "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6" - } - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/45_eth_getLogs_range_hex.json b/simulators/ethereum/graphql/testcases/45_eth_getLogs_range_hex.json deleted file mode 100644 index f7891fc7d8..0000000000 --- a/simulators/ethereum/graphql/testcases/45_eth_getLogs_range_hex.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "request": "{ logs( filter: { fromBlock:\"0x14\", toBlock: \"0x18\", topics : [], addresses : []}) { index transaction{hash} } }", - "responses": [{ - "data": { - "logs": [ - { - "index": "0x0", - "transaction": { - "hash": "0x97a385bf570ced7821c6495b3877ddd2afd5c452f350f0d4876e98d9161389c6" - } - }, - { - "index": "0x0", - "transaction": { - "hash": "0x5ecd942096ab3f70c5bcc8f3a98f88c4ff0a3bd986417df9948eb1819db76d0e" - } - } - ] - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/46_transaction_fromByHexBlockNumber.json b/simulators/ethereum/graphql/testcases/46_transaction_fromByHexBlockNumber.json deleted file mode 100644 index 96ff90d147..0000000000 --- a/simulators/ethereum/graphql/testcases/46_transaction_fromByHexBlockNumber.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "request": "{transaction (hash : \"0x9cc6c7e602c56aa30c554bb691377f8703d778cec8845f4b88c0f72516b304f4\") { block { number } from(block: \"0x1d\") {transactionCount}} } ", - "responses": [ - { - "data": { - "transaction": { - "block": { - "number": "0x1e" - }, - "from": { - "transactionCount": "0x1d" - } - } - } - } - ], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/47_block_withdrawals_pre_shanghai.json b/simulators/ethereum/graphql/testcases/47_block_withdrawals_pre_shanghai.json deleted file mode 100644 index 1699f5c9d8..0000000000 --- a/simulators/ethereum/graphql/testcases/47_block_withdrawals_pre_shanghai.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "request": - "{ block (number: 32) { number withdrawalsRoot withdrawals { index amount } } }", - - "responses": [{ - "data" : { - "block" : { - "number" : "0x20", - "withdrawalsRoot": null, - "withdrawals": null - } - } - }], - "statusCode": 200 -} diff --git a/simulators/ethereum/graphql/testcases/48_block_withdrawals.json b/simulators/ethereum/graphql/testcases/48_block_withdrawals.json deleted file mode 100644 index 154c685f9e..0000000000 --- a/simulators/ethereum/graphql/testcases/48_block_withdrawals.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "request": - "{ block (number: 33) { number withdrawalsRoot withdrawals { index amount validator address } } }", - - "responses": [{ - "data" : { - "block" : { - "number" : "0x21", - "withdrawalsRoot": "0x37945ab58d2712a26df2a38d217e822694927e29b30d5993d7a53ccea618d1f3", - "withdrawals": [{ - "index": "0x0", - "amount": "0x2540be400", - "validator": "0xa", - "address": "0x0000000000000000000000000000000000000dad" - }] - } - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/49_get_type2Transaction.json b/simulators/ethereum/graphql/testcases/49_get_type2Transaction.json deleted file mode 100644 index 5ceb49f1f7..0000000000 --- a/simulators/ethereum/graphql/testcases/49_get_type2Transaction.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "request": "{transaction (hash : \"0x3ecd2ca6cf26c864d0ea5f038a58d4cd4a46a3e242fe92f446f392fdc232dd98\") { accessList { address storageKeys } maxFeePerGas maxPriorityFeePerGas nonce type status } } ", - "responses": [{ - "data": { - "transaction": { - "accessList": [{ - "address": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f", - "storageKeys": ["0x0000000000000000000000000000000000000000000000000000000000000000"] - }], - "maxFeePerGas": "0xb2d05e00", - "maxPriorityFeePerGas": "0x3b9aca00", - "nonce": "0x20", - "type": "0x2", - "status": "0x1" - } - } - }], - "statusCode": 200 -} \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/50_eth_getBlock_shanghai.json b/simulators/ethereum/graphql/testcases/50_eth_getBlock_shanghai.json deleted file mode 100644 index 7c7d8bd588..0000000000 --- a/simulators/ethereum/graphql/testcases/50_eth_getBlock_shanghai.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "request": "{block (number : 33) { baseFeePerGas difficulty extraData miner { address } mixHash nonce stateRoot totalDifficulty withdrawalsRoot withdrawals { address amount index validator } }} ", - "responses":[{ - "data" : { - "block" : { - "baseFeePerGas": "0x3b9aca00", - "difficulty": "0x0", - "extraData": "0x", - "miner": { - "address": "0x0000000000000000000000000000000000000000" - }, - "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "nonce": "0x0000000000000000", - "stateRoot": "0x0d3c456bb68669bad05da3a1a766daab236c9df1da8f74edf5ebe9383f00084c", - "totalDifficulty": "0x427c00", - "withdrawalsRoot": "0x37945ab58d2712a26df2a38d217e822694927e29b30d5993d7a53ccea618d1f3", - "withdrawals": [ - { - "address": "0x0000000000000000000000000000000000000dad", - "amount": "0x2540be400", - "index": "0x0", - "validator": "0xa" - } - ] - } - } - }], - "statusCode": 200 -} \ No newline at end of file From ca423d4f54a5bff261c6487be817edcb7e75fca9 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Tue, 19 Sep 2023 15:48:34 +0800 Subject: [PATCH 02/13] simulators/ethereum: drop init file Signed-off-by: jsvisa --- .../ethereum/graphql/init/testBlockchain.blocks | Bin 24039 -> 0 bytes .../ethereum/graphql/init/testGenesis.json | 16 ---------------- 2 files changed, 16 deletions(-) delete mode 100755 simulators/ethereum/graphql/init/testBlockchain.blocks delete mode 100644 simulators/ethereum/graphql/init/testGenesis.json diff --git a/simulators/ethereum/graphql/init/testBlockchain.blocks b/simulators/ethereum/graphql/init/testBlockchain.blocks deleted file mode 100755 index 480efc87d9fcf4bb02cebf943897e5fec7d18226..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24039 zcmeI4cT^P1y0>SBC^-m{B&&cRL84@kAO=7{au_lKl5-mJfReKcG$0^JKtMo22@)g= zf@Dxhl7k>9;ZEaWt9yIc=VRY>@4DZz{wRL+R&{lC*E3bs-7mET-QI$J1|WYEfRk-k zXGWWJ-SYy=%$~Hpq3R)#p^go8BwbFE+L3q@BNvNAuB^lrrbTxy24N;@TtOqel3WaU zJ;mxPl}`)$2tTLq;6)Re+#x5XLYV~3fYo5i_A=E1H)iNgP`9aN?fJ`0Mb~WJ(v}~m zPO>Vfff{m_eK0Cz_}c=N(7$Q<|Nq(kFbD+U&$-l(2vB`>$5#qq53H)1G-f5jWxzgl zxy%Cdl#}11!qz^&s=FKRsalJ&NY^&<&!roxfi*Q-$IP~%Ux3YJQonU0YuG}*&z{*` zn>lxN4uOog!Q65;!QCgj3_eHf{zY}Q#JG$1!m4qOS+XW|CX}6cA~PRWBI2XT>k?#t zS_}|rtqcIN`3)3WKAahNBE31S>rQ7sl+1F)`nwYAm9)p1Bj3T zWDQ~f;qyH7Cl-m0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cNj39~i0QWaZid%n~mZ#GMLmqo2wa^LW2OrEEvcY|{Dqn&C8G znYEqk)c-Zkej?;2eCU5lfe8c{Nq`Xqx*z`$eXm6V^c%uL(Cu@kw*+!_0kzvpeS_5F zAsNl&fsLun>Y5g@0SkrbK0UbS#lFDBK`&Hbrcho=HZ;v^|uZAOqf3*eEcz4`pcVuAw7LX<=Rct23?c1KFhZdVWv2ffOi?C zE&~#ly5#}v2b>W)D+N1hrE3mM<_p!EH8}F5-5LlN#`kR~J4v(#9lmr#&NlQ#UyIwX zf4PB`$tW8onPgG=>FG3pV>J{g&YrVa{2VZF8WE!T9Mz;)aT?@|?l8{4tzD@BTWtuN*9I0=k08l7 zYXGr5^?QQM^!4+$_HoDYLrx330j@CVNLNK>ax5VgVUfjj3%?M6ZRdWIxdydDM(?L$ z3>0SzTQC~Ht~c@0$UvZU_178I2)zZhdsr2@EAjlPLZmW~*(c#Df6v*UZv~hJ@I_=S zp9EPv?b6Li%QhX%W3ozK8H{jTSfBeSC=S8C0&piA6{9tgz7)HbMB+f3VS$MimoOuL_*GB*XhR+(0)+3jKmdVQt+KE)B5_&d7k5eML_l( aDR{qTbOeDDdvJx{|Kb+}!c=i5ApZpceM=Sq diff --git a/simulators/ethereum/graphql/init/testGenesis.json b/simulators/ethereum/graphql/init/testGenesis.json deleted file mode 100644 index e55ac90082..0000000000 --- a/simulators/ethereum/graphql/init/testGenesis.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "config" : {}, - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "0x020000", - "extraData" : "0x42", - "gasLimit" : "0x2fefd8", - "mixHash" : "0x2c85bcbce56429100b2108254bb56906257582aeafcbd682bc9af67a9f5aee46", - "nonce" : "0x78cc16f7b4f65485", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "timestamp" : "0x54c98c81", - "alloc" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b": { - "balance" : "0x09184e72a000" - } - } -} \ No newline at end of file From f04ccd52daf4b1d02e5a032d8af4002fcf809176 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Tue, 19 Sep 2023 16:31:22 +0800 Subject: [PATCH 03/13] sim/graphql: walk the testcases from docker Signed-off-by: jsvisa --- simulators/ethereum/graphql/graphql.go | 55 ++++++++++++++++---------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/simulators/ethereum/graphql/graphql.go b/simulators/ethereum/graphql/graphql.go index 0ef3a6aca9..8c619295c7 100644 --- a/simulators/ethereum/graphql/graphql.go +++ b/simulators/ethereum/graphql/graphql.go @@ -8,10 +8,8 @@ import ( "net/http" "os" "path" - "path/filepath" "reflect" "strconv" - "strings" "sync" "github.com/ethereum/hive/hivesim" @@ -50,8 +48,8 @@ the client launched by this test.`, "HIVE_SHANGHAI_TIMESTAMP": "1444660030", }, Files: map[string]string{ - "/genesis.json": "./init/testGenesis.json", - "/chain.rlp": "./init/testBlockchain.blocks", + "/genesis.json": "./tests/genesis.json", + "/chain.rlp": "./tests/chain.rlp", }, Run: graphqlTest, }) @@ -75,7 +73,7 @@ func graphqlTest(t *hivesim.T, c *hivesim.Client) { go func() { defer wg.Done() for test := range testCh { - url := "https://github.com/ethereum/hive/blob/master/simulators/ethereum/graphql/testcases" + url := "https://github.com/ethereum/execution-apis/blob/master/graphql/tests" t.Run(hivesim.TestSpec{ Name: fmt.Sprintf("%s (%s)", test.name, c.Type), Description: fmt.Sprintf("Test case source: %s/%v.json", url, test.name), @@ -90,38 +88,55 @@ func graphqlTest(t *hivesim.T, c *hivesim.Client) { // deliverTests reads the test case files, sending them to the output channel. func deliverTests(t *hivesim.T, wg *sync.WaitGroup, limit int) <-chan *testCase { out := make(chan *testCase) + root := "tests" + files, err := os.ReadDir(root) + if err != nil { + t.Fatalf("Warning: can't read test directory %s: %v", root, err) + } + var i = 0 wg.Add(1) go func() { defer wg.Done() - filepath.Walk("./testcases", func(filepath string, info os.FileInfo, err error) error { + + for _, file := range files { if limit >= 0 && i >= limit { - return nil + return } - if info.IsDir() { - return nil + if !file.IsDir() { + continue } - if fname := info.Name(); !strings.HasSuffix(fname, ".json") { - return nil + var ( + requestFile = path.Join(root, file.Name(), "request.gql") + responseFile = path.Join(root, file.Name(), "response.json") + ) + + request, err := os.ReadFile(requestFile) + if err != nil { + t.Logf("Warning: can't read test file %s: %v", requestFile, err) + continue } - data, err := os.ReadFile(filepath) + + response, err := os.ReadFile(responseFile) if err != nil { - t.Logf("Warning: can't read test file %s: %v", filepath, err) - return nil + t.Logf("Warning: can't read test file %s: %v", responseFile, err) + continue } + var gqlTest graphQLTest - if err = json.Unmarshal(data, &gqlTest); err != nil { - t.Logf("Warning: can't unmarshal test file %s: %v", filepath, err) - return nil + if err = json.Unmarshal(response, &gqlTest); err != nil { + t.Logf("Warning: can't unmarshal test file %s: %v", responseFile, err) + continue } + gqlTest.Request = string(request) i = i + 1 t := testCase{ - name: strings.TrimSuffix(info.Name(), path.Ext(info.Name())), + name: file.Name(), gqlTest: &gqlTest, } out <- &t - return nil - }) + } + close(out) }() return out From 09d6a6e54d0d3e531169d7f627c34eb969f6ed01 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Tue, 19 Sep 2023 16:31:49 +0800 Subject: [PATCH 04/13] graphql: git clone testcases from execution-apis Signed-off-by: jsvisa --- simulators/ethereum/graphql/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/simulators/ethereum/graphql/Dockerfile b/simulators/ethereum/graphql/Dockerfile index 9b378708ce..1ffbb764a0 100644 --- a/simulators/ethereum/graphql/Dockerfile +++ b/simulators/ethereum/graphql/Dockerfile @@ -2,6 +2,9 @@ FROM golang:1-alpine as builder RUN apk add --update git gcc musl-dev linux-headers +# Clone the tests repo. +RUN git clone --depth 1 https://github.com/ethereum/execution-apis.git /execution-apis + # Build the simulator executable. ADD . /source WORKDIR /source @@ -12,4 +15,5 @@ FROM alpine:latest ADD . /source WORKDIR /source COPY --from=builder /source/graphql . +COPY --from=builder /execution-apis/graphql/tests ./tests ENTRYPOINT ["./graphql"] From 8a20fd2b5a83b8eae440d395497cad9757f4b7b3 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Tue, 19 Sep 2023 16:38:10 +0800 Subject: [PATCH 05/13] grqphql: testcase Signed-off-by: jsvisa --- simulators/ethereum/graphql/graphql_test.go | 29 +++++++++++++++------ 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/simulators/ethereum/graphql/graphql_test.go b/simulators/ethereum/graphql/graphql_test.go index e1bf3457fb..9a3c6e6cbe 100644 --- a/simulators/ethereum/graphql/graphql_test.go +++ b/simulators/ethereum/graphql/graphql_test.go @@ -22,15 +22,28 @@ type gasPrice struct { func Test_responseMatch(t *testing.T) { // create hivesim tester hivesimT := &hivesim.T{} - // unmarshal JSON test file - fp := "./testcases/07_eth_gasPrice.json" - data, err := os.ReadFile(fp) - if err != nil { - t.Fatalf("Warning: can't read test file %s: %v", fp, err) - } + data := ` +{ + "request": + "{ gasPrice }", + "responses": [ + { + "data" : { + "gasPrice" : "0x10" + } + }, + { + "data" : { + "gasPrice" : "0x1" + } + } + ], + "statusCode": 200 +} + ` var gqlTest graphQLTest - if err = json.Unmarshal(data, &gqlTest); err != nil { - t.Fatalf("Warning: can't unmarshal test file %s: %v", fp, err) + if err := json.Unmarshal([]byte(data), &gqlTest); err != nil { + t.Fatalf("Warning: can't unmarshal test %v", err) } // build test case tc := testCase{ From 70e84dac977cf7bea645a0c1b23f641729430e44 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Tue, 26 Sep 2023 23:24:19 +0800 Subject: [PATCH 06/13] sim/graphql: adjust the path Signed-off-by: jsvisa --- simulators/ethereum/graphql/Dockerfile | 2 +- simulators/ethereum/graphql/graphql.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/simulators/ethereum/graphql/Dockerfile b/simulators/ethereum/graphql/Dockerfile index 1ffbb764a0..b062b2c4cb 100644 --- a/simulators/ethereum/graphql/Dockerfile +++ b/simulators/ethereum/graphql/Dockerfile @@ -15,5 +15,5 @@ FROM alpine:latest ADD . /source WORKDIR /source COPY --from=builder /source/graphql . -COPY --from=builder /execution-apis/graphql/tests ./tests +COPY --from=builder /execution-apis/tests/graphql ./tests ENTRYPOINT ["./graphql"] diff --git a/simulators/ethereum/graphql/graphql.go b/simulators/ethereum/graphql/graphql.go index 8c619295c7..030c5e4365 100644 --- a/simulators/ethereum/graphql/graphql.go +++ b/simulators/ethereum/graphql/graphql.go @@ -73,7 +73,7 @@ func graphqlTest(t *hivesim.T, c *hivesim.Client) { go func() { defer wg.Done() for test := range testCh { - url := "https://github.com/ethereum/execution-apis/blob/master/graphql/tests" + url := "https://github.com/ethereum/execution-apis/blob/master/tests/graphql" t.Run(hivesim.TestSpec{ Name: fmt.Sprintf("%s (%s)", test.name, c.Type), Description: fmt.Sprintf("Test case source: %s/%v.json", url, test.name), From ed6d3b0a5981de63a1c0f2e485f581b8e807947a Mon Sep 17 00:00:00 2001 From: jsvisa Date: Tue, 26 Sep 2023 23:26:07 +0800 Subject: [PATCH 07/13] sim/rpc-compat: adjust the path Signed-off-by: jsvisa --- simulators/ethereum/rpc-compat/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulators/ethereum/rpc-compat/Dockerfile b/simulators/ethereum/rpc-compat/Dockerfile index d338a2c1ef..40c33549a5 100644 --- a/simulators/ethereum/rpc-compat/Dockerfile +++ b/simulators/ethereum/rpc-compat/Dockerfile @@ -19,6 +19,6 @@ FROM alpine:latest ADD . /source WORKDIR /source COPY --from=builder /source/rpc-compat . -COPY --from=builder /execution-apis/tests ./tests +COPY --from=builder /execution-apis/tests/jsonrpc ./tests ENTRYPOINT ["./rpc-compat"] From dedd80756de71ebe4f78b11a40ed1afbc441cee7 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Thu, 19 Oct 2023 10:11:34 +0800 Subject: [PATCH 08/13] grqphql: go mod tidy Signed-off-by: jsvisa --- simulators/ethereum/graphql/go.mod | 8 +++++++- simulators/ethereum/graphql/go.sum | 13 +++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/simulators/ethereum/graphql/go.mod b/simulators/ethereum/graphql/go.mod index 68b2773a8f..cde7717d8c 100644 --- a/simulators/ethereum/graphql/go.mod +++ b/simulators/ethereum/graphql/go.mod @@ -2,7 +2,10 @@ module github.com/ethereum/hive/simulators/ethereum/graphql go 1.18 -require github.com/ethereum/hive v0.0.0-20230919110229-d58aec4a3eb5 +require ( + github.com/ethereum/hive v0.0.0-20230919110229-d58aec4a3eb5 + github.com/yudai/gojsondiff v1.0.0 +) require ( github.com/Microsoft/go-winio v0.6.1 // indirect @@ -15,10 +18,13 @@ require ( github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/holiman/uint256 v1.2.3 // indirect + github.com/sergi/go-diff v1.3.1 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect + github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect + github.com/yudai/pp v2.0.1+incompatible // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect golang.org/x/crypto v0.12.0 // indirect golang.org/x/exp v0.0.0-20230810033253-352e893a4cad // indirect diff --git a/simulators/ethereum/graphql/go.sum b/simulators/ethereum/graphql/go.sum index 385d52e663..d640d76332 100644 --- a/simulators/ethereum/graphql/go.sum +++ b/simulators/ethereum/graphql/go.sum @@ -51,6 +51,9 @@ github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= @@ -69,9 +72,12 @@ github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= @@ -81,6 +87,12 @@ github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFA github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCOA= +github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= +github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M= +github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= +github.com/yudai/pp v2.0.1+incompatible h1:Q4//iY4pNF6yPLZIigmvcl7k/bPgrcTPIFIcmawg5bI= +github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= @@ -153,6 +165,7 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inconshreveable/log15.v2 v2.0.0-20200109203555-b30bc20e4fd1 h1:iiHuQZCNgYPmFQxd3BBN/Nc5+dAwzZuq5y40s20oQw0= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= From c13b0d26e2aef89143344e175761d52d0ff0e8f6 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Thu, 19 Oct 2023 10:14:20 +0800 Subject: [PATCH 09/13] graphql: no need to test responseMatch Signed-off-by: jsvisa --- simulators/ethereum/graphql/graphql_test.go | 106 -------------------- 1 file changed, 106 deletions(-) delete mode 100644 simulators/ethereum/graphql/graphql_test.go diff --git a/simulators/ethereum/graphql/graphql_test.go b/simulators/ethereum/graphql/graphql_test.go deleted file mode 100644 index 9a3c6e6cbe..0000000000 --- a/simulators/ethereum/graphql/graphql_test.go +++ /dev/null @@ -1,106 +0,0 @@ -package main - -import ( - "encoding/json" - "strconv" - "testing" - - "github.com/ethereum/hive/hivesim" -) - -type testResponse struct { - Data gasPrice `json:"data"` -} - -type gasPrice struct { - GasPrice string `json:"gasPrice"` -} - -// Test_responseMatch tests whether the graphql tests are able -// to successfully compare a response to an array of valid expected -// responses. -func Test_responseMatch(t *testing.T) { - // create hivesim tester - hivesimT := &hivesim.T{} - data := ` -{ - "request": - "{ gasPrice }", - "responses": [ - { - "data" : { - "gasPrice" : "0x10" - } - }, - { - "data" : { - "gasPrice" : "0x1" - } - } - ], - "statusCode": 200 -} - ` - var gqlTest graphQLTest - if err := json.Unmarshal([]byte(data), &gqlTest); err != nil { - t.Fatalf("Warning: can't unmarshal test %v", err) - } - // build test case - tc := testCase{ - name: "test1", - gqlTest: &gqlTest, - } - // create valid tests - var tests = []struct { - resp testResponse - status string - expectedFailure bool // true == failure expected - }{ - { - resp: testResponse{ - Data: gasPrice{GasPrice: "0x1"}, - }, - status: "200", - }, - { - resp: testResponse{ - Data: gasPrice{GasPrice: "0x10"}, - }, - status: "200", - }, - { - resp: testResponse{ - Data: gasPrice{GasPrice: "0x12"}, - }, - status: "400", - expectedFailure: true, - }, - { - resp: testResponse{ - Data: gasPrice{GasPrice: "0x11"}, - }, - status: "400", - expectedFailure: true, - }, - { - resp: testResponse{ - Data: gasPrice{GasPrice: "failfailfail"}, - }, - status: "200", - expectedFailure: true, - }, - } - - for i, tt := range tests { - t.Run(strconv.Itoa(i), func(t *testing.T) { - resp, err := json.Marshal(tt.resp) - if err != nil { - t.Fatal("could not marshal data: ", err) - } - err = tc.responseMatch(hivesimT, "200", resp) - if err != nil && !tt.expectedFailure { - t.Fatal(err) - } - }) - } -} From a3dacf786eff609ea8eee1b6b82b51c1f487b61c Mon Sep 17 00:00:00 2001 From: jsvisa Date: Thu, 19 Oct 2023 10:15:36 +0800 Subject: [PATCH 10/13] graphql: grqphal test via .io format Signed-off-by: jsvisa --- simulators/ethereum/graphql/graphql.go | 265 +++++++++++++------------ 1 file changed, 142 insertions(+), 123 deletions(-) diff --git a/simulators/ethereum/graphql/graphql.go b/simulators/ethereum/graphql/graphql.go index 030c5e4365..ce2d563cee 100644 --- a/simulators/ethereum/graphql/graphql.go +++ b/simulators/ethereum/graphql/graphql.go @@ -3,16 +3,21 @@ package main import ( "bytes" "encoding/json" + "errors" "fmt" "io" "net/http" "os" - "path" - "reflect" + "path/filepath" + "regexp" "strconv" + "strings" "sync" + "time" "github.com/ethereum/hive/hivesim" + diff "github.com/yudai/gojsondiff" + "github.com/yudai/gojsondiff/formatter" ) func main() { @@ -66,18 +71,25 @@ func graphqlTest(t *hivesim.T, c *hivesim.Client) { } } + _, testPattern := t.Sim.TestPattern() + re := regexp.MustCompile(testPattern) + var wg sync.WaitGroup - testCh := deliverTests(t, &wg, -1) + testCh := deliverTests(t, "tests", &wg, re) for i := 0; i < parallelism; i++ { wg.Add(1) - go func() { + func() { defer wg.Done() for test := range testCh { url := "https://github.com/ethereum/execution-apis/blob/master/tests/graphql" t.Run(hivesim.TestSpec{ - Name: fmt.Sprintf("%s (%s)", test.name, c.Type), - Description: fmt.Sprintf("Test case source: %s/%v.json", url, test.name), - Run: func(t *hivesim.T) { test.run(t, c) }, + Name: fmt.Sprintf("%s (%s)", test.Name, c.Type), + Description: fmt.Sprintf("Test case source: %s/%v.io", url, test.Name), + Run: func(t *hivesim.T) { + if err := runTest(t, c, test.Data); err != nil { + t.Fatalf("failed in test: %s, error: %v\n", test.Name, err) + } + }, }) } }() @@ -85,150 +97,157 @@ func graphqlTest(t *hivesim.T, c *hivesim.Client) { wg.Wait() } -// deliverTests reads the test case files, sending them to the output channel. -func deliverTests(t *hivesim.T, wg *sync.WaitGroup, limit int) <-chan *testCase { - out := make(chan *testCase) - root := "tests" - files, err := os.ReadDir(root) - if err != nil { - t.Fatalf("Warning: can't read test directory %s: %v", root, err) - } +type test struct { + Name string + Data []byte +} - var i = 0 +// deliverTests reads the test case files, sending them to the output channel. +func deliverTests(t *hivesim.T, root string, wg *sync.WaitGroup, re *regexp.Regexp) <-chan *test { + out := make(chan *test) wg.Add(1) go func() { defer wg.Done() - for _, file := range files { - if limit >= 0 && i >= limit { - return - } - if !file.IsDir() { - continue - } - var ( - requestFile = path.Join(root, file.Name(), "request.gql") - responseFile = path.Join(root, file.Name(), "response.json") - ) - - request, err := os.ReadFile(requestFile) + filepath.Walk(root, func(path string, info os.FileInfo, err error) error { if err != nil { - t.Logf("Warning: can't read test file %s: %v", requestFile, err) - continue + t.Logf("unable to walk path: %s", err) + return err } - - response, err := os.ReadFile(responseFile) - if err != nil { - t.Logf("Warning: can't read test file %s: %v", responseFile, err) - continue + if info.IsDir() { + return nil } - - var gqlTest graphQLTest - if err = json.Unmarshal(response, &gqlTest); err != nil { - t.Logf("Warning: can't unmarshal test file %s: %v", responseFile, err) - continue + if fname := info.Name(); !strings.HasSuffix(fname, ".io") { + return nil } - gqlTest.Request = string(request) - i = i + 1 - t := testCase{ - name: file.Name(), - gqlTest: &gqlTest, + pathname := strings.TrimSuffix(strings.TrimPrefix(path, root), ".io") + if !re.MatchString(pathname) { + t.Log("skip", pathname) + return nil // skip } - out <- &t - } + data, err := os.ReadFile(path) + if err != nil { + return err + } + name := strings.TrimLeft(strings.TrimLeft(pathname, root), "/") + out <- &test{Name: name, Data: data} + return nil + }) close(out) }() return out } -type testCase struct { - name string - gqlTest *graphQLTest -} - -// graphQLTest is the JSON object structure of a test case file. -type graphQLTest struct { - Request string `json:"request"` - Responses []interface{} `json:"responses"` - StatusCode int `json:"statusCode"` -} - type qlQuery struct { Query string `json:"query"` } -// prepareRunTest administers the hive-specific test stuff, registering the suite and reporting back the suite results -func (tc *testCase) run(t *hivesim.T, c *hivesim.Client) { - // Example of working queries: - // curl 'http://127.0.0.1:8545/graphql' --data-binary '{"query":"query blockNumber {\n block {\n number\n }\n}\n"}' - // curl 'http://127.0.0.1:8545/graphql' --data-binary '{"query":"query blockNumber {\n block {\n number\n }\n}\n","variables":null,"operationName":"blockNumber"}' - postData, err := json.Marshal(qlQuery{Query: tc.gqlTest.Request}) - if err != nil { - t.Fatal("can't marshal query:", err) - } - url := fmt.Sprintf("http://%v:8545/graphql", c.IP) - resp, err := http.Post(url, "application/json", bytes.NewReader(postData)) - if err != nil { - t.Fatal("HTTP post failed:", err) - } - respBytes, err := io.ReadAll(resp.Body) - if err != nil { - t.Fatal("can't read HTTP response:", err) - } - resp.Body.Close() - - if resp.StatusCode != tc.gqlTest.StatusCode { - t.Errorf("HTTP response code is %d, want %d \n response body: %s", resp.StatusCode, tc.gqlTest.StatusCode, string(respBytes)) - } - if resp.StatusCode != 200 { - // Test expects HTTP error, and the client sent one, test done. - // We don't bother to check the exact error messages, those aren't fully specified. - return - } - - tc.responseMatch(t, resp.Status, respBytes) +type qlResponse struct { + Errors *[]interface{} `json:"errors,omitempty"` + Data *interface{} `json:"data,omitempty"` } -func (tc *testCase) responseMatch(t *hivesim.T, respStatus string, respBytes []byte) error { - // Check that the response matches. - var got interface{} - if err := json.Unmarshal(respBytes, &got); err != nil { - t.Fatal("can't decode response:", err) - } - // return if a response matches. If not, error out. - for _, response := range tc.gqlTest.Responses { - if reflect.DeepEqual(response, got) { - return nil +func runTest(t *hivesim.T, c *hivesim.Client, data []byte) error { + var ( + client = &http.Client{ + Timeout: 5 * time.Second, } - } + url = fmt.Sprintf("http://%s:8545/graphql", c.IP.String()) + err error + code int + resp []byte + ) + + for _, line := range strings.Split(string(data), "\n") { + line = strings.TrimSpace(line) + switch { + case len(line) == 0 || strings.HasPrefix(line, "//"): + // Skip comments, blank lines. + continue + case strings.HasPrefix(line, ">> "): + // Send request. + code, resp, err = sendHTTP(client, url, line[3:]) + if err != nil { + return err + } + case strings.HasPrefix(line, "<< "): + // Read response. Unmarshal to interface{} to verify deep equality. Marshal + // again to remove padding differences and to print each field in the same + // order. This makes it easy to spot any discrepancies. + if resp == nil { + // t.Error("invalid test, response before request") + return errors.New("invalid test, response before request") + } - prettyQuery, ok := reindentJSON(tc.gqlTest.Request) - prettyResponse, _ := json.MarshalIndent(got, "", " ") + var have qlResponse + if err := json.Unmarshal(resp, &have); err != nil { + t.Fatal("can't decode response:", err) + } - t.Log("Test failed.") - t.Log("HTTP response code:", respStatus) - if ok { - t.Log("query:", prettyQuery) + // Check error with StatusCode only + if have.Errors != nil { + if code != 400 { + return fmt.Errorf("invalid test stateCode, want 400, have %d", code) + } + } else { + if code != 200 { + return fmt.Errorf("invalid test stateCode, want 200, have %d", code) + } + want := []byte(strings.TrimSpace(line)[3:]) // trim leading "<< " + + // Now compare the response body. + d, err := diff.New().Compare(resp, want) + if err != nil { + return fmt.Errorf("failed to unmarshal value: %s\n", err) + } + // If there is a discrepancy, return error. + if d.Modified() { + var got map[string]interface{} + json.Unmarshal(resp, &got) + config := formatter.AsciiFormatterConfig{ + ShowArrayIndex: true, + Coloring: false, + } + formatter := formatter.NewAsciiFormatter(got, config) + diffString, _ := formatter.Format(d) + return fmt.Errorf("response differs from expected:\n%s", diffString) + } + } + resp = nil + default: + t.Fatalf("invalid line in test script: %s", line) + } } - t.Log("expected value(s):") - - for _, expected := range tc.gqlTest.Responses { - prettyExpected, _ := json.MarshalIndent(expected, "", " ") - t.Log(string(prettyExpected), "\n_____________________\n") + if resp != nil { + t.Fatalf("unhandled response in test case") } - - t.Log("got:", string(prettyResponse)) - t.Fail() - - return fmt.Errorf("test failed") + return nil } -func reindentJSON(text string) (string, bool) { - var obj interface{} - if json.Unmarshal([]byte(text), &obj) != nil { - return "", false +// sendHttp sends an HTTP GraphQL POST with the provided data and reads the +// response into a byte slice and returns it. +// Example of working queries: +// curl 'http://127.0.0.1:8545/graphql' --data-binary '{"query":"query blockNumber {block {number}}"}' +// curl 'http://127.0.0.1:8545/graphql' --data-binary '{"query":"query blockNumber {block {number}}","variables":null,"operationName":"blockNumber"}' +func sendHTTP(c *http.Client, url string, query string) (int, []byte, error) { + data, err := json.Marshal(qlQuery{Query: query}) + if err != nil { + return 0, nil, err + } + req, err := http.NewRequest("POST", url, bytes.NewReader(data)) + if err != nil { + return 0, nil, fmt.Errorf("error building request: %v", err) + } + req.Header.Set("Content-Type", "application/json") + resp, err := c.Do(req) + if err != nil { + return 0, nil, fmt.Errorf("write error: %v", err) } - indented, _ := json.MarshalIndent(&obj, "", " ") - return string(indented), true + body, err := io.ReadAll(resp.Body) + if err != nil { + return 0, nil, fmt.Errorf("read error: %v", err) + } + resp.Body.Close() + return resp.StatusCode, body, nil } From 4d531bc65b25fbd3e56950916a90f2ccfaf606d3 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Thu, 19 Oct 2023 21:04:18 +0800 Subject: [PATCH 11/13] graphql: add diff instruct Signed-off-by: jsvisa --- simulators/ethereum/graphql/graphql.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/simulators/ethereum/graphql/graphql.go b/simulators/ethereum/graphql/graphql.go index ce2d563cee..4f072c6a39 100644 --- a/simulators/ethereum/graphql/graphql.go +++ b/simulators/ethereum/graphql/graphql.go @@ -176,7 +176,6 @@ func runTest(t *hivesim.T, c *hivesim.Client, data []byte) error { // again to remove padding differences and to print each field in the same // order. This makes it easy to spot any discrepancies. if resp == nil { - // t.Error("invalid test, response before request") return errors.New("invalid test, response before request") } @@ -211,7 +210,7 @@ func runTest(t *hivesim.T, c *hivesim.Client, data []byte) error { } formatter := formatter.NewAsciiFormatter(got, config) diffString, _ := formatter.Format(d) - return fmt.Errorf("response differs from expected:\n%s", diffString) + return fmt.Errorf("response differs from expected(-/have +/want):\n%s", diffString) } } resp = nil @@ -228,8 +227,8 @@ func runTest(t *hivesim.T, c *hivesim.Client, data []byte) error { // sendHttp sends an HTTP GraphQL POST with the provided data and reads the // response into a byte slice and returns it. // Example of working queries: -// curl 'http://127.0.0.1:8545/graphql' --data-binary '{"query":"query blockNumber {block {number}}"}' -// curl 'http://127.0.0.1:8545/graphql' --data-binary '{"query":"query blockNumber {block {number}}","variables":null,"operationName":"blockNumber"}' +// curl 'http://127.0.0.1:8545/graphql' -H 'Content-Type: application/json' -d '{"query":"query blockNumber {block {number}}"}' +// curl 'http://127.0.0.1:8545/graphql' -H 'Content-Type: application/json' -d '{"query":"query blockNumber {block {number}}","variables":null,"operationName":"blockNumber"}' func sendHTTP(c *http.Client, url string, query string) (int, []byte, error) { data, err := json.Marshal(qlQuery{Query: query}) if err != nil { From a002a08aa255d4706811e8b26d229f962470eff3 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Thu, 19 Oct 2023 21:13:26 +0800 Subject: [PATCH 12/13] graphql: use main branch Signed-off-by: jsvisa --- simulators/ethereum/graphql/graphql.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulators/ethereum/graphql/graphql.go b/simulators/ethereum/graphql/graphql.go index 4f072c6a39..77ad262b90 100644 --- a/simulators/ethereum/graphql/graphql.go +++ b/simulators/ethereum/graphql/graphql.go @@ -81,7 +81,7 @@ func graphqlTest(t *hivesim.T, c *hivesim.Client) { func() { defer wg.Done() for test := range testCh { - url := "https://github.com/ethereum/execution-apis/blob/master/tests/graphql" + url := "https://github.com/ethereum/execution-apis/blob/main/tests/graphql" t.Run(hivesim.TestSpec{ Name: fmt.Sprintf("%s (%s)", test.Name, c.Type), Description: fmt.Sprintf("Test case source: %s/%v.io", url, test.Name), From 331454c123f52b9980b6c362474ef4830bb1f478 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Thu, 19 Oct 2023 21:45:34 +0800 Subject: [PATCH 13/13] graphql: logging request/response Signed-off-by: jsvisa --- simulators/ethereum/graphql/graphql.go | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/simulators/ethereum/graphql/graphql.go b/simulators/ethereum/graphql/graphql.go index 77ad262b90..12574f9518 100644 --- a/simulators/ethereum/graphql/graphql.go +++ b/simulators/ethereum/graphql/graphql.go @@ -152,6 +152,10 @@ func runTest(t *hivesim.T, c *hivesim.Client, data []byte) error { var ( client = &http.Client{ Timeout: 5 * time.Second, + Transport: &loggingRoundTrip{ + t: t, + inner: http.DefaultTransport, + }, } url = fmt.Sprintf("http://%s:8545/graphql", c.IP.String()) err error @@ -250,3 +254,38 @@ func sendHTTP(c *http.Client, url string, query string) (int, []byte, error) { resp.Body.Close() return resp.StatusCode, body, nil } + +// loggingRoundTrip writes requests and responses to the test log. +type loggingRoundTrip struct { + t *hivesim.T + inner http.RoundTripper +} + +func (rt *loggingRoundTrip) RoundTrip(req *http.Request) (*http.Response, error) { + // Read and log the request body. + reqBytes, err := io.ReadAll(req.Body) + req.Body.Close() + if err != nil { + return nil, err + } + rt.t.Logf(">> %s", bytes.TrimSpace(reqBytes)) + reqCopy := *req + reqCopy.Body = io.NopCloser(bytes.NewReader(reqBytes)) + + // Do the round trip. + resp, err := rt.inner.RoundTrip(&reqCopy) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + // Read and log the response bytes. + respBytes, err := io.ReadAll(resp.Body) + if err != nil { + return nil, err + } + respCopy := *resp + respCopy.Body = io.NopCloser(bytes.NewReader(respBytes)) + rt.t.Logf("<< %s", bytes.TrimSpace(respBytes)) + return &respCopy, nil +}