1- use ark_ec:: { AffineCurve , ProjectiveCurve } ;
1+ use ark_ec:: { AffineRepr , CurveGroup } ;
22use ark_ff:: { Field , UniformRand } ;
33use ledger:: {
44 generators:: zkapp_command_builder:: get_transaction_commitments,
@@ -69,7 +69,11 @@ use mina_signer::{
6969 CompressedPubKey , CurvePoint , Keypair , NetworkId , ScalarField , SecKey , Signature , Signer ,
7070} ;
7171use rand:: { seq:: SliceRandom , Rng } ;
72- use std:: { array, iter, ops:: RangeInclusive , sync:: Arc } ;
72+ use std:: {
73+ array, iter,
74+ ops:: { Mul , RangeInclusive } ,
75+ sync:: Arc ,
76+ } ;
7377use tuple_map:: TupleMap2 ;
7478
7579use super :: context:: { FuzzerCtx , PermissionModel } ;
@@ -155,9 +159,7 @@ impl Generator<Keypair> for FuzzerCtx {
155159 fn gen ( & mut self ) -> Keypair {
156160 let sec_key: SecKey = self . gen ( ) ;
157161 let scalar = sec_key. into_scalar ( ) ;
158- let public: CurvePoint = CurvePoint :: prime_subgroup_generator ( )
159- . mul ( scalar)
160- . into_affine ( ) ;
162+ let public: CurvePoint = CurvePoint :: generator ( ) . mul ( scalar) . into_affine ( ) ;
161163
162164 let keypair = Keypair :: from_parts_unsafe ( scalar, public) ;
163165
@@ -223,10 +225,14 @@ impl<F: Field + From<i32>> Generator<CurvePointGenerator<F>> for FuzzerCtx {
223225impl Generator < ( Fp , Fp ) > for FuzzerCtx {
224226 #[ coverage( off) ]
225227 fn gen ( & mut self ) -> ( Fp , Fp ) {
228+ use std:: ops:: Mul ;
226229 if let Some ( ( x, y) ) = self . state . cache_curve_point_fp {
227- let p = GroupAffine :: < Fp > :: new ( x, y, false ) ;
228- let rand_scalar: u64 = self . gen . rng . gen ( ) ;
229- let new_p: GroupAffine < Fp > = p. mul ( rand_scalar) . into ( ) ;
230+ let p = GroupAffine :: < Fp > :: new ( x, y) ;
231+ let rand_scalar: u64 = self . r#gen . rng . gen ( ) ;
232+ let scalar_field_elem =
233+ <Fp as ledger:: proofs:: field:: FieldWitness >:: Scalar :: from ( rand_scalar) ;
234+
235+ let new_p: GroupAffine < Fp > = p. mul ( scalar_field_elem) . into ( ) ;
230236 ( new_p. x , new_p. y )
231237 } else {
232238 let p: CurvePointGenerator < Fp > = self . gen ( ) ;
@@ -240,9 +246,11 @@ impl Generator<(Fq, Fq)> for FuzzerCtx {
240246 #[ coverage( off) ]
241247 fn gen ( & mut self ) -> ( Fq , Fq ) {
242248 if let Some ( ( x, y) ) = self . state . cache_curve_point_fq {
243- let p = GroupAffine :: < Fq > :: new ( x, y, false ) ;
249+ let p = GroupAffine :: < Fq > :: new ( x, y) ;
244250 let rand_scalar: u64 = self . gen . rng . gen ( ) ;
245- let new_p: GroupAffine < Fq > = p. mul ( rand_scalar) . into ( ) ;
251+ let scalar_field_elem =
252+ <Fq as ledger:: proofs:: field:: FieldWitness >:: Scalar :: from ( rand_scalar) ;
253+ let new_p: GroupAffine < Fq > = p. mul ( scalar_field_elem) . into ( ) ;
246254 ( new_p. x , new_p. y )
247255 } else {
248256 let p: CurvePointGenerator < Fq > = self . gen ( ) ;
0 commit comments