From 5ad1f0b61a858c1ab94b490736e1b729ac1f9e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Fri, 25 Apr 2025 11:02:32 +0200 Subject: [PATCH 1/3] add reserved byte to reply surb serialisation (#5731) --- .../anonymous-replies/src/reply_surb.rs | 7 ------- .../anonymous-replies/src/requests/v2.rs | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/common/nymsphinx/anonymous-replies/src/reply_surb.rs b/common/nymsphinx/anonymous-replies/src/reply_surb.rs index a9e7dc76a1..821c0c022b 100644 --- a/common/nymsphinx/anonymous-replies/src/reply_surb.rs +++ b/common/nymsphinx/anonymous-replies/src/reply_surb.rs @@ -9,7 +9,6 @@ use nym_sphinx_addressing::nodes::{ }; use nym_sphinx_params::packet_sizes::PacketSize; use nym_sphinx_params::{PacketType, ReplySurbKeyDigestAlgorithm}; -use nym_sphinx_types::constants::PAYLOAD_KEY_SEED_SIZE; use nym_sphinx_types::{ NymPacket, SURBMaterial, SphinxError, HEADER_SIZE, NODE_ADDRESS_LENGTH, SURB, X25519_WITH_EXPLICIT_PAYLOAD_KEYS_VERSION, @@ -127,12 +126,6 @@ impl ReplySurb { }) } - /// Returns the expected number of bytes the [`ReplySURB`] will take after serialization using the new encoding format. - /// Useful for deserialization from a bytes stream. - pub fn v2_serialised_len(num_hops: u8) -> usize { - Self::BASE_OVERHEAD + num_hops as usize * PAYLOAD_KEY_SEED_SIZE - } - pub fn encryption_key(&self) -> &SurbEncryptionKey { &self.encryption_key } diff --git a/common/nymsphinx/anonymous-replies/src/requests/v2.rs b/common/nymsphinx/anonymous-replies/src/requests/v2.rs index 813fabc276..6d624455d9 100644 --- a/common/nymsphinx/anonymous-replies/src/requests/v2.rs +++ b/common/nymsphinx/anonymous-replies/src/requests/v2.rs @@ -32,24 +32,28 @@ fn v2_reply_surbs_serialised_len(surbs: &[ReplySurb]) -> usize { } } - // when serialising surbs are always prepended with u16-encoded count an u8-encoded number of hops - 3 + num_surbs * v2_reply_surb_serialised_len(num_hops) + // when serialising surbs are always prepended with: + // - u16-encoded count, + // - u8-encoded number of hops + // - u8 reserved value + 4 + num_surbs * v2_reply_surb_serialised_len(num_hops) } -// NUM_SURBS (u16) || HOPS (u8) || SURB_DATA +// NUM_SURBS (u16) || HOPS (u8) || RESERVED (u8) || SURB_DATA fn recover_reply_surbs_v2( bytes: &[u8], ) -> Result<(Vec, usize), InvalidReplyRequestError> { - if bytes.len() < 2 { + if bytes.len() < 4 { return Err(InvalidReplyRequestError::RequestTooShortToDeserialize); } // we're not attaching more than 65k surbs... let num_surbs = u16::from_be_bytes([bytes[0], bytes[1]]); let num_hops = bytes[2]; - let mut consumed = 3; + let _reserved = bytes[3]; + let mut consumed = 4; - let surb_size = ReplySurb::v2_serialised_len(num_hops); + let surb_size = v2_reply_surb_serialised_len(num_hops); if bytes[consumed..].len() < num_surbs as usize * surb_size { return Err(InvalidReplyRequestError::RequestTooShortToDeserialize); } @@ -69,11 +73,13 @@ fn recover_reply_surbs_v2( fn reply_surbs_bytes_v2(reply_surbs: &[ReplySurb]) -> impl Iterator + use<'_> { let num_surbs = reply_surbs.len() as u16; let num_hops = reply_surbs_hops(reply_surbs); + let reserved = 0; num_surbs .to_be_bytes() .into_iter() .chain(once(num_hops)) + .chain(once(reserved)) .chain(reply_surbs.iter().flat_map(|surb| surb.to_bytes())) } From 9c2595d9ef45ff27623ab0a57d732817fed81b35 Mon Sep 17 00:00:00 2001 From: benedettadavico Date: Fri, 25 Apr 2025 15:47:20 +0200 Subject: [PATCH 2/3] bump versions --- Cargo.lock | 12 ++++++------ clients/native/Cargo.toml | 2 +- clients/socks5/Cargo.toml | 2 +- nym-api/Cargo.toml | 2 +- nym-node/Cargo.toml | 2 +- service-providers/network-requester/Cargo.toml | 2 +- tools/nym-cli/Cargo.toml | 2 +- tools/nymvisor/Cargo.toml | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6b0225f947..b33bc19a31 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4987,7 +4987,7 @@ dependencies = [ [[package]] name = "nym-cli" -version = "1.1.53" +version = "1.1.54" dependencies = [ "anyhow", "base64 0.22.1", @@ -5070,7 +5070,7 @@ dependencies = [ [[package]] name = "nym-client" -version = "1.1.53" +version = "1.1.54" dependencies = [ "bs58", "clap", @@ -6068,7 +6068,7 @@ dependencies = [ [[package]] name = "nym-network-requester" -version = "1.1.54" +version = "1.1.55" dependencies = [ "addr", "anyhow", @@ -6119,7 +6119,7 @@ dependencies = [ [[package]] name = "nym-node" -version = "1.9.0" +version = "1.10.0" dependencies = [ "anyhow", "arc-swap", @@ -6513,7 +6513,7 @@ dependencies = [ [[package]] name = "nym-socks5-client" -version = "1.1.53" +version = "1.1.54" dependencies = [ "bs58", "clap", @@ -7117,7 +7117,7 @@ dependencies = [ [[package]] name = "nymvisor" -version = "0.1.18" +version = "0.1.19" dependencies = [ "anyhow", "bytes", diff --git a/clients/native/Cargo.toml b/clients/native/Cargo.toml index a626cc874a..eb788f7aa8 100644 --- a/clients/native/Cargo.toml +++ b/clients/native/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nym-client" -version = "1.1.53" +version = "1.1.54" authors = ["Dave Hrycyszyn ", "Jędrzej Stuczyński "] description = "Implementation of the Nym Client" edition = "2021" diff --git a/clients/socks5/Cargo.toml b/clients/socks5/Cargo.toml index 94ed60ecf0..d6592b77ca 100644 --- a/clients/socks5/Cargo.toml +++ b/clients/socks5/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nym-socks5-client" -version = "1.1.53" +version = "1.1.54" authors = ["Dave Hrycyszyn "] description = "A SOCKS5 localhost proxy that converts incoming messages to Sphinx and sends them to a Nym address" edition = "2021" diff --git a/nym-api/Cargo.toml b/nym-api/Cargo.toml index 2470440442..4a8856b45e 100644 --- a/nym-api/Cargo.toml +++ b/nym-api/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "nym-api" license = "GPL-3.0" -version = "1.1.55" +version = "1.1.56" authors.workspace = true edition = "2021" rust-version.workspace = true diff --git a/nym-node/Cargo.toml b/nym-node/Cargo.toml index 96fc4667be..cad6aabe34 100644 --- a/nym-node/Cargo.toml +++ b/nym-node/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "nym-node" -version = "1.9.0" +version = "1.10.0" authors.workspace = true repository.workspace = true homepage.workspace = true diff --git a/service-providers/network-requester/Cargo.toml b/service-providers/network-requester/Cargo.toml index aece5f7091..ef44ea1197 100644 --- a/service-providers/network-requester/Cargo.toml +++ b/service-providers/network-requester/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "nym-network-requester" license = "GPL-3.0" -version = "1.1.54" +version = "1.1.55" authors.workspace = true edition.workspace = true rust-version = "1.70" diff --git a/tools/nym-cli/Cargo.toml b/tools/nym-cli/Cargo.toml index c255f53fcf..4df9ddd361 100644 --- a/tools/nym-cli/Cargo.toml +++ b/tools/nym-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nym-cli" -version = "1.1.53" +version = "1.1.54" authors.workspace = true edition = "2021" license.workspace = true diff --git a/tools/nymvisor/Cargo.toml b/tools/nymvisor/Cargo.toml index 54bf2ff786..6dce2d7112 100644 --- a/tools/nymvisor/Cargo.toml +++ b/tools/nymvisor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nymvisor" -version = "0.1.18" +version = "0.1.19" authors.workspace = true repository.workspace = true homepage.workspace = true From e594630314d4676cbe9bba9ab07bd405a9cf679a Mon Sep 17 00:00:00 2001 From: benedettadavico Date: Tue, 29 Apr 2025 12:19:54 +0200 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd16457c60..452d8c4eb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,40 @@ Post 1.0.0 release, the changelog format is based on [Keep a Changelog](https:// ## [Unreleased] +## [2025.8-tourist] (2025-04-29) + +- add reserved byte to reply surb serialisation ([#5731]) +- Remove inactive peers ([#5721]) +- Update Hickory DNS "0.24.4" to "0.25" ([#5709]) +- build(deps): bump the patch-updates group across 1 directory with 7 updates ([#5708]) +- Peer handle should die more gracefully ([#5704]) +- build(deps): bump crossbeam-channel from 0.5.14 to 0.5.15 ([#5702]) +- build(deps): bump actions/checkout from 3 to 4 ([#5700]) +- Feature/updated sphinx payload keys ([#5698]) +- Bump the nym-vpn deb metapackage to 1.0 ([#5697]) +- Make mix hops optional for Mixnet Client ([#5696]) +- build(deps): bump tokio from 1.44.1 to 1.44.2 ([#5693]) +- Feature/replay protection ([#5682]) +- Adding fresh nym-api tests and workflow ([#5659]) +- build(deps): bump next from 14.2.21 to 14.2.25 ([#5655]) +- build(deps): bump pnpm/action-setup from 4.0.0 to 4.1.0 ([#5436]) + +[#5731]: https://github.com/nymtech/nym/pull/5731 +[#5721]: https://github.com/nymtech/nym/pull/5721 +[#5709]: https://github.com/nymtech/nym/pull/5709 +[#5708]: https://github.com/nymtech/nym/pull/5708 +[#5704]: https://github.com/nymtech/nym/pull/5704 +[#5702]: https://github.com/nymtech/nym/pull/5702 +[#5700]: https://github.com/nymtech/nym/pull/5700 +[#5698]: https://github.com/nymtech/nym/pull/5698 +[#5697]: https://github.com/nymtech/nym/pull/5697 +[#5696]: https://github.com/nymtech/nym/pull/5696 +[#5693]: https://github.com/nymtech/nym/pull/5693 +[#5682]: https://github.com/nymtech/nym/pull/5682 +[#5659]: https://github.com/nymtech/nym/pull/5659 +[#5655]: https://github.com/nymtech/nym/pull/5655 +[#5436]: https://github.com/nymtech/nym/pull/5436 + ## [2025.7-tex] (2025-04-14) - Expand /v3/nym-nodes with geodata ([#5686])