@@ -4041,7 +4041,7 @@ mod tests_with_wasm {
4041
4041
4042
4042
#[ cfg( test) ]
4043
4043
mod tests {
4044
- use std:: { collections:: HashMap , path:: Path , str :: FromStr } ;
4044
+ use std:: { collections:: HashMap , path:: Path } ;
4045
4045
4046
4046
use kimchi:: circuits:: gate:: CircuitGate ;
4047
4047
use mina_hasher:: Fp ;
@@ -4098,21 +4098,17 @@ mod tests {
4098
4098
T :: binprot_read ( & mut read) . unwrap ( )
4099
4099
}
4100
4100
4101
- fn read_witnesses ( ) -> std :: io :: Result < Vec < Fp > > {
4101
+ fn read_witnesses < F : FieldWitness > ( filename : & str ) -> Result < Vec < F > , ( ) > {
4102
4102
let f = std:: fs:: read_to_string (
4103
- Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) ) . join ( "/tmp/fps_rampup4.txt" ) ,
4104
- ) ? ;
4105
- // let f = std::fs::read_to_string(Path::new(env!("CARGO_MANIFEST_DIR")) .join("fps.txt"))?;
4106
-
4107
- let fps = f
4108
- . lines ( )
4103
+ std :: path :: Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) )
4104
+ . join ( "rampup4" )
4105
+ . join ( filename ) ,
4106
+ )
4107
+ . unwrap ( ) ;
4108
+ f . lines ( )
4109
4109
. filter ( |s| !s. is_empty ( ) )
4110
- . map ( |s| Fp :: from_str ( s) . unwrap ( ) )
4111
- . collect :: < Vec < _ > > ( ) ;
4112
-
4113
- // TODO: Implement [0..652]
4114
- // Ok(fps.split_off(652))
4115
- Ok ( fps)
4110
+ . map ( |s| F :: from_str ( s) . map_err ( |_| ( ) ) )
4111
+ . collect ( )
4116
4112
}
4117
4113
4118
4114
fn read_constraints_data < F : FieldWitness > (
@@ -4566,22 +4562,7 @@ mod tests {
4566
4562
4567
4563
let mut witnesses: Witness < Fp > = Witness :: new :: < StepTransactionProof > ( ) ;
4568
4564
4569
- fn read_witnesses ( filename : & str ) -> Vec < Fp > {
4570
- let f = std:: fs:: read_to_string (
4571
- std:: path:: Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) )
4572
- . join ( "rampup4" )
4573
- . join ( filename) ,
4574
- )
4575
- . unwrap ( ) ;
4576
- let fqs = f
4577
- . lines ( )
4578
- . filter ( |s| !s. is_empty ( ) )
4579
- . map ( |s| Fp :: from_str ( s) . unwrap ( ) )
4580
- . collect :: < Vec < _ > > ( ) ;
4581
- fqs
4582
- }
4583
-
4584
- witnesses. ocaml_aux = read_witnesses ( "fps_rampup4.txt" ) ;
4565
+ witnesses. ocaml_aux = read_witnesses ( "fps_rampup4.txt" ) . unwrap ( ) ;
4585
4566
4586
4567
let WrapProof { proof, .. } = generate_tx_proof (
4587
4568
TransactionParams {
@@ -4639,7 +4620,8 @@ mod tests {
4639
4620
expected_step_proof : Some (
4640
4621
"fb89b6d51ce5ed6fe7815b86ca37a7dcdc34d9891b4967692d3751dad32842f8" ,
4641
4622
) ,
4642
- ocaml_wrap_witness : Some ( read_witnesses_fq ( "fqs_merge.txt" ) ) ,
4623
+
4624
+ ocaml_wrap_witness : Some ( read_witnesses ( "fqs_merge.txt" ) . unwrap ( ) ) ,
4643
4625
} ,
4644
4626
& mut witnesses,
4645
4627
) ;
@@ -4744,21 +4726,6 @@ mod tests {
4744
4726
) ;
4745
4727
}
4746
4728
4747
- fn read_witnesses_fq ( filename : & str ) -> Vec < Fq > {
4748
- let f = std:: fs:: read_to_string (
4749
- std:: path:: Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) )
4750
- . join ( "rampup4" )
4751
- . join ( filename) ,
4752
- )
4753
- . unwrap ( ) ;
4754
- let fqs = f
4755
- . lines ( )
4756
- . filter ( |s| !s. is_empty ( ) )
4757
- . map ( |s| Fq :: from_str ( s) . unwrap ( ) )
4758
- . collect :: < Vec < _ > > ( ) ;
4759
- fqs
4760
- }
4761
-
4762
4729
#[ test]
4763
4730
fn test_block_proof ( ) {
4764
4731
let Ok ( data) = std:: fs:: read (
@@ -4794,7 +4761,7 @@ mod tests {
4794
4761
expected_step_proof : Some (
4795
4762
"a82a10e5c276dd6dc251241dcbad005201034ffff5752516a179f317dfe385f5" ,
4796
4763
) ,
4797
- ocaml_wrap_witness : Some ( read_witnesses_fq ( "block_fqs.txt" ) ) ,
4764
+ ocaml_wrap_witness : Some ( read_witnesses ( "block_fqs.txt" ) . unwrap ( ) ) ,
4798
4765
} ,
4799
4766
& mut witnesses,
4800
4767
) ;
@@ -4879,7 +4846,7 @@ mod tests {
4879
4846
expected_step_proof : Some (
4880
4847
"a82a10e5c276dd6dc251241dcbad005201034ffff5752516a179f317dfe385f5" ,
4881
4848
) ,
4882
- ocaml_wrap_witness : Some ( read_witnesses_fq ( "block_fqs.txt" ) ) ,
4849
+ ocaml_wrap_witness : Some ( read_witnesses ( "block_fqs.txt" ) . unwrap ( ) ) ,
4883
4850
} ,
4884
4851
& mut witnesses,
4885
4852
) ;
@@ -4911,7 +4878,7 @@ mod tests {
4911
4878
expected_step_proof : Some (
4912
4879
"fb89b6d51ce5ed6fe7815b86ca37a7dcdc34d9891b4967692d3751dad32842f8" ,
4913
4880
) ,
4914
- ocaml_wrap_witness : Some ( read_witnesses_fq ( "fqs_merge.txt" ) ) ,
4881
+ ocaml_wrap_witness : Some ( read_witnesses ( "fqs_merge.txt" ) . unwrap ( ) ) ,
4915
4882
} ,
4916
4883
& mut witnesses,
4917
4884
) ;
@@ -4952,25 +4919,14 @@ mod tests {
4952
4919
// ("fee_transfer_9_rampup4.bin", "087a07eddedf5de18b2f2bd7ded3cd474d00a0030e9c13d7a5fd2433c72fc7d5"),
4953
4920
] ;
4954
4921
4955
- fn read_witnesses ( filename : & str ) -> Vec < Fp > {
4956
- let f = std:: fs:: read_to_string (
4957
- std:: path:: Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) ) . join ( filename) ,
4958
- )
4959
- . unwrap ( ) ;
4960
- f. lines ( )
4961
- . filter ( |s| !s. is_empty ( ) )
4962
- . map ( |s| Fp :: from_str ( s) . unwrap ( ) )
4963
- . collect :: < Vec < _ > > ( )
4964
- }
4965
-
4966
4922
for ( file, expected_sum) in requests {
4967
4923
let data = std:: fs:: read ( base_dir. join ( file) ) . unwrap ( ) ;
4968
4924
let ( statement, tx_witness, message) = extract_request ( & data) ;
4969
4925
4970
4926
let mut witnesses: Witness < Fp > = Witness :: new :: < StepTransactionProof > ( ) ;
4971
4927
4972
4928
if file == "request_payment_0_rampup4.bin" {
4973
- witnesses. ocaml_aux = read_witnesses ( "fps_rampup4.txt" ) ;
4929
+ witnesses. ocaml_aux = read_witnesses ( "fps_rampup4.txt" ) . unwrap ( ) ;
4974
4930
}
4975
4931
4976
4932
let WrapProof { proof, .. } = generate_tx_proof (
0 commit comments