From ca107d94360cdf8bbfbdb12fe5320ed74f80e40c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Wed, 22 Feb 2023 10:44:21 +0100 Subject: [PATCH] Change crate name to sphinx-packet (#91) * Change crate name to sphinx-packet * Update imports * rustfmt * Allow renamed and removed lints --- Cargo.toml | 2 +- benches/benchmarks.rs | 14 ++++++++------ src/crypto/keys.rs | 3 +++ tests/integration_test.rs | 24 ++++++++++++------------ 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cbb121e..a990396 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "sphinx" +name = "sphinx-packet" version = "0.1.0" authors = ["Ania Piotrowska ", "Dave Hrycyszyn ", "Jędrzej Stuczyński "] edition = "2018" diff --git a/benches/benchmarks.rs b/benches/benchmarks.rs index 49fb810..efe5f04 100644 --- a/benches/benchmarks.rs +++ b/benches/benchmarks.rs @@ -12,14 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -extern crate sphinx; +extern crate sphinx_packet; use criterion::{black_box, criterion_group, criterion_main, Criterion}; -use sphinx::constants::{DESTINATION_ADDRESS_LENGTH, IDENTIFIER_LENGTH, NODE_ADDRESS_LENGTH}; -use sphinx::crypto::keygen; -use sphinx::header::delays; -use sphinx::route::{Destination, DestinationAddressBytes, Node, NodeAddressBytes}; -use sphinx::SphinxPacket; +use sphinx_packet::constants::{ + DESTINATION_ADDRESS_LENGTH, IDENTIFIER_LENGTH, NODE_ADDRESS_LENGTH, +}; +use sphinx_packet::crypto::keygen; +use sphinx_packet::header::delays; +use sphinx_packet::route::{Destination, DestinationAddressBytes, Node, NodeAddressBytes}; +use sphinx_packet::SphinxPacket; use std::time::Duration; fn make_packet_copy(packet: &SphinxPacket) -> SphinxPacket { diff --git a/src/crypto/keys.rs b/src/crypto/keys.rs index 3575200..77dee4f 100644 --- a/src/crypto/keys.rs +++ b/src/crypto/keys.rs @@ -44,6 +44,9 @@ pub fn clamp_scalar_bytes(mut scalar_bytes: [u8; PRIVATE_KEY_SIZE]) -> Scalar { // derive zeroize::Zeroize on drop here pub struct PrivateKey(Scalar); +// Because the lint below was renamed in nightly but not in stable, making this problematic in CI +// which tests both, for a brief period we allow renamed lints. +#[allow(renamed_and_removed_lints)] // TODO: remove this in next version #[allow(clippy::derive_hash_xor_eq)] // TODO: we must be careful about that one if anything changes in the future #[derive(Copy, Clone, Debug, Hash)] pub struct PublicKey(MontgomeryPoint); diff --git a/tests/integration_test.rs b/tests/integration_test.rs index b79c139..3b336d1 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -12,20 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -extern crate sphinx; +extern crate sphinx_packet; -use sphinx::crypto; -use sphinx::header::delays; -use sphinx::route::{Destination, Node}; -use sphinx::SphinxPacket; +use sphinx_packet::crypto; +use sphinx_packet::header::delays; +use sphinx_packet::route::{Destination, Node}; +use sphinx_packet::SphinxPacket; // const PAYLOAD_SIZE: usize = 1024; #[cfg(test)] mod create_and_process_sphinx_packet { use super::*; - use sphinx::route::{DestinationAddressBytes, NodeAddressBytes}; - use sphinx::{ + use sphinx_packet::route::{DestinationAddressBytes, NodeAddressBytes}; + use sphinx_packet::{ constants::{ DESTINATION_ADDRESS_LENGTH, IDENTIFIER_LENGTH, NODE_ADDRESS_LENGTH, PAYLOAD_SIZE, SECURITY_PARAMETER, @@ -102,8 +102,8 @@ mod create_and_process_sphinx_packet { #[cfg(test)] mod converting_sphinx_packet_to_and_from_bytes { use super::*; - use sphinx::route::{DestinationAddressBytes, NodeAddressBytes}; - use sphinx::{ + use sphinx_packet::route::{DestinationAddressBytes, NodeAddressBytes}; + use sphinx_packet::{ constants::{ DESTINATION_ADDRESS_LENGTH, IDENTIFIER_LENGTH, NODE_ADDRESS_LENGTH, PAYLOAD_SIZE, SECURITY_PARAMETER, @@ -220,9 +220,9 @@ mod converting_sphinx_packet_to_and_from_bytes { mod create_and_process_surb { use super::*; use crypto::EphemeralSecret; - use sphinx::route::NodeAddressBytes; - use sphinx::surb::{SURBMaterial, SURB}; - use sphinx::{ + use sphinx_packet::route::NodeAddressBytes; + use sphinx_packet::surb::{SURBMaterial, SURB}; + use sphinx_packet::{ constants::{NODE_ADDRESS_LENGTH, PAYLOAD_SIZE, SECURITY_PARAMETER}, packet::builder::DEFAULT_PAYLOAD_SIZE, test_utils::fixtures::destination_fixture,