From d2df3bcdc8b8fa68a6e95dd79e9d7969ee58d4c6 Mon Sep 17 00:00:00 2001 From: Simon Wicky Date: Tue, 10 Mar 2026 11:36:10 +0100 Subject: [PATCH] enable LP registration in registration client (#6538) --- Cargo.toml | 5 +- nym-registration-client/src/builder/mod.rs | 55 +++++++++++----------- nym-registration-client/src/lib.rs | 4 +- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4f7ebfae70..ace8dd7f08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] diff --git a/nym-registration-client/src/builder/mod.rs b/nym-registration-client/src/builder/mod.rs index 37e66a03df..397a943d86 100644 --- a/nym-registration-client/src/builder/mod.rs +++ b/nym-registration-client/src/builder/mod.rs @@ -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 { 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 { - // 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 = - // 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 { + 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 = + 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 diff --git a/nym-registration-client/src/lib.rs b/nym-registration-client/src/lib.rs index 3ae9cb64fa..ca00e270a0 100644 --- a/nym-registration-client/src/lib.rs +++ b/nym-registration-client/src/lib.rs @@ -24,14 +24,14 @@ mod types; pub enum RegistrationClient { Mixnet(Box), - // Lp(Box), + Lp(Box), } impl RegistrationClient { pub async fn register(self) -> Result { match self { RegistrationClient::Mixnet(client) => client.register().await, - // RegistrationClient::Lp(client) => client.register().await, + RegistrationClient::Lp(client) => client.register().await, } } }