lp: attempt to negotiate (and use) protocol version (#6399)

This commit is contained in:
Jędrzej Stuczyński
2026-01-30 12:38:32 +00:00
committed by GitHub
parent dccdde108c
commit 8916b021a9
17 changed files with 441 additions and 110 deletions
+4 -1
View File
@@ -14,6 +14,7 @@ use nym_crypto::asymmetric::x25519;
use nym_http_api_client::UserAgent;
use nym_kkt_ciphersuite::SignatureScheme;
use nym_kkt_ciphersuite::{KEM, KEMKeyDigests};
use nym_lp::packet::version;
use nym_network_defaults::DEFAULT_NYM_NODE_HTTP_PORT;
use nym_node_requests::api::client::NymNodeApiClientExt;
use nym_node_requests::api::v1::node::models::AuxiliaryDetails as NodeAuxiliaryDetails;
@@ -28,7 +29,6 @@ use std::time::Duration;
use time::OffsetDateTime;
use tracing::{debug, info, warn};
use url::Url;
// in the old behaviour we were getting all skimmed nodes to retrieve performance
// that was ultimately unused
// should we want to use it again, the code is commented out below
@@ -135,6 +135,8 @@ impl DirectoryNode {
expected_kem_key_hashes: lp_data.kem_keys()?,
expected_signing_key_hashes: lp_data.signing_keys()?,
x25519: noise_key.x25519_pubkey,
// \/ TODO: proper derivation from build version
lp_version: version::CURRENT,
}),
_ => None,
};
@@ -480,6 +482,7 @@ pub struct TestedNodeLpDetails {
pub expected_kem_key_hashes: HashMap<KEM, KEMKeyDigests>,
pub expected_signing_key_hashes: HashMap<SignatureScheme, KEMKeyDigests>,
pub x25519: x25519::PublicKey,
pub lp_version: u8,
}
impl TestedNodeDetails {
+12 -2
View File
@@ -163,6 +163,7 @@ pub async fn lp_registration_probe(
bandwidth_controller: &dyn BandwidthTicketProvider,
) -> anyhow::Result<LpProbeResults> {
let lp_address = gateway_lp_data.address;
let lp_version = gateway_lp_data.lp_version;
let peer = helpers::to_lp_remote_peer(gateway_identity, gateway_lp_data);
info!("Starting LP registration probe for gateway at {lp_address}",);
@@ -180,6 +181,7 @@ pub async fn lp_registration_probe(
client_ed25519_keypair,
peer,
lp_address,
lp_version,
);
// Step 1: Perform handshake (connection is implicit in packet-per-connection model)
@@ -289,6 +291,9 @@ pub async fn wg_probe_lp(
let entry_address = entry_lp_data.address;
let exit_address = exit_lp_data.address;
let entry_lp_version = entry_lp_data.lp_version;
let exit_lp_version = exit_lp_data.lp_version;
let entry_ip = entry_address.ip();
let exit_ip = exit_address.ip();
@@ -316,6 +321,7 @@ pub async fn wg_probe_lp(
entry_lp_keypair,
entry_peer,
entry_address,
entry_lp_version,
);
// Perform handshake with entry gateway (connection is implicit)
@@ -327,8 +333,12 @@ pub async fn wg_probe_lp(
// STEP 2: Use nested session to register with exit gateway via forwarding
info!("Registering with exit gateway via entry forwarding...");
let mut nested_session =
NestedLpSession::new(exit_address.to_string(), exit_lp_keypair, exit_peer);
let mut nested_session = NestedLpSession::new(
exit_address.to_string(),
exit_lp_keypair,
exit_peer,
exit_lp_version,
);
// Convert exit gateway identity to ed25519 public key for registration
let exit_gateway_pubkey = ed25519::PublicKey::from_bytes(&exit_gateway.identity.to_bytes())
+3 -1
View File
@@ -317,6 +317,7 @@ pub(crate) async fn run() -> anyhow::Result<ProbeResult> {
expected_kem_key_hashes,
expected_signing_key_hashes: todo!(),
x25519: x25519_key,
lp_version: todo!(),
};
let entry_details = TestedNodeDetails::from_cli(identity, entry_lp_node);
@@ -348,8 +349,9 @@ pub(crate) async fn run() -> anyhow::Result<ProbeResult> {
let exit_lp_node = TestedNodeLpDetails {
address: exit_lp_addr,
expected_kem_key_hashes,
expected_signing_key_hashes: Default::default(),
expected_signing_key_hashes: todo!(),
x25519: x25519_key,
lp_version: todo!(),
};
Some(TestedNodeDetails::from_cli(identity, exit_lp_node))