Skip to content

Commit 1ddb301

Browse files
committed
chore: address comments
1 parent cd6cc58 commit 1ddb301

File tree

9 files changed

+400
-532
lines changed

9 files changed

+400
-532
lines changed

core/service/src/engine/threshold/service/key_generator.rs

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use threshold_fhe::{
3131
execution::{
3232
endpoints::keygen::{distributed_decompression_keygen_z128, OnlineDistributedKeyGen},
3333
keyset_config as ddec_keyset_config,
34-
online::{bit_lift::BitLift, preprocessing::DKGPreprocessing},
34+
online::preprocessing::DKGPreprocessing,
3535
runtime::sessions::{base_session::BaseSession, small_session::SmallSession},
3636
tfhe_internals::{
3737
parameters::DKGParams,
@@ -126,7 +126,6 @@ pub struct RealKeyGenerator<
126126
PubS: Storage + Sync + Send + 'static,
127127
PrivS: StorageExt + Sync + Send + 'static,
128128
KG: OnlineDistributedKeyGen<Z128, { ResiduePolyF4Z128::EXTENSION_DEGREE }> + 'static,
129-
BL: BitLift,
130129
> {
131130
pub base_kms: BaseKmsStruct,
132131
pub crypto_storage: ThresholdCryptoMaterialStorage<PubS, PrivS>,
@@ -140,7 +139,6 @@ pub struct RealKeyGenerator<
140139
pub ongoing: Arc<Mutex<HashMap<RequestId, CancellationToken>>>,
141140
pub rate_limiter: RateLimiter,
142141
pub(crate) _kg: PhantomData<KG>,
143-
pub(crate) _bl: PhantomData<BL>,
144142
// This is a lock to make sure calls to keygen do not happen concurrently.
145143
// It's needed because we lock the meta store at different times before starting the keygen
146144
// and if two concurrent keygen calls on the same key ID or preproc ID are made, they can interfere with each other.
@@ -154,20 +152,18 @@ pub struct RealInsecureKeyGenerator<
154152
PubS: Storage + Sync + Send + 'static,
155153
PrivS: StorageExt + Sync + Send + 'static,
156154
KG: OnlineDistributedKeyGen<Z128, { ResiduePolyF4Z128::EXTENSION_DEGREE }> + 'static,
157-
BL: BitLift,
158155
> {
159-
pub real_key_generator: RealKeyGenerator<PubS, PrivS, KG, BL>,
156+
pub real_key_generator: RealKeyGenerator<PubS, PrivS, KG>,
160157
}
161158

162159
#[cfg(feature = "insecure")]
163160
impl<
164161
PubS: Storage + Sync + Send + 'static,
165162
PrivS: StorageExt + Sync + Send + 'static,
166163
KG: OnlineDistributedKeyGen<Z128, { ResiduePolyF4Z128::EXTENSION_DEGREE }>,
167-
BL: BitLift,
168-
> RealInsecureKeyGenerator<PubS, PrivS, KG, BL>
164+
> RealInsecureKeyGenerator<PubS, PrivS, KG>
169165
{
170-
pub async fn from_real_keygen(value: &RealKeyGenerator<PubS, PrivS, KG, BL>) -> Self {
166+
pub async fn from_real_keygen(value: &RealKeyGenerator<PubS, PrivS, KG>) -> Self {
171167
Self {
172168
real_key_generator: RealKeyGenerator {
173169
base_kms: value.base_kms.new_instance().await,
@@ -179,7 +175,6 @@ impl<
179175
ongoing: Arc::clone(&value.ongoing),
180176
rate_limiter: value.rate_limiter.clone(),
181177
_kg: std::marker::PhantomData,
182-
_bl: std::marker::PhantomData,
183178
serial_lock: Arc::new(Mutex::new(())),
184179
},
185180
}
@@ -191,8 +186,7 @@ impl<
191186
PubS: Storage + Sync + Send + 'static,
192187
PrivS: StorageExt + Sync + Send + 'static,
193188
KG: OnlineDistributedKeyGen<Z128, { ResiduePolyF4Z128::EXTENSION_DEGREE }> + 'static,
194-
BL: BitLift,
195-
> InsecureKeyGenerator for RealInsecureKeyGenerator<PubS, PrivS, KG, BL>
189+
> InsecureKeyGenerator for RealInsecureKeyGenerator<PubS, PrivS, KG>
196190
{
197191
async fn insecure_key_gen(
198192
&self,
@@ -247,8 +241,7 @@ impl<
247241
PubS: Storage + Sync + Send + 'static,
248242
PrivS: StorageExt + Sync + Send + 'static,
249243
KG: OnlineDistributedKeyGen<Z128, { ResiduePolyF4Z128::EXTENSION_DEGREE }> + 'static,
250-
BL: BitLift,
251-
> RealKeyGenerator<PubS, PrivS, KG, BL>
244+
> RealKeyGenerator<PubS, PrivS, KG>
252245
{
253246
#[allow(clippy::too_many_arguments)]
254247
async fn launch_dkg(
@@ -1459,8 +1452,7 @@ impl<
14591452
PubS: Storage + Sync + Send + 'static,
14601453
PrivS: StorageExt + Sync + Send + 'static,
14611454
KG: OnlineDistributedKeyGen<Z128, { ResiduePolyF4Z128::EXTENSION_DEGREE }> + 'static,
1462-
BL: BitLift,
1463-
> KeyGenerator for RealKeyGenerator<PubS, PrivS, KG, BL>
1455+
> KeyGenerator for RealKeyGenerator<PubS, PrivS, KG>
14641456
{
14651457
async fn key_gen(
14661458
&self,
@@ -1486,8 +1478,7 @@ mod tests {
14861478
use rand::rngs::OsRng;
14871479
use threshold_fhe::{
14881480
execution::{
1489-
online::{bit_lift::SecureBitLift, preprocessing::dummy::DummyPreprocessing},
1490-
small_execution::prss::PRSSSetup,
1481+
online::preprocessing::dummy::DummyPreprocessing, small_execution::prss::PRSSSetup,
14911482
},
14921483
malicious_execution::endpoints::keygen::{
14931484
DroppingOnlineDistributedKeyGen128, FailingOnlineDistributedKeyGen128,
@@ -1508,8 +1499,7 @@ mod tests {
15081499
PubS: Storage + Sync + Send + 'static,
15091500
PrivS: StorageExt + Sync + Send + 'static,
15101501
KG: OnlineDistributedKeyGen<Z128, { ResiduePolyF4Z128::EXTENSION_DEGREE }> + 'static,
1511-
BL: BitLift,
1512-
> RealKeyGenerator<PubS, PrivS, KG, BL>
1502+
> RealKeyGenerator<PubS, PrivS, KG>
15131503
{
15141504
async fn init_test(
15151505
base_kms: BaseKmsStruct,
@@ -1537,7 +1527,6 @@ mod tests {
15371527
ongoing,
15381528
rate_limiter,
15391529
_kg: PhantomData,
1540-
_bl: PhantomData,
15411530
serial_lock: Arc::new(Mutex::new(())),
15421531
}
15431532
}
@@ -1551,10 +1540,8 @@ mod tests {
15511540
}
15521541
}
15531542

1554-
impl<
1555-
KG: OnlineDistributedKeyGen<Z128, { ResiduePolyF4Z128::EXTENSION_DEGREE }> + 'static,
1556-
BL: BitLift,
1557-
> RealKeyGenerator<ram::RamStorage, ram::RamStorage, KG, BL>
1543+
impl<KG: OnlineDistributedKeyGen<Z128, { ResiduePolyF4Z128::EXTENSION_DEGREE }> + 'static>
1544+
RealKeyGenerator<ram::RamStorage, ram::RamStorage, KG>
15581545
{
15591546
async fn init_ram_keygen(
15601547
base_kms: BaseKmsStruct,
@@ -1570,7 +1557,7 @@ mod tests {
15701557
KG: OnlineDistributedKeyGen<Z128, { ResiduePolyF4Z128::EXTENSION_DEGREE }> + 'static,
15711558
>() -> (
15721559
[RequestId; 4],
1573-
RealKeyGenerator<ram::RamStorage, ram::RamStorage, KG, SecureBitLift>,
1560+
RealKeyGenerator<ram::RamStorage, ram::RamStorage, KG>,
15741561
) {
15751562
use crate::cryptography::signatures::gen_sig_keys;
15761563
let (_pk, sk) = gen_sig_keys(&mut rand::rngs::OsRng);
@@ -1584,7 +1571,7 @@ mod tests {
15841571
&epoch_id,
15851572
base_kms.new_rng().await,
15861573
);
1587-
let kg = RealKeyGenerator::<ram::RamStorage, ram::RamStorage, KG, SecureBitLift>::init_ram_keygen(
1574+
let kg = RealKeyGenerator::<ram::RamStorage, ram::RamStorage, KG>::init_ram_keygen(
15881575
base_kms,
15891576
session_maker.make_immutable(),
15901577
)

core/service/src/engine/threshold/service/kms_impl.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use serde::{Deserialize, Serialize};
1313
use tfhe::{core_crypto::prelude::LweKeyswitchKey, named::Named, Versionize};
1414
use tfhe_versionable::{Upgrade, Version, VersionsDispatch};
1515
use threshold_fhe::execution::endpoints::reshare_sk::SecureReshareSecretKeys;
16-
use threshold_fhe::execution::online::bit_lift::SecureBitLift;
1716
use threshold_fhe::{
1817
algebra::{galois_rings::degree_4::ResiduePolyF4Z128, structure_traits::Ring},
1918
execution::{
@@ -308,7 +307,6 @@ pub type RealThresholdKms<PubS, PrivS> = ThresholdKms<
308307
PubS,
309308
PrivS,
310309
SecureOnlineDistributedKeyGen128<{ ResiduePolyF4Z128::EXTENSION_DEGREE }>,
311-
SecureBitLift,
312310
>,
313311
RealPreprocessor<SecureSmallProducerFactory<ResiduePolyF4Z128>>,
314312
RealCrsGenerator<PubS, PrivS, SecureCeremony>,
@@ -325,13 +323,11 @@ pub type RealThresholdKms<PubS, PrivS> = ThresholdKms<
325323
PubS,
326324
PrivS,
327325
SecureOnlineDistributedKeyGen128<{ ResiduePolyF4Z128::EXTENSION_DEGREE }>,
328-
SecureBitLift,
329326
>,
330327
RealInsecureKeyGenerator<
331328
PubS,
332329
PrivS,
333330
SecureOnlineDistributedKeyGen128<{ ResiduePolyF4Z128::EXTENSION_DEGREE }>,
334-
SecureBitLift,
335331
>,
336332
RealPreprocessor<SecureSmallProducerFactory<ResiduePolyF4Z128>>,
337333
RealCrsGenerator<PubS, PrivS, SecureCeremony>,
@@ -655,7 +651,6 @@ where
655651
ongoing: Arc::clone(&slow_events),
656652
rate_limiter: rate_limiter.clone(),
657653
_kg: PhantomData,
658-
_bl: PhantomData,
659654
serial_lock: Arc::new(Mutex::new(())),
660655
};
661656

0 commit comments

Comments
 (0)