aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitry <dimitry@ethereum.org>2018-11-20 02:28:33 +0800
committerDimitry <dimitry@ethereum.org>2018-11-20 02:28:33 +0800
commite091b9be7a31d1985e685991c05ea3f9b548bddc (patch)
tree287faa33d20d47a163e0b8088540f48544da9598
parent03f578c27bf5a58ba8d88df4a01b5395470f7bfe (diff)
downloaddexon-tests-consttransition.tar
dexon-tests-consttransition.tar.gz
dexon-tests-consttransition.tar.bz2
dexon-tests-consttransition.tar.lz
dexon-tests-consttransition.tar.xz
dexon-tests-consttransition.tar.zst
dexon-tests-consttransition.zip
fix blockchain tests expect section json scheme checkconsttransition
more info when scheme check errors
-rw-r--r--JSONSchema/bc-filler-schema.json24
-rw-r--r--JSONSchema/definitions.json39
-rw-r--r--JSONSchema/st-filler-schema.json14
-rw-r--r--src/BlockchainTestsFiller/TransitionTests/bcHomesteadToDao/DaoTransactionsFiller.json4
-rw-r--r--src/BlockchainTestsFiller/TransitionTests/bcHomesteadToDao/DaoTransactions_EmptyTransactionAndForkBlocksAheadFiller.json4
-rw-r--r--src/BlockchainTestsFiller/TransitionTests/bcHomesteadToDao/DaoTransactions_UncleExtradataFiller.json4
-rw-r--r--src/BlockchainTestsFiller/TransitionTests/bcHomesteadToEIP150/EIP150TransitionFiller.json2
-rwxr-xr-xtest.py5
8 files changed, 70 insertions, 26 deletions
diff --git a/JSONSchema/bc-filler-schema.json b/JSONSchema/bc-filler-schema.json
index b002f43ae..a6874095a 100644
--- a/JSONSchema/bc-filler-schema.json
+++ b/JSONSchema/bc-filler-schema.json
@@ -1,5 +1,17 @@
{
"definitions": {
+ "BlockchainExpectSection": {
+ "additionalProperties": false,
+ "properties": {
+ "network": {
+ "$ref": "#/definitions/Networks"
+ },
+ "result": {
+ "$ref": "#/definitions/AccountMap"
+ }
+ },
+ "type": "array"
+ },
"BadHexData": {
"pattern": "^0x[0-9a-zA-Z]*$",
"type": "string"
@@ -317,12 +329,14 @@
"type": "string"
},
"expect": {
- "patternProperties": {
- "^0x[0-9a-f]*": {
- "$ref": "#/definitions/PreStateAccount",
- "description": "poststate account address with 0x prefix"
+ "oneOf": [
+ {
+ "$ref": "#/definitions/AccountMap"
+ },
+ {
+ "$ref": "#/definitions/BlockchainExpectSection"
}
- }
+ ]
},
"genesisBlockHeader": {
"$ref": "#/definitions/BlockHeader"
diff --git a/JSONSchema/definitions.json b/JSONSchema/definitions.json
index 529e08763..1d5a9ad69 100644
--- a/JSONSchema/definitions.json
+++ b/JSONSchema/definitions.json
@@ -1,5 +1,44 @@
{
"definitions": {
+ "AccountMap": {
+ "additionalProperties": false,
+ "patternProperties": {
+ "^0x[0-9a-fA-F]{40}": {
+ "$ref": "#/definitions/ExpectAccount",
+ "description": "filler prestate addresses with 0x prefix"
+ },
+ "^[0-9a-fA-F]{40}": {
+ "$ref": "#/definitions/ExpectAccount",
+ "description": "filler prestate addresses without 0x prefix"
+ }
+ },
+ "type": "object"
+ },
+ "ExpectAccount": {
+ "additionalproperties": true,
+ "properties": {
+ "balance": {
+ "$ref": "#/definitions/IntegerOrEmptyOrConfusedHex"
+ },
+ "code": {
+ "type": "string"
+ },
+ "nonce": {
+ "$ref": "#/definitions/IntegerOrEmptyOrConfusedHex"
+ },
+ "storage": {
+ "additionalProperties": false,
+ "patternProperties": {
+ "^0x[0-9a-f]+": {
+ "$ref": "#/definitions/PrefixedHexOrInteger",
+ "description": "storage key with 0x prefix, just the prefix `0x` is null and thus not permitted, a hex quantity is permitted. for the storage value, only hex data is permitted in filled test. Both decimal and hex allowed for the fillers."
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
"AddressMaybePrefixOrEmpty": {
"oneOf": [
{
diff --git a/JSONSchema/st-filler-schema.json b/JSONSchema/st-filler-schema.json
index ed0e14e58..c533ad819 100644
--- a/JSONSchema/st-filler-schema.json
+++ b/JSONSchema/st-filler-schema.json
@@ -1,19 +1,5 @@
{
"definitions": {
- "AccountMap": {
- "additionalProperties": false,
- "patternProperties": {
- "^0x[0-9a-fA-F]{40}": {
- "$ref": "#/definitions/PreStateAccount",
- "description": "filler prestate addresses with 0x prefix"
- },
- "^[0-9a-fA-F]{40}": {
- "$ref": "#/definitions/PreStateAccount",
- "description": "filler prestate addresses without 0x prefix"
- }
- },
- "type": "object"
- },
"NullSenderTransaction": {
"properties": {
"data": {
diff --git a/src/BlockchainTestsFiller/TransitionTests/bcHomesteadToDao/DaoTransactionsFiller.json b/src/BlockchainTestsFiller/TransitionTests/bcHomesteadToDao/DaoTransactionsFiller.json
index b8b1991ce..c6f367efd 100644
--- a/src/BlockchainTestsFiller/TransitionTests/bcHomesteadToDao/DaoTransactionsFiller.json
+++ b/src/BlockchainTestsFiller/TransitionTests/bcHomesteadToDao/DaoTransactionsFiller.json
@@ -27,12 +27,12 @@
},
"1000000000000000000000000000000000000007" : {
"storage" : {
- "0x" : "10000000000"
+ "0x00" : "10000000000"
}
},
"1000000000000000000000000000000000000008" : {
"storage" : {
- "0x" : "0"
+ "0x00" : "0"
}
},
"bf4ed7b27f1d666546e30d74d50d173d20bca754" : {
diff --git a/src/BlockchainTestsFiller/TransitionTests/bcHomesteadToDao/DaoTransactions_EmptyTransactionAndForkBlocksAheadFiller.json b/src/BlockchainTestsFiller/TransitionTests/bcHomesteadToDao/DaoTransactions_EmptyTransactionAndForkBlocksAheadFiller.json
index 41e5fe3d5..0c7f0f11c 100644
--- a/src/BlockchainTestsFiller/TransitionTests/bcHomesteadToDao/DaoTransactions_EmptyTransactionAndForkBlocksAheadFiller.json
+++ b/src/BlockchainTestsFiller/TransitionTests/bcHomesteadToDao/DaoTransactions_EmptyTransactionAndForkBlocksAheadFiller.json
@@ -27,12 +27,12 @@
},
"1000000000000000000000000000000000000007" : {
"storage" : {
- "0x" : "10000000000"
+ "0x00" : "10000000000"
}
},
"1000000000000000000000000000000000000008" : {
"storage" : {
- "0x" : "0"
+ "0x00" : "0"
}
},
"bf4ed7b27f1d666546e30d74d50d173d20bca754" : {
diff --git a/src/BlockchainTestsFiller/TransitionTests/bcHomesteadToDao/DaoTransactions_UncleExtradataFiller.json b/src/BlockchainTestsFiller/TransitionTests/bcHomesteadToDao/DaoTransactions_UncleExtradataFiller.json
index 243abacc5..9df99033e 100644
--- a/src/BlockchainTestsFiller/TransitionTests/bcHomesteadToDao/DaoTransactions_UncleExtradataFiller.json
+++ b/src/BlockchainTestsFiller/TransitionTests/bcHomesteadToDao/DaoTransactions_UncleExtradataFiller.json
@@ -33,12 +33,12 @@
},
"1000000000000000000000000000000000000007" : {
"storage" : {
- "0x" : "10000000000"
+ "0x00" : "10000000000"
}
},
"1000000000000000000000000000000000000008" : {
"storage" : {
- "0x" : "0"
+ "0x00" : "0"
}
},
"bf4ed7b27f1d666546e30d74d50d173d20bca754" : {
diff --git a/src/BlockchainTestsFiller/TransitionTests/bcHomesteadToEIP150/EIP150TransitionFiller.json b/src/BlockchainTestsFiller/TransitionTests/bcHomesteadToEIP150/EIP150TransitionFiller.json
index b9b16be37..10a10ca52 100644
--- a/src/BlockchainTestsFiller/TransitionTests/bcHomesteadToEIP150/EIP150TransitionFiller.json
+++ b/src/BlockchainTestsFiller/TransitionTests/bcHomesteadToEIP150/EIP150TransitionFiller.json
@@ -30,7 +30,7 @@
"0x06" : "0x01",
"0x07" : "0x01",
"0x08" : "0x01",
- "0x09" : "0x4176a",
+ "0x09" : "0x04176a",
"0x0a" : "0x057ee9",
"0x0b" : "0x5dddfce53ee040d9eb21afbc0ae1bb4dbb0ba643",
"0x64" : "0x11"
diff --git a/test.py b/test.py
index 0189859ad..e0a3bc24c 100755
--- a/test.py
+++ b/test.py
@@ -108,7 +108,12 @@ def validateSchema(testFile, schemaFile):
try:
jsonschema.validate(testInput, schema)
except:
+ from jsonschema import Draft4Validator
_logerror("Validation failed:", "schema", schemaFile, "on", testFile)
+ v = Draft4Validator(schema)
+ errors = sorted(v.iter_errors(testInput), key=lambda e: e.path)
+ for error in errors:
+ _logerror(error.message)
def validateTestFile(testFile):
if testFile.startswith("./src/VMTestsFiller/"):