@@ -9,24 +9,12 @@ use crate::prelude::*;
9
9
10
10
impl < const N : usize , T > TasmObject for [ T ; N ]
11
11
where
12
- T : BFieldCodec + TasmObject ,
12
+ T : TasmObject ,
13
13
{
14
14
fn label_friendly_name ( ) -> String {
15
15
format ! ( "array{}___{}" , N , T :: label_friendly_name( ) )
16
16
}
17
17
18
- fn get_field ( _field_name : & str ) -> Vec < LabelledInstruction > {
19
- todo ! ( )
20
- }
21
-
22
- fn get_field_with_size ( _field_name : & str ) -> Vec < LabelledInstruction > {
23
- todo ! ( )
24
- }
25
-
26
- fn get_field_start_with_jump_distance ( _field_name : & str ) -> Vec < LabelledInstruction > {
27
- todo ! ( )
28
- }
29
-
30
18
fn compute_size_and_assert_valid_size_indicator ( _: & mut Library ) -> Vec < LabelledInstruction > {
31
19
if let Some ( static_size) = T :: static_length ( ) {
32
20
let own_size = static_size * N ;
@@ -49,24 +37,12 @@ where
49
37
50
38
impl < T > TasmObject for Vec < T >
51
39
where
52
- T : BFieldCodec + TasmObject ,
40
+ T : TasmObject ,
53
41
{
54
42
fn label_friendly_name ( ) -> String {
55
43
format ! ( "vec___{}" , T :: label_friendly_name( ) )
56
44
}
57
45
58
- fn get_field ( _field_name : & str ) -> Vec < LabelledInstruction > {
59
- panic ! ( "`Vec` does not have fields; cannot access them" )
60
- }
61
-
62
- fn get_field_with_size ( _field_name : & str ) -> Vec < LabelledInstruction > {
63
- panic ! ( "`Vec` does not have fields; cannot access them" )
64
- }
65
-
66
- fn get_field_start_with_jump_distance ( _field_name : & str ) -> Vec < LabelledInstruction > {
67
- panic ! ( "`Vec` does not have fields; cannot access them" )
68
- }
69
-
70
46
fn compute_size_and_assert_valid_size_indicator (
71
47
library : & mut Library ,
72
48
) -> Vec < LabelledInstruction > {
@@ -209,18 +185,6 @@ impl TasmObject for BFieldElement {
209
185
DataType :: Bfe . label_friendly_name ( )
210
186
}
211
187
212
- fn get_field ( _field_name : & str ) -> Vec < LabelledInstruction > {
213
- panic ! ( )
214
- }
215
-
216
- fn get_field_with_size ( _field_name : & str ) -> Vec < LabelledInstruction > {
217
- panic ! ( )
218
- }
219
-
220
- fn get_field_start_with_jump_distance ( _field_name : & str ) -> Vec < LabelledInstruction > {
221
- panic ! ( )
222
- }
223
-
224
188
fn compute_size_and_assert_valid_size_indicator ( _: & mut Library ) -> Vec < LabelledInstruction > {
225
189
panic ! ( "Size is known statically for BFieldElement encoding" )
226
190
}
@@ -236,18 +200,6 @@ impl TasmObject for XFieldElement {
236
200
DataType :: Xfe . label_friendly_name ( )
237
201
}
238
202
239
- fn get_field ( _field_name : & str ) -> Vec < LabelledInstruction > {
240
- panic ! ( )
241
- }
242
-
243
- fn get_field_with_size ( _field_name : & str ) -> Vec < LabelledInstruction > {
244
- panic ! ( )
245
- }
246
-
247
- fn get_field_start_with_jump_distance ( _field_name : & str ) -> Vec < LabelledInstruction > {
248
- panic ! ( )
249
- }
250
-
251
203
fn compute_size_and_assert_valid_size_indicator ( _: & mut Library ) -> Vec < LabelledInstruction > {
252
204
panic ! ( "Size is known statically for XFieldElement encoding" )
253
205
}
@@ -266,18 +218,6 @@ impl TasmObject for Digest {
266
218
DataType :: Digest . label_friendly_name ( )
267
219
}
268
220
269
- fn get_field ( _field_name : & str ) -> Vec < LabelledInstruction > {
270
- panic ! ( )
271
- }
272
-
273
- fn get_field_with_size ( _field_name : & str ) -> Vec < LabelledInstruction > {
274
- panic ! ( )
275
- }
276
-
277
- fn get_field_start_with_jump_distance ( _field_name : & str ) -> Vec < LabelledInstruction > {
278
- panic ! ( )
279
- }
280
-
281
221
fn compute_size_and_assert_valid_size_indicator ( _: & mut Library ) -> Vec < LabelledInstruction > {
282
222
panic ! ( "Size is known statically for Digest encoding" )
283
223
}
@@ -296,18 +236,6 @@ impl TasmObject for bool {
296
236
DataType :: Bool . label_friendly_name ( )
297
237
}
298
238
299
- fn get_field ( _field_name : & str ) -> Vec < LabelledInstruction > {
300
- panic ! ( )
301
- }
302
-
303
- fn get_field_with_size ( _field_name : & str ) -> Vec < LabelledInstruction > {
304
- panic ! ( )
305
- }
306
-
307
- fn get_field_start_with_jump_distance ( _field_name : & str ) -> Vec < LabelledInstruction > {
308
- panic ! ( )
309
- }
310
-
311
239
fn compute_size_and_assert_valid_size_indicator ( _: & mut Library ) -> Vec < LabelledInstruction > {
312
240
panic ! ( "Size is known statically for bool encoding" )
313
241
}
@@ -327,18 +255,6 @@ impl TasmObject for u32 {
327
255
DataType :: U32 . label_friendly_name ( )
328
256
}
329
257
330
- fn get_field ( _field_name : & str ) -> Vec < LabelledInstruction > {
331
- panic ! ( )
332
- }
333
-
334
- fn get_field_with_size ( _field_name : & str ) -> Vec < LabelledInstruction > {
335
- panic ! ( )
336
- }
337
-
338
- fn get_field_start_with_jump_distance ( _field_name : & str ) -> Vec < LabelledInstruction > {
339
- panic ! ( )
340
- }
341
-
342
258
fn compute_size_and_assert_valid_size_indicator ( _: & mut Library ) -> Vec < LabelledInstruction > {
343
259
panic ! ( "Size is known statically for u32 encoding" )
344
260
}
@@ -359,18 +275,6 @@ impl TasmObject for u64 {
359
275
DataType :: U64 . label_friendly_name ( )
360
276
}
361
277
362
- fn get_field ( _field_name : & str ) -> Vec < LabelledInstruction > {
363
- panic ! ( )
364
- }
365
-
366
- fn get_field_with_size ( _field_name : & str ) -> Vec < LabelledInstruction > {
367
- panic ! ( )
368
- }
369
-
370
- fn get_field_start_with_jump_distance ( _field_name : & str ) -> Vec < LabelledInstruction > {
371
- panic ! ( )
372
- }
373
-
374
278
fn compute_size_and_assert_valid_size_indicator ( _: & mut Library ) -> Vec < LabelledInstruction > {
375
279
panic ! ( "Size is known statically for u64 encoding" )
376
280
}
@@ -393,18 +297,6 @@ impl TasmObject for u128 {
393
297
DataType :: U128 . label_friendly_name ( )
394
298
}
395
299
396
- fn get_field ( _field_name : & str ) -> Vec < LabelledInstruction > {
397
- panic ! ( )
398
- }
399
-
400
- fn get_field_with_size ( _field_name : & str ) -> Vec < LabelledInstruction > {
401
- panic ! ( )
402
- }
403
-
404
- fn get_field_start_with_jump_distance ( _field_name : & str ) -> Vec < LabelledInstruction > {
405
- panic ! ( )
406
- }
407
-
408
300
fn compute_size_and_assert_valid_size_indicator ( _: & mut Library ) -> Vec < LabelledInstruction > {
409
301
panic ! ( "Size is known statically for u128 encoding" )
410
302
}
@@ -426,8 +318,8 @@ impl TasmObject for u128 {
426
318
427
319
impl < T , S > TasmObject for ( T , S )
428
320
where
429
- T : TasmObject + BFieldCodec ,
430
- S : TasmObject + BFieldCodec ,
321
+ T : TasmObject ,
322
+ S : TasmObject ,
431
323
{
432
324
fn label_friendly_name ( ) -> String {
433
325
format ! (
@@ -437,18 +329,6 @@ where
437
329
)
438
330
}
439
331
440
- fn get_field ( _field_name : & str ) -> Vec < LabelledInstruction > {
441
- panic ! ( )
442
- }
443
-
444
- fn get_field_with_size ( _field_name : & str ) -> Vec < LabelledInstruction > {
445
- panic ! ( )
446
- }
447
-
448
- fn get_field_start_with_jump_distance ( _field_name : & str ) -> Vec < LabelledInstruction > {
449
- panic ! ( )
450
- }
451
-
452
332
fn compute_size_and_assert_valid_size_indicator (
453
333
library : & mut Library ,
454
334
) -> Vec < LabelledInstruction > {
@@ -558,18 +438,6 @@ impl TasmObject for Polynomial<'_, XFieldElement> {
558
438
"polynomial_xfe" . to_owned ( )
559
439
}
560
440
561
- fn get_field ( _field_name : & str ) -> Vec < LabelledInstruction > {
562
- todo ! ( )
563
- }
564
-
565
- fn get_field_with_size ( _field_name : & str ) -> Vec < LabelledInstruction > {
566
- todo ! ( )
567
- }
568
-
569
- fn get_field_start_with_jump_distance ( _field_name : & str ) -> Vec < LabelledInstruction > {
570
- todo ! ( )
571
- }
572
-
573
441
fn compute_size_and_assert_valid_size_indicator ( _: & mut Library ) -> Vec < LabelledInstruction > {
574
442
triton_asm ! (
575
443
// _ *field_size
@@ -613,18 +481,6 @@ impl TasmObject for Proof {
613
481
"tvm_proof" . to_owned ( )
614
482
}
615
483
616
- fn get_field ( _field_name : & str ) -> Vec < LabelledInstruction > {
617
- panic ! ( )
618
- }
619
-
620
- fn get_field_with_size ( _field_name : & str ) -> Vec < LabelledInstruction > {
621
- panic ! ( )
622
- }
623
-
624
- fn get_field_start_with_jump_distance ( _field_name : & str ) -> Vec < LabelledInstruction > {
625
- panic ! ( )
626
- }
627
-
628
484
fn compute_size_and_assert_valid_size_indicator ( _: & mut Library ) -> Vec < LabelledInstruction > {
629
485
// Proofs are special, as the fields of a proof is only accessed through
630
486
// the [`DequeueNextAs`](crate::verifier::vm_proof_iter::dequeue_next_as)
@@ -653,24 +509,12 @@ impl TasmObject for Proof {
653
509
654
510
impl < T > TasmObject for Option < T >
655
511
where
656
- T : TasmObject + BFieldCodec ,
512
+ T : TasmObject ,
657
513
{
658
514
fn label_friendly_name ( ) -> String {
659
515
format ! ( "option_L_{}_R" , T :: label_friendly_name( ) )
660
516
}
661
517
662
- fn get_field ( _field_name : & str ) -> Vec < LabelledInstruction > {
663
- panic ! ( "cannot get field of an option type" ) ;
664
- }
665
-
666
- fn get_field_with_size ( _field_name : & str ) -> Vec < LabelledInstruction > {
667
- panic ! ( "cannot get field with size of an option type" ) ;
668
- }
669
-
670
- fn get_field_start_with_jump_distance ( _field_name : & str ) -> Vec < LabelledInstruction > {
671
- panic ! ( "cannot get field start with jump distance of an option type" ) ;
672
- }
673
-
674
518
fn compute_size_and_assert_valid_size_indicator (
675
519
library : & mut Library ,
676
520
) -> Vec < LabelledInstruction > {
@@ -777,7 +621,7 @@ mod tests {
777
621
use super :: * ;
778
622
use crate :: memory:: encode_to_memory;
779
623
780
- fn decode_iter_prop < T : TasmObject + BFieldCodec + Eq + Debug > ( obj_written : T ) {
624
+ fn decode_iter_prop < T : TasmObject + Eq + Debug > ( obj_written : T ) {
781
625
let mut memory = HashMap :: default ( ) ;
782
626
let address = random ( ) ;
783
627
encode_to_memory ( & mut memory, address, & obj_written) ;
0 commit comments