Skip to content

Commit 961753f

Browse files
authored
tests: update tests (#712)
Here I'm updating tests with recent changes to the test generator: - adding tests for `blockHash` parameter of eth_getLogs - testing more parameter error cases of eth_getLogs - fixing the error code of eth_getStorageAt for invalid parameter - fixing the transaction type in eth_estimateGas test with blobs
1 parent f910189 commit 961753f

8 files changed

+18
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// checks gas estimation for blob transactions (EIP-4844)
22
// speconly: client response is only checked for schema validity.
3-
>> {"jsonrpc":"2.0","id":1,"method":"eth_estimateGas","params":[{"blobVersionedHashes":["0x0100000000000000000000000000000000000000000000000000000000000000"],"from":"0x0c2c51a0990aee1d73c1228de158688341557508","maxFeePerBlobGas":"0x5","nonce":"0x0","to":"0x0100000000000000000000000000000000000000","type":"0x5","value":"0x1"}]}
3+
>> {"jsonrpc":"2.0","id":1,"method":"eth_estimateGas","params":[{"blobVersionedHashes":["0x0100000000000000000000000000000000000000000000000000000000000000"],"from":"0x0c2c51a0990aee1d73c1228de158688341557508","maxFeePerBlobGas":"0x5","nonce":"0x0","to":"0x0100000000000000000000000000000000000000","type":"0x3","value":"0x1"}]}
44
<< {"jsonrpc":"2.0","id":1,"result":"0x5208"}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// checks that an error is returned if `fromBlock`/`toBlock` are specified together with `blockHash`
2+
>> {"jsonrpc":"2.0","id":1,"method":"eth_getLogs","params":[{"blockHash":"0xfec6e8fb3735a6f24416b3b9887fd4cab5e474436ecd4ce701685487ee957416","fromBlock":"0x3","toBlock":"0x4"}]}
3+
<< {"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"invalid argument 0: cannot specify both BlockHash and FromBlock/ToBlock, choose one or the other"}}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// checks that an error is returned if `toBlock` is greater than the latest block
2+
>> {"jsonrpc":"2.0","id":1,"method":"eth_getLogs","params":[{"address":null,"fromBlock":"0x29","toBlock":"0x2f","topics":null}]}
3+
<< {"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"block range extends beyond current head block"}}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// checks that an error is returned if `fromBlock` is larger than `toBlock`
2+
>> {"jsonrpc":"2.0","id":1,"method":"eth_getLogs","params":[{"address":null,"fromBlock":"0x29","toBlock":"0x26","topics":null}]}
3+
<< {"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"invalid block range params"}}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// queries for logs in a block, identified by blockHash
2+
>> {"jsonrpc":"2.0","id":1,"method":"eth_getLogs","params":[{"address":null,"blockHash":"0x29cc6f97784c864cbe29b3502934ad874f48ddc89580018f5a32e01652c88f0a","topics":[["0x00000000000000000000000000000000000000000000000000000000656d6974"],["0x4238ace0bf7e66fd40fea01bdf43f4f30423f48432efd0da3af5fcb17a977fd4"]]}]}
3+
<< {"jsonrpc":"2.0","id":1,"result":[{"address":"0x7dcd17433742f4c0ca53122ab541d0ba67fc27df","topics":["0x00000000000000000000000000000000000000000000000000000000656d6974","0x4238ace0bf7e66fd40fea01bdf43f4f30423f48432efd0da3af5fcb17a977fd4"],"data":"0x0000000000000000000000000000000000000000000000000000000000000001","blockNumber":"0x4","transactionHash":"0xf047c5133c96c405a79d01038b4ccf8208c03e296dd9f6bea083727c9513f805","transactionIndex":"0x0","blockHash":"0x29cc6f97784c864cbe29b3502934ad874f48ddc89580018f5a32e01652c88f0a","blockTimestamp":"0x28","logIndex":"0x0","removed":false}]}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// queries for all logs of a block, identified by blockHash
2+
>> {"jsonrpc":"2.0","id":1,"method":"eth_getLogs","params":[{"address":null,"blockHash":"0x29cc6f97784c864cbe29b3502934ad874f48ddc89580018f5a32e01652c88f0a","topics":null}]}
3+
<< {"jsonrpc":"2.0","id":1,"result":[{"address":"0x7dcd17433742f4c0ca53122ab541d0ba67fc27df","topics":["0x00000000000000000000000000000000000000000000000000000000656d6974","0x4238ace0bf7e66fd40fea01bdf43f4f30423f48432efd0da3af5fcb17a977fd4"],"data":"0x0000000000000000000000000000000000000000000000000000000000000001","blockNumber":"0x4","transactionHash":"0xf047c5133c96c405a79d01038b4ccf8208c03e296dd9f6bea083727c9513f805","transactionIndex":"0x0","blockHash":"0x29cc6f97784c864cbe29b3502934ad874f48ddc89580018f5a32e01652c88f0a","blockTimestamp":"0x28","logIndex":"0x0","removed":false}]}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// requests an invalid storage key
22
>> {"jsonrpc":"2.0","id":1,"method":"eth_getStorageAt","params":["0xaa00000000000000000000000000000000000000","0x00000000000000000000000000000000000000000000000000000000000000000","latest"]}
3-
<< {"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"unable to decode storage key: hex string too long, want at most 32 bytes"}}
3+
<< {"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"storage key too long (want at most 32 bytes): \"0x00000000000000000000000000000000000000000000000000000000000000000\""}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// requests an invalid storage key
22
>> {"jsonrpc":"2.0","id":1,"method":"eth_getStorageAt","params":["0xaa00000000000000000000000000000000000000","0xasdf","latest"]}
3-
<< {"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"unable to decode storage key: hex string invalid"}}
3+
<< {"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"invalid hex in storage key: \"0xasdf\""}}

0 commit comments

Comments
 (0)