Skip to content

Commit aba749e

Browse files
committed
add eth_getStorageAt RPC schema/tests
1 parent 18a580b commit aba749e

2 files changed

Lines changed: 109 additions & 0 deletions

File tree

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"id": "eth_getStorageAt",
4+
"title": "eth_getStorageAt",
5+
"description": "eth_getStorageAt JSON-RPC method request and response schema.",
6+
7+
"request": {
8+
"id": "#request",
9+
"allOf": [
10+
{ "$ref": "jsonrpc-request.json" },
11+
{ "$ref": "#/definitions/request-obj" }
12+
],
13+
"definitions": {
14+
"request-obj": {
15+
"id": "#request-obj",
16+
"properties": {
17+
"method": {
18+
"type": "string",
19+
"enum": ["eth_getStorageAt"]
20+
},
21+
"params": {
22+
"type": "array",
23+
"items": [
24+
{
25+
"type": "string",
26+
"description": "DATA, 32 Bytes - Hash of a block."
27+
},
28+
{
29+
"type": "string",
30+
"description": "QUANTITY- Integer position in the storage."
31+
},
32+
{
33+
"type": "string",
34+
"description": "QUANTITY|TAG - integer block number, or the string \"latest\", \"earliest\" or \"pending\""
35+
}
36+
],
37+
"minItems": 3,
38+
"maxItems": 3
39+
}
40+
}
41+
}
42+
}
43+
},
44+
45+
46+
"response": {
47+
"id": "#response",
48+
"allOf": [
49+
{ "$ref": "jsonrpc-response.json" },
50+
{ "$ref": "#/definitions/response-obj" }
51+
],
52+
"definitions": {
53+
"response-obj": {
54+
"id": "#response-obj",
55+
"properties": {
56+
"result": {
57+
"type": "string"
58+
}
59+
}
60+
}
61+
}
62+
}
63+
64+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"title" : "eth_getStorageAt",
3+
"schema": {
4+
"$ref": "../schemas/eth_getStorageAt.json"
5+
},
6+
7+
"chainConfig" : {
8+
"$ref": "../configs/bcRPC_API_Test.json"
9+
},
10+
11+
"tests": [
12+
{
13+
"title": "eth_getStorageAt latest block with non-zero storage key",
14+
"request" : {
15+
"method" : "eth_getStorageAt",
16+
"params" : ["0x6295ee1b4f6dd65047762f924ecd367c17eabf8f", "0x01", "latest"]
17+
},
18+
"expectedResponse" : {
19+
"result": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee"
20+
},
21+
"asserts": [
22+
{
23+
"description": "response has blockHeader hash",
24+
"program": ".receivedResponse.result != null"
25+
}
26+
]
27+
},
28+
{
29+
"title": "eth_getStorageAt earliest block with zero storage key",
30+
"request" : {
31+
"method" : "eth_getStorageAt",
32+
"params" : ["0x6295ee1b4f6dd65047762f924ecd367c17eabf8f", "0x01", "earliest"]
33+
},
34+
"expectedResponse" : {
35+
"result": "0000000000000000000000000000000000000000000000000000000000000000"
36+
},
37+
"asserts": [
38+
{
39+
"description": "response has blockHeader hash",
40+
"program": ".receivedResponse.result != null"
41+
}
42+
]
43+
}
44+
]
45+
}

0 commit comments

Comments
 (0)