@@ -46,10 +46,13 @@ pub fn caml_pasta_fp_plonk_proof_create(
46
46
prev_sgs : Vec < CamlGVesta > ,
47
47
) -> Result < CamlProofWithPublic < CamlGVesta , CamlFp > , ocaml:: Error > {
48
48
{
49
- let ptr: & mut poly_commitment:: srs:: SRS < Vesta > =
50
- unsafe { & mut * ( std:: sync:: Arc :: as_ptr ( & index. as_ref ( ) . 0 . srs ) as * mut _ ) } ;
51
- ptr. with_lagrange_basis ( index. as_ref ( ) . 0 . cs . domain . d1 ) ;
49
+ index
50
+ . as_ref ( )
51
+ . 0
52
+ . srs
53
+ . with_lagrange_basis ( index. as_ref ( ) . 0 . cs . domain . d1 ) ;
52
54
}
55
+
53
56
let prev = if prev_challenges. is_empty ( ) {
54
57
Vec :: new ( )
55
58
} else {
@@ -112,9 +115,11 @@ pub fn caml_pasta_fp_plonk_proof_create_and_verify(
112
115
prev_sgs : Vec < CamlGVesta > ,
113
116
) -> Result < CamlProofWithPublic < CamlGVesta , CamlFp > , ocaml:: Error > {
114
117
{
115
- let ptr: & mut poly_commitment:: srs:: SRS < Vesta > =
116
- unsafe { & mut * ( std:: sync:: Arc :: as_ptr ( & index. as_ref ( ) . 0 . srs ) as * mut _ ) } ;
117
- ptr. with_lagrange_basis ( index. as_ref ( ) . 0 . cs . domain . d1 ) ;
118
+ index
119
+ . as_ref ( )
120
+ . 0
121
+ . srs
122
+ . with_lagrange_basis ( index. as_ref ( ) . 0 . cs . domain . d1 ) ;
118
123
}
119
124
let prev = if prev_challenges. is_empty ( ) {
120
125
Vec :: new ( )
@@ -199,7 +204,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_lookup(
199
204
polynomial:: COLUMNS ,
200
205
wires:: Wire ,
201
206
} ;
202
- use poly_commitment:: srs:: { endos, SRS } ;
207
+ use poly_commitment:: srs:: endos;
203
208
204
209
let num_gates = 1000 ;
205
210
let num_tables: usize = 5 ;
@@ -276,8 +281,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_lookup(
276
281
. build ( )
277
282
. unwrap ( ) ;
278
283
279
- let ptr: & mut SRS < Vesta > = unsafe { & mut * ( std:: sync:: Arc :: as_ptr ( & srs. 0 ) as * mut _ ) } ;
280
- ptr. with_lagrange_basis ( cs. domain . d1 ) ;
284
+ srs. 0 . with_lagrange_basis ( cs. domain . d1 ) ;
281
285
282
286
let ( endo_q, _endo_r) = endos :: < Pallas > ( ) ;
283
287
let index = ProverIndex :: < Vesta , OpeningProof < Vesta > > :: create ( cs, endo_q, srs. 0 ) ;
@@ -321,7 +325,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_foreign_field_mul(
321
325
use num_bigint:: BigUint ;
322
326
use num_bigint:: RandBigInt ;
323
327
use o1_utils:: { foreign_field:: BigUintForeignFieldHelpers , FieldHelpers } ;
324
- use poly_commitment:: srs:: { endos, SRS } ;
328
+ use poly_commitment:: srs:: endos;
325
329
use rand:: { rngs:: StdRng , SeedableRng } ;
326
330
327
331
let foreign_field_modulus = Fq :: modulus_biguint ( ) ;
@@ -441,8 +445,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_foreign_field_mul(
441
445
// Create constraint system
442
446
let cs = ConstraintSystem :: < Fp > :: create ( gates) . build ( ) . unwrap ( ) ;
443
447
444
- let ptr: & mut SRS < Vesta > = unsafe { & mut * ( std:: sync:: Arc :: as_ptr ( & srs. 0 ) as * mut _ ) } ;
445
- ptr. with_lagrange_basis ( cs. domain . d1 ) ;
448
+ srs. 0 . with_lagrange_basis ( cs. domain . d1 ) ;
446
449
447
450
let ( endo_q, _endo_r) = endos :: < Pallas > ( ) ;
448
451
let index = ProverIndex :: < Vesta , OpeningProof < Vesta > > :: create ( cs, endo_q, srs. 0 ) ;
@@ -478,7 +481,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_range_check(
478
481
use num_bigint:: BigUint ;
479
482
use num_bigint:: RandBigInt ;
480
483
use o1_utils:: { foreign_field:: BigUintForeignFieldHelpers , BigUintFieldHelpers } ;
481
- use poly_commitment:: srs:: { endos, SRS } ;
484
+ use poly_commitment:: srs:: endos;
482
485
use rand:: { rngs:: StdRng , SeedableRng } ;
483
486
484
487
let rng = & mut StdRng :: from_seed ( [ 255u8 ; 32 ] ) ;
@@ -508,8 +511,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_range_check(
508
511
// Create constraint system
509
512
let cs = ConstraintSystem :: < Fp > :: create ( gates) . build ( ) . unwrap ( ) ;
510
513
511
- let ptr: & mut SRS < Vesta > = unsafe { & mut * ( std:: sync:: Arc :: as_ptr ( & srs. 0 ) as * mut _ ) } ;
512
- ptr. with_lagrange_basis ( cs. domain . d1 ) ;
514
+ srs. 0 . with_lagrange_basis ( cs. domain . d1 ) ;
513
515
514
516
let ( endo_q, _endo_r) = endos :: < Pallas > ( ) ;
515
517
let index = ProverIndex :: < Vesta , OpeningProof < Vesta > > :: create ( cs, endo_q, srs. 0 ) ;
@@ -546,7 +548,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_range_check0(
546
548
polynomials:: { generic:: GenericGateSpec , range_check} ,
547
549
wires:: Wire ,
548
550
} ;
549
- use poly_commitment:: srs:: { endos, SRS } ;
551
+ use poly_commitment:: srs:: endos;
550
552
551
553
let gates = {
552
554
// Public input row with value 0
@@ -581,8 +583,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_range_check0(
581
583
// not sure if theres a smarter way instead of the double unwrap, but should be fine in the test
582
584
let cs = ConstraintSystem :: < Fp > :: create ( gates) . build ( ) . unwrap ( ) ;
583
585
584
- let ptr: & mut SRS < Vesta > = unsafe { & mut * ( std:: sync:: Arc :: as_ptr ( & srs. 0 ) as * mut _ ) } ;
585
- ptr. with_lagrange_basis ( cs. domain . d1 ) ;
586
+ srs. 0 . with_lagrange_basis ( cs. domain . d1 ) ;
586
587
587
588
let ( endo_q, _endo_r) = endos :: < Pallas > ( ) ;
588
589
let index = ProverIndex :: < Vesta , OpeningProof < Vesta > > :: create ( cs, endo_q, srs. 0 ) ;
@@ -625,7 +626,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_ffadd(
625
626
wires:: Wire ,
626
627
} ;
627
628
use num_bigint:: BigUint ;
628
- use poly_commitment:: srs:: { endos, SRS } ;
629
+ use poly_commitment:: srs:: endos;
629
630
630
631
// Includes a row to store value 1
631
632
let num_public_inputs = 1 ;
@@ -706,8 +707,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_ffadd(
706
707
. build ( )
707
708
. unwrap ( ) ;
708
709
709
- let ptr: & mut SRS < Vesta > = unsafe { & mut * ( std:: sync:: Arc :: as_ptr ( & srs. 0 ) as * mut _ ) } ;
710
- ptr. with_lagrange_basis ( cs. domain . d1 ) ;
710
+ srs. 0 . with_lagrange_basis ( cs. domain . d1 ) ;
711
711
712
712
let ( endo_q, _endo_r) = endos :: < Pallas > ( ) ;
713
713
let index = ProverIndex :: < Vesta , OpeningProof < Vesta > > :: create ( cs, endo_q, srs. 0 ) ;
@@ -747,7 +747,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_xor(
747
747
polynomials:: { generic:: GenericGateSpec , xor} ,
748
748
wires:: Wire ,
749
749
} ;
750
- use poly_commitment:: srs:: { endos, SRS } ;
750
+ use poly_commitment:: srs:: endos;
751
751
752
752
let num_public_inputs = 2 ;
753
753
@@ -795,8 +795,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_xor(
795
795
. build ( )
796
796
. unwrap ( ) ;
797
797
798
- let ptr: & mut SRS < Vesta > = unsafe { & mut * ( std:: sync:: Arc :: as_ptr ( & srs. 0 ) as * mut _ ) } ;
799
- ptr. with_lagrange_basis ( cs. domain . d1 ) ;
798
+ srs. 0 . with_lagrange_basis ( cs. domain . d1 ) ;
800
799
801
800
let ( endo_q, _endo_r) = endos :: < Pallas > ( ) ;
802
801
let index = ProverIndex :: < Vesta , OpeningProof < Vesta > > :: create ( cs, endo_q, srs. 0 ) ;
@@ -839,7 +838,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_rot(
839
838
} ,
840
839
wires:: Wire ,
841
840
} ;
842
- use poly_commitment:: srs:: { endos, SRS } ;
841
+ use poly_commitment:: srs:: endos;
843
842
844
843
// Includes the actual input of the rotation and a row with the zero value
845
844
let num_public_inputs = 2 ;
@@ -889,8 +888,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_rot(
889
888
. build ( )
890
889
. unwrap ( ) ;
891
890
892
- let ptr: & mut SRS < Vesta > = unsafe { & mut * ( std:: sync:: Arc :: as_ptr ( & srs. 0 ) as * mut _ ) } ;
893
- ptr. with_lagrange_basis ( cs. domain . d1 ) ;
891
+ srs. 0 . with_lagrange_basis ( cs. domain . d1 ) ;
894
892
895
893
let ( endo_q, _endo_r) = endos :: < Pallas > ( ) ;
896
894
let index = ProverIndex :: < Vesta , OpeningProof < Vesta > > :: create ( cs, endo_q, srs. 0 ) ;
0 commit comments