2020-08-05 12:20:13 +00:00
{
"$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" : {
2020-08-06 16:20:17 +00:00
"title" : "a unique identifier that identifies this test vector" ,
2020-08-05 12:20:13 +00:00
"type" : "string"
} ,
"version" : {
2020-08-06 16:20:17 +00:00
"title" : "the version of this test vector" ,
"type" : "string"
} ,
"description" : {
"title" : "an optional description of the test vector" ,
"type" : "string"
} ,
"comment" : {
"title" : "optional comments about this test vector, e.g. applicability, hints, rationale, etc." ,
2020-08-05 12:20:13 +00:00
"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"
]
}
}
}
}
} ,
2020-08-05 14:52:57 +00:00
"state_tree" : {
"additionalProperties" : false ,
"required" : [
"root_cid"
] ,
"properties" : {
"root_cid" : {
"additionalProperties" : false ,
"required" : [
"/"
] ,
"properties" : {
"/" : {
"type" : "string"
}
}
}
}
} ,
2020-08-06 16:20:17 +00:00
"receipt" : {
"type" : "object" ,
"required" : [
"exit_code" ,
"return" ,
"gas_used"
] ,
"additionalProperties" : false ,
"properties" : {
"exit_code" : {
"type" : "number"
} ,
"return" : {
"$ref" : "#/definitions/hex"
} ,
"gas_used" : {
"type" : "number"
}
}
} ,
2020-08-05 12:20:13 +00:00
"preconditions" : {
"title" : "execution preconditions" ,
"description" : "preconditions that need to be applied and satisfied before this test vector can be executed" ,
"additionalProperties" : false ,
"properties" : {
2020-08-05 14:52:57 +00:00
"epoch" : {
"type" : "integer"
} ,
2020-08-05 12:20:13 +00:00
"state_tree" : {
"title" : "state tree to seed" ,
"description" : "state tree to seed before applying this test vector; mapping of actor addresses => serialized state" ,
2020-08-05 14:52:57 +00:00
"$ref" : "#/definitions/state_tree"
2020-08-05 12:20:13 +00:00
}
}
} ,
"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" ,
2020-08-05 14:52:57 +00:00
"$ref" : "#/definitions/state_tree"
2020-08-06 16:20:17 +00:00
} ,
"receipts" : {
"title" : "receipts to match" ,
"description" : "receipts to match, required when using messages-class test vectors; length of this array MUST be equal to length of apply_messages" ,
"type" : "array" ,
"items" : {
"$ref" : "#/definitions/receipt"
}
2020-08-05 12:20:13 +00:00
}
}
} ,
2020-08-05 15:00:14 +00:00
"apply_messages" : {
2020-08-06 16:20:17 +00:00
"title" : "messages to apply, along with the receipt to expect for each" ,
2020-08-05 15:00:14 +00:00
"type" : "array" ,
2020-08-06 16:20:17 +00:00
"items" : {
"$ref" : "#/definitions/hex"
}
2020-08-05 12:20:13 +00:00
}
} ,
"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" : [
2020-08-06 16:20:17 +00:00
"messages" ,
2020-08-05 12:20:13 +00:00
"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"
} ,
2020-08-05 14:52:57 +00:00
"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"
} ,
2020-08-05 12:20:13 +00:00
"preconditions" : {
"$ref" : "#/definitions/preconditions"
} ,
"postconditions" : {
"$ref" : "#/definitions/postconditions"
}
} ,
"allOf" : [
{
"if" : {
"properties" : {
"class" : {
2020-08-06 16:20:17 +00:00
"const" : "messages"
2020-08-05 12:20:13 +00:00
}
}
} ,
"then" : {
2020-08-05 14:52:57 +00:00
"required" : [
2020-08-05 15:00:14 +00:00
"apply_messages"
2020-08-05 14:52:57 +00:00
] ,
2020-08-05 12:20:13 +00:00
"properties" : {
2020-08-05 15:00:14 +00:00
"apply_messages" : {
"$ref" : "#/definitions/apply_messages"
2020-08-05 12:20:13 +00:00
}
}
}
}
]
2020-08-05 15:00:14 +00:00
}