159 lines
4.2 KiB
JSON
159 lines
4.2 KiB
JSON
{
|
|
"$id": "https://filecoin.io/oni/schemas/test-vector.json",
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"title": "a filecoin VM test vector",
|
|
"type": "object",
|
|
"definitions": {
|
|
"hex": {
|
|
"title": "hex value",
|
|
"description": "a hex value prefixed with 0x, and accepting only lowercase characters; 0x represents an empty byte array",
|
|
"type": "string",
|
|
"pattern": "0x[0-9a-f]*",
|
|
"examples": [
|
|
"0xa1b2c3",
|
|
"0x"
|
|
]
|
|
},
|
|
"meta": {
|
|
"title": "metadata",
|
|
"description": "metadata about this test vector, such as its id, version, data about its generation, etc.",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"version": {
|
|
"type": "string"
|
|
},
|
|
"gen": {
|
|
"title": "generation metadata",
|
|
"description": "metadata about how this test vector was generated",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"source": {
|
|
"type": "string",
|
|
"examples": [
|
|
"lotus",
|
|
"dsl"
|
|
]
|
|
},
|
|
"version": {
|
|
"type": "string",
|
|
"examples": [
|
|
"0.4.1+git.27d74337+api0.8.1"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"state_tree": {
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"root_cid"
|
|
],
|
|
"properties": {
|
|
"root_cid": {
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"/"
|
|
],
|
|
"properties": {
|
|
"/": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"preconditions": {
|
|
"title": "execution preconditions",
|
|
"description": "preconditions that need to be applied and satisfied before this test vector can be executed",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"epoch": {
|
|
"type": "integer"
|
|
},
|
|
"state_tree": {
|
|
"title": "state tree to seed",
|
|
"description": "state tree to seed before applying this test vector; mapping of actor addresses => serialized state",
|
|
"$ref": "#/definitions/state_tree"
|
|
}
|
|
}
|
|
},
|
|
"postconditions": {
|
|
"title": "execution preconditions",
|
|
"description": "postconditions that need to be satisfied after execution for this test vector to pass",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"state_tree": {
|
|
"title": "state tree postconditions",
|
|
"description": "state tree postconditions that must be true for this test vector to pass",
|
|
"$ref": "#/definitions/state_tree"
|
|
}
|
|
}
|
|
},
|
|
"apply_message": {
|
|
"title": "message to apply, hex-encoded",
|
|
"$ref": "#/definitions/hex"
|
|
}
|
|
},
|
|
"required": [
|
|
"class"
|
|
],
|
|
"properties": {
|
|
"class": {
|
|
"title": "test vector class",
|
|
"description": "test vector class; depending on the value, the apply_* property to provide (and its schema) will vary; the relevant apply property is apply_[class]",
|
|
"type": "string",
|
|
"enum": [
|
|
"message",
|
|
"block",
|
|
"tipset",
|
|
"chain"
|
|
]
|
|
},
|
|
"selector": {
|
|
"title": "selector the driver can use to determine if this test vector applies",
|
|
"description": "format TBD",
|
|
"type": "string"
|
|
},
|
|
"_meta": {
|
|
"$ref": "#/definitions/meta"
|
|
},
|
|
"car_bytes": {
|
|
"title": "car containing state trees",
|
|
"description": "the gzipped, hex-encoded CAR containing the pre- and post-condition state trees for this test vector",
|
|
"$ref": "#/definitions/hex"
|
|
},
|
|
"preconditions": {
|
|
"$ref": "#/definitions/preconditions"
|
|
},
|
|
"postconditions": {
|
|
"$ref": "#/definitions/postconditions"
|
|
}
|
|
},
|
|
"allOf": [
|
|
{
|
|
"if": {
|
|
"properties": {
|
|
"class": {
|
|
"const": "message"
|
|
}
|
|
}
|
|
},
|
|
"then": {
|
|
"required": [
|
|
"apply_message"
|
|
],
|
|
"properties": {
|
|
"apply_message": {
|
|
"$ref": "#/definitions/apply_message"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
} |