@@ -97,23 +97,29 @@ fn get_zigzag_params() -> Option<groth16::Parameters<Bls12>> {
9797 ( * ZIGZAG_PARAMS ) . clone ( )
9898}
9999
100- fn get_post_params ( sector_bytes : usize ) -> groth16:: Parameters < Bls12 > {
101- println ! ( "getting post params for sector size: {}" , sector_bytes) ;
100+ fn get_post_params ( sector_bytes : usize ) -> error:: Result < groth16:: Parameters < Bls12 > > {
102101 let post_public_params = post_public_params ( sector_bytes as usize ) ;
103- let post_circuit: VDFPoStCircuit < Bls12 > =
104- <VDFPostCompound as CompoundProof <
105- Bls12 ,
106- VDFPoSt < PedersenHasher , Sloth > ,
107- VDFPoStCircuit < Bls12 > ,
108- > >:: blank_circuit ( & post_public_params, & ENGINE_PARAMS ) ;
109- VDFPostCompound :: get_groth_params ( post_circuit, & post_public_params) . unwrap ( )
102+ <VDFPostCompound as CompoundProof <
103+ Bls12 ,
104+ VDFPoSt < PedersenHasher , Sloth > ,
105+ VDFPoStCircuit < Bls12 > ,
106+ > >:: groth_params ( & post_public_params, & ENGINE_PARAMS )
107+ . map_err ( |e| e. into ( ) )
110108}
111109
112- const DEGREE : usize = 1 ; // TODO: 5; FIXME: increasing degree introduces a test failure. Figure out why.
113- const EXPANSION_DEGREE : usize = 6 ;
110+ const DEGREE : usize = 2 ;
111+ const EXPANSION_DEGREE : usize = 8 ;
114112const SLOTH_ITER : usize = 0 ;
115113const LAYERS : usize = 2 ; // TODO: 10;
116- const CHALLENGES : LayerChallenges = LayerChallenges :: new_fixed ( LAYERS , 1 ) ;
114+ const TAPER_LAYERS : usize = LAYERS ; // TODO: 7
115+ const TAPER : f64 = 1.0 / 3.0 ;
116+ const CHALLENGE_COUNT : usize = 2 ;
117+ const DRG_SEED : [ u32 ; 7 ] = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 ] ; // Arbitrary, need a theory for how to vary this over time.
118+
119+ lazy_static ! {
120+ static ref CHALLENGES : LayerChallenges =
121+ LayerChallenges :: new_tapered( LAYERS , CHALLENGE_COUNT , TAPER_LAYERS , TAPER ) ;
122+ }
117123
118124fn setup_params ( sector_bytes : usize ) -> layered_drgporep:: SetupParams {
119125 assert ! (
@@ -128,11 +134,11 @@ fn setup_params(sector_bytes: usize) -> layered_drgporep::SetupParams {
128134 nodes,
129135 degree : DEGREE ,
130136 expansion_degree : EXPANSION_DEGREE ,
131- seed : new_seed ( ) ,
137+ seed : DRG_SEED ,
132138 } ,
133139 sloth_iter : SLOTH_ITER ,
134140 } ,
135- layer_challenges : CHALLENGES ,
141+ layer_challenges : CHALLENGES . clone ( ) ,
136142 }
137143}
138144
@@ -285,7 +291,7 @@ pub fn generate_post(sector_bytes: u64, input: PoStInput) -> error::Result<PoStO
285291
286292 let priv_inputs = vdf_post:: PrivateInputs :: < PedersenHasher > :: new ( & borrowed_trees[ ..] ) ;
287293
288- let groth_params = get_post_params ( sector_bytes as usize ) ;
294+ let groth_params = get_post_params ( sector_bytes as usize ) ? ;
289295
290296 let proof = VDFPostCompound :: prove ( & pub_params, & pub_inputs, & priv_inputs, Some ( groth_params) )
291297 . expect ( "failed while proving" ) ;
@@ -339,7 +345,7 @@ pub fn verify_post(
339345 faults,
340346 } ;
341347
342- let groth_params = get_post_params ( sector_bytes as usize ) ;
348+ let groth_params = get_post_params ( sector_bytes as usize ) ? ;
343349
344350 let proof = MultiProof :: new_from_reader ( Some ( POST_PARTITIONS ) , proof_vec, groth_params) ?;
345351
@@ -612,7 +618,6 @@ pub fn verify_seal(
612618 let ( _fake, _delay_seconds, _sector_bytes, proof_sector_bytes, uses_official_circuit) =
613619 get_config ( sector_config) ;
614620
615- let challenges = CHALLENGES ;
616621 let prover_id = pad_safe_fr ( prover_id_in) ;
617622 let sector_id = pad_safe_fr ( sector_id_in) ;
618623 let replica_id = replica_id :: < DefaultTreeHasher > ( prover_id, sector_id) ;
0 commit comments