enable LP registration in registration client (#6538)
This commit is contained in:
+3
-2
@@ -173,7 +173,8 @@ members = [
|
||||
"wasm/zknym-lib",
|
||||
# "nym-gateway-probe",
|
||||
"integration-tests",
|
||||
"common/nym-kkt-ciphersuite", "common/nym-kkt-context",
|
||||
"common/nym-kkt-ciphersuite",
|
||||
"common/nym-kkt-context",
|
||||
]
|
||||
|
||||
default-members = [
|
||||
@@ -190,7 +191,7 @@ default-members = [
|
||||
"service-providers/ip-packet-router",
|
||||
"service-providers/network-requester",
|
||||
"tools/nymvisor",
|
||||
"nym-registration-client"
|
||||
"nym-registration-client",
|
||||
]
|
||||
|
||||
exclude = ["contracts", "nym-wallet", "cpu-cycles"]
|
||||
|
||||
@@ -14,7 +14,9 @@ use nym_validator_client::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
RegistrationClient, clients::MixnetBasedRegistrationClient, config::RegistrationMode,
|
||||
RegistrationClient,
|
||||
clients::{LpBasedRegistrationClient, MixnetBasedRegistrationClient},
|
||||
config::RegistrationMode,
|
||||
error::RegistrationClientError,
|
||||
};
|
||||
use config::BuilderConfig;
|
||||
@@ -48,10 +50,7 @@ impl RegistrationClientBuilder {
|
||||
pub async fn build(self) -> Result<RegistrationClient, RegistrationClientError> {
|
||||
if self.use_lp() {
|
||||
tracing::debug!("Using LP for registration");
|
||||
Err(RegistrationClientError::LpRegistrationNotPossible {
|
||||
node_id: "any".to_string(),
|
||||
})
|
||||
// Ok(RegistrationClient::Lp(Box::new(self.build_lp().await?)))
|
||||
Ok(RegistrationClient::Lp(Box::new(self.build_lp().await?)))
|
||||
} else {
|
||||
tracing::debug!("Using Mixnet for registration");
|
||||
Ok(RegistrationClient::Mixnet(Box::new(
|
||||
@@ -124,29 +123,29 @@ impl RegistrationClientBuilder {
|
||||
})
|
||||
}
|
||||
|
||||
// async fn build_lp(self) -> Result<LpBasedRegistrationClient, RegistrationClientError> {
|
||||
// let storage = self.config.setup_credential_storage().await?;
|
||||
// let config = self.config.registration_client_config();
|
||||
//
|
||||
// let nyxd_client = get_nyxd_client(&self.config.network_env)?;
|
||||
//
|
||||
// let bandwidth_controller: Box<dyn BandwidthTicketProvider> =
|
||||
// if let Some(credential_storage) = storage {
|
||||
// Box::new(BandwidthController::new(credential_storage, nyxd_client))
|
||||
// } else {
|
||||
// Box::new(BandwidthController::new(
|
||||
// EphemeralCredentialStorage::default(),
|
||||
// nyxd_client,
|
||||
// ))
|
||||
// };
|
||||
//
|
||||
// Ok(LpBasedRegistrationClient {
|
||||
// config,
|
||||
// bandwidth_controller,
|
||||
// cancel_token: self.config.cancel_token.clone(),
|
||||
// fallback_client_builder: Some(self),
|
||||
// })
|
||||
// }
|
||||
async fn build_lp(self) -> Result<LpBasedRegistrationClient, RegistrationClientError> {
|
||||
let storage = self.config.setup_credential_storage().await?;
|
||||
let config = self.config.registration_client_config();
|
||||
|
||||
let nyxd_client = get_nyxd_client(&self.config.network_env)?;
|
||||
|
||||
let bandwidth_controller: Box<dyn BandwidthTicketProvider> =
|
||||
if let Some(credential_storage) = storage {
|
||||
Box::new(BandwidthController::new(credential_storage, nyxd_client))
|
||||
} else {
|
||||
Box::new(BandwidthController::new(
|
||||
EphemeralCredentialStorage::default(),
|
||||
nyxd_client,
|
||||
))
|
||||
};
|
||||
|
||||
Ok(LpBasedRegistrationClient {
|
||||
config,
|
||||
bandwidth_controller,
|
||||
cancel_token: self.config.cancel_token.clone(),
|
||||
fallback_client_builder: Some(self),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// temporary while we use the legacy bandwidth-controller
|
||||
|
||||
@@ -24,14 +24,14 @@ mod types;
|
||||
|
||||
pub enum RegistrationClient {
|
||||
Mixnet(Box<clients::MixnetBasedRegistrationClient>),
|
||||
// Lp(Box<clients::LpBasedRegistrationClient>),
|
||||
Lp(Box<clients::LpBasedRegistrationClient>),
|
||||
}
|
||||
|
||||
impl RegistrationClient {
|
||||
pub async fn register(self) -> Result<RegistrationResult, RegistrationClientError> {
|
||||
match self {
|
||||
RegistrationClient::Mixnet(client) => client.register().await,
|
||||
// RegistrationClient::Lp(client) => client.register().await,
|
||||
RegistrationClient::Lp(client) => client.register().await,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user