Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core-client/tests/integration/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ async fn setup_isolated_threshold_cli_test_with_custodian_backup(
///
/// # Note
/// Uses Default FHE parameters (production-like, slower than Test params) with `ensure_default_prss=false`.
/// Internally uses `TestMaterialSpec::threshold_default_no_prss` — PRSS is excluded from
/// required material and is not used at all (no pre-generated PRSS needed).
/// Internally uses `TestMaterialSpec::threshold_default` — PRSS is bootstrapped at runtime
/// when `ensure_default_prss=true`.
///
/// # Example
/// ```no_run
Expand Down Expand Up @@ -555,7 +555,7 @@ async fn setup_isolated_threshold_cli_test_impl_with_spec(

let default_material_spec = match fhe_params {
FheParameter::Default => {
kms_lib::testing::material::TestMaterialSpec::threshold_default_no_prss(party_count)
kms_lib::testing::material::TestMaterialSpec::threshold_default(party_count)
}
_ => kms_lib::testing::material::TestMaterialSpec::threshold_basic(party_count),
};
Expand Down
56 changes: 2 additions & 54 deletions core/service/src/client/test_tools.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::client::client_wasm::Client;
use crate::conf::{CoreConfig, Keychain, SecretSharingKeychain, init_conf};
use crate::conf::{CoreConfig, init_conf};
use crate::conf::{
ServiceEndpoint,
threshold::{PeerConf, ThresholdPartyConf},
Expand All @@ -11,26 +10,20 @@ use crate::engine::context_manager::create_default_centralized_context_in_storag
use crate::engine::threshold::service::{RealThresholdKms, new_real_threshold_kms};
use crate::engine::{Shutdown, run_server};
use crate::grpc::MetaStoreStatusServiceImpl;
use crate::util::key_setup::test_tools::file_backup_vault;
use crate::util::key_setup::test_tools::setup::ensure_testing_material_exists;
use crate::util::rate_limiter::RateLimiterConfig;
use crate::vault::Vault;
use crate::vault::storage::StorageExt;
use crate::vault::storage::{
Storage, StorageType, crypto_material::get_core_signing_key, file::FileStorage,
};
use crate::vault::storage::{Storage, crypto_material::get_core_signing_key, file::FileStorage};
use futures_util::FutureExt;
use itertools::Itertools;
use kms_grpc::kms_service::v1::core_service_endpoint_client::CoreServiceEndpointClient;
use kms_grpc::kms_service::v1::core_service_endpoint_server::CoreServiceEndpointServer;
use kms_grpc::rpc_types::KMSType;
use std::collections::HashMap;
use std::path::Path;
use std::str::FromStr;
use std::sync::Arc;
use test_utils::random_free_port::get_listeners_random_free_ports;
use threshold_execution::endpoints::decryption::DecryptionMode;
use threshold_execution::tfhe_internals::parameters::DKGParams;
use threshold_networking::grpc::GrpcServer;
use tokio::task::{JoinHandle, JoinSet};
use tonic::server::NamedService;
Expand All @@ -40,9 +33,6 @@ use tonic_health::pb::HealthCheckRequest;
use tonic_health::pb::health_client::HealthClient;
use tonic_health::server::HealthReporter;

#[cfg(feature = "slow_tests")]
use crate::util::key_setup::test_tools::setup::ensure_default_material_exists;

// Put gRPC size limit to 100 MB.
// We need a high limit because ciphertexts may be large after SnS.
const GRPC_MAX_MESSAGE_SIZE: usize = 100 * 1024 * 1024;
Expand Down Expand Up @@ -804,48 +794,6 @@ pub(crate) async fn setup_centralized<
(server_handle, client)
}

/// Spin up a centralized KMS server with the custodian-flavored backup vault and
/// return the server handle, gRPC client, and internal client.
pub async fn centralized_custodian_handles(
param: &DKGParams,
rate_limiter_conf: Option<RateLimiterConfig>,
test_data_path: Option<&Path>,
pub_storage_prefix: Option<&str>,
backup_storage_prefix: Option<&str>,
) -> (ServerHandle, CoreServiceEndpointClient<Channel>, Client) {
let backup_vault = file_backup_vault(
Some(&Keychain::SecretSharing(SecretSharingKeychain {})),
test_data_path,
test_data_path,
pub_storage_prefix,
backup_storage_prefix,
)
.await;

let priv_storage = FileStorage::new(test_data_path, StorageType::PRIV, None).unwrap();
let pub_storage = FileStorage::new(test_data_path, StorageType::PUB, None).unwrap();

ensure_testing_material_exists(test_data_path).await;
#[cfg(feature = "slow_tests")]
ensure_default_material_exists().await;

let (kms_server, kms_client) = setup_centralized(
pub_storage,
priv_storage,
Some(backup_vault),
rate_limiter_conf,
)
.await;
let pub_storage = HashMap::from_iter([(
1,
FileStorage::new(test_data_path, StorageType::PUB, None).unwrap(),
)]);
let client_storage = FileStorage::new(test_data_path, StorageType::CLIENT, None).unwrap();
let internal_client = Client::new_client(client_storage, pub_storage, param, None)
.await
.unwrap();
(kms_server, kms_client, internal_client)
}
/// Wait for a server to be ready for requests. I.e. wait until it enters the SERVING state.
/// Note that this method may panic if the server does not become ready within a certain time frame.
pub async fn await_server_ready(service_name: &str, port: u16) {
Expand Down
4 changes: 0 additions & 4 deletions core/service/src/client/tests/centralized/crs_gen_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::engine::base::safe_serialize_hash_element_versioned;
use crate::testing::setup::CentralizedTestEnv;
use crate::vault::storage::{StorageType, file::FileStorage};
use crate::{
client::tests::common::TIME_TO_SLEEP_MS,
consts::TEST_PARAM,
cryptography::internal_crypto_types::WrappedDKGParams,
dummy_domain,
Expand Down Expand Up @@ -70,8 +69,6 @@ async fn crs_gen_centralized_manual(
test_name: &str,
params: Option<FheParameter>,
) -> Result<()> {
// TODO(dp): remove this?
tokio::time::sleep(tokio::time::Duration::from_millis(TIME_TO_SLEEP_MS)).await;
let env = CentralizedTestEnv::builder()
.with_test_name(test_name)
.with_backup_vault()
Expand Down Expand Up @@ -168,7 +165,6 @@ pub async fn crs_gen_centralized(
keygen: 1,
new_epoch: 1,
};
tokio::time::sleep(tokio::time::Duration::from_millis(TIME_TO_SLEEP_MS)).await;
let env = CentralizedTestEnv::builder()
.with_test_name(test_name)
.with_backup_vault()
Expand Down
Loading
Loading