From 889e4baaf7215fe24fff86878f0dcb6894a1e118 Mon Sep 17 00:00:00 2001 From: renaynay <41963722+renaynay@users.noreply.github.com> Date: Wed, 27 Jan 2021 18:39:50 +0100 Subject: [PATCH 1/2] replace queries on account with queries on block for account info --- simulators/ethereum/graphql/graphql.go | 21 +++++++--- simulators/ethereum/graphql/graphql_test.go | 42 +++++++++++++++++++ .../graphql/testcases/01_eth_blockNumber.json | 2 +- .../graphql/testcases/02_eth_call_Block8.json | 2 +- .../testcases/03_eth_call_BlockLatest.json | 2 +- .../04_eth_estimateGas_contractDeploy.json | 2 +- .../05_eth_estimateGas_noParams.json | 2 +- .../06_eth_estimateGas_transfer.json | 2 +- .../graphql/testcases/07_eth_gasPrice.json | 2 +- .../testcases/08_eth_getBalance_0x19.json | 12 +++--- ..._getBalance_invalidAccountBlockNumber.json | 3 +- ...0_eth_getBalance_invalidAccountLatest.json | 3 +- .../testcases/11_eth_getBalance_latest.json | 13 +++--- .../12_eth_getBalance_toobig_bn.json | 9 +++- .../13_eth_getBalance_without_addr.json | 4 +- .../testcases/14_eth_getBlock_byHash.json | 2 +- .../15_eth_getBlock_byHashInvalid.json | 2 +- .../testcases/16_eth_getBlock_byNumber.json | 2 +- .../18_eth_getBlock_wrongParams.json | 2 +- ...9_eth_getBlockTransactionCount_byHash.json | 2 +- ...eth_getBlockTransactionCount_byNumber.json | 2 +- .../testcases/21_eth_getCode_noCode.json | 12 +++--- .../graphql/testcases/22_eth_getCode.json | 12 +++--- .../testcases/23_eth_getLogs_matchTopic.json | 2 +- .../testcases/24_eth_getLogs_range.json | 2 +- ..._getStorageAt_illegalRangeGreaterThan.json | 2 +- .../testcases/26_eth_getStorageAt.json | 2 +- ...th_getTransaction_byBlockHashAndIndex.json | 2 +- ..._getTransaction_byBlockNumberAndIndex.json | 2 +- ...nsaction_byBlockNumberAndInvalidIndex.json | 2 +- .../31_eth_getTransaction_byHashNull.json | 2 +- .../testcases/32_eth_getTransactionCount.json | 2 +- ...h_sendRawTransaction_contractCreation.json | 2 +- .../graphql/testcases/35_graphql_pending.json | 2 +- ...36_eth_sendRawTransaction_messageCall.json | 2 +- ...37_eth_sendRawTransaction_nonceTooLow.json | 2 +- ..._eth_sendRawTransaction_transferEther.json | 2 +- ...endRawTransaction_unsignedTransaction.json | 2 +- .../graphql/testcases/40_eth_syncing.json | 2 +- .../testcases/41_graphql_blocks_byFrom.json | 2 +- .../testcases/42_graphql_blocks_byRange.json | 2 +- .../43_graphql_blocks_byWrongRange.json | 2 +- .../testcases/44_graphql_tooComplex.json | 2 +- .../45_graphql_tooComplexSchema.json | 2 +- 44 files changed, 132 insertions(+), 67 deletions(-) diff --git a/simulators/ethereum/graphql/graphql.go b/simulators/ethereum/graphql/graphql.go index a072c93ebd..e1979c335f 100644 --- a/simulators/ethereum/graphql/graphql.go +++ b/simulators/ethereum/graphql/graphql.go @@ -118,9 +118,9 @@ type testCase struct { // 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"` + Request string `json:"request"` + Responses []interface{} `json:"responses"` + StatusCodes []int `json:"statusCodes"` } type qlQuery struct { @@ -147,8 +147,8 @@ func (tc *testCase) run(t *hivesim.T, c *hivesim.Client) { } 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 !tc.statusCodeMatch(resp.StatusCode) { + t.Errorf("HTTP response code is %d, want %v \n response body: %s", resp.StatusCode, tc.gqlTest.StatusCodes, string(respBytes)) } if resp.StatusCode != 200 { // Test expects HTTP error, and the client sent one, test done. @@ -159,6 +159,17 @@ func (tc *testCase) run(t *hivesim.T, c *hivesim.Client) { tc.responseMatch(t, resp.Status, respBytes) } +// statusCodeMatch checks if a response status code matches against +// one of the expected status codes. +func (tc *testCase) statusCodeMatch(resp int) bool { + for _, expected := range tc.gqlTest.StatusCodes { + if expected == resp { + return true + } + } + return false +} + func (tc *testCase) responseMatch(t *hivesim.T, respStatus string, respBytes []byte) error { // Check that the response matches. var got interface{} diff --git a/simulators/ethereum/graphql/graphql_test.go b/simulators/ethereum/graphql/graphql_test.go index a682685dfd..289340feaa 100644 --- a/simulators/ethereum/graphql/graphql_test.go +++ b/simulators/ethereum/graphql/graphql_test.go @@ -92,3 +92,45 @@ func Test_responseMatch(t *testing.T) { }) } } + +func Test_statusCodeMatch(t *testing.T) { + // unmarshal JSON test file + fp := "./testcases/09_eth_getBalance_invalidAccountBlockNumber.json" + data, err := ioutil.ReadFile(fp) + if err != nil { + t.Fatalf("Warning: can't read test file %s: %v", fp, err) + } + var gqlTest graphQLTest + if err = json.Unmarshal(data, &gqlTest); err != nil { + t.Fatalf("Warning: can't unmarshal test file %s: %v", fp, err) + } + // build test case + tc := testCase{ + name: "test1", + gqlTest: &gqlTest, + } + // create valid tests + var tests = []struct { + statusCode int + expectedFailure bool // true == failure expected + }{ + { + statusCode: 400, + }, + { + statusCode: 200, + }, + { + statusCode: 404, + expectedFailure: true, + }, + } + + for i, tt := range tests { + t.Run(strconv.Itoa(i), func(t *testing.T) { + if !tc.statusCodeMatch(tt.statusCode) && !tt.expectedFailure { + t.Fatal(err) + } + }) + } +} diff --git a/simulators/ethereum/graphql/testcases/01_eth_blockNumber.json b/simulators/ethereum/graphql/testcases/01_eth_blockNumber.json index d74b9a8580..b365cc9654 100644 --- a/simulators/ethereum/graphql/testcases/01_eth_blockNumber.json +++ b/simulators/ethereum/graphql/testcases/01_eth_blockNumber.json @@ -9,5 +9,5 @@ } } }], - "statusCode": 200 + "statusCodes": [200] } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/02_eth_call_Block8.json b/simulators/ethereum/graphql/testcases/02_eth_call_Block8.json index 426a4846a5..b0cd0159bf 100644 --- a/simulators/ethereum/graphql/testcases/02_eth_call_Block8.json +++ b/simulators/ethereum/graphql/testcases/02_eth_call_Block8.json @@ -12,5 +12,5 @@ } } }], - "statusCode": 200 + "statusCodes": [200] } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/03_eth_call_BlockLatest.json b/simulators/ethereum/graphql/testcases/03_eth_call_BlockLatest.json index 6a21adac9a..11a6eab088 100644 --- a/simulators/ethereum/graphql/testcases/03_eth_call_BlockLatest.json +++ b/simulators/ethereum/graphql/testcases/03_eth_call_BlockLatest.json @@ -12,5 +12,5 @@ } } }], - "statusCode": 200 + "statusCodes": [200] } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/04_eth_estimateGas_contractDeploy.json b/simulators/ethereum/graphql/testcases/04_eth_estimateGas_contractDeploy.json index 7ab7ff729e..86dde90eb0 100644 --- a/simulators/ethereum/graphql/testcases/04_eth_estimateGas_contractDeploy.json +++ b/simulators/ethereum/graphql/testcases/04_eth_estimateGas_contractDeploy.json @@ -7,5 +7,5 @@ } } }], - "statusCode": 200 + "statusCodes": [200] } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/05_eth_estimateGas_noParams.json b/simulators/ethereum/graphql/testcases/05_eth_estimateGas_noParams.json index bc72d4cf85..a9511d7e51 100644 --- a/simulators/ethereum/graphql/testcases/05_eth_estimateGas_noParams.json +++ b/simulators/ethereum/graphql/testcases/05_eth_estimateGas_noParams.json @@ -8,5 +8,5 @@ } }], - "statusCode": 200 + "statusCodes": [200] } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/06_eth_estimateGas_transfer.json b/simulators/ethereum/graphql/testcases/06_eth_estimateGas_transfer.json index 913e29b594..86a8c0b2f9 100644 --- a/simulators/ethereum/graphql/testcases/06_eth_estimateGas_transfer.json +++ b/simulators/ethereum/graphql/testcases/06_eth_estimateGas_transfer.json @@ -7,5 +7,5 @@ } } }], - "statusCode": 200 + "statusCodes": [200] } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/07_eth_gasPrice.json b/simulators/ethereum/graphql/testcases/07_eth_gasPrice.json index e54d5b2800..8147c6b268 100644 --- a/simulators/ethereum/graphql/testcases/07_eth_gasPrice.json +++ b/simulators/ethereum/graphql/testcases/07_eth_gasPrice.json @@ -13,5 +13,5 @@ } } ], - "statusCode": 200 + "statusCodes": [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 index 0f914e57d4..da57144d13 100644 --- a/simulators/ethereum/graphql/testcases/08_eth_getBalance_0x19.json +++ b/simulators/ethereum/graphql/testcases/08_eth_getBalance_0x19.json @@ -1,12 +1,14 @@ { - "request": "{account(blockNumber:\"0x19\", address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance } }", + "request": "{block (number : 25) {account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance } }}", "responses": [{ - "data" : { - "account" : { - "balance" : "0xfa" + "data": { + "block": { + "account": { + "balance": "0xfa" + } } } }], - "statusCode": 200 + "statusCodes": [200] } diff --git a/simulators/ethereum/graphql/testcases/09_eth_getBalance_invalidAccountBlockNumber.json b/simulators/ethereum/graphql/testcases/09_eth_getBalance_invalidAccountBlockNumber.json index 3b08d8f89b..3096a40b48 100644 --- a/simulators/ethereum/graphql/testcases/09_eth_getBalance_invalidAccountBlockNumber.json +++ b/simulators/ethereum/graphql/testcases/09_eth_getBalance_invalidAccountBlockNumber.json @@ -1,5 +1,5 @@ { - "request": "{account(blockNumber:\"0x19\", address: \"0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef\") { balance } }", + "request": "{block (number: 25) {account(address: \"0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef\") { balance } }}", "responses": [{ "data": { "account": { @@ -9,4 +9,3 @@ }], "statusCode": 200 } - diff --git a/simulators/ethereum/graphql/testcases/10_eth_getBalance_invalidAccountLatest.json b/simulators/ethereum/graphql/testcases/10_eth_getBalance_invalidAccountLatest.json index f1ac347f9b..bc80db1502 100644 --- a/simulators/ethereum/graphql/testcases/10_eth_getBalance_invalidAccountLatest.json +++ b/simulators/ethereum/graphql/testcases/10_eth_getBalance_invalidAccountLatest.json @@ -1,5 +1,5 @@ { - "request": "{account(address: \"0xdeaff00ddeaff00ddeaff00ddeaff00ddeaff00d\") { balance } }", + "request": "{block{account(address: \"0xdeaff00ddeaff00ddeaff00ddeaff00ddeaff00d\") { balance } }}", "responses": [{ "data": { "account": { @@ -9,4 +9,3 @@ }], "statusCode": 200 } - diff --git a/simulators/ethereum/graphql/testcases/11_eth_getBalance_latest.json b/simulators/ethereum/graphql/testcases/11_eth_getBalance_latest.json index 8edbd9e6cc..cef35927dc 100644 --- a/simulators/ethereum/graphql/testcases/11_eth_getBalance_latest.json +++ b/simulators/ethereum/graphql/testcases/11_eth_getBalance_latest.json @@ -1,12 +1,15 @@ { - "request": "{account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance } }", + "request": "{block{account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance } }}", "responses":[{ - "data" : { - "account" : { - "balance" : "0x140" + "data": { + "block": { + "account": { + "balance": "0x140" + } } } + }, }], - "statusCode": 200 + "statusCodes": [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 index 93e24a71f9..4254b2c1f0 100644 --- a/simulators/ethereum/graphql/testcases/12_eth_getBalance_toobig_bn.json +++ b/simulators/ethereum/graphql/testcases/12_eth_getBalance_toobig_bn.json @@ -1,5 +1,5 @@ { - "request": "{account(blockNumber:\"0x21\", address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance } }", + "request": "{block (number: 33) {account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance } }}", "responses": [{ "errors": [ { @@ -21,7 +21,12 @@ } ], "data": null + }, + { + "data": { + "block": null + } }], - "statusCode": 400 + "statusCodes": [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 index d5fb681658..2157eb7f1e 100644 --- a/simulators/ethereum/graphql/testcases/13_eth_getBalance_without_addr.json +++ b/simulators/ethereum/graphql/testcases/13_eth_getBalance_without_addr.json @@ -1,5 +1,5 @@ { - "request": "{account { balance } }", + "request": "{block{account { balance } }}", "responses": [{ "errors": [ { @@ -16,6 +16,6 @@ } ] }], - "statusCode": 400 + "statusCodes": [400] } diff --git a/simulators/ethereum/graphql/testcases/14_eth_getBlock_byHash.json b/simulators/ethereum/graphql/testcases/14_eth_getBlock_byHash.json index dca77109cb..56908baaaa 100644 --- a/simulators/ethereum/graphql/testcases/14_eth_getBlock_byHash.json +++ b/simulators/ethereum/graphql/testcases/14_eth_getBlock_byHash.json @@ -30,5 +30,5 @@ } } }], - "statusCode": 200 + "statusCodes": [200] } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/15_eth_getBlock_byHashInvalid.json b/simulators/ethereum/graphql/testcases/15_eth_getBlock_byHashInvalid.json index a53a108341..740ad6d905 100644 --- a/simulators/ethereum/graphql/testcases/15_eth_getBlock_byHashInvalid.json +++ b/simulators/ethereum/graphql/testcases/15_eth_getBlock_byHashInvalid.json @@ -20,5 +20,5 @@ ], "data": null }], - "statusCode": 400 + "statusCodes": [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 index a8c2518bb9..f26752319b 100644 --- a/simulators/ethereum/graphql/testcases/16_eth_getBlock_byNumber.json +++ b/simulators/ethereum/graphql/testcases/16_eth_getBlock_byNumber.json @@ -40,5 +40,5 @@ } } }], - "statusCode": 200 + "statusCodes": [200] } \ 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 index f2e7f663af..d9ff5aa3c7 100644 --- a/simulators/ethereum/graphql/testcases/18_eth_getBlock_wrongParams.json +++ b/simulators/ethereum/graphql/testcases/18_eth_getBlock_wrongParams.json @@ -22,5 +22,5 @@ ], "data": null }], - "statusCode": 400 + "statusCodes": [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 index d43de22a43..3166999275 100644 --- a/simulators/ethereum/graphql/testcases/19_eth_getBlockTransactionCount_byHash.json +++ b/simulators/ethereum/graphql/testcases/19_eth_getBlockTransactionCount_byHash.json @@ -11,5 +11,5 @@ } } }], - "statusCode": 200 + "statusCodes": [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 index 789b424657..9a60a42eab 100644 --- a/simulators/ethereum/graphql/testcases/20_eth_getBlockTransactionCount_byNumber.json +++ b/simulators/ethereum/graphql/testcases/20_eth_getBlockTransactionCount_byNumber.json @@ -29,5 +29,5 @@ } } }], - "statusCode": 200 + "statusCodes": [200] } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/21_eth_getCode_noCode.json b/simulators/ethereum/graphql/testcases/21_eth_getCode_noCode.json index f01b4065fb..e4c454be27 100644 --- a/simulators/ethereum/graphql/testcases/21_eth_getCode_noCode.json +++ b/simulators/ethereum/graphql/testcases/21_eth_getCode_noCode.json @@ -1,14 +1,16 @@ { - "request" : "{ account(address: \"0x8888f1f195afa192cfee860698584c030f4c9db1\") { code } }", + "request" : "{block{ account(address: \"0x8888f1f195afa192cfee860698584c030f4c9db1\") { code } }}", "responses": [{ - "data" : { - "account" :{ - "code" :"0x" + "data": { + "block": { + "account": { + "code": "0x" + } } } }], - "statusCode": 200 + "statusCodes": [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 index 45741f1cbf..914e726fef 100644 --- a/simulators/ethereum/graphql/testcases/22_eth_getCode.json +++ b/simulators/ethereum/graphql/testcases/22_eth_getCode.json @@ -1,13 +1,15 @@ { - "request" : "{ account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { code } }", + "request" : "{block{ account(address: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { code } }}", "responses": [{ - "data" : { - "account" :{ - "code" :"0x6000357c010000000000000000000000000000000000000000000000000000000090048063102accc11461012c57806312a7b9141461013a5780631774e6461461014c5780631e26fd331461015d5780631f9030371461016e578063343a875d1461018057806338cc4831146101955780634e7ad367146101bd57806357cb2fc4146101cb57806365538c73146101e057806368895979146101ee57806376bc21d9146102005780639a19a9531461020e5780639dc2c8f51461021f578063a53b1c1e1461022d578063a67808571461023e578063b61c05031461024c578063c2b12a731461025a578063d2282dc51461026b578063e30081a01461027c578063e8beef5b1461028d578063f38b06001461029b578063f5b53e17146102a9578063fd408767146102bb57005b6101346104d6565b60006000f35b61014261039b565b8060005260206000f35b610157600435610326565b60006000f35b6101686004356102c9565b60006000f35b610176610442565b8060005260206000f35b6101886103d3565b8060ff1660005260206000f35b61019d610413565b8073ffffffffffffffffffffffffffffffffffffffff1660005260206000f35b6101c56104c5565b60006000f35b6101d36103b7565b8060000b60005260206000f35b6101e8610454565b60006000f35b6101f6610401565b8060005260206000f35b61020861051f565b60006000f35b6102196004356102e5565b60006000f35b610227610693565b60006000f35b610238600435610342565b60006000f35b610246610484565b60006000f35b610254610493565b60006000f35b61026560043561038d565b60006000f35b610276600435610350565b60006000f35b61028760043561035e565b60006000f35b6102956105b4565b60006000f35b6102a3610547565b60006000f35b6102b16103ef565b8060005260206000f35b6102c3610600565b60006000f35b80600060006101000a81548160ff021916908302179055505b50565b80600060016101000a81548160ff02191690837f01000000000000000000000000000000000000000000000000000000000000009081020402179055505b50565b80600060026101000a81548160ff021916908302179055505b50565b806001600050819055505b50565b806002600050819055505b50565b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b50565b806004600050819055505b50565b6000600060009054906101000a900460ff1690506103b4565b90565b6000600060019054906101000a900460000b90506103d0565b90565b6000600060029054906101000a900460ff1690506103ec565b90565b600060016000505490506103fe565b90565b60006002600050549050610410565b90565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061043f565b90565b60006004600050549050610451565b90565b7f65c9ac8011e286e89d02a269890f41d67ca2cc597b2c76c7c69321ff492be5806000602a81526020016000a15b565b6000602a81526020016000a05b565b60017f81933b308056e7e85668661dcd102b1f22795b4431f9cf4625794f381c271c6b6000602a81526020016000a25b565b60016000602a81526020016000a15b565b3373ffffffffffffffffffffffffffffffffffffffff1660017f0e216b62efbb97e751a2ce09f607048751720397ecfb9eef1e48a6644948985b6000602a81526020016000a35b565b3373ffffffffffffffffffffffffffffffffffffffff1660016000602a81526020016000a25b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660017f317b31292193c2a4f561cc40a95ea0d97a2733f14af6d6d59522473e1f3ae65f6000602a81526020016000a45b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660016000602a81526020016000a35b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660017fd5f0a30e4be0c6be577a71eceb7464245a796a7e6a55c0d971837b250de05f4e60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe98152602001602a81526020016000a45b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff16600160007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe98152602001602a81526020016000a35b56" + "data": { + "block": { + "account": { + "code": "0x6000357c010000000000000000000000000000000000000000000000000000000090048063102accc11461012c57806312a7b9141461013a5780631774e6461461014c5780631e26fd331461015d5780631f9030371461016e578063343a875d1461018057806338cc4831146101955780634e7ad367146101bd57806357cb2fc4146101cb57806365538c73146101e057806368895979146101ee57806376bc21d9146102005780639a19a9531461020e5780639dc2c8f51461021f578063a53b1c1e1461022d578063a67808571461023e578063b61c05031461024c578063c2b12a731461025a578063d2282dc51461026b578063e30081a01461027c578063e8beef5b1461028d578063f38b06001461029b578063f5b53e17146102a9578063fd408767146102bb57005b6101346104d6565b60006000f35b61014261039b565b8060005260206000f35b610157600435610326565b60006000f35b6101686004356102c9565b60006000f35b610176610442565b8060005260206000f35b6101886103d3565b8060ff1660005260206000f35b61019d610413565b8073ffffffffffffffffffffffffffffffffffffffff1660005260206000f35b6101c56104c5565b60006000f35b6101d36103b7565b8060000b60005260206000f35b6101e8610454565b60006000f35b6101f6610401565b8060005260206000f35b61020861051f565b60006000f35b6102196004356102e5565b60006000f35b610227610693565b60006000f35b610238600435610342565b60006000f35b610246610484565b60006000f35b610254610493565b60006000f35b61026560043561038d565b60006000f35b610276600435610350565b60006000f35b61028760043561035e565b60006000f35b6102956105b4565b60006000f35b6102a3610547565b60006000f35b6102b16103ef565b8060005260206000f35b6102c3610600565b60006000f35b80600060006101000a81548160ff021916908302179055505b50565b80600060016101000a81548160ff02191690837f01000000000000000000000000000000000000000000000000000000000000009081020402179055505b50565b80600060026101000a81548160ff021916908302179055505b50565b806001600050819055505b50565b806002600050819055505b50565b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b50565b806004600050819055505b50565b6000600060009054906101000a900460ff1690506103b4565b90565b6000600060019054906101000a900460000b90506103d0565b90565b6000600060029054906101000a900460ff1690506103ec565b90565b600060016000505490506103fe565b90565b60006002600050549050610410565b90565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061043f565b90565b60006004600050549050610451565b90565b7f65c9ac8011e286e89d02a269890f41d67ca2cc597b2c76c7c69321ff492be5806000602a81526020016000a15b565b6000602a81526020016000a05b565b60017f81933b308056e7e85668661dcd102b1f22795b4431f9cf4625794f381c271c6b6000602a81526020016000a25b565b60016000602a81526020016000a15b565b3373ffffffffffffffffffffffffffffffffffffffff1660017f0e216b62efbb97e751a2ce09f607048751720397ecfb9eef1e48a6644948985b6000602a81526020016000a35b565b3373ffffffffffffffffffffffffffffffffffffffff1660016000602a81526020016000a25b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660017f317b31292193c2a4f561cc40a95ea0d97a2733f14af6d6d59522473e1f3ae65f6000602a81526020016000a45b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660016000602a81526020016000a35b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff1660017fd5f0a30e4be0c6be577a71eceb7464245a796a7e6a55c0d971837b250de05f4e60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe98152602001602a81526020016000a45b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001023373ffffffffffffffffffffffffffffffffffffffff16600160007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe98152602001602a81526020016000a35b56" + } } } }], - "statusCode": 200 + "statusCodes": [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 index 4dc1db88b7..64474ad7ec 100644 --- a/simulators/ethereum/graphql/testcases/23_eth_getLogs_matchTopic.json +++ b/simulators/ethereum/graphql/testcases/23_eth_getLogs_matchTopic.json @@ -18,5 +18,5 @@ } }], - "statusCode": 200 + "statusCodes": [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 index 52289500ab..078fdf4134 100644 --- a/simulators/ethereum/graphql/testcases/24_eth_getLogs_range.json +++ b/simulators/ethereum/graphql/testcases/24_eth_getLogs_range.json @@ -36,5 +36,5 @@ ] } }], - "statusCode": 200 + "statusCodes": [200] } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/25_eth_getStorageAt_illegalRangeGreaterThan.json b/simulators/ethereum/graphql/testcases/25_eth_getStorageAt_illegalRangeGreaterThan.json index a440e32052..7a5d377ed0 100644 --- a/simulators/ethereum/graphql/testcases/25_eth_getStorageAt_illegalRangeGreaterThan.json +++ b/simulators/ethereum/graphql/testcases/25_eth_getStorageAt_illegalRangeGreaterThan.json @@ -9,5 +9,5 @@ } }], - "statusCode": 200 + "statusCodes": [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 index faa8f236cd..56830da53e 100644 --- a/simulators/ethereum/graphql/testcases/26_eth_getStorageAt.json +++ b/simulators/ethereum/graphql/testcases/26_eth_getStorageAt.json @@ -9,5 +9,5 @@ } }], - "statusCode": 200 + "statusCodes": [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 index a445305c3c..83bdfe62b0 100644 --- a/simulators/ethereum/graphql/testcases/27_eth_getTransaction_byBlockHashAndIndex.json +++ b/simulators/ethereum/graphql/testcases/27_eth_getTransaction_byBlockHashAndIndex.json @@ -16,5 +16,5 @@ } }], - "statusCode": 200 + "statusCodes": [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 index 00a41f132d..2adca806e7 100644 --- a/simulators/ethereum/graphql/testcases/28_eth_getTransaction_byBlockNumberAndIndex.json +++ b/simulators/ethereum/graphql/testcases/28_eth_getTransaction_byBlockNumberAndIndex.json @@ -16,5 +16,5 @@ } }], - "statusCode": 200 + "statusCodes": [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 index f7dd2b9529..f010f88830 100644 --- a/simulators/ethereum/graphql/testcases/29_eth_getTransaction_byBlockNumberAndInvalidIndex.json +++ b/simulators/ethereum/graphql/testcases/29_eth_getTransaction_byBlockNumberAndInvalidIndex.json @@ -10,5 +10,5 @@ } } }], - "statusCode": 200 + "statusCodes": [200] } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/31_eth_getTransaction_byHashNull.json b/simulators/ethereum/graphql/testcases/31_eth_getTransaction_byHashNull.json index cf238cb74e..f3613be3d7 100644 --- a/simulators/ethereum/graphql/testcases/31_eth_getTransaction_byHashNull.json +++ b/simulators/ethereum/graphql/testcases/31_eth_getTransaction_byHashNull.json @@ -9,5 +9,5 @@ "transaction" : null } }], - "statusCode": 200 + "statusCodes": [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 index 1283f72a77..99ec798549 100644 --- a/simulators/ethereum/graphql/testcases/32_eth_getTransactionCount.json +++ b/simulators/ethereum/graphql/testcases/32_eth_getTransactionCount.json @@ -9,5 +9,5 @@ } }], - "statusCode": 200 + "statusCodes": [200] } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/34_eth_sendRawTransaction_contractCreation.json b/simulators/ethereum/graphql/testcases/34_eth_sendRawTransaction_contractCreation.json index 2f710211aa..1156bb8fa7 100644 --- a/simulators/ethereum/graphql/testcases/34_eth_sendRawTransaction_contractCreation.json +++ b/simulators/ethereum/graphql/testcases/34_eth_sendRawTransaction_contractCreation.json @@ -5,5 +5,5 @@ "sendRawTransaction" : "0xf9a25e1d6202e9ea1d984f76939e9bb3609bfb9aea2541ae8a629270343fbb2f" } }], - "statusCode": 200 + "statusCodes": [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 index 96b7fe0a70..38e2ebe9b9 100644 --- a/simulators/ethereum/graphql/testcases/35_graphql_pending.json +++ b/simulators/ethereum/graphql/testcases/35_graphql_pending.json @@ -23,5 +23,5 @@ } } }], - "statusCode": 200 + "statusCodes": [200] } diff --git a/simulators/ethereum/graphql/testcases/36_eth_sendRawTransaction_messageCall.json b/simulators/ethereum/graphql/testcases/36_eth_sendRawTransaction_messageCall.json index e5eace1ff7..badb24ac7e 100644 --- a/simulators/ethereum/graphql/testcases/36_eth_sendRawTransaction_messageCall.json +++ b/simulators/ethereum/graphql/testcases/36_eth_sendRawTransaction_messageCall.json @@ -6,5 +6,5 @@ } }], - "statusCode": 200 + "statusCodes": [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 index 5d677670fc..1f3c5abe84 100644 --- a/simulators/ethereum/graphql/testcases/37_eth_sendRawTransaction_nonceTooLow.json +++ b/simulators/ethereum/graphql/testcases/37_eth_sendRawTransaction_nonceTooLow.json @@ -22,5 +22,5 @@ ], "data": null }], - "statusCode": 400 + "statusCodes": [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 index 466d22f7f6..06c99371c1 100644 --- a/simulators/ethereum/graphql/testcases/38_eth_sendRawTransaction_transferEther.json +++ b/simulators/ethereum/graphql/testcases/38_eth_sendRawTransaction_transferEther.json @@ -5,5 +5,5 @@ "sendRawTransaction" : "0x772b6d5c64b9798865d6dfa35ba44d181abd96a448f8ab7ea9e9631cabb7b290" } }], - "statusCode": 200 + "statusCodes": [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 index 30b83680aa..72006d1a7b 100644 --- a/simulators/ethereum/graphql/testcases/39_eth_sendRawTransaction_unsignedTransaction.json +++ b/simulators/ethereum/graphql/testcases/39_eth_sendRawTransaction_unsignedTransaction.json @@ -22,5 +22,5 @@ ], "data": null }], - "statusCode": 400 + "statusCodes": [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 index 941b54845c..23b328c4bf 100644 --- a/simulators/ethereum/graphql/testcases/40_eth_syncing.json +++ b/simulators/ethereum/graphql/testcases/40_eth_syncing.json @@ -7,5 +7,5 @@ "syncing" : null } }], - "statusCode": 200 + "statusCodes": [200] } diff --git a/simulators/ethereum/graphql/testcases/41_graphql_blocks_byFrom.json b/simulators/ethereum/graphql/testcases/41_graphql_blocks_byFrom.json index ade785cc23..a3f367dc8e 100644 --- a/simulators/ethereum/graphql/testcases/41_graphql_blocks_byFrom.json +++ b/simulators/ethereum/graphql/testcases/41_graphql_blocks_byFrom.json @@ -15,5 +15,5 @@ ] } }], - "statusCode": 200 + "statusCodes": [200] } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/42_graphql_blocks_byRange.json b/simulators/ethereum/graphql/testcases/42_graphql_blocks_byRange.json index f826c70e5e..5b401c13ad 100644 --- a/simulators/ethereum/graphql/testcases/42_graphql_blocks_byRange.json +++ b/simulators/ethereum/graphql/testcases/42_graphql_blocks_byRange.json @@ -36,5 +36,5 @@ } ] } }], - "statusCode": 200 + "statusCodes": [200] } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/43_graphql_blocks_byWrongRange.json b/simulators/ethereum/graphql/testcases/43_graphql_blocks_byWrongRange.json index 32e3f2c6c1..001b913528 100644 --- a/simulators/ethereum/graphql/testcases/43_graphql_blocks_byWrongRange.json +++ b/simulators/ethereum/graphql/testcases/43_graphql_blocks_byWrongRange.json @@ -22,5 +22,5 @@ ], "data": null }], - "statusCode": 400 + "statusCodes": [400] } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/44_graphql_tooComplex.json b/simulators/ethereum/graphql/testcases/44_graphql_tooComplex.json index a49a6090a8..0a84cb3328 100644 --- a/simulators/ethereum/graphql/testcases/44_graphql_tooComplex.json +++ b/simulators/ethereum/graphql/testcases/44_graphql_tooComplex.json @@ -10,5 +10,5 @@ } ] }], - "statusCode": 400 + "statusCodes": [400] } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/45_graphql_tooComplexSchema.json b/simulators/ethereum/graphql/testcases/45_graphql_tooComplexSchema.json index 70b82a9c8d..0d76fca6c1 100644 --- a/simulators/ethereum/graphql/testcases/45_graphql_tooComplexSchema.json +++ b/simulators/ethereum/graphql/testcases/45_graphql_tooComplexSchema.json @@ -10,5 +10,5 @@ } ] }], - "statusCode": 400 + "statusCodes": [400] } \ No newline at end of file From ccb142601009ad2600bca116861cb6d304ce599b Mon Sep 17 00:00:00 2001 From: renaynay <41963722+renaynay@users.noreply.github.com> Date: Tue, 9 Mar 2021 12:51:18 +0000 Subject: [PATCH 2/2] remove multiple status codes --- simulators/ethereum/graphql/graphql.go | 21 +++------- simulators/ethereum/graphql/graphql_test.go | 42 ------------------- .../graphql/testcases/01_eth_blockNumber.json | 2 +- .../graphql/testcases/02_eth_call_Block8.json | 2 +- .../testcases/03_eth_call_BlockLatest.json | 2 +- .../04_eth_estimateGas_contractDeploy.json | 2 +- .../05_eth_estimateGas_noParams.json | 3 +- .../06_eth_estimateGas_transfer.json | 2 +- .../graphql/testcases/07_eth_gasPrice.json | 2 +- .../testcases/08_eth_getBalance_0x19.json | 2 +- .../testcases/11_eth_getBalance_latest.json | 3 +- .../12_eth_getBalance_toobig_bn.json | 2 +- .../13_eth_getBalance_without_addr.json | 2 +- .../testcases/14_eth_getBlock_byHash.json | 2 +- .../15_eth_getBlock_byHashInvalid.json | 2 +- .../testcases/16_eth_getBlock_byNumber.json | 2 +- .../18_eth_getBlock_wrongParams.json | 2 +- ...9_eth_getBlockTransactionCount_byHash.json | 2 +- ...eth_getBlockTransactionCount_byNumber.json | 2 +- .../testcases/21_eth_getCode_noCode.json | 4 +- .../graphql/testcases/22_eth_getCode.json | 3 +- .../testcases/23_eth_getLogs_matchTopic.json | 2 +- .../testcases/24_eth_getLogs_range.json | 2 +- ..._getStorageAt_illegalRangeGreaterThan.json | 2 +- .../testcases/26_eth_getStorageAt.json | 2 +- ...th_getTransaction_byBlockHashAndIndex.json | 2 +- ..._getTransaction_byBlockNumberAndIndex.json | 2 +- ...nsaction_byBlockNumberAndInvalidIndex.json | 2 +- .../31_eth_getTransaction_byHashNull.json | 2 +- .../testcases/32_eth_getTransactionCount.json | 2 +- ...h_sendRawTransaction_contractCreation.json | 2 +- .../graphql/testcases/35_graphql_pending.json | 2 +- ...36_eth_sendRawTransaction_messageCall.json | 2 +- ...37_eth_sendRawTransaction_nonceTooLow.json | 2 +- ..._eth_sendRawTransaction_transferEther.json | 2 +- ...endRawTransaction_unsignedTransaction.json | 2 +- .../graphql/testcases/40_eth_syncing.json | 2 +- .../testcases/41_graphql_blocks_byFrom.json | 2 +- .../testcases/42_graphql_blocks_byRange.json | 2 +- .../43_graphql_blocks_byWrongRange.json | 2 +- .../testcases/44_graphql_tooComplex.json | 2 +- .../45_graphql_tooComplexSchema.json | 2 +- 42 files changed, 45 insertions(+), 103 deletions(-) diff --git a/simulators/ethereum/graphql/graphql.go b/simulators/ethereum/graphql/graphql.go index e1979c335f..a072c93ebd 100644 --- a/simulators/ethereum/graphql/graphql.go +++ b/simulators/ethereum/graphql/graphql.go @@ -118,9 +118,9 @@ type testCase struct { // graphQLTest is the JSON object structure of a test case file. type graphQLTest struct { - Request string `json:"request"` - Responses []interface{} `json:"responses"` - StatusCodes []int `json:"statusCodes"` + Request string `json:"request"` + Responses []interface{} `json:"responses"` + StatusCode int `json:"statusCode"` } type qlQuery struct { @@ -147,8 +147,8 @@ func (tc *testCase) run(t *hivesim.T, c *hivesim.Client) { } resp.Body.Close() - if !tc.statusCodeMatch(resp.StatusCode) { - t.Errorf("HTTP response code is %d, want %v \n response body: %s", resp.StatusCode, tc.gqlTest.StatusCodes, string(respBytes)) + 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. @@ -159,17 +159,6 @@ func (tc *testCase) run(t *hivesim.T, c *hivesim.Client) { tc.responseMatch(t, resp.Status, respBytes) } -// statusCodeMatch checks if a response status code matches against -// one of the expected status codes. -func (tc *testCase) statusCodeMatch(resp int) bool { - for _, expected := range tc.gqlTest.StatusCodes { - if expected == resp { - return true - } - } - return false -} - func (tc *testCase) responseMatch(t *hivesim.T, respStatus string, respBytes []byte) error { // Check that the response matches. var got interface{} diff --git a/simulators/ethereum/graphql/graphql_test.go b/simulators/ethereum/graphql/graphql_test.go index 289340feaa..a682685dfd 100644 --- a/simulators/ethereum/graphql/graphql_test.go +++ b/simulators/ethereum/graphql/graphql_test.go @@ -92,45 +92,3 @@ func Test_responseMatch(t *testing.T) { }) } } - -func Test_statusCodeMatch(t *testing.T) { - // unmarshal JSON test file - fp := "./testcases/09_eth_getBalance_invalidAccountBlockNumber.json" - data, err := ioutil.ReadFile(fp) - if err != nil { - t.Fatalf("Warning: can't read test file %s: %v", fp, err) - } - var gqlTest graphQLTest - if err = json.Unmarshal(data, &gqlTest); err != nil { - t.Fatalf("Warning: can't unmarshal test file %s: %v", fp, err) - } - // build test case - tc := testCase{ - name: "test1", - gqlTest: &gqlTest, - } - // create valid tests - var tests = []struct { - statusCode int - expectedFailure bool // true == failure expected - }{ - { - statusCode: 400, - }, - { - statusCode: 200, - }, - { - statusCode: 404, - expectedFailure: true, - }, - } - - for i, tt := range tests { - t.Run(strconv.Itoa(i), func(t *testing.T) { - if !tc.statusCodeMatch(tt.statusCode) && !tt.expectedFailure { - t.Fatal(err) - } - }) - } -} diff --git a/simulators/ethereum/graphql/testcases/01_eth_blockNumber.json b/simulators/ethereum/graphql/testcases/01_eth_blockNumber.json index b365cc9654..d74b9a8580 100644 --- a/simulators/ethereum/graphql/testcases/01_eth_blockNumber.json +++ b/simulators/ethereum/graphql/testcases/01_eth_blockNumber.json @@ -9,5 +9,5 @@ } } }], - "statusCodes": [200] + "statusCode": 200 } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/02_eth_call_Block8.json b/simulators/ethereum/graphql/testcases/02_eth_call_Block8.json index b0cd0159bf..426a4846a5 100644 --- a/simulators/ethereum/graphql/testcases/02_eth_call_Block8.json +++ b/simulators/ethereum/graphql/testcases/02_eth_call_Block8.json @@ -12,5 +12,5 @@ } } }], - "statusCodes": [200] + "statusCode": 200 } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/03_eth_call_BlockLatest.json b/simulators/ethereum/graphql/testcases/03_eth_call_BlockLatest.json index 11a6eab088..6a21adac9a 100644 --- a/simulators/ethereum/graphql/testcases/03_eth_call_BlockLatest.json +++ b/simulators/ethereum/graphql/testcases/03_eth_call_BlockLatest.json @@ -12,5 +12,5 @@ } } }], - "statusCodes": [200] + "statusCode": 200 } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/04_eth_estimateGas_contractDeploy.json b/simulators/ethereum/graphql/testcases/04_eth_estimateGas_contractDeploy.json index 86dde90eb0..7ab7ff729e 100644 --- a/simulators/ethereum/graphql/testcases/04_eth_estimateGas_contractDeploy.json +++ b/simulators/ethereum/graphql/testcases/04_eth_estimateGas_contractDeploy.json @@ -7,5 +7,5 @@ } } }], - "statusCodes": [200] + "statusCode": 200 } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/05_eth_estimateGas_noParams.json b/simulators/ethereum/graphql/testcases/05_eth_estimateGas_noParams.json index a9511d7e51..c36e86d557 100644 --- a/simulators/ethereum/graphql/testcases/05_eth_estimateGas_noParams.json +++ b/simulators/ethereum/graphql/testcases/05_eth_estimateGas_noParams.json @@ -7,6 +7,5 @@ } } }], - - "statusCodes": [200] + "statusCode": 200 } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/06_eth_estimateGas_transfer.json b/simulators/ethereum/graphql/testcases/06_eth_estimateGas_transfer.json index 86a8c0b2f9..913e29b594 100644 --- a/simulators/ethereum/graphql/testcases/06_eth_estimateGas_transfer.json +++ b/simulators/ethereum/graphql/testcases/06_eth_estimateGas_transfer.json @@ -7,5 +7,5 @@ } } }], - "statusCodes": [200] + "statusCode": 200 } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/07_eth_gasPrice.json b/simulators/ethereum/graphql/testcases/07_eth_gasPrice.json index 8147c6b268..e54d5b2800 100644 --- a/simulators/ethereum/graphql/testcases/07_eth_gasPrice.json +++ b/simulators/ethereum/graphql/testcases/07_eth_gasPrice.json @@ -13,5 +13,5 @@ } } ], - "statusCodes": [200] + "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 index da57144d13..6e17cfb97b 100644 --- a/simulators/ethereum/graphql/testcases/08_eth_getBalance_0x19.json +++ b/simulators/ethereum/graphql/testcases/08_eth_getBalance_0x19.json @@ -9,6 +9,6 @@ } } }], - "statusCodes": [200] + "statusCode": 200 } diff --git a/simulators/ethereum/graphql/testcases/11_eth_getBalance_latest.json b/simulators/ethereum/graphql/testcases/11_eth_getBalance_latest.json index cef35927dc..6dfdb27d9a 100644 --- a/simulators/ethereum/graphql/testcases/11_eth_getBalance_latest.json +++ b/simulators/ethereum/graphql/testcases/11_eth_getBalance_latest.json @@ -8,8 +8,7 @@ } } } - }, }], - "statusCodes": [200] + "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 index 4254b2c1f0..39d4c98b00 100644 --- a/simulators/ethereum/graphql/testcases/12_eth_getBalance_toobig_bn.json +++ b/simulators/ethereum/graphql/testcases/12_eth_getBalance_toobig_bn.json @@ -27,6 +27,6 @@ "block": null } }], - "statusCodes": [400] + "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 index 2157eb7f1e..54bb700d1c 100644 --- a/simulators/ethereum/graphql/testcases/13_eth_getBalance_without_addr.json +++ b/simulators/ethereum/graphql/testcases/13_eth_getBalance_without_addr.json @@ -16,6 +16,6 @@ } ] }], - "statusCodes": [400] + "statusCode": 400 } diff --git a/simulators/ethereum/graphql/testcases/14_eth_getBlock_byHash.json b/simulators/ethereum/graphql/testcases/14_eth_getBlock_byHash.json index 56908baaaa..dca77109cb 100644 --- a/simulators/ethereum/graphql/testcases/14_eth_getBlock_byHash.json +++ b/simulators/ethereum/graphql/testcases/14_eth_getBlock_byHash.json @@ -30,5 +30,5 @@ } } }], - "statusCodes": [200] + "statusCode": 200 } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/15_eth_getBlock_byHashInvalid.json b/simulators/ethereum/graphql/testcases/15_eth_getBlock_byHashInvalid.json index 740ad6d905..a53a108341 100644 --- a/simulators/ethereum/graphql/testcases/15_eth_getBlock_byHashInvalid.json +++ b/simulators/ethereum/graphql/testcases/15_eth_getBlock_byHashInvalid.json @@ -20,5 +20,5 @@ ], "data": null }], - "statusCodes": [400] + "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 index f26752319b..a8c2518bb9 100644 --- a/simulators/ethereum/graphql/testcases/16_eth_getBlock_byNumber.json +++ b/simulators/ethereum/graphql/testcases/16_eth_getBlock_byNumber.json @@ -40,5 +40,5 @@ } } }], - "statusCodes": [200] + "statusCode": 200 } \ 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 index d9ff5aa3c7..f2e7f663af 100644 --- a/simulators/ethereum/graphql/testcases/18_eth_getBlock_wrongParams.json +++ b/simulators/ethereum/graphql/testcases/18_eth_getBlock_wrongParams.json @@ -22,5 +22,5 @@ ], "data": null }], - "statusCodes": [400] + "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 index 3166999275..d43de22a43 100644 --- a/simulators/ethereum/graphql/testcases/19_eth_getBlockTransactionCount_byHash.json +++ b/simulators/ethereum/graphql/testcases/19_eth_getBlockTransactionCount_byHash.json @@ -11,5 +11,5 @@ } } }], - "statusCodes": [200] + "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 index 9a60a42eab..789b424657 100644 --- a/simulators/ethereum/graphql/testcases/20_eth_getBlockTransactionCount_byNumber.json +++ b/simulators/ethereum/graphql/testcases/20_eth_getBlockTransactionCount_byNumber.json @@ -29,5 +29,5 @@ } } }], - "statusCodes": [200] + "statusCode": 200 } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/21_eth_getCode_noCode.json b/simulators/ethereum/graphql/testcases/21_eth_getCode_noCode.json index e4c454be27..f70d77d1d1 100644 --- a/simulators/ethereum/graphql/testcases/21_eth_getCode_noCode.json +++ b/simulators/ethereum/graphql/testcases/21_eth_getCode_noCode.json @@ -10,7 +10,5 @@ } } }], - - "statusCodes": [200] - + "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 index 914e726fef..e8babeb9bf 100644 --- a/simulators/ethereum/graphql/testcases/22_eth_getCode.json +++ b/simulators/ethereum/graphql/testcases/22_eth_getCode.json @@ -10,6 +10,5 @@ } } }], - - "statusCodes": [200] + "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 index 64474ad7ec..4dc1db88b7 100644 --- a/simulators/ethereum/graphql/testcases/23_eth_getLogs_matchTopic.json +++ b/simulators/ethereum/graphql/testcases/23_eth_getLogs_matchTopic.json @@ -18,5 +18,5 @@ } }], - "statusCodes": [200] + "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 index 078fdf4134..52289500ab 100644 --- a/simulators/ethereum/graphql/testcases/24_eth_getLogs_range.json +++ b/simulators/ethereum/graphql/testcases/24_eth_getLogs_range.json @@ -36,5 +36,5 @@ ] } }], - "statusCodes": [200] + "statusCode": 200 } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/25_eth_getStorageAt_illegalRangeGreaterThan.json b/simulators/ethereum/graphql/testcases/25_eth_getStorageAt_illegalRangeGreaterThan.json index 7a5d377ed0..a440e32052 100644 --- a/simulators/ethereum/graphql/testcases/25_eth_getStorageAt_illegalRangeGreaterThan.json +++ b/simulators/ethereum/graphql/testcases/25_eth_getStorageAt_illegalRangeGreaterThan.json @@ -9,5 +9,5 @@ } }], - "statusCodes": [200] + "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 index 56830da53e..faa8f236cd 100644 --- a/simulators/ethereum/graphql/testcases/26_eth_getStorageAt.json +++ b/simulators/ethereum/graphql/testcases/26_eth_getStorageAt.json @@ -9,5 +9,5 @@ } }], - "statusCodes": [200] + "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 index 83bdfe62b0..a445305c3c 100644 --- a/simulators/ethereum/graphql/testcases/27_eth_getTransaction_byBlockHashAndIndex.json +++ b/simulators/ethereum/graphql/testcases/27_eth_getTransaction_byBlockHashAndIndex.json @@ -16,5 +16,5 @@ } }], - "statusCodes": [200] + "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 index 2adca806e7..00a41f132d 100644 --- a/simulators/ethereum/graphql/testcases/28_eth_getTransaction_byBlockNumberAndIndex.json +++ b/simulators/ethereum/graphql/testcases/28_eth_getTransaction_byBlockNumberAndIndex.json @@ -16,5 +16,5 @@ } }], - "statusCodes": [200] + "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 index f010f88830..f7dd2b9529 100644 --- a/simulators/ethereum/graphql/testcases/29_eth_getTransaction_byBlockNumberAndInvalidIndex.json +++ b/simulators/ethereum/graphql/testcases/29_eth_getTransaction_byBlockNumberAndInvalidIndex.json @@ -10,5 +10,5 @@ } } }], - "statusCodes": [200] + "statusCode": 200 } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/31_eth_getTransaction_byHashNull.json b/simulators/ethereum/graphql/testcases/31_eth_getTransaction_byHashNull.json index f3613be3d7..cf238cb74e 100644 --- a/simulators/ethereum/graphql/testcases/31_eth_getTransaction_byHashNull.json +++ b/simulators/ethereum/graphql/testcases/31_eth_getTransaction_byHashNull.json @@ -9,5 +9,5 @@ "transaction" : null } }], - "statusCodes": [200] + "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 index 99ec798549..1283f72a77 100644 --- a/simulators/ethereum/graphql/testcases/32_eth_getTransactionCount.json +++ b/simulators/ethereum/graphql/testcases/32_eth_getTransactionCount.json @@ -9,5 +9,5 @@ } }], - "statusCodes": [200] + "statusCode": 200 } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/34_eth_sendRawTransaction_contractCreation.json b/simulators/ethereum/graphql/testcases/34_eth_sendRawTransaction_contractCreation.json index 1156bb8fa7..2f710211aa 100644 --- a/simulators/ethereum/graphql/testcases/34_eth_sendRawTransaction_contractCreation.json +++ b/simulators/ethereum/graphql/testcases/34_eth_sendRawTransaction_contractCreation.json @@ -5,5 +5,5 @@ "sendRawTransaction" : "0xf9a25e1d6202e9ea1d984f76939e9bb3609bfb9aea2541ae8a629270343fbb2f" } }], - "statusCodes": [200] + "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 index 38e2ebe9b9..96b7fe0a70 100644 --- a/simulators/ethereum/graphql/testcases/35_graphql_pending.json +++ b/simulators/ethereum/graphql/testcases/35_graphql_pending.json @@ -23,5 +23,5 @@ } } }], - "statusCodes": [200] + "statusCode": 200 } diff --git a/simulators/ethereum/graphql/testcases/36_eth_sendRawTransaction_messageCall.json b/simulators/ethereum/graphql/testcases/36_eth_sendRawTransaction_messageCall.json index badb24ac7e..e5eace1ff7 100644 --- a/simulators/ethereum/graphql/testcases/36_eth_sendRawTransaction_messageCall.json +++ b/simulators/ethereum/graphql/testcases/36_eth_sendRawTransaction_messageCall.json @@ -6,5 +6,5 @@ } }], - "statusCodes": [200] + "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 index 1f3c5abe84..5d677670fc 100644 --- a/simulators/ethereum/graphql/testcases/37_eth_sendRawTransaction_nonceTooLow.json +++ b/simulators/ethereum/graphql/testcases/37_eth_sendRawTransaction_nonceTooLow.json @@ -22,5 +22,5 @@ ], "data": null }], - "statusCodes": [400] + "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 index 06c99371c1..466d22f7f6 100644 --- a/simulators/ethereum/graphql/testcases/38_eth_sendRawTransaction_transferEther.json +++ b/simulators/ethereum/graphql/testcases/38_eth_sendRawTransaction_transferEther.json @@ -5,5 +5,5 @@ "sendRawTransaction" : "0x772b6d5c64b9798865d6dfa35ba44d181abd96a448f8ab7ea9e9631cabb7b290" } }], - "statusCodes": [200] + "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 index 72006d1a7b..30b83680aa 100644 --- a/simulators/ethereum/graphql/testcases/39_eth_sendRawTransaction_unsignedTransaction.json +++ b/simulators/ethereum/graphql/testcases/39_eth_sendRawTransaction_unsignedTransaction.json @@ -22,5 +22,5 @@ ], "data": null }], - "statusCodes": [400] + "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 index 23b328c4bf..941b54845c 100644 --- a/simulators/ethereum/graphql/testcases/40_eth_syncing.json +++ b/simulators/ethereum/graphql/testcases/40_eth_syncing.json @@ -7,5 +7,5 @@ "syncing" : null } }], - "statusCodes": [200] + "statusCode": 200 } diff --git a/simulators/ethereum/graphql/testcases/41_graphql_blocks_byFrom.json b/simulators/ethereum/graphql/testcases/41_graphql_blocks_byFrom.json index a3f367dc8e..ade785cc23 100644 --- a/simulators/ethereum/graphql/testcases/41_graphql_blocks_byFrom.json +++ b/simulators/ethereum/graphql/testcases/41_graphql_blocks_byFrom.json @@ -15,5 +15,5 @@ ] } }], - "statusCodes": [200] + "statusCode": 200 } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/42_graphql_blocks_byRange.json b/simulators/ethereum/graphql/testcases/42_graphql_blocks_byRange.json index 5b401c13ad..f826c70e5e 100644 --- a/simulators/ethereum/graphql/testcases/42_graphql_blocks_byRange.json +++ b/simulators/ethereum/graphql/testcases/42_graphql_blocks_byRange.json @@ -36,5 +36,5 @@ } ] } }], - "statusCodes": [200] + "statusCode": 200 } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/43_graphql_blocks_byWrongRange.json b/simulators/ethereum/graphql/testcases/43_graphql_blocks_byWrongRange.json index 001b913528..32e3f2c6c1 100644 --- a/simulators/ethereum/graphql/testcases/43_graphql_blocks_byWrongRange.json +++ b/simulators/ethereum/graphql/testcases/43_graphql_blocks_byWrongRange.json @@ -22,5 +22,5 @@ ], "data": null }], - "statusCodes": [400] + "statusCode": 400 } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/44_graphql_tooComplex.json b/simulators/ethereum/graphql/testcases/44_graphql_tooComplex.json index 0a84cb3328..a49a6090a8 100644 --- a/simulators/ethereum/graphql/testcases/44_graphql_tooComplex.json +++ b/simulators/ethereum/graphql/testcases/44_graphql_tooComplex.json @@ -10,5 +10,5 @@ } ] }], - "statusCodes": [400] + "statusCode": 400 } \ No newline at end of file diff --git a/simulators/ethereum/graphql/testcases/45_graphql_tooComplexSchema.json b/simulators/ethereum/graphql/testcases/45_graphql_tooComplexSchema.json index 0d76fca6c1..70b82a9c8d 100644 --- a/simulators/ethereum/graphql/testcases/45_graphql_tooComplexSchema.json +++ b/simulators/ethereum/graphql/testcases/45_graphql_tooComplexSchema.json @@ -10,5 +10,5 @@ } ] }], - "statusCodes": [400] + "statusCode": 400 } \ No newline at end of file