@@ -432,7 +432,7 @@ impl<let NumBytes: u16, let NumPackedFields: u16, let TranscriptEntries: u16> JS
432
432
let NumWholeLimbs = NumBytes / 31 ;
433
433
for i in 0 ..NumWholeLimbs {
434
434
let mut limb : Field = 0 ;
435
- for j in 0 ..NumBytes {
435
+ for j in 0 ..31 {
436
436
limb *= 0x100 ;
437
437
limb += self .json [i * 31 + j ] as Field ;
438
438
}
@@ -530,6 +530,9 @@ impl<let NumBytes: u16, let NumPackedFields: u16, let TranscriptEntries: u16> JS
530
530
531
531
// fn process_transcript_entry(entry: TranscriptEntry)
532
532
fn create_json_entries (&mut self ) {
533
+ // TODO put somewhere different?
534
+ self .compute_packed_json ();
535
+
533
536
let mut entry_ptr = 0 ;
534
537
let mut depth : Field = 1 ;
535
538
let mut num_entries_at_current_depth : Field = 0 ;
@@ -718,6 +721,15 @@ impl<let NumBytes: u16, let NumPackedFields: u16, let TranscriptEntries: u16> JS
718
721
}
719
722
}
720
723
724
+ fn extend_array <let InBytes : u32 , let OutBytes : u32 >(input : [u8 ; InBytes ]) -> [u8 ; OutBytes ] {
725
+ assert (InBytes <= OutBytes );
726
+ let mut result : [u8 ; OutBytes ] = [0 ; OutBytes ];
727
+ for i in 0 ..InBytes {
728
+ result [i ] = input [i ];
729
+ }
730
+ result
731
+ }
732
+
721
733
#[test]
722
734
fn test_redux () {
723
735
/*
@@ -793,7 +805,7 @@ fn test_redux() {
793
805
// TODO FIX PADDING ISSUE
794
806
let text = "{ \" foo\" : 1234, \" bar\" : { \" foo\" : 9876, \" bar\" : true }, \" baz\" : \" hello\" } " ;
795
807
796
- let mut json = JSON {
808
+ let mut json = JSON {
797
809
json : text .as_bytes (),
798
810
transcript : [0 ; 30 ],
799
811
transcript_length : 0 ,
@@ -1149,7 +1161,7 @@ struct JSONEntry {
1149
1161
#[test]
1150
1162
fn test_literal () {
1151
1163
let text = "{ \" name\" : \" Adeel Solangi\" , \" testA\" : false, \" testB\" : true, \" testC\" : null } " ;
1152
- let mut json = JSON {
1164
+ let mut json : JSON < 142 , 10 , 20 > = JSON {
1153
1165
json : text .as_bytes (),
1154
1166
transcript : [0 ; 20 ],
1155
1167
transcript_length : 0 ,
@@ -1159,7 +1171,7 @@ fn test_literal() {
1159
1171
layer_context : OBJECT_LAYER ,
1160
1172
layer_index_in_transcript : 0 ,
1161
1173
packed_json_entries : [0 ; 20 ],
1162
- packed_json : [0 , 10 ]
1174
+ packed_json : [0 ; 10 ]
1163
1175
};
1164
1176
1165
1177
json = json .build_transcript ();
@@ -1206,7 +1218,7 @@ fn test_arrays() {
1206
1218
layer_context : OBJECT_LAYER ,
1207
1219
layer_index_in_transcript : 0 ,
1208
1220
packed_json_entries : [0 ; 60 ],
1209
- packed_json : [0 , 10 ]
1221
+ packed_json : [0 ; 10 ]
1210
1222
};
1211
1223
1212
1224
json = json .build_transcript ();
0 commit comments