forked from filecoin-project/test-vectors
-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.json
367 lines (367 loc) · 9.71 KB
/
schema.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
{
"$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": {
"base64": {
"title": "base64 encoded value",
"description": "a standard base64 encoded value, as defined in RFC 4648",
"type": "string",
"pattern": "^[0-9a-zA-Z+/=]*$",
"examples": [
"igBCAGRCAGQAQgAKAUIAyEIACgBA",
""
]
},
"meta": {
"title": "metadata",
"description": "metadata about this test vector, such as its id, version, data about its generation, etc.; metadata is informational and does not affect driver execution",
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"title": "a unique identifier that identifies this test vector",
"type": "string"
},
"version": {
"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.",
"type": "string"
},
"gen": {
"title": "generation metadata",
"description": "metadata about how this test vector was generated",
"type": "array",
"items": {
"$ref": "#/definitions/gen_data"
}
},
"tags": {
"title": "an optional means of grouping test vectors together",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"cid": {
"type": "object",
"additionalProperties": false,
"required": [
"/"
],
"properties": {
"/": {
"type": "string"
}
}
},
"gen_data": {
"title": "generation metadata entry",
"description": "",
"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": {
"$ref": "#/definitions/cid"
}
}
},
"receipt": {
"type": "object",
"required": [
"exit_code",
"return",
"gas_used"
],
"additionalProperties": false,
"properties": {
"exit_code": {
"type": "number"
},
"return": {
"$ref": "#/definitions/base64"
},
"gas_used": {
"type": "number"
}
}
},
"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": {
"apply_message_failures": {
"title": "messages that failed to be applied",
"description": "indexes of messages in apply_messages that failed to be applied",
"type": "array",
"additionalItems": false,
"items": {
"type": "integer"
}
},
"state_tree": {
"title": "state tree postconditions",
"description": "state tree postconditions that must be true for this test vector to pass",
"$ref": "#/definitions/state_tree"
},
"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",
"additionalItems": false,
"items": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/definitions/receipt"
}
]
}
},
"receipts_roots": {
"title": "receipts roots for the applied tipsets",
"type": "array",
"additionalItems": false,
"items": {
"$ref": "#/definitions/cid"
}
}
}
},
"diagnostics": {
"title": "execution diagnostics",
"description": "diagnostics associated with the state change performed in the test",
"additionalProperties": false,
"properties": {
"format": {
"title": "diagnostics format",
"description": "version / opaque string indicating the format diagnostics have been serialized to",
"type": "string"
},
"data": {
"title": "diagnostics data",
"description": "serialization of diagnostic data internally represented per format",
"$ref": "#/definitions/base64"
}
}
},
"apply_messages": {
"title": "messages to apply",
"type": "array",
"items": {
"type": "object",
"required": [
"bytes",
"epoch"
],
"additionalProperties": false,
"properties": {
"bytes": {
"$ref": "#/definitions/base64"
},
"epoch": {
"type": "integer"
}
}
}
},
"apply_tipsets": {
"title": "tipsets to apply",
"type": "object",
"required": ["epoch", "basefee", "blocks"],
"additionalProperties": false,
"properties": {
"epoch": {
"type": "number"
},
"basefee": {
"description": "this is a big.Int",
"type": "number"
},
"blocks": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["miner_addr", "win_count", "messages"],
"properties": {
"miner_addr": {
"type": "string"
},
"win_count": {
"type": "number"
},
"messages": {
"$ref": "#/definitions/base64"
}
}
}
}
},
"items": {
"type": "object",
"required": [
"bytes",
"epoch"
],
"additionalProperties": false,
"properties": {
"bytes": {
"$ref": "#/definitions/base64"
},
"epoch": {
"type": "integer"
}
}
}
}
},
"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",
"tipset",
"blockseq"
]
},
"selector": {
"title": "predicates the driver can use to determine if this test vector is relevant given the capabilities/features of the underlying implementation and/or test environment",
"type": "object",
"additionalProperties": {
"type": "string"
},
"examples": [
{
"chaos_actor": "true"
},
{
"chaos_actor": "true",
"feature": "value"
}
]
},
"hints": {
"type": "array",
"title": "hints are flags that convey information to the driver",
"description": "use hints to express facts like this vector is knowingly incorrect (e.g. when the reference implementation is broken), that drivers should negate the postconditions (i.e. test that they are NOT the ones expressed in the vector), etc.",
"items": {
"type": "string"
},
"examples": [
[
"incorrect",
"negate"
]
]
},
"_meta": {
"$ref": "#/definitions/meta"
},
"car": {
"title": "car containing state trees",
"description": "the gzipped, base64 CAR containing the pre- and post-condition state trees for this test vector",
"$ref": "#/definitions/base64"
},
"preconditions": {
"$ref": "#/definitions/preconditions"
},
"postconditions": {
"$ref": "#/definitions/postconditions"
}
},
"allOf": [
{
"if": {
"properties": {
"class": {
"const": "messages"
}
}
},
"then": {
"required": [
"apply_messages"
],
"properties": {
"apply_messages": {
"$ref": "#/definitions/apply_messages"
}
}
}
},
{
"if": {
"properties": {
"class": {
"const": "tipset"
}
}
},
"then": {
"required": [
"apply_tipsets"
],
"properties": {
"apply_messages": {
"$ref": "#/definitions/apply_tipsets"
}
}
}
}
]
}