From 39609ecd688ccbb23bdb4ae21ef58fa61efb0d7b Mon Sep 17 00:00:00 2001 From: aniampio Date: Tue, 25 Oct 2022 23:18:54 +0100 Subject: [PATCH 1/6] Add acks for POINTER EU project to the README file --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ff50ef7..aad9485 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Unit + integration test coverage is currently well above 90%, please ensure that ### Benchmarks -To run benchmarks, use: +To run benchmarks, use: ``` cargo bench @@ -40,3 +40,8 @@ test tests::bench_process ... bench: 157.322 us/iter * `1000000 / 386.348` = ~2588 packet creations per second * `1000000 / 157.322` = ~6356 packet unwrappings per second + + +--- +This code has received partial funding from the Next Generation Internet POINTER programme of the European Commission, as part of the Horizon 2020 Research and Innovation Programme, under Grant Agreement Nº 871528. +--- From f387e353ad1232127e51d8484d75e987c7ea6ced Mon Sep 17 00:00:00 2001 From: aniampio Date: Tue, 25 Oct 2022 23:20:02 +0100 Subject: [PATCH 2/6] Update style --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index aad9485..fda22c7 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,5 @@ test tests::bench_process ... bench: 157.322 us/iter * `1000000 / 157.322` = ~6356 packet unwrappings per second ---- +### Acknowledgments This code has received partial funding from the Next Generation Internet POINTER programme of the European Commission, as part of the Horizon 2020 Research and Innovation Programme, under Grant Agreement Nº 871528. ---- From f1dff1592efe3e4f31b9ffa616bd886c6d3ce969 Mon Sep 17 00:00:00 2001 From: aniampio Date: Tue, 25 Oct 2022 23:27:40 +0100 Subject: [PATCH 3/6] Run clippy and fmt --- src/header/delays.rs | 2 +- src/header/filler.rs | 2 +- src/route.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/header/delays.rs b/src/header/delays.rs index 4f87d05..6f06b69 100644 --- a/src/header/delays.rs +++ b/src/header/delays.rs @@ -19,7 +19,7 @@ use std::{borrow::Borrow, time::Duration}; // TODO: once we get to proper refactoring, I think this should just be // a type alias to probably time::Duration -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct Delay(u64); impl Delay { diff --git a/src/header/filler.rs b/src/header/filler.rs index f6a82f5..2712f7a 100644 --- a/src/header/filler.rs +++ b/src/header/filler.rs @@ -19,7 +19,7 @@ use crate::{constants, utils}; pub const FILLER_STEP_SIZE_INCREASE: usize = NODE_META_INFO_SIZE + HEADER_INTEGRITY_MAC_SIZE; -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct Filler { value: Vec, } diff --git a/src/route.rs b/src/route.rs index 43c29d9..0177961 100644 --- a/src/route.rs +++ b/src/route.rs @@ -156,7 +156,7 @@ impl Display for NodeAddressBytes { // in paper I pub type SURBIdentifier = [u8; IDENTIFIER_LENGTH]; -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct Destination { // address in theory could be changed to a vec as it does not need to be strictly DESTINATION_ADDRESS_LENGTH long // but cannot be longer than that (assuming longest possible route) From 90878d602ddca3dce7087634052b93c3f0a5a880 Mon Sep 17 00:00:00 2001 From: aniampio Date: Tue, 25 Oct 2022 23:37:07 +0100 Subject: [PATCH 4/6] Fix suggestions from clippy --- src/header/routing/nodes.rs | 2 +- src/payload/mod.rs | 4 ++-- src/route.rs | 4 ++-- src/surb/mod.rs | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/header/routing/nodes.rs b/src/header/routing/nodes.rs index 31358ff..c0c7416 100644 --- a/src/header/routing/nodes.rs +++ b/src/header/routing/nodes.rs @@ -206,7 +206,7 @@ impl RawRoutingInformation { FINAL_HOP => Ok(self.parse_as_final_hop()), _ => Err(Error::new( ErrorKind::InvalidRouting, - format!("tried to parse unknown routing flag: {}", flag), + format!("tried to parse unknown routing flag: {flag}"), )), } } diff --git a/src/payload/mod.rs b/src/payload/mod.rs index e9e6153..3bb84c9 100644 --- a/src/payload/mod.rs +++ b/src/payload/mod.rs @@ -111,7 +111,7 @@ impl Payload { if let Err(err) = lioness_cipher.encrypt(&mut self.0) { return Err(Error::new( ErrorKind::InvalidPayload, - format!("error while encrypting payload - {}", err), + format!("error while encrypting payload - {err}"), )); }; Ok(self) @@ -127,7 +127,7 @@ impl Payload { if let Err(err) = lioness_cipher.decrypt(&mut self.0) { return Err(Error::new( ErrorKind::InvalidPayload, - format!("error while unwrapping payload - {}", err), + format!("error while unwrapping payload - {err}"), )); }; Ok(self) diff --git a/src/route.rs b/src/route.rs index 0177961..216019b 100644 --- a/src/route.rs +++ b/src/route.rs @@ -32,7 +32,7 @@ impl DestinationAddressBytes { Err(e) => { return Err(Error::new( ErrorKind::InvalidRouting, - format!("failed to decode destination from b58 string: {:?}", e), + format!("failed to decode destination from b58 string: {e:?}"), )) } }; @@ -100,7 +100,7 @@ impl NodeAddressBytes { Err(e) => { return Err(Error::new( ErrorKind::InvalidRouting, - format!("failed to decode node address from b58 string: {:?}", e), + format!("failed to decode node address from b58 string: {e:?}"), )) } }; diff --git a/src/surb/mod.rs b/src/surb/mod.rs index 7a88f57..c53d092 100644 --- a/src/surb/mod.rs +++ b/src/surb/mod.rs @@ -27,10 +27,10 @@ impl fmt::Debug for SURB { let formatted_keys = format!("{{ {} }}", formatted_keys_inner.join(", ")); write!( - f, - "SURB: {{ SURB_header: {:?}, first_hop_address: {:?}, payload_keys: {:?} }}", - self.SURB_header, self.first_hop_address, formatted_keys - ) + f, + "SURB: {{ SURB_header: {:?}, first_hop_address: {:?}, payload_keys: {formatted_keys:?} }}", + 32 ~ self.SURB_header, self.first_hop_address + ) } } From b26378b66f36f3ebd02cc1eec9ed19dd0d750954 Mon Sep 17 00:00:00 2001 From: aniampio Date: Tue, 25 Oct 2022 23:39:58 +0100 Subject: [PATCH 5/6] Fix typo --- src/surb/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/surb/mod.rs b/src/surb/mod.rs index c53d092..7a88f57 100644 --- a/src/surb/mod.rs +++ b/src/surb/mod.rs @@ -27,10 +27,10 @@ impl fmt::Debug for SURB { let formatted_keys = format!("{{ {} }}", formatted_keys_inner.join(", ")); write!( - f, - "SURB: {{ SURB_header: {:?}, first_hop_address: {:?}, payload_keys: {formatted_keys:?} }}", - 32 ~ self.SURB_header, self.first_hop_address - ) + f, + "SURB: {{ SURB_header: {:?}, first_hop_address: {:?}, payload_keys: {:?} }}", + self.SURB_header, self.first_hop_address, formatted_keys + ) } } From 1bee1be5b04285a1472b0f04aa757fbde69c3f4c Mon Sep 17 00:00:00 2001 From: aniampio Date: Tue, 25 Oct 2022 23:45:26 +0100 Subject: [PATCH 6/6] Change string formatting (required by clippy) --- src/surb/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/surb/mod.rs b/src/surb/mod.rs index 7a88f57..dfe3e36 100644 --- a/src/surb/mod.rs +++ b/src/surb/mod.rs @@ -28,8 +28,8 @@ impl fmt::Debug for SURB { write!( f, - "SURB: {{ SURB_header: {:?}, first_hop_address: {:?}, payload_keys: {:?} }}", - self.SURB_header, self.first_hop_address, formatted_keys + "SURB: {{ SURB_header: {:?}, first_hop_address: {:?}, payload_keys: {formatted_keys:?} }}", + self.SURB_header, self.first_hop_address ) } }