@@ -27,14 +27,15 @@ pub(crate) async fn stf<S: GarblerArtifactStore>(
2727 match state. step {
2828 Step :: Uninit => {
2929 // state update
30- state. config = Config {
30+ state. config = Some ( Config {
3131 seed : data. seed ,
3232 setup_inputs : data. setup_inputs ,
33- } ;
33+ } ) ;
3434 state. step = Step :: GeneratingPolynomials ;
3535
3636 // generate actions
37- actions. push ( Action :: GeneratePolynomials ( state. config . seed ) ) ;
37+ let seed = state. config . expect ( "just set" ) . seed ;
38+ actions. push ( Action :: GeneratePolynomials ( seed) ) ;
3839 }
3940 _ => return Err ( SMError :: UnexpectedInput ) ,
4041 }
@@ -71,7 +72,8 @@ pub(crate) async fn stf<S: GarblerArtifactStore>(
7172 state. step = Step :: GeneratingTableCommitments ;
7273
7374 // generate actions
74- let seeds = generate_garbling_table_seeds ( state. config . seed ) ;
75+ let config = require_config ( & state) ?;
76+ let seeds = generate_garbling_table_seeds ( config. seed ) ;
7577 actions. push ( Action :: GenerateTableCommitments (
7678 Box :: new ( seeds) ,
7779 input_shares,
@@ -135,13 +137,14 @@ pub(crate) async fn stf<S: GarblerArtifactStore>(
135137 let msg_id = challenge_msg. id ( ) ;
136138 let ( input_shares, output_shares) =
137139 state. artifact_store . load_shares ( ) . await ?;
138- let seeds = generate_garbling_table_seeds ( state. config . seed ) ;
140+ let config = require_config ( & state) ?;
141+ let seeds = generate_garbling_table_seeds ( config. seed ) ;
139142 let challenge_response_msg = create_challenge_response_msg (
140143 challenge_msg. challenge_indices . as_ref ( ) ,
141144 input_shares,
142145 output_shares,
143146 seeds,
144- state . config . setup_inputs ,
147+ config. setup_inputs ,
145148 ) ;
146149 state
147150 . artifact_store
@@ -186,7 +189,8 @@ pub(crate) async fn stf<S: GarblerArtifactStore>(
186189 let eval_commitments =
187190 get_eval_commitments ( & eval_indices, garbling_table_commitments. as_ref ( ) ) ;
188191
189- let garbling_seeds = generate_garbling_table_seeds ( state. config . seed ) ;
192+ let config = require_config ( & state) ?;
193+ let garbling_seeds = generate_garbling_table_seeds ( config. seed ) ;
190194 let eval_seeds = get_eval_seeds ( & eval_indices, & garbling_seeds) ;
191195
192196 state. step = Step :: TransferringGarblingTables {
@@ -449,14 +453,16 @@ pub(crate) async fn restore<S: GarblerArtifactStore>(state: &State<S>) -> SMResu
449453 match & state. step {
450454 Step :: Uninit => { }
451455 Step :: GeneratingPolynomials => {
452- actions. push ( Action :: GeneratePolynomials ( state. config . seed ) ) ;
456+ let config = require_config ( state) ?;
457+ actions. push ( Action :: GeneratePolynomials ( config. seed ) ) ;
453458 }
454459 Step :: GeneratingShares => {
455460 let polynomials = state. artifact_store . load_polynomials ( ) . await ?;
456461 actions. push ( Action :: GenerateShares ( polynomials) ) ;
457462 }
458463 Step :: GeneratingTableCommitments => {
459- let seeds = generate_garbling_table_seeds ( state. config . seed ) ;
464+ let config = require_config ( state) ?;
465+ let seeds = generate_garbling_table_seeds ( config. seed ) ;
460466 let ( input_shares, output_shares) = state. artifact_store . load_shares ( ) . await ?;
461467 actions. push ( Action :: GenerateTableCommitments (
462468 Box :: new ( seeds) ,
@@ -485,13 +491,14 @@ pub(crate) async fn restore<S: GarblerArtifactStore>(state: &State<S>) -> SMResu
485491 } ;
486492 let challenge_indices = state. artifact_store . load_challenge_indices ( ) . await ?;
487493 let ( input_shares, output_shares) = state. artifact_store . load_shares ( ) . await ?;
488- let seeds = generate_garbling_table_seeds ( state. config . seed ) ;
494+ let config = require_config ( state) ?;
495+ let seeds = generate_garbling_table_seeds ( config. seed ) ;
489496 let challenge_response_msg = create_challenge_response_msg (
490497 challenge_indices. as_ref ( ) ,
491498 input_shares,
492499 output_shares,
493500 seeds,
494- state . config . setup_inputs ,
501+ config. setup_inputs ,
495502 ) ;
496503
497504 // sanity check
@@ -610,6 +617,12 @@ pub(crate) async fn restore<S: GarblerArtifactStore>(state: &State<S>) -> SMResu
610617 Ok ( actions)
611618}
612619
620+ fn require_config < S > ( state : & State < S > ) -> SMResult < Config > {
621+ state
622+ . config
623+ . ok_or_else ( || SMError :: StateInconsistency ( "expected config to not be None" ) )
624+ }
625+
613626#[ expect( unused_variables) ]
614627fn generate_garbling_table_seeds ( base_seed : Seed ) -> AllGarblingSeeds {
615628 todo ! ( )
0 commit comments