Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
Merge pull request #161 from icon-project/add_deposit_datatype_to_deb…
Browse files Browse the repository at this point in the history
…ug_estimatestep

Add `deposit` data type to `debug_estimateStep` json schema validator
  • Loading branch information
Eunsoo Park committed May 24, 2021
2 parents f233b13 + cdd11ae commit f6628dc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 48 deletions.
49 changes: 1 addition & 48 deletions iconrpcserver/dispatcher/validator.py
Expand Up @@ -659,62 +659,15 @@ def validate_jsonschema_v2(request: object):
},
"additionalProperties": False,
"required": ["jsonrpc", "method", "id", "params"]

}

debug_estimateStep_v3: dict = {
"title": "debug_estimateStep",
"id": "https://github.com/icon-project/icon-rpc-server/blob/master/docs/icon-json-rpc-v3.md#debug_estimateStep",
"type": "object",
"properties": {
"jsonrpc": {"type": "string", "enum": ["2.0"]},
"method": {"type": "string"},
"id": {"type": "number"},
"params": {
"type": "object",
"properties": {
"version": {"type": "string", "format": "int_16"},
"from": {"type": "string", "format": "address_eoa"},
"to": {"type": "string", "format": "address"},
"value": {"type": "string", "format": "int_16"},
"message": {"type": "string"},
"stepLimit": {"type": "string", "format": "int_16"},
"timestamp": {"type": "string", "format": "int_16"},
"nid": {"type": "string", "format": "int_16"},
"nonce": {"type": "string", "format": "int_16"},
"dataType": {"type": "string", "enum": ["call", "deploy", "message"]},
"data": {
"oneOf": [
{
"type": "object",
"properties": {
"method": {"type": "string"},
"params": {"type": "object"}
},
"additionalProperties": False,
"required": ["method"]
},
{
"type": "object",
"properties": {
"contentType": {"type": "string", "enum": ["application/zip", "application/tbears"]},
"content": {"type": "string"}, # tbears get string content
"params": {"type": "object"}
},
"additionalProperties": False,
"required": ["contentType", "content"]
},
{"type": "string"}
],
}
},
"additionalProperties": False,
"required": ["version", "from", "to", "timestamp"]
}
},
"properties": icx_sendTransaction_v3["properties"],
"additionalProperties": False,
"required": ["jsonrpc", "method", "id", "params"]

}

rep_getListByHash_v3: dict = {
Expand Down
14 changes: 14 additions & 0 deletions tests/test_jsonschema_validator.py
Expand Up @@ -570,6 +570,20 @@ def test_sendTransaction(self):
for data in send_txs:
self.check_sendTransaction(data)

def test_debug_estimateStep(self):
send_txs = [
self.sendTransaction,
self.sendTransaction_call,
self.sendTransaction_deploy,
self.sendTransaction_message,
self.sendTransaction_deposit
]

for data in send_txs:
debug_estimate_step = data
debug_estimate_step["method"] = "debug_estimateStep"
self.check_sendTransaction(debug_estimate_step)

def check_sendTransaction(self, full_data):
# check default function
self.check_valid(full_data=full_data)
Expand Down

0 comments on commit f6628dc

Please sign in to comment.