@@ -170,6 +170,8 @@ def asn_sequence_of(t):
170
170
def asn_member (t ):
171
171
if t ["type" ] == "OCTET STRING" :
172
172
t = dict (type = "SEQUENCE OF" , element = dict (type = "U8" ), size = t ["size" ])
173
+ if t ["type" ] == "BOOLEAN" :
174
+ return "bool"
173
175
if t ["type" ] == "SEQUENCE OF" :
174
176
r = asn_sequence_of (t )
175
177
elif t ["type" ] in asn_types :
@@ -190,16 +192,22 @@ def asn_member(t):
190
192
enum_trait = []
191
193
for tname , t in asn_types .items ():
192
194
ty = types [tname ]
195
+ if tname == "BOOLEAN" :
196
+ ty .decl = c_using (tname , "bool" )
197
+ continue
193
198
if tname == "U8" :
194
199
ty .decl = c_using (tname , "uint8_t" )
195
200
continue
201
+ if tname == "U16" :
202
+ ty .decl = c_using (tname , "uint16_t" )
203
+ continue
196
204
if tname == "U32" :
197
205
ty .decl = c_using (tname , "uint32_t" )
198
206
continue
199
207
if t ["type" ] == "NULL" :
200
208
t = dict (type = "SEQUENCE" , members = [])
201
209
if t ["type" ] == "CHOICE" :
202
- if tname == "MmrPeak" :
210
+ if tname == "MmrPeak" or tname == "AvailabilityAssignmentItem" : # TODO(#14): Need to make in universal
203
211
assert [x ["name" ] for x in t ["members" ]] == ["none" , "some" ]
204
212
ty .decl = c_using (
205
213
tname , "std::optional<%s>" % asn_member (t ["members" ][1 ])
@@ -348,6 +356,19 @@ def safrole():
348
356
)
349
357
g .write ("safrole" )
350
358
359
+ def disputes ():
360
+ g = Gen (
361
+ "jam::test_vectors_disputes" ,
362
+ ["validators-count" , "core-count" , "epoch-length" , "validators-super-majority" ],
363
+ asn_file ("disputes/disputes" ),
364
+ "DisputesModule" ,
365
+ [
366
+ (name , parse_const (asn_file ("disputes/%s" % name ), "Constants" ))
367
+ for name in ["tiny" , "full" ]
368
+ ],
369
+ )
370
+ g .write ("disputes" )
371
+
351
372
352
373
def history ():
353
374
g = Gen (
@@ -362,4 +383,4 @@ def history():
362
383
363
384
if __name__ == "__main__" :
364
385
for arg in sys .argv [1 :]:
365
- dict (safrole = safrole , history = history )[arg ]()
386
+ dict (safrole = safrole , history = history , disputes = disputes )[arg ]()
0 commit comments