aboutsummaryrefslogtreecommitdiffstats
path: root/JSONSchema
diff options
context:
space:
mode:
authorcdetrio <cdetrio@gmail.com>2017-08-06 05:14:02 +0800
committerUbuntu <ubuntu@ip-172-31-32-43.us-west-2.compute.internal>2017-08-08 04:41:46 +0800
commit110969e11c15c2d69e4a9666f6805497dfee70c3 (patch)
tree859d2500eb24291d3714b4a56d18e96ec2507e80 /JSONSchema
parent0570119b4075010dfb8b6611523e1d5c26829ccf (diff)
downloaddexon-tests-110969e11c15c2d69e4a9666f6805497dfee70c3.tar
dexon-tests-110969e11c15c2d69e4a9666f6805497dfee70c3.tar.gz
dexon-tests-110969e11c15c2d69e4a9666f6805497dfee70c3.tar.bz2
dexon-tests-110969e11c15c2d69e4a9666f6805497dfee70c3.tar.lz
dexon-tests-110969e11c15c2d69e4a9666f6805497dfee70c3.tar.xz
dexon-tests-110969e11c15c2d69e4a9666f6805497dfee70c3.tar.zst
dexon-tests-110969e11c15c2d69e4a9666f6805497dfee70c3.zip
use more type definitions in schema
Diffstat (limited to 'JSONSchema')
-rw-r--r--JSONSchema/schema.json330
1 files changed, 214 insertions, 116 deletions
diff --git a/JSONSchema/schema.json b/JSONSchema/schema.json
index 78004e0c3..5dee66084 100644
--- a/JSONSchema/schema.json
+++ b/JSONSchema/schema.json
@@ -1,21 +1,217 @@
{
"definitions": {
- "GasAmount": {
- "pattern": "(^0x[76543210][0-9a-f]{15}$)|(^0x[0-9a-f]{0,15}$)",
+ "EmptyString": {
+ "type": "string",
+ "pattern": "^$"
+ },
+ "HexData": {
+ "pattern": "^0x([0-9a-fA-F][0-9a-fA-F])*$",
+ "type": "string"
+ },
+ "HexQuantity": {
+ "pattern": "(^0x0$)|(^0x[1-9a-fA-F][0-9a-fA-F]*$)",
+ "type": "string"
+ },
+ "ConfusedHexType": {
+ "anyOf": [
+ { "$ref": "#/definitions/HexData" },
+ { "$ref": "#/definitions/HexQuantity" }
+ ]
+ },
+ "HexDataOrEmpty": {
+ "oneOf": [
+ { "$ref": "#/definitions/HexData" },
+ { "$ref": "#/definitions/EmptyString" }
+ ]
+ },
+ "HexNoPrefix" : {
+ "pattern": "^([0-9a-fA-F][0-9a-fA-F])+$",
"type": "string"
},
- "SecretKey": {
- "pattern": "^0x[0-9a-f]{64}$",
+ "HexMaybePrefix": {
+ "oneOf": [
+ { "$ref": "#/definitions/HexNoPrefix" },
+ { "$ref": "#/definitions/HexData" }
+ ]
+ },
+ "HexMaybePrefixOrEmpty": {
+ "oneOf": [
+ { "$ref": "#/definitions/HexMaybePrefix" },
+ { "$ref": "#/definitions/EmptyString" }
+ ]
+ },
+ "IntegerString": {
+ "pattern": "^[0-9]+$",
"type": "string"
},
+ "IntegerOrEmpty": {
+ "oneOf": [
+ { "$ref": "#/definitions/IntegerString" },
+ { "$ref": "#/definitions/EmptyString" }
+ ]
+ },
+ "IntegerOrNumber": {
+ "oneOf": [
+ { "$ref": "#/definitions/IntegerString" },
+ { "type": "number" }
+ ]
+ },
+ "IntegerOrNumberOrConfusedHex": {
+ "oneOf": [
+ { "$ref": "#/definitions/IntegerOrNumber" },
+ { "$ref": "#/definitions/ConfusedHexType" }
+ ]
+ },
+ "IntegerOrEmptyOrHexQuantity": {
+ "oneOf": [
+ { "$ref": "#/definitions/IntegerOrEmpty" },
+ { "$ref": "#/definitions/HexQuantity" }
+ ]
+ },
+ "IntegerOrHexQuantity": {
+ "oneOf": [
+ { "$ref": "#/definitions/IntegerString" },
+ { "$ref": "#/definitions/HexQuantity" }
+ ]
+ },
+ "IntegerOrConfusedHex": {
+ "anyOf": [
+ { "$ref": "#/definitions/IntegerString" },
+ { "$ref": "#/definitions/ConfusedHexType" }
+ ]
+ },
+ "IntegerOrEmptyOrConfusedHex": {
+ "oneOf": [
+ { "$ref": "#/definitions/IntegerOrEmpty" },
+ { "$ref": "#/definitions/ConfusedHexType" }
+ ]
+ },
+ "PreStateAccount": {
+ "type": "object",
+ "additionalproperties": true,
+ "properties": {
+ "balance": { "$ref": "#/definitions/ConfusedHexType" },
+ "code": { "type": "string" },
+ "nonce": { "$ref": "#/definitions/ConfusedHexType" },
+ "storage": { "type": "object" }
+ },
+ "required": [
+ "balance",
+ "code",
+ "nonce"
+ ]
+ },
+ "TxSigR": {
+ "oneOf": [
+ { "enum" : [ "0x00" ] }
+ ]
+ },
+ "TxSigS": {
+ "oneOf": [
+ { "enum" : [ "0x00" ] }
+ ]
+ },
+ "TxSigV": {
+ "description": "a value of 0 is an invalid chainId, but used in a test case",
+ "oneOf": [
+ { "enum" : [ "0x00", "0x01" ] }
+ ]
+ },
+ "HexLen40": {
+ "pattern": "^0x[0-9a-fA-F]{40}$",
+ "type": "string"
+ },
+ "HexNoPrefixLen40": {
+ "pattern": "^[0-9a-fA-F]{40}$",
+ "type": "string"
+ },
+ "AddressMaybePrefixOrEmpty" : {
+ "oneOf": [
+ { "$ref": "#/definitions/HexLen40" },
+ { "$ref": "#/definitions/HexNoPrefixLen40" },
+ { "$ref": "#/definitions/EmptyString" }
+ ]
+ },
+ "Transaction": {
+ "type": "object",
+ "additionalProperties": true,
+ "not": {
+ "required": ["r, s, v"]
+ },
+ "properties": {
+ "data": {
+ "items": { "$ref": "#/definitions/HexDataOrEmpty" },
+ "type": "array"
+ },
+ "gasLimit": {
+ "items": { "$ref": "#/definitions/IntegerOrEmptyOrConfusedHex" },
+ "type": "array"
+ },
+ "gasPrice": { "$ref": "#/definitions/IntegerOrEmptyOrConfusedHex" },
+ "nonce": { "$ref": "#/definitions/IntegerOrEmptyOrConfusedHex" },
+ "secretKey": { "$ref": "#/definitions/HexMaybePrefix" },
+ "to": { "$ref": "#/definitions/AddressMaybePrefixOrEmpty"},
+ "value": {
+ "items": { "$ref": "#/definitions/IntegerOrEmptyOrConfusedHex" },
+ "type": "array"
+ }
+ },
+ "required": [
+ "data",
+ "gasLimit",
+ "gasPrice",
+ "nonce",
+ "secretKey",
+ "to",
+ "value"
+ ]
+ },
+ "NullSenderTransaction": {
+ "type": "object",
+ "additionalProperties": true,
+ "not": {
+ "required": ["secretKey"]
+ },
+ "properties": {
+ "data": {
+ "items": { "$ref": "#/definitions/HexMaybePrefixOrEmpty" },
+ "type": "array"
+ },
+ "gasLimit": {
+ "items": { "$ref": "#/definitions/IntegerOrEmptyOrConfusedHex" },
+ "type": "array"
+ },
+ "gasPrice": { "$ref": "#/definitions/IntegerOrEmptyOrConfusedHex" },
+ "nonce": { "$ref": "#/definitions/IntegerOrEmptyOrConfusedHex" },
+ "r": { "$ref": "#/definitions/TxSigR" },
+ "s": { "$ref": "#/definitions/TxSigS" },
+ "to": { "$ref": "#/definitions/AddressMaybePrefixOrEmpty"},
+ "v": { "$ref": "#/definitions/TxSigV" },
+ "value": {
+ "items": { "$ref": "#/definitions/IntegerOrEmptyOrConfusedHex" },
+ "type": "array"
+ }
+ },
+ "required": [
+ "data",
+ "gasLimit",
+ "gasPrice",
+ "nonce",
+ "r",
+ "s",
+ "v",
+ "to",
+ "value"
+ ]
+ },
"TransactionResults": {
"items": {
"additionalProperties": false,
"properties": {
"hash": {
- "pattern": "^0x[0-9a-f]*$",
- "type": "string"
+ "$ref": "#/definitions/HexData"
},
+ "logs": {},
"indexes": {
"additionalProperties": false,
"properties": {
@@ -53,27 +249,22 @@
"additionalproperties": false,
"properties": {
"currentCoinbase": {
- "pattern": "^0x[0-9a-f]*$",
- "type": "string"
+ "$ref": "#/definitions/HexData"
},
"currentDifficulty": {
- "pattern": "^0x[0-9a-f]*$",
- "type": "string"
+ "$ref": "#/definitions/ConfusedHexType"
},
"currentGasLimit": {
- "$ref": "#/definitions/GasAmount"
+ "$ref": "#/definitions/ConfusedHexType"
},
"currentNumber": {
- "pattern": "^0x[0-9a-f]*$",
- "type": "string"
+ "$ref": "#/definitions/ConfusedHexType"
},
"currentTimestamp": {
- "pattern": "^0x[0-9a-f]*$",
- "type": "string"
+ "$ref": "#/definitions/ConfusedHexType"
},
"previousHash": {
- "pattern": "^0x[0-9a-f]*$",
- "type": "string"
+ "$ref": "#/definitions/HexData"
}
},
"required": [
@@ -114,110 +305,17 @@
"additionalProperties": false,
"patternProperties": {
"^0x[0-9a-f]*": {
- "additionalproperties": false,
- "properties": {
- "balance": {
- "pattern": "^0x[0-9a-f]*$",
- "type": "string"
- },
- "code": {
- "pattern": "^(0x[0-9a-f]*)?$",
- "type": "string"
- },
- "nonce": {
- "pattern": "^0x[0-9a-f]*$",
- "type": "string"
- },
- "storage": {
- "type": "object"
- }
- },
- "required": [
- "balance",
- "code",
- "nonce"
- ],
- "type": "object"
+ "description": "prestate account address with 0x prefix",
+ "$ref": "#/definitions/PreStateAccount"
}
},
"type": "object"
},
"transaction": {
- "additionalProperties": false,
- "properties": {
- "data": {
- "items": {
- "oneOf": [
- {
- "pattern": "^0x[0-9a-f]*$",
- "type": "string"
- },
- {
- "pattern": "^$",
- "type": "string"
- }
- ]
- },
- "type": "array"
- },
- "gasLimit": {
- "items": {
- "$ref": "#/definitions/GasAmount"
- },
- "type": "array"
- },
- "gasPrice": {
- "$ref": "#/definitions/GasAmount"
- },
- "nonce": {
- "pattern": "^0x[0-9a-f]{1,4}$",
- "type": "string"
- },
- "r": {
- "pattern": "^0x[0-9a-f]{16}$",
- "type": "string"
- },
- "s": {
- "pattern": "^0x[0-9a-f]{16}$",
- "type": "string"
- },
- "secretKey": {
- "$ref": "#/definitions/SecretKey"
- },
- "to": {
- "oneOf": [
- {
- "pattern": "^0x[0-9a-f]{1,10}$",
- "type": "string"
- },
- {
- "pattern": "",
- "type": "string"
- }
- ]
- },
- "v": {
- "pattern": "^0x[0-9a-f]{16}$",
- "type": "string"
- },
- "value": {
- "items": {
- "pattern": "^0x[0-9a-f]*$",
- "type": "string"
- },
- "type": "array"
- }
- },
- "required": [
- "data",
- "gasLimit",
- "gasPrice",
- "nonce",
- "secretKey",
- "to",
- "value"
- ],
- "type": "object"
+ "oneOf": [
+ { "$ref": "#/definitions/Transaction" },
+ { "$ref": "#/definitions/NullSenderTransaction" }
+ ]
}
},
"type": "object"