@@ -307,13 +307,7 @@ fn sanity_check_cells_and_cell_ids(
307
307
#[ cfg( test) ]
308
308
mod tests {
309
309
310
- use std:: ops:: Range ;
311
-
312
- use crate :: {
313
- consensus_specs_fixed_test_vector:: { CELLS_STR , COMMITMENT_STR , PROOFS_STR } ,
314
- constants:: CELLS_PER_EXT_BLOB ,
315
- verifier:: { is_cell_ids_unique, VerifierContext } ,
316
- } ;
310
+ use crate :: verifier:: is_cell_ids_unique;
317
311
318
312
#[ test]
319
313
fn test_cell_ids_unique ( ) {
@@ -326,95 +320,4 @@ mod tests {
326
320
let cell_ids = vec ! [ 0 , 0 , 0 ] ;
327
321
assert ! ( !is_cell_ids_unique( & cell_ids) ) ;
328
322
}
329
-
330
- #[ test]
331
- fn test_proofs_verify ( ) {
332
- // Setup
333
- let ctx = VerifierContext :: new ( ) ;
334
-
335
- let commitment_str = COMMITMENT_STR ;
336
- let commitment_bytes: [ u8 ; 48 ] = hex:: decode ( commitment_str) . unwrap ( ) . try_into ( ) . unwrap ( ) ;
337
-
338
- let proofs_str = PROOFS_STR ;
339
- let proofs_bytes: Vec < [ u8 ; 48 ] > = proofs_str
340
- . iter ( )
341
- . map ( |proof_str| hex:: decode ( proof_str) . unwrap ( ) . try_into ( ) . unwrap ( ) )
342
- . collect ( ) ;
343
-
344
- let cells_str = CELLS_STR ;
345
- let cells_bytes: Vec < Vec < u8 > > = cells_str
346
- . into_iter ( )
347
- . map ( |cell_str| hex:: decode ( cell_str) . unwrap ( ) )
348
- . collect ( ) ;
349
-
350
- for k in 0 ..proofs_bytes. len ( ) {
351
- let proof_bytes = proofs_bytes[ k] ;
352
- let cell_bytes = cells_bytes[ k] . clone ( ) . try_into ( ) . unwrap ( ) ;
353
- let cell_id = k as u64 ;
354
-
355
- assert ! ( ctx
356
- . verify_cell_kzg_proof( & commitment_bytes, cell_id, & cell_bytes, & proof_bytes)
357
- . is_ok( ) ) ;
358
- }
359
-
360
- assert ! ( ctx
361
- . verify_cell_kzg_proof_batch(
362
- vec![ & commitment_bytes; proofs_bytes. len( ) ] ,
363
- vec![ 0 ; proofs_bytes. len( ) ] ,
364
- ( 0 ..proofs_bytes. len( ) ) . map( |x| x as u64 ) . collect( ) ,
365
- cells_bytes
366
- . iter( )
367
- . map( Vec :: as_slice)
368
- . map( |cell| cell. try_into( ) . unwrap( ) )
369
- . collect( ) ,
370
- proofs_bytes
371
- . iter( )
372
- . map( |proof| proof. try_into( ) . unwrap( ) )
373
- . collect( ) ,
374
- )
375
- . is_ok( ) ) ;
376
- }
377
-
378
- #[ test]
379
- fn test_recover_all_cells ( ) {
380
- let ctx = VerifierContext :: new ( ) ;
381
- let num_cells_to_keep = CELLS_PER_EXT_BLOB / 2 ;
382
-
383
- fn generate_unique_random_numbers ( range : Range < u64 > , n : usize ) -> Vec < u64 > {
384
- use rand:: prelude:: SliceRandom ;
385
- let mut numbers: Vec < _ > = range. into_iter ( ) . collect ( ) ;
386
- numbers. shuffle ( & mut rand:: thread_rng ( ) ) ;
387
- numbers. into_iter ( ) . take ( n) . collect ( )
388
- }
389
-
390
- let cell_ids_to_keep = generate_unique_random_numbers ( 0 ..128 , num_cells_to_keep) ;
391
- let cells_as_hex_strings: Vec < _ > = cell_ids_to_keep
392
- . iter ( )
393
- . map ( |cell_id| CELLS_STR [ * cell_id as usize ] )
394
- . collect ( ) ;
395
- let cells_to_keep: Vec < _ > = cells_as_hex_strings
396
- . into_iter ( )
397
- . map ( |cell_str| hex:: decode ( cell_str) . unwrap ( ) )
398
- . collect ( ) ;
399
-
400
- let all_cells: Vec < _ > = CELLS_STR
401
- . into_iter ( )
402
- . map ( |cell_str| hex:: decode ( cell_str) . unwrap ( ) )
403
- . collect ( ) ;
404
-
405
- let recovered_cells = ctx
406
- . recover_all_cells (
407
- cell_ids_to_keep,
408
- cells_to_keep
409
- . iter ( )
410
- . map ( Vec :: as_slice)
411
- . map ( |v| v. try_into ( ) . unwrap ( ) )
412
- . collect ( ) ,
413
- )
414
- . unwrap ( ) ;
415
-
416
- for ( recovered_cell, expected_cell) in recovered_cells. into_iter ( ) . zip ( all_cells) {
417
- assert_eq ! ( & recovered_cell[ ..] , & expected_cell[ ..] )
418
- }
419
- }
420
323
}
0 commit comments