Skip to content

Commit

Permalink
add eth_getStorageAt RPC schema/tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jwasinger committed Nov 28, 2017
1 parent 18a580b commit aba749e
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
64 changes: 64 additions & 0 deletions rpc-specs-tests/schemas/eth_getStorageAt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "eth_getStorageAt",
"title": "eth_getStorageAt",
"description": "eth_getStorageAt JSON-RPC method request and response schema.",

"request": {
"id": "#request",
"allOf": [
{ "$ref": "jsonrpc-request.json" },
{ "$ref": "#/definitions/request-obj" }
],
"definitions": {
"request-obj": {
"id": "#request-obj",
"properties": {
"method": {
"type": "string",
"enum": ["eth_getStorageAt"]
},
"params": {
"type": "array",
"items": [
{
"type": "string",
"description": "DATA, 32 Bytes - Hash of a block."
},
{
"type": "string",
"description": "QUANTITY- Integer position in the storage."
},
{
"type": "string",
"description": "QUANTITY|TAG - integer block number, or the string \"latest\", \"earliest\" or \"pending\""
}
],
"minItems": 3,
"maxItems": 3
}
}
}
}
},


"response": {
"id": "#response",
"allOf": [
{ "$ref": "jsonrpc-response.json" },
{ "$ref": "#/definitions/response-obj" }
],
"definitions": {
"response-obj": {
"id": "#response-obj",
"properties": {
"result": {
"type": "string"
}
}
}
}
}

}
45 changes: 45 additions & 0 deletions rpc-specs-tests/tests/eth_getStorageAt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"title" : "eth_getStorageAt",
"schema": {
"$ref": "../schemas/eth_getStorageAt.json"
},

"chainConfig" : {
"$ref": "../configs/bcRPC_API_Test.json"
},

"tests": [
{
"title": "eth_getStorageAt latest block with non-zero storage key",
"request" : {
"method" : "eth_getStorageAt",
"params" : ["0x6295ee1b4f6dd65047762f924ecd367c17eabf8f", "0x01", "latest"]
},
"expectedResponse" : {
"result": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee"
},
"asserts": [
{
"description": "response has blockHeader hash",
"program": ".receivedResponse.result != null"
}
]
},
{
"title": "eth_getStorageAt earliest block with zero storage key",
"request" : {
"method" : "eth_getStorageAt",
"params" : ["0x6295ee1b4f6dd65047762f924ecd367c17eabf8f", "0x01", "earliest"]
},
"expectedResponse" : {
"result": "0000000000000000000000000000000000000000000000000000000000000000"
},
"asserts": [
{
"description": "response has blockHeader hash",
"program": ".receivedResponse.result != null"
}
]
}
]
}

0 comments on commit aba749e

Please sign in to comment.