@@ -5,10 +5,7 @@ use crate::{
55 compute_info_standard_keygen, retrieve_parameters, BaseKmsStruct , KeyGenMetadata ,
66 DSEP_PUBDATA_KEY ,
77 } ,
8- threshold:: {
9- service:: { session:: ImmutableSessionMaker , ThresholdFheKeys } ,
10- traits:: Resharer ,
11- } ,
8+ threshold:: { service:: session:: ImmutableSessionMaker , traits:: Resharer } ,
129 utils:: MetricedError ,
1310 validation:: {
1411 parse_optional_proto_request_id, parse_proto_request_id, RequestIdParsingErr ,
@@ -570,9 +567,6 @@ impl<PubS: Storage + Send + Sync + 'static, PrivS: StorageExt + Send + Sync + 's
570567 )
571568 . await ?;
572569
573- let ( integer_server_key, _, _, decompression_key, sns_key, _, _, _) =
574- fhe_pubkeys. server_key . clone ( ) . into_raw_parts ( ) ;
575-
576570 // Compute all the info required for storing
577571 // using the same IDs and domain as we should've had the
578572 // DKG went through successfully
@@ -594,14 +588,6 @@ impl<PubS: Storage + Send + Sync + 'static, PrivS: StorageExt + Send + Sync + 's
594588 }
595589 } ;
596590
597- let threshold_fhe_keys = ThresholdFheKeys {
598- private_keys : Arc :: new ( new_private_key_set) ,
599- integer_server_key : Arc :: new ( integer_server_key) ,
600- sns_key : sns_key. map ( Arc :: new) ,
601- decompression_key : decompression_key. map ( Arc :: new) ,
602- meta_data : info. clone ( ) ,
603- } ;
604-
605591 // Purge before we can overwrite, use a dummy_meta_store
606592 // as this was meant to update the meta store of DKG upon failing
607593 let dummy_meta_store = RwLock :: new ( MetaStore :: < KeyGenMetadata > :: new ( 1 , 1 ) ) ;
@@ -618,12 +604,14 @@ impl<PubS: Storage + Send + Sync + 'static, PrivS: StorageExt + Send + Sync + 's
618604 // HOTFIX(keygen-recovery): Note that this overwrites the private storage
619605 // at the given key ID. It's needed as long as reshare shortcuts the
620606 // GW, but should be fixed long term.
607+ // Memory optimization: Storage function now handles server_key
608+ // component extraction internally, avoiding the need to clone server_key here.
621609 crypto_storage
622610 . write_threshold_keys_with_reshare_meta_store (
623611 & request_id,
624612 & key_id_to_reshare,
625613 & old_epoch_id,
626- threshold_fhe_keys ,
614+ new_private_key_set ,
627615 fhe_pubkeys,
628616 info. clone ( ) ,
629617 Arc :: clone ( & meta_store) ,
0 commit comments