diff --git a/Cargo.lock b/Cargo.lock index e83e38a1..07997288 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -56,16 +56,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" -[[package]] -name = "async-buffer" -version = "0.1.0" -dependencies = [ - "futures", - "pin-project", - "thiserror", - "tokio", -] - [[package]] name = "async-lock" version = "3.4.0" @@ -469,12 +459,32 @@ dependencies = [ ] [[package]] -name = "cryptonight-cuprate" +name = "cuprate-address-book" version = "0.1.0" dependencies = [ - "cc", - "hex", + "borsh", + "cuprate-p2p-core", + "cuprate-pruning", + "cuprate-test-utils", + "cuprate-wire", + "futures", + "indexmap 2.2.6", + "rand", "thiserror", + "tokio", + "tokio-util", + "tower", + "tracing", +] + +[[package]] +name = "cuprate-async-buffer" +version = "0.1.0" +dependencies = [ + "futures", + "pin-project", + "thiserror", + "tokio", ] [[package]] @@ -487,6 +497,7 @@ dependencies = [ "cfg-if", "crossbeam", "cuprate-helper", + "cuprate-pruning", "cuprate-test-utils", "cuprate-types", "curve25519-dalek", @@ -494,7 +505,6 @@ dependencies = [ "heed", "hex", "hex-literal", - "monero-pruning", "monero-serai", "page_size", "paste", @@ -542,7 +552,7 @@ name = "cuprate-consensus-rules" version = "0.1.0" dependencies = [ "crypto-bigint", - "cryptonight-cuprate", + "cuprate-cryptonight", "cuprate-helper", "curve25519-dalek", "dalek-ff-group", @@ -559,6 +569,46 @@ dependencies = [ "tracing", ] +[[package]] +name = "cuprate-cryptonight" +version = "0.1.0" +dependencies = [ + "cc", + "hex", + "thiserror", +] + +[[package]] +name = "cuprate-dandelion-tower" +version = "0.1.0" +dependencies = [ + "futures", + "proptest", + "rand", + "rand_distr", + "thiserror", + "tokio", + "tokio-util", + "tower", + "tracing", +] + +[[package]] +name = "cuprate-database" +version = "0.0.0" + +[[package]] +name = "cuprate-epee-encoding" +version = "0.5.0" +dependencies = [ + "bytes", + "cuprate-fixed-bytes", + "hex", + "paste", + "ref-cast", + "thiserror", +] + [[package]] name = "cuprate-fast-sync" version = "0.1.0" @@ -579,6 +629,14 @@ dependencies = [ "tower", ] +[[package]] +name = "cuprate-fixed-bytes" +version = "0.1.0" +dependencies = [ + "bytes", + "thiserror", +] + [[package]] name = "cuprate-helper" version = "0.1.0" @@ -594,24 +652,49 @@ dependencies = [ "windows", ] +[[package]] +name = "cuprate-json-rpc" +version = "0.0.0" +dependencies = [ + "pretty_assertions", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cuprate-levin" +version = "0.1.0" +dependencies = [ + "bitflags 2.5.0", + "bytes", + "futures", + "proptest", + "rand", + "thiserror", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "cuprate-p2p" version = "0.1.0" dependencies = [ - "async-buffer", "bytes", + "cuprate-address-book", + "cuprate-async-buffer", + "cuprate-fixed-bytes", "cuprate-helper", + "cuprate-p2p-core", + "cuprate-pruning", "cuprate-test-utils", + "cuprate-wire", "dashmap", - "fixed-bytes", "futures", "hex", "indexmap 2.2.6", - "monero-address-book", - "monero-p2p", - "monero-pruning", "monero-serai", - "monero-wire", "pin-project", "proptest", "rand", @@ -626,10 +709,43 @@ dependencies = [ "tracing", ] +[[package]] +name = "cuprate-p2p-core" +version = "0.1.0" +dependencies = [ + "async-trait", + "borsh", + "cuprate-helper", + "cuprate-pruning", + "cuprate-test-utils", + "cuprate-wire", + "futures", + "hex", + "thiserror", + "tokio", + "tokio-stream", + "tokio-util", + "tower", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "cuprate-pruning" +version = "0.1.0" +dependencies = [ + "borsh", + "thiserror", +] + [[package]] name = "cuprate-rpc-interface" version = "0.0.0" +[[package]] +name = "cuprate-rpc-types" +version = "0.0.0" + [[package]] name = "cuprate-test-utils" version = "0.1.0" @@ -638,13 +754,13 @@ dependencies = [ "borsh", "bytes", "cuprate-helper", + "cuprate-p2p-core", "cuprate-types", + "cuprate-wire", "futures", "hex", "hex-literal", - "monero-p2p", "monero-serai", - "monero-wire", "pretty_assertions", "serde", "serde_json", @@ -665,6 +781,19 @@ dependencies = [ "monero-serai", ] +[[package]] +name = "cuprate-wire" +version = "0.1.0" +dependencies = [ + "bitflags 2.5.0", + "bytes", + "cuprate-epee-encoding", + "cuprate-fixed-bytes", + "cuprate-levin", + "hex", + "thiserror", +] + [[package]] name = "curve25519-dalek" version = "4.1.3" @@ -710,21 +839,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "dandelion-tower" -version = "0.1.0" -dependencies = [ - "futures", - "proptest", - "rand", - "rand_distr", - "thiserror", - "tokio", - "tokio-util", - "tower", - "tracing", -] - [[package]] name = "dashmap" version = "5.5.3" @@ -738,10 +852,6 @@ dependencies = [ "parking_lot_core", ] -[[package]] -name = "database" -version = "0.0.0" - [[package]] name = "diff" version = "0.1.13" @@ -808,18 +918,6 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" -[[package]] -name = "epee-encoding" -version = "0.5.0" -dependencies = [ - "bytes", - "fixed-bytes", - "hex", - "paste", - "ref-cast", - "thiserror", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -880,14 +978,6 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" -[[package]] -name = "fixed-bytes" -version = "0.1.0" -dependencies = [ - "bytes", - "thiserror", -] - [[package]] name = "flexible-transcript" version = "0.3.2" @@ -1299,16 +1389,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "json-rpc" -version = "0.0.0" -dependencies = [ - "pretty_assertions", - "serde", - "serde_json", - "thiserror", -] - [[package]] name = "keccak" version = "0.1.5" @@ -1324,21 +1404,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "levin-cuprate" -version = "0.1.0" -dependencies = [ - "bitflags 2.5.0", - "bytes", - "futures", - "proptest", - "rand", - "thiserror", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "libc" version = "0.2.155" @@ -1442,25 +1507,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "monero-address-book" -version = "0.1.0" -dependencies = [ - "borsh", - "cuprate-test-utils", - "futures", - "indexmap 2.2.6", - "monero-p2p", - "monero-pruning", - "monero-wire", - "rand", - "thiserror", - "tokio", - "tokio-util", - "tower", - "tracing", -] - [[package]] name = "monero-generators" version = "0.4.0" @@ -1474,39 +1520,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "monero-p2p" -version = "0.1.0" -dependencies = [ - "async-trait", - "borsh", - "cuprate-helper", - "cuprate-test-utils", - "futures", - "hex", - "monero-pruning", - "monero-wire", - "thiserror", - "tokio", - "tokio-stream", - "tokio-util", - "tower", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "monero-pruning" -version = "0.1.0" -dependencies = [ - "borsh", - "thiserror", -] - -[[package]] -name = "monero-rpc-types" -version = "0.0.0" - [[package]] name = "monero-serai" version = "0.1.4-alpha" @@ -1540,19 +1553,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "monero-wire" -version = "0.1.0" -dependencies = [ - "bitflags 2.5.0", - "bytes", - "epee-encoding", - "fixed-bytes", - "hex", - "levin-cuprate", - "thiserror", -] - [[package]] name = "multiexp" version = "0.4.0" diff --git a/Cargo.toml b/Cargo.toml index 7be28732..8891b83b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,21 +10,21 @@ members = [ "net/epee-encoding", "net/fixed-bytes", "net/levin", - "net/monero-wire", - "p2p/cuprate-p2p", - "p2p/dandelion", - "p2p/monero-p2p", + "net/wire", + "p2p/p2p", + "p2p/p2p-core", + "p2p/dandelion-tower", "p2p/async-buffer", "p2p/address-book", - "storage/cuprate-blockchain", - "storage/cuprate-txpool", + "storage/blockchain", + "storage/txpool", "storage/database", "pruning", "test-utils", "types", "rpc/json-rpc", - "rpc/monero-rpc-types", - "rpc/cuprate-rpc-interface", + "rpc/rpc-types", + "rpc/rpc-interface", ] [profile.release] diff --git a/consensus/fast-sync/Cargo.toml b/consensus/fast-sync/Cargo.toml index 3a0754a3..32fce11d 100644 --- a/consensus/fast-sync/Cargo.toml +++ b/consensus/fast-sync/Cargo.toml @@ -10,7 +10,7 @@ path = "src/create.rs" [dependencies] clap = { workspace = true, features = ["derive", "std"] } -cuprate-blockchain = { path = "../../storage/cuprate-blockchain" } +cuprate-blockchain = { path = "../../storage/blockchain" } cuprate-consensus = { path = ".." } cuprate-consensus-rules = { path = "../rules" } cuprate-types = { path = "../../types" } diff --git a/consensus/rules/Cargo.toml b/consensus/rules/Cargo.toml index 0b8c35db..fd86a61e 100644 --- a/consensus/rules/Cargo.toml +++ b/consensus/rules/Cargo.toml @@ -12,7 +12,7 @@ rayon = ["dep:rayon"] [dependencies] cuprate-helper = { path = "../../helper", default-features = false, features = ["std"] } -cryptonight-cuprate = {path = "../../cryptonight"} +cuprate-cryptonight = {path = "../../cryptonight"} monero-serai = { workspace = true, features = ["std"] } multiexp = { workspace = true, features = ["std", "batch"] } diff --git a/consensus/rules/src/blocks.rs b/consensus/rules/src/blocks.rs index 8e1b345e..cb0e3e45 100644 --- a/consensus/rules/src/blocks.rs +++ b/consensus/rules/src/blocks.rs @@ -3,7 +3,7 @@ use std::collections::HashSet; use crypto_bigint::{CheckedMul, U256}; use monero_serai::block::Block; -use cryptonight_cuprate::*; +use cuprate_cryptonight::*; use crate::{ current_unix_timestamp, diff --git a/cryptonight/Cargo.toml b/cryptonight/Cargo.toml index 7cd1cd41..e2701142 100644 --- a/cryptonight/Cargo.toml +++ b/cryptonight/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "cryptonight-cuprate" +name = "cuprate-cryptonight" version = "0.1.0" edition = "2021" description = "A wrapper around Monero's CryptoNight hash function." diff --git a/net/epee-encoding/Cargo.toml b/net/epee-encoding/Cargo.toml index 8bae8579..7feac004 100644 --- a/net/epee-encoding/Cargo.toml +++ b/net/epee-encoding/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "epee-encoding" +name = "cuprate-epee-encoding" version = "0.5.0" edition = "2021" license = "MIT" @@ -12,10 +12,10 @@ rust-version = "1.60" [features] default = ["std"] -std = ["dep:thiserror", "bytes/std", "fixed-bytes/std"] +std = ["dep:thiserror", "bytes/std", "cuprate-fixed-bytes/std"] [dependencies] -fixed-bytes = { path = "../fixed-bytes", default-features = false } +cuprate-fixed-bytes = { path = "../fixed-bytes", default-features = false } paste = "1.0.14" ref-cast = "1.0.22" diff --git a/net/epee-encoding/src/lib.rs b/net/epee-encoding/src/lib.rs index 92046d32..5b64315e 100644 --- a/net/epee-encoding/src/lib.rs +++ b/net/epee-encoding/src/lib.rs @@ -8,7 +8,7 @@ //! //! example without macro: //! ```rust -//! # use epee_encoding::{EpeeObject, EpeeObjectBuilder, read_epee_value, write_field, to_bytes, from_bytes}; +//! # use cuprate_epee_encoding::{EpeeObject, EpeeObjectBuilder, read_epee_value, write_field, to_bytes, from_bytes}; //! # use bytes::{Buf, BufMut}; //! //! pub struct Test { @@ -21,7 +21,7 @@ //! } //! //! impl EpeeObjectBuilder for __TestEpeeBuilder { -//! fn add_field(&mut self, name: &str, r: &mut B) -> epee_encoding::error::Result { +//! fn add_field(&mut self, name: &str, r: &mut B) -> cuprate_epee_encoding::error::Result { //! match name { //! "val" => {self.val = Some(read_epee_value(r)?);} //! _ => return Ok(false), @@ -29,10 +29,10 @@ //! Ok(true) //! } //! -//! fn finish(self) -> epee_encoding::error::Result { +//! fn finish(self) -> cuprate_epee_encoding::error::Result { //! Ok( //! Test { -//! val: self.val.ok_or_else(|| epee_encoding::error::Error::Format("Required field was not found!"))? +//! val: self.val.ok_or_else(|| cuprate_epee_encoding::error::Error::Format("Required field was not found!"))? //! } //! ) //! } @@ -45,7 +45,7 @@ //! 1 //! } //! -//! fn write_fields(self, w: &mut B) -> epee_encoding::error::Result<()> { +//! fn write_fields(self, w: &mut B) -> cuprate_epee_encoding::error::Result<()> { //! // write the fields //! write_field(self.val, "val", w) //! } @@ -233,7 +233,7 @@ fn write_epee_value(val: T, w: &mut B) -> Result<()> { /// let t: [u8; 8] = [3, 0, 0, 0, 1, 0, 0, 0]; /// let mut w = vec![]; /// -/// epee_encoding::write_bytes(t, &mut w).unwrap(); +/// cuprate_epee_encoding::write_bytes(t, &mut w).unwrap(); /// /// assert_eq!(w.len(), 9); // length of bytes + bytes /// assert_eq!(w[1..], t); @@ -274,7 +274,7 @@ pub fn write_bytes, B: BufMut>(t: T, w: &mut B) -> Result<()> { /// let mut w = vec![]; /// /// let iter: std::vec::IntoIter = vec.into_iter(); -/// epee_encoding::write_iterator(iter, &mut w).unwrap(); +/// cuprate_epee_encoding::write_iterator(iter, &mut w).unwrap(); /// /// assert_eq!(w.len(), 17); /// assert_eq!(w[1..9], [3, 0, 0, 0, 0, 0, 0, 0]); diff --git a/net/epee-encoding/src/macros.rs b/net/epee-encoding/src/macros.rs index 1ec0446e..38dcc45d 100644 --- a/net/epee-encoding/src/macros.rs +++ b/net/epee-encoding/src/macros.rs @@ -10,7 +10,7 @@ pub use paste::paste; /// // see: /// mod visibility { /// -/// use epee_encoding::epee_object; +/// use cuprate_epee_encoding::epee_object; /// /// struct Example { /// a: u8 @@ -30,7 +30,7 @@ pub use paste::paste; /// // see: /// mod visibility { /// -/// use epee_encoding::epee_object; +/// use cuprate_epee_encoding::epee_object; /// /// struct Example { /// a: u8, @@ -60,7 +60,7 @@ pub use paste::paste; /// c: u8 as u8, /// // `=> read_fn, write_fn, should_write_fn,` allows you to specify alt field encoding functions. /// // for the required args see the default functions, which are used here: -/// d: u8 => epee_encoding::read_epee_value, epee_encoding::write_field, ::should_write, +/// d: u8 => cuprate_epee_encoding::read_epee_value, cuprate_epee_encoding::write_field, ::should_write, /// // `!flatten` can be used on fields which are epee objects, and it flattens the fields of that object into this object. /// // So for this example `e_f` will not appear in the data but e will. /// // You can't use the other options with this. @@ -126,25 +126,25 @@ macro_rules! epee_object { $(!flatten: $flat_field: ident: $flat_ty:ty ,)* ) => { - epee_encoding::macros::paste!( + cuprate_epee_encoding::macros::paste!( #[allow(non_snake_case)] mod [<__epee_builder_ $obj>] { use super::*; #[derive(Default)] pub struct [<__Builder $obj>] { - $($field: Option,)* - $($flat_field: <$flat_ty as epee_encoding::EpeeObject>::Builder,)* + $($field: Option,)* + $($flat_field: <$flat_ty as cuprate_epee_encoding::EpeeObject>::Builder,)* } - impl epee_encoding::EpeeObjectBuilder<$obj> for [<__Builder $obj>] { - fn add_field(&mut self, name: &str, b: &mut B) -> epee_encoding::error::Result { + impl cuprate_epee_encoding::EpeeObjectBuilder<$obj> for [<__Builder $obj>] { + fn add_field(&mut self, name: &str, b: &mut B) -> cuprate_epee_encoding::error::Result { match name { - $(epee_encoding::epee_object!(@internal_field_name $field, $($alt_name)?) => { + $(cuprate_epee_encoding::epee_object!(@internal_field_name $field, $($alt_name)?) => { if core::mem::replace(&mut self.$field, Some( - epee_encoding::epee_object!(@internal_try_right_then_left epee_encoding::read_epee_value(b)?, $($read_fn(b)?)?) + cuprate_epee_encoding::epee_object!(@internal_try_right_then_left cuprate_epee_encoding::read_epee_value(b)?, $($read_fn(b)?)?) )).is_some() { - Err(epee_encoding::error::Error::Value(format!("Duplicate field in data: {}", epee_encoding::epee_object!(@internal_field_name$field, $($alt_name)?))))?; + Err(cuprate_epee_encoding::error::Error::Value(format!("Duplicate field in data: {}", cuprate_epee_encoding::epee_object!(@internal_field_name$field, $($alt_name)?))))?; } Ok(true) },)* @@ -159,12 +159,12 @@ macro_rules! epee_object { } } - fn finish(self) -> epee_encoding::error::Result<$obj> { + fn finish(self) -> cuprate_epee_encoding::error::Result<$obj> { Ok( $obj { $( $field: { - let epee_default_value = epee_encoding::epee_object!(@internal_try_right_then_left epee_encoding::EpeeValue::epee_default_value(), $({ + let epee_default_value = cuprate_epee_encoding::epee_object!(@internal_try_right_then_left cuprate_epee_encoding::EpeeValue::epee_default_value(), $({ let _ = $should_write_fn; None })?); @@ -173,7 +173,7 @@ macro_rules! epee_object { $(.or(Some($default)))? .or(epee_default_value) $(.map(<$ty_as>::into))? - .ok_or(epee_encoding::error::Error::Value(format!("Missing field in data: {}", epee_encoding::epee_object!(@internal_field_name$field, $($alt_name)?))))? + .ok_or(cuprate_epee_encoding::error::Error::Value(format!("Missing field in data: {}", cuprate_epee_encoding::epee_object!(@internal_field_name$field, $($alt_name)?))))? }, )* @@ -187,16 +187,16 @@ macro_rules! epee_object { } } - impl epee_encoding::EpeeObject for $obj { + impl cuprate_epee_encoding::EpeeObject for $obj { type Builder = [<__epee_builder_ $obj>]::[<__Builder $obj>]; fn number_of_fields(&self) -> u64 { let mut fields = 0; $( - let field = epee_encoding::epee_object!(@internal_try_right_then_left &self.$field, $(<&$ty_as>::from(&self.$field))? ); + let field = cuprate_epee_encoding::epee_object!(@internal_try_right_then_left &self.$field, $(<&$ty_as>::from(&self.$field))? ); - if $((field) != &$default &&)? epee_encoding::epee_object!(@internal_try_right_then_left epee_encoding::EpeeValue::should_write, $($should_write_fn)?)(field ) + if $((field) != &$default &&)? cuprate_epee_encoding::epee_object!(@internal_try_right_then_left cuprate_epee_encoding::EpeeValue::should_write, $($should_write_fn)?)(field ) { fields += 1; } @@ -209,13 +209,13 @@ macro_rules! epee_object { fields } - fn write_fields(self, w: &mut B) -> epee_encoding::error::Result<()> { + fn write_fields(self, w: &mut B) -> cuprate_epee_encoding::error::Result<()> { $( - let field = epee_encoding::epee_object!(@internal_try_right_then_left self.$field, $(<$ty_as>::from(self.$field))? ); + let field = cuprate_epee_encoding::epee_object!(@internal_try_right_then_left self.$field, $(<$ty_as>::from(self.$field))? ); - if $(field != $default &&)? epee_encoding::epee_object!(@internal_try_right_then_left epee_encoding::EpeeValue::should_write, $($should_write_fn)?)(&field ) + if $(field != $default &&)? cuprate_epee_encoding::epee_object!(@internal_try_right_then_left cuprate_epee_encoding::EpeeValue::should_write, $($should_write_fn)?)(&field ) { - epee_encoding::epee_object!(@internal_try_right_then_left epee_encoding::write_field, $($write_fn)?)((field), epee_encoding::epee_object!(@internal_field_name$field, $($alt_name)?), w)?; + cuprate_epee_encoding::epee_object!(@internal_try_right_then_left cuprate_epee_encoding::write_field, $($write_fn)?)((field), cuprate_epee_encoding::epee_object!(@internal_field_name$field, $($alt_name)?), w)?; } )* diff --git a/net/epee-encoding/src/value.rs b/net/epee-encoding/src/value.rs index 0dcd45a8..094f0ef1 100644 --- a/net/epee-encoding/src/value.rs +++ b/net/epee-encoding/src/value.rs @@ -6,7 +6,7 @@ use core::fmt::Debug; use bytes::{Buf, BufMut, Bytes, BytesMut}; -use fixed_bytes::{ByteArray, ByteArrayVec}; +use cuprate_fixed_bytes::{ByteArray, ByteArrayVec}; use crate::{ io::{checked_read_primitive, checked_write_primitive}, diff --git a/net/epee-encoding/src/varint.rs b/net/epee-encoding/src/varint.rs index e574ba85..ae9c5697 100644 --- a/net/epee-encoding/src/varint.rs +++ b/net/epee-encoding/src/varint.rs @@ -10,7 +10,7 @@ const FITS_IN_FOUR_BYTES: u64 = 2_u64.pow(32 - SIZE_OF_SIZE_MARKER) - 1; /// Read an epee variable sized number from `r`. /// /// ```rust -/// use epee_encoding::read_varint; +/// use cuprate_epee_encoding::read_varint; /// /// assert_eq!(read_varint(&mut [252].as_slice()).unwrap(), 63); /// assert_eq!(read_varint(&mut [1, 1].as_slice()).unwrap(), 64); @@ -41,7 +41,7 @@ pub fn read_varint(r: &mut B) -> Result { /// Write an epee variable sized number into `w`. /// /// ```rust -/// use epee_encoding::write_varint; +/// use cuprate_epee_encoding::write_varint; /// /// let mut buf = vec![]; /// diff --git a/net/epee-encoding/tests/alt_name.rs b/net/epee-encoding/tests/alt_name.rs index 6122c242..8a9bc6fa 100644 --- a/net/epee-encoding/tests/alt_name.rs +++ b/net/epee-encoding/tests/alt_name.rs @@ -1,4 +1,4 @@ -use epee_encoding::{epee_object, from_bytes, to_bytes}; +use cuprate_epee_encoding::{epee_object, from_bytes, to_bytes}; struct AltName { val: u8, diff --git a/net/epee-encoding/tests/duplicate_key.rs b/net/epee-encoding/tests/duplicate_key.rs index 5fe32ac8..c1b3148f 100644 --- a/net/epee-encoding/tests/duplicate_key.rs +++ b/net/epee-encoding/tests/duplicate_key.rs @@ -1,4 +1,4 @@ -use epee_encoding::{epee_object, from_bytes}; +use cuprate_epee_encoding::{epee_object, from_bytes}; struct T { a: u8, diff --git a/net/epee-encoding/tests/epee_default.rs b/net/epee-encoding/tests/epee_default.rs index 016b68f4..c221b28e 100644 --- a/net/epee-encoding/tests/epee_default.rs +++ b/net/epee-encoding/tests/epee_default.rs @@ -1,4 +1,4 @@ -use epee_encoding::{epee_object, from_bytes, to_bytes}; +use cuprate_epee_encoding::{epee_object, from_bytes, to_bytes}; pub struct Optional { val: u8, diff --git a/net/epee-encoding/tests/flattened.rs b/net/epee-encoding/tests/flattened.rs index ef92e5e8..a737370f 100644 --- a/net/epee-encoding/tests/flattened.rs +++ b/net/epee-encoding/tests/flattened.rs @@ -1,4 +1,4 @@ -use epee_encoding::{epee_object, from_bytes, to_bytes}; +use cuprate_epee_encoding::{epee_object, from_bytes, to_bytes}; struct Child { val: u64, diff --git a/net/epee-encoding/tests/options.rs b/net/epee-encoding/tests/options.rs index f8cb4969..5bae9a96 100644 --- a/net/epee-encoding/tests/options.rs +++ b/net/epee-encoding/tests/options.rs @@ -1,4 +1,4 @@ -use epee_encoding::{epee_object, from_bytes, to_bytes}; +use cuprate_epee_encoding::{epee_object, from_bytes, to_bytes}; use std::ops::Deref; #[derive(Clone)] diff --git a/net/epee-encoding/tests/p2p.rs b/net/epee-encoding/tests/p2p.rs index 386cc1a1..2f74ef6f 100644 --- a/net/epee-encoding/tests/p2p.rs +++ b/net/epee-encoding/tests/p2p.rs @@ -1,4 +1,4 @@ -use epee_encoding::{epee_object, from_bytes, to_bytes}; +use cuprate_epee_encoding::{epee_object, from_bytes, to_bytes}; #[derive(Eq, PartialEq, Debug, Clone)] pub struct SupportFlags(u32); diff --git a/net/epee-encoding/tests/rpc.rs b/net/epee-encoding/tests/rpc.rs index 4d0848f0..973498e2 100644 --- a/net/epee-encoding/tests/rpc.rs +++ b/net/epee-encoding/tests/rpc.rs @@ -1,4 +1,4 @@ -use epee_encoding::{epee_object, from_bytes, to_bytes}; +use cuprate_epee_encoding::{epee_object, from_bytes, to_bytes}; #[derive(Clone, Debug, PartialEq)] struct BaseResponse { diff --git a/net/epee-encoding/tests/seq.rs b/net/epee-encoding/tests/seq.rs index 9d3189a1..a4685d0f 100644 --- a/net/epee-encoding/tests/seq.rs +++ b/net/epee-encoding/tests/seq.rs @@ -1,4 +1,4 @@ -use epee_encoding::{epee_object, from_bytes}; +use cuprate_epee_encoding::{epee_object, from_bytes}; struct ObjSeq { seq: Vec, diff --git a/net/epee-encoding/tests/stack_overflow.rs b/net/epee-encoding/tests/stack_overflow.rs index 395b7570..c53420a6 100644 --- a/net/epee-encoding/tests/stack_overflow.rs +++ b/net/epee-encoding/tests/stack_overflow.rs @@ -1,4 +1,4 @@ -use epee_encoding::{epee_object, from_bytes}; +use cuprate_epee_encoding::{epee_object, from_bytes}; struct D { val: u8, diff --git a/net/fixed-bytes/Cargo.toml b/net/fixed-bytes/Cargo.toml index c144c78f..b592a09e 100644 --- a/net/fixed-bytes/Cargo.toml +++ b/net/fixed-bytes/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "fixed-bytes" +name = "cuprate-fixed-bytes" version = "0.1.0" edition = "2021" license = "MIT" diff --git a/net/levin/Cargo.toml b/net/levin/Cargo.toml index d7ca94b5..13deabea 100644 --- a/net/levin/Cargo.toml +++ b/net/levin/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "levin-cuprate" +name = "cuprate-levin" version = "0.1.0" edition = "2021" description = "A crate for working with the Levin protocol in Rust." diff --git a/net/levin/tests/fragmented_message.rs b/net/levin/tests/fragmented_message.rs index 45ff3a0f..7799a719 100644 --- a/net/levin/tests/fragmented_message.rs +++ b/net/levin/tests/fragmented_message.rs @@ -8,7 +8,7 @@ use tokio::{ }; use tokio_util::codec::{FramedRead, FramedWrite}; -use levin_cuprate::{ +use cuprate_levin::{ message::make_fragmented_messages, BucketBuilder, BucketError, LevinBody, LevinCommand, LevinMessageCodec, MessageType, Protocol, }; diff --git a/net/monero-wire/Cargo.toml b/net/wire/Cargo.toml similarity index 67% rename from net/monero-wire/Cargo.toml rename to net/wire/Cargo.toml index 882b3644..c71a77b8 100644 --- a/net/monero-wire/Cargo.toml +++ b/net/wire/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "monero-wire" +name = "cuprate-wire" version = "0.1.0" edition = "2021" license = "MIT" @@ -8,12 +8,12 @@ repository = "https://github.com/SyntheticBird45/cuprate/tree/main/net/monero-wi [features] default = [] -tracing = ["levin-cuprate/tracing"] +tracing = ["cuprate-levin/tracing"] [dependencies] -levin-cuprate = {path="../levin"} -epee-encoding = { path = "../epee-encoding" } -fixed-bytes = { path = "../fixed-bytes" } +cuprate-levin = { path = "../levin" } +cuprate-epee-encoding = { path = "../epee-encoding" } +cuprate-fixed-bytes = { path = "../fixed-bytes" } bitflags = { workspace = true, features = ["std"] } bytes = { workspace = true, features = ["std"] } diff --git a/net/monero-wire/src/lib.rs b/net/wire/src/lib.rs similarity index 88% rename from net/monero-wire/src/lib.rs rename to net/wire/src/lib.rs index 27e6481d..45a2405c 100644 --- a/net/monero-wire/src/lib.rs +++ b/net/wire/src/lib.rs @@ -25,11 +25,11 @@ pub mod network_address; pub mod p2p; -pub use levin_cuprate::BucketError; +pub use cuprate_levin::BucketError; pub use network_address::{NetZone, NetworkAddress}; pub use p2p::*; // re-export. -pub use levin_cuprate as levin; +pub use cuprate_levin as levin; -pub type MoneroWireCodec = levin_cuprate::codec::LevinMessageCodec; +pub type MoneroWireCodec = cuprate_levin::codec::LevinMessageCodec; diff --git a/net/monero-wire/src/network_address.rs b/net/wire/src/network_address.rs similarity index 95% rename from net/monero-wire/src/network_address.rs rename to net/wire/src/network_address.rs index 900ae61d..632739af 100644 --- a/net/monero-wire/src/network_address.rs +++ b/net/wire/src/network_address.rs @@ -18,7 +18,7 @@ //! I2p. Currently this module only has IPv(4/6). //! use bytes::BufMut; -use epee_encoding::EpeeObject; +use cuprate_epee_encoding::EpeeObject; use std::{hash::Hash, net, net::SocketAddr}; mod epee_builder; @@ -45,7 +45,7 @@ impl EpeeObject for NetworkAddress { 2 } - fn write_fields(self, w: &mut B) -> epee_encoding::Result<()> { + fn write_fields(self, w: &mut B) -> cuprate_epee_encoding::Result<()> { TaggedNetworkAddress::from(self).write_fields(w) } } diff --git a/net/monero-wire/src/network_address/epee_builder.rs b/net/wire/src/network_address/epee_builder.rs similarity index 75% rename from net/monero-wire/src/network_address/epee_builder.rs rename to net/wire/src/network_address/epee_builder.rs index 0678b22e..36db8241 100644 --- a/net/monero-wire/src/network_address/epee_builder.rs +++ b/net/wire/src/network_address/epee_builder.rs @@ -1,7 +1,7 @@ use bytes::Buf; use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; -use epee_encoding::{epee_object, EpeeObjectBuilder}; +use cuprate_epee_encoding::{epee_object, EpeeObjectBuilder}; use thiserror::Error; use crate::NetworkAddress; @@ -19,19 +19,28 @@ epee_object!( ); impl EpeeObjectBuilder for TaggedNetworkAddress { - fn add_field(&mut self, name: &str, b: &mut B) -> epee_encoding::Result { + fn add_field(&mut self, name: &str, b: &mut B) -> cuprate_epee_encoding::Result { match name { "type" => { - if std::mem::replace(&mut self.ty, Some(epee_encoding::read_epee_value(b)?)) - .is_some() + if std::mem::replace( + &mut self.ty, + Some(cuprate_epee_encoding::read_epee_value(b)?), + ) + .is_some() { - return Err(epee_encoding::Error::Format("Duplicate field in data.")); + return Err(cuprate_epee_encoding::Error::Format( + "Duplicate field in data.", + )); } Ok(true) } "addr" => { - if std::mem::replace(&mut self.addr, epee_encoding::read_epee_value(b)?).is_some() { - return Err(epee_encoding::Error::Format("Duplicate field in data.")); + if std::mem::replace(&mut self.addr, cuprate_epee_encoding::read_epee_value(b)?) + .is_some() + { + return Err(cuprate_epee_encoding::Error::Format( + "Duplicate field in data.", + )); } Ok(true) } @@ -39,9 +48,9 @@ impl EpeeObjectBuilder for TaggedNetworkAddress { } } - fn finish(self) -> epee_encoding::Result { + fn finish(self) -> cuprate_epee_encoding::Result { self.try_into() - .map_err(|_| epee_encoding::Error::Value("Invalid network address".to_string())) + .map_err(|_| cuprate_epee_encoding::Error::Value("Invalid network address".to_string())) } } diff --git a/net/monero-wire/src/p2p.rs b/net/wire/src/p2p.rs similarity index 96% rename from net/monero-wire/src/p2p.rs rename to net/wire/src/p2p.rs index 7a2b7de6..0d448e4f 100644 --- a/net/monero-wire/src/p2p.rs +++ b/net/wire/src/p2p.rs @@ -20,8 +20,8 @@ use std::fmt::Formatter; use bytes::{Buf, BytesMut}; -use epee_encoding::epee_object; -use levin_cuprate::{ +use cuprate_epee_encoding::epee_object; +use cuprate_levin::{ BucketBuilder, BucketError, LevinBody, LevinCommand as LevinCommandTrait, MessageType, }; @@ -154,22 +154,23 @@ impl From for u32 { } } -fn decode_message( +fn decode_message( ret: impl FnOnce(T) -> Ret, buf: &mut B, ) -> Result { - let t = epee_encoding::from_bytes(buf).map_err(|e| BucketError::BodyDecodingError(e.into()))?; + let t = cuprate_epee_encoding::from_bytes(buf) + .map_err(|e| BucketError::BodyDecodingError(e.into()))?; Ok(ret(t)) } -fn build_message( +fn build_message( id: LevinCommand, val: T, builder: &mut BucketBuilder, ) -> Result<(), BucketError> { builder.set_command(id); builder.set_body( - epee_encoding::to_bytes(val) + cuprate_epee_encoding::to_bytes(val) .map(BytesMut::freeze) .map_err(|e| BucketError::BodyDecodingError(e.into()))?, ); @@ -280,13 +281,13 @@ impl RequestMessage { C::Handshake => decode_message(RequestMessage::Handshake, buf)?, C::TimedSync => decode_message(RequestMessage::TimedSync, buf)?, C::Ping => { - epee_encoding::from_bytes::(buf) + cuprate_epee_encoding::from_bytes::(buf) .map_err(|e| BucketError::BodyDecodingError(e.into()))?; RequestMessage::Ping } C::SupportFlags => { - epee_encoding::from_bytes::(buf) + cuprate_epee_encoding::from_bytes::(buf) .map_err(|e| BucketError::BodyDecodingError(e.into()))?; RequestMessage::SupportFlags diff --git a/net/monero-wire/src/p2p/admin.rs b/net/wire/src/p2p/admin.rs similarity index 99% rename from net/monero-wire/src/p2p/admin.rs rename to net/wire/src/p2p/admin.rs index 95ffef2d..173c2938 100644 --- a/net/monero-wire/src/p2p/admin.rs +++ b/net/wire/src/p2p/admin.rs @@ -19,7 +19,7 @@ //! protocol messages. use bytes::Bytes; -use epee_encoding::epee_object; +use cuprate_epee_encoding::epee_object; use super::common::{BasicNodeData, CoreSyncData, PeerListEntryBase, PeerSupportFlags}; @@ -134,7 +134,8 @@ mod tests { 186, 15, 178, 70, 173, 170, 187, 31, 70, 50, 227, 11, 116, 111, 112, 95, 118, 101, 114, 115, 105, 111, 110, 8, 1, ]; - let handshake: HandshakeRequest = epee_encoding::from_bytes(&mut &bytes[..]).unwrap(); + let handshake: HandshakeRequest = + cuprate_epee_encoding::from_bytes(&mut &bytes[..]).unwrap(); let basic_node_data = BasicNodeData { my_port: 0, network_id: [ @@ -161,8 +162,9 @@ mod tests { assert_eq!(basic_node_data, handshake.node_data); assert_eq!(core_sync_data, handshake.payload_data); - let mut encoded_bytes = epee_encoding::to_bytes(handshake.clone()).unwrap(); - let handshake_2: HandshakeRequest = epee_encoding::from_bytes(&mut encoded_bytes).unwrap(); + let mut encoded_bytes = cuprate_epee_encoding::to_bytes(handshake.clone()).unwrap(); + let handshake_2: HandshakeRequest = + cuprate_epee_encoding::from_bytes(&mut encoded_bytes).unwrap(); assert_eq!(handshake, handshake_2); } @@ -938,7 +940,8 @@ mod tests { 181, 216, 193, 135, 23, 186, 168, 207, 119, 86, 235, 11, 116, 111, 112, 95, 118, 101, 114, 115, 105, 111, 110, 8, 16, ]; - let handshake: HandshakeResponse = epee_encoding::from_bytes(&mut &bytes[..]).unwrap(); + let handshake: HandshakeResponse = + cuprate_epee_encoding::from_bytes(&mut &bytes[..]).unwrap(); let basic_node_data = BasicNodeData { my_port: 18080, @@ -967,9 +970,10 @@ mod tests { assert_eq!(core_sync_data, handshake.payload_data); assert_eq!(250, handshake.local_peerlist_new.len()); - let mut encoded_bytes = epee_encoding::to_bytes(handshake.clone()).unwrap(); + let mut encoded_bytes = cuprate_epee_encoding::to_bytes(handshake.clone()).unwrap(); - let handshake_2: HandshakeResponse = epee_encoding::from_bytes(&mut encoded_bytes).unwrap(); + let handshake_2: HandshakeResponse = + cuprate_epee_encoding::from_bytes(&mut encoded_bytes).unwrap(); assert_eq!(handshake, handshake_2); } diff --git a/net/monero-wire/src/p2p/common.rs b/net/wire/src/p2p/common.rs similarity index 92% rename from net/monero-wire/src/p2p/common.rs rename to net/wire/src/p2p/common.rs index 74babefe..91adb908 100644 --- a/net/monero-wire/src/p2p/common.rs +++ b/net/wire/src/p2p/common.rs @@ -18,8 +18,8 @@ use bitflags::bitflags; use bytes::{Buf, BufMut, Bytes}; -use epee_encoding::{epee_object, EpeeValue, InnerMarker}; -use fixed_bytes::ByteArray; +use cuprate_epee_encoding::{epee_object, EpeeValue, InnerMarker}; +use cuprate_fixed_bytes::ByteArray; use crate::NetworkAddress; @@ -241,12 +241,12 @@ epee_object!( txs: TransactionBlobs = TransactionBlobs::None => tx_blob_read, tx_blob_write, should_write_tx_blobs, ); -fn tx_blob_read(b: &mut B) -> epee_encoding::Result { - let marker = epee_encoding::read_marker(b)?; +fn tx_blob_read(b: &mut B) -> cuprate_epee_encoding::Result { + let marker = cuprate_epee_encoding::read_marker(b)?; match marker.inner_marker { InnerMarker::Object => Ok(TransactionBlobs::Pruned(Vec::read(b, &marker)?)), InnerMarker::String => Ok(TransactionBlobs::Normal(Vec::read(b, &marker)?)), - _ => Err(epee_encoding::Error::Value( + _ => Err(cuprate_epee_encoding::Error::Value( "Invalid marker for tx blobs".to_string(), )), } @@ -256,11 +256,15 @@ fn tx_blob_write( val: TransactionBlobs, field_name: &str, w: &mut B, -) -> epee_encoding::Result<()> { +) -> cuprate_epee_encoding::Result<()> { if should_write_tx_blobs(&val) { match val { - TransactionBlobs::Normal(bytes) => epee_encoding::write_field(bytes, field_name, w)?, - TransactionBlobs::Pruned(obj) => epee_encoding::write_field(obj, field_name, w)?, + TransactionBlobs::Normal(bytes) => { + cuprate_epee_encoding::write_field(bytes, field_name, w)? + } + TransactionBlobs::Pruned(obj) => { + cuprate_epee_encoding::write_field(obj, field_name, w)? + } TransactionBlobs::None => (), } } diff --git a/net/monero-wire/src/p2p/protocol.rs b/net/wire/src/p2p/protocol.rs similarity index 99% rename from net/monero-wire/src/p2p/protocol.rs rename to net/wire/src/p2p/protocol.rs index 4dc9a928..5e95a4f8 100644 --- a/net/monero-wire/src/p2p/protocol.rs +++ b/net/wire/src/p2p/protocol.rs @@ -20,8 +20,8 @@ use bytes::Bytes; -use epee_encoding::{container_as_blob::ContainerAsBlob, epee_object}; -use fixed_bytes::{ByteArray, ByteArrayVec}; +use cuprate_epee_encoding::{container_as_blob::ContainerAsBlob, epee_object}; +use cuprate_fixed_bytes::{ByteArray, ByteArrayVec}; use super::common::BlockCompleteEntry; @@ -705,13 +705,14 @@ mod tests { 248, 248, 91, 110, 107, 144, 12, 175, 253, 21, 121, 28, ]; - let new_transactions: NewTransactions = epee_encoding::from_bytes(&mut &bytes[..]).unwrap(); + let new_transactions: NewTransactions = + cuprate_epee_encoding::from_bytes(&mut &bytes[..]).unwrap(); assert_eq!(4, new_transactions.txs.len()); - let mut encoded_bytes = epee_encoding::to_bytes(new_transactions.clone()).unwrap(); + let mut encoded_bytes = cuprate_epee_encoding::to_bytes(new_transactions.clone()).unwrap(); let new_transactions_2: NewTransactions = - epee_encoding::from_bytes(&mut encoded_bytes).unwrap(); + cuprate_epee_encoding::from_bytes(&mut encoded_bytes).unwrap(); assert_eq!(new_transactions, new_transactions_2); } @@ -1057,10 +1058,12 @@ mod tests { 101, 110, 116, 95, 98, 108, 111, 99, 107, 99, 104, 97, 105, 110, 95, 104, 101, 105, 103, 104, 116, 5, 209, 45, 42, 0, 0, 0, 0, 0, ]; - let fluffy_block: NewFluffyBlock = epee_encoding::from_bytes(&mut &bytes[..]).unwrap(); + let fluffy_block: NewFluffyBlock = + cuprate_epee_encoding::from_bytes(&mut &bytes[..]).unwrap(); - let mut encoded_bytes = epee_encoding::to_bytes(fluffy_block.clone()).unwrap(); - let fluffy_block_2: NewFluffyBlock = epee_encoding::from_bytes(&mut encoded_bytes).unwrap(); + let mut encoded_bytes = cuprate_epee_encoding::to_bytes(fluffy_block.clone()).unwrap(); + let fluffy_block_2: NewFluffyBlock = + cuprate_epee_encoding::from_bytes(&mut encoded_bytes).unwrap(); assert_eq!(fluffy_block, fluffy_block_2); } diff --git a/p2p/address-book/Cargo.toml b/p2p/address-book/Cargo.toml index 9b24c022..9cff78a8 100644 --- a/p2p/address-book/Cargo.toml +++ b/p2p/address-book/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "monero-address-book" +name = "cuprate-address-book" version = "0.1.0" edition = "2021" license = "MIT" @@ -7,9 +7,9 @@ authors = ["Boog900"] [dependencies] -monero-pruning = { path = "../../pruning" } -monero-wire = { path= "../../net/monero-wire" } -monero-p2p = { path = "../monero-p2p" } +cuprate-pruning = { path = "../../pruning" } +cuprate-wire = { path= "../../net/wire" } +cuprate-p2p-core = { path = "../p2p-core" } tower = { workspace = true, features = ["util"] } tokio = { workspace = true, features = ["time", "fs", "rt"]} diff --git a/p2p/address-book/src/book.rs b/p2p/address-book/src/book.rs index 2f0617e9..b6ab07ad 100644 --- a/p2p/address-book/src/book.rs +++ b/p2p/address-book/src/book.rs @@ -19,13 +19,13 @@ use tokio::{ use tokio_util::time::DelayQueue; use tower::Service; -use monero_p2p::{ +use cuprate_p2p_core::{ client::InternalPeerID, handles::ConnectionHandle, services::{AddressBookRequest, AddressBookResponse, ZoneSpecificPeerListEntryBase}, NetZoneAddress, NetworkZone, }; -use monero_pruning::PruningSeed; +use cuprate_pruning::PruningSeed; use crate::{peer_list::PeerList, store::save_peers_to_disk, AddressBookConfig, AddressBookError}; diff --git a/p2p/address-book/src/book/tests.rs b/p2p/address-book/src/book/tests.rs index 1cb0fc85..11f31868 100644 --- a/p2p/address-book/src/book/tests.rs +++ b/p2p/address-book/src/book/tests.rs @@ -3,8 +3,8 @@ use std::{path::PathBuf, sync::Arc, time::Duration}; use futures::StreamExt; use tokio::{sync::Semaphore, time::interval}; -use monero_p2p::handles::HandleBuilder; -use monero_pruning::PruningSeed; +use cuprate_p2p_core::handles::HandleBuilder; +use cuprate_pruning::PruningSeed; use super::{AddressBook, ConnectionPeerEntry, InternalPeerID}; use crate::{peer_list::tests::make_fake_peer_list, AddressBookConfig, AddressBookError}; diff --git a/p2p/address-book/src/lib.rs b/p2p/address-book/src/lib.rs index 51f83ddc..1ce659f1 100644 --- a/p2p/address-book/src/lib.rs +++ b/p2p/address-book/src/lib.rs @@ -2,8 +2,8 @@ //! //! This module holds the logic for persistent peer storage. //! Cuprates address book is modeled as a [`tower::Service`] -//! The request is [`AddressBookRequest`](monero_p2p::services::AddressBookRequest) and the response is -//! [`AddressBookResponse`](monero_p2p::services::AddressBookResponse). +//! The request is [`AddressBookRequest`](cuprate_p2p_core::services::AddressBookRequest) and the response is +//! [`AddressBookResponse`](cuprate_p2p_core::services::AddressBookResponse). //! //! Cuprate, like monerod, actually has multiple address books, one //! for each [`NetworkZone`]. This is to reduce the possibility of @@ -13,7 +13,7 @@ //! use std::{io::ErrorKind, path::PathBuf, time::Duration}; -use monero_p2p::NetworkZone; +use cuprate_p2p_core::NetworkZone; mod book; mod peer_list; diff --git a/p2p/address-book/src/peer_list.rs b/p2p/address-book/src/peer_list.rs index 2aaf432a..e2a15d8a 100644 --- a/p2p/address-book/src/peer_list.rs +++ b/p2p/address-book/src/peer_list.rs @@ -3,8 +3,8 @@ use std::collections::{BTreeMap, HashMap, HashSet}; use indexmap::IndexMap; use rand::prelude::*; -use monero_p2p::{services::ZoneSpecificPeerListEntryBase, NetZoneAddress, NetworkZone}; -use monero_pruning::{PruningSeed, CRYPTONOTE_MAX_BLOCK_HEIGHT}; +use cuprate_p2p_core::{services::ZoneSpecificPeerListEntryBase, NetZoneAddress, NetworkZone}; +use cuprate_pruning::{PruningSeed, CRYPTONOTE_MAX_BLOCK_HEIGHT}; #[cfg(test)] pub mod tests; diff --git a/p2p/address-book/src/peer_list/tests.rs b/p2p/address-book/src/peer_list/tests.rs index 7aba0a20..8d2d2200 100644 --- a/p2p/address-book/src/peer_list/tests.rs +++ b/p2p/address-book/src/peer_list/tests.rs @@ -2,11 +2,9 @@ use std::collections::HashSet; use rand::Rng; -use monero_p2p::services::ZoneSpecificPeerListEntryBase; -use monero_pruning::PruningSeed; - +use cuprate_p2p_core::{services::ZoneSpecificPeerListEntryBase, NetZoneAddress}; +use cuprate_pruning::PruningSeed; use cuprate_test_utils::test_netzone::{TestNetZone, TestNetZoneAddr}; -use monero_p2p::NetZoneAddress; use super::PeerList; diff --git a/p2p/address-book/src/store.rs b/p2p/address-book/src/store.rs index c15e0a77..94b0ec24 100644 --- a/p2p/address-book/src/store.rs +++ b/p2p/address-book/src/store.rs @@ -3,7 +3,7 @@ use std::fs; use borsh::{from_slice, to_vec, BorshDeserialize, BorshSerialize}; use tokio::task::{spawn_blocking, JoinHandle}; -use monero_p2p::{services::ZoneSpecificPeerListEntryBase, NetZoneAddress, NetworkZone}; +use cuprate_p2p_core::{services::ZoneSpecificPeerListEntryBase, NetZoneAddress, NetworkZone}; use crate::{peer_list::PeerList, AddressBookConfig}; diff --git a/p2p/async-buffer/Cargo.toml b/p2p/async-buffer/Cargo.toml index 59f04301..e39acc32 100644 --- a/p2p/async-buffer/Cargo.toml +++ b/p2p/async-buffer/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "async-buffer" +name = "cuprate-async-buffer" version = "0.1.0" edition = "2021" license = "MIT" diff --git a/p2p/async-buffer/tests/basic.rs b/p2p/async-buffer/tests/basic.rs index 93717300..38340a11 100644 --- a/p2p/async-buffer/tests/basic.rs +++ b/p2p/async-buffer/tests/basic.rs @@ -1,6 +1,6 @@ use futures::{FutureExt, StreamExt}; -use async_buffer::new_buffer; +use cuprate_async_buffer::new_buffer; #[tokio::test] async fn async_buffer_send_rec() { diff --git a/p2p/dandelion/Cargo.toml b/p2p/dandelion-tower/Cargo.toml similarity index 96% rename from p2p/dandelion/Cargo.toml rename to p2p/dandelion-tower/Cargo.toml index e5d7e340..5e2fec53 100644 --- a/p2p/dandelion/Cargo.toml +++ b/p2p/dandelion-tower/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "dandelion-tower" +name = "cuprate-dandelion-tower" version = "0.1.0" edition = "2021" license = "MIT" diff --git a/p2p/dandelion/src/config.rs b/p2p/dandelion-tower/src/config.rs similarity index 100% rename from p2p/dandelion/src/config.rs rename to p2p/dandelion-tower/src/config.rs diff --git a/p2p/dandelion/src/lib.rs b/p2p/dandelion-tower/src/lib.rs similarity index 100% rename from p2p/dandelion/src/lib.rs rename to p2p/dandelion-tower/src/lib.rs diff --git a/p2p/dandelion/src/pool.rs b/p2p/dandelion-tower/src/pool.rs similarity index 100% rename from p2p/dandelion/src/pool.rs rename to p2p/dandelion-tower/src/pool.rs diff --git a/p2p/dandelion/src/router.rs b/p2p/dandelion-tower/src/router.rs similarity index 100% rename from p2p/dandelion/src/router.rs rename to p2p/dandelion-tower/src/router.rs diff --git a/p2p/dandelion/src/tests/mod.rs b/p2p/dandelion-tower/src/tests/mod.rs similarity index 100% rename from p2p/dandelion/src/tests/mod.rs rename to p2p/dandelion-tower/src/tests/mod.rs diff --git a/p2p/dandelion/src/tests/pool.rs b/p2p/dandelion-tower/src/tests/pool.rs similarity index 100% rename from p2p/dandelion/src/tests/pool.rs rename to p2p/dandelion-tower/src/tests/pool.rs diff --git a/p2p/dandelion/src/tests/router.rs b/p2p/dandelion-tower/src/tests/router.rs similarity index 100% rename from p2p/dandelion/src/tests/router.rs rename to p2p/dandelion-tower/src/tests/router.rs diff --git a/p2p/dandelion/src/traits.rs b/p2p/dandelion-tower/src/traits.rs similarity index 100% rename from p2p/dandelion/src/traits.rs rename to p2p/dandelion-tower/src/traits.rs diff --git a/p2p/monero-p2p/Cargo.toml b/p2p/p2p-core/Cargo.toml similarity index 84% rename from p2p/monero-p2p/Cargo.toml rename to p2p/p2p-core/Cargo.toml index 83cfd949..f434d51a 100644 --- a/p2p/monero-p2p/Cargo.toml +++ b/p2p/p2p-core/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "monero-p2p" +name = "cuprate-p2p-core" version = "0.1.0" edition = "2021" license = "MIT" @@ -7,12 +7,12 @@ authors = ["Boog900"] [features] default = ["borsh"] -borsh = ["dep:borsh", "monero-pruning/borsh"] +borsh = ["dep:borsh", "cuprate-pruning/borsh"] [dependencies] cuprate-helper = { path = "../../helper", features = ["asynch"], default-features = false } -monero-wire = { path = "../../net/monero-wire", features = ["tracing"] } -monero-pruning = { path = "../../pruning" } +cuprate-wire = { path = "../../net/wire", features = ["tracing"] } +cuprate-pruning = { path = "../../pruning" } tokio = { workspace = true, features = ["net", "sync", "macros", "time"]} tokio-util = { workspace = true, features = ["codec"] } diff --git a/p2p/monero-p2p/src/client.rs b/p2p/p2p-core/src/client.rs similarity index 99% rename from p2p/monero-p2p/src/client.rs rename to p2p/p2p-core/src/client.rs index 33446819..0e81d964 100644 --- a/p2p/monero-p2p/src/client.rs +++ b/p2p/p2p-core/src/client.rs @@ -14,7 +14,7 @@ use tower::{Service, ServiceExt}; use tracing::Instrument; use cuprate_helper::asynch::InfallibleOneshotReceiver; -use monero_pruning::PruningSeed; +use cuprate_pruning::PruningSeed; use crate::{ handles::{ConnectionGuard, ConnectionHandle}, diff --git a/p2p/monero-p2p/src/client/connection.rs b/p2p/p2p-core/src/client/connection.rs similarity index 97% rename from p2p/monero-p2p/src/client/connection.rs rename to p2p/p2p-core/src/client/connection.rs index 266dcf7f..341d8c09 100644 --- a/p2p/monero-p2p/src/client/connection.rs +++ b/p2p/p2p-core/src/client/connection.rs @@ -17,7 +17,7 @@ use tokio::{ use tokio_stream::wrappers::ReceiverStream; use tower::ServiceExt; -use monero_wire::{LevinCommand, Message, ProtocolMessage}; +use cuprate_wire::{LevinCommand, Message, ProtocolMessage}; use crate::{ constants::{REQUEST_TIMEOUT, SENDING_TIMEOUT}, @@ -241,7 +241,7 @@ where /// The main-loop for when we are in [`State::WaitingForRequest`]. async fn state_waiting_for_request(&mut self, stream: &mut Str) -> Result<(), PeerError> where - Str: FusedStream> + Unpin, + Str: FusedStream> + Unpin, { tracing::debug!("waiting for peer/client request."); @@ -274,7 +274,7 @@ where /// The main-loop for when we are in [`State::WaitingForResponse`]. async fn state_waiting_for_response(&mut self, stream: &mut Str) -> Result<(), PeerError> where - Str: FusedStream> + Unpin, + Str: FusedStream> + Unpin, { tracing::debug!("waiting for peer response."); @@ -306,7 +306,7 @@ where /// `eager_protocol_messages` are protocol messages that we received during a handshake. pub async fn run(mut self, mut stream: Str, eager_protocol_messages: Vec) where - Str: FusedStream> + Unpin, + Str: FusedStream> + Unpin, { tracing::debug!( "Handling eager messages len: {}", diff --git a/p2p/monero-p2p/src/client/connector.rs b/p2p/p2p-core/src/client/connector.rs similarity index 100% rename from p2p/monero-p2p/src/client/connector.rs rename to p2p/p2p-core/src/client/connector.rs diff --git a/p2p/monero-p2p/src/client/handshaker.rs b/p2p/p2p-core/src/client/handshaker.rs similarity index 99% rename from p2p/monero-p2p/src/client/handshaker.rs rename to p2p/p2p-core/src/client/handshaker.rs index 03f3f563..1071b339 100644 --- a/p2p/monero-p2p/src/client/handshaker.rs +++ b/p2p/p2p-core/src/client/handshaker.rs @@ -20,8 +20,8 @@ use tokio::{ use tower::{Service, ServiceExt}; use tracing::{info_span, Instrument}; -use monero_pruning::{PruningError, PruningSeed}; -use monero_wire::{ +use cuprate_pruning::{PruningError, PruningSeed}; +use cuprate_wire::{ admin::{ HandshakeRequest, HandshakeResponse, PingResponse, SupportFlagsResponse, PING_OK_RESPONSE_STATUS_TEXT, @@ -586,7 +586,7 @@ async fn wait_for_message( peer_sink: &mut Z::Sink, peer_stream: &mut Z::Stream, - eager_protocol_messages: &mut Vec, + eager_protocol_messages: &mut Vec, our_basic_node_data: &BasicNodeData, ) -> Result { diff --git a/p2p/monero-p2p/src/client/timeout_monitor.rs b/p2p/p2p-core/src/client/timeout_monitor.rs similarity index 99% rename from p2p/monero-p2p/src/client/timeout_monitor.rs rename to p2p/p2p-core/src/client/timeout_monitor.rs index dcdf85d7..db261b4d 100644 --- a/p2p/monero-p2p/src/client/timeout_monitor.rs +++ b/p2p/p2p-core/src/client/timeout_monitor.rs @@ -5,7 +5,6 @@ use std::sync::Arc; use futures::channel::oneshot; -use monero_wire::admin::TimedSyncRequest; use tokio::{ sync::{mpsc, Semaphore}, time::{interval, MissedTickBehavior}, @@ -13,6 +12,8 @@ use tokio::{ use tower::ServiceExt; use tracing::instrument; +use cuprate_wire::admin::TimedSyncRequest; + use crate::{ client::{connection::ConnectionTaskRequest, InternalPeerID}, constants::{MAX_PEERS_IN_PEER_LIST_MESSAGE, TIMEOUT_INTERVAL}, diff --git a/p2p/monero-p2p/src/constants.rs b/p2p/p2p-core/src/constants.rs similarity index 100% rename from p2p/monero-p2p/src/constants.rs rename to p2p/p2p-core/src/constants.rs diff --git a/p2p/monero-p2p/src/error.rs b/p2p/p2p-core/src/error.rs similarity index 96% rename from p2p/monero-p2p/src/error.rs rename to p2p/p2p-core/src/error.rs index e74a2bb6..65303adc 100644 --- a/p2p/monero-p2p/src/error.rs +++ b/p2p/p2p-core/src/error.rs @@ -45,7 +45,7 @@ pub enum PeerError { #[error("inner service error: {0}")] ServiceError(#[from] tower::BoxError), #[error("bucket error: {0}")] - BucketError(#[from] monero_wire::BucketError), + BucketError(#[from] cuprate_wire::BucketError), #[error("handshake error: {0}")] Handshake(#[from] crate::client::HandshakeError), #[error("i/o error: {0}")] diff --git a/p2p/monero-p2p/src/handles.rs b/p2p/p2p-core/src/handles.rs similarity index 100% rename from p2p/monero-p2p/src/handles.rs rename to p2p/p2p-core/src/handles.rs diff --git a/p2p/monero-p2p/src/lib.rs b/p2p/p2p-core/src/lib.rs similarity index 99% rename from p2p/monero-p2p/src/lib.rs rename to p2p/p2p-core/src/lib.rs index 13ecf4aa..8703d59e 100644 --- a/p2p/monero-p2p/src/lib.rs +++ b/p2p/p2p-core/src/lib.rs @@ -16,7 +16,7 @@ use std::{fmt::Debug, future::Future, hash::Hash, pin::Pin}; use futures::{Sink, Stream}; -use monero_wire::{ +use cuprate_wire::{ levin::LevinMessage, network_address::NetworkAddressIncorrectZone, BucketError, Message, NetworkAddress, }; diff --git a/p2p/monero-p2p/src/network_zones.rs b/p2p/p2p-core/src/network_zones.rs similarity index 100% rename from p2p/monero-p2p/src/network_zones.rs rename to p2p/p2p-core/src/network_zones.rs diff --git a/p2p/monero-p2p/src/network_zones/clear.rs b/p2p/p2p-core/src/network_zones/clear.rs similarity index 98% rename from p2p/monero-p2p/src/network_zones/clear.rs rename to p2p/p2p-core/src/network_zones/clear.rs index c77f1333..192e3637 100644 --- a/p2p/monero-p2p/src/network_zones/clear.rs +++ b/p2p/p2p-core/src/network_zones/clear.rs @@ -11,7 +11,7 @@ use tokio::net::{ }; use tokio_util::codec::{FramedRead, FramedWrite}; -use monero_wire::MoneroWireCodec; +use cuprate_wire::MoneroWireCodec; use crate::{NetZoneAddress, NetworkZone}; diff --git a/p2p/monero-p2p/src/protocol.rs b/p2p/p2p-core/src/protocol.rs similarity index 99% rename from p2p/monero-p2p/src/protocol.rs rename to p2p/p2p-core/src/protocol.rs index 10157ae6..172038f8 100644 --- a/p2p/monero-p2p/src/protocol.rs +++ b/p2p/p2p-core/src/protocol.rs @@ -22,7 +22,7 @@ //! Request: NewFluffyBlock, Response: None, //! Request: NewTransactions, Response: None //! -use monero_wire::{ +use cuprate_wire::{ admin::{ HandshakeRequest, HandshakeResponse, PingResponse, SupportFlagsResponse, TimedSyncRequest, TimedSyncResponse, diff --git a/p2p/monero-p2p/src/protocol/try_from.rs b/p2p/p2p-core/src/protocol/try_from.rs similarity index 98% rename from p2p/monero-p2p/src/protocol/try_from.rs rename to p2p/p2p-core/src/protocol/try_from.rs index 02a5233e..8e3d026a 100644 --- a/p2p/monero-p2p/src/protocol/try_from.rs +++ b/p2p/p2p-core/src/protocol/try_from.rs @@ -1,7 +1,7 @@ //! This module contains the implementations of [`TryFrom`] and [`From`] to convert between //! [`Message`], [`PeerRequest`] and [`PeerResponse`]. -use monero_wire::{Message, ProtocolMessage, RequestMessage, ResponseMessage}; +use cuprate_wire::{Message, ProtocolMessage, RequestMessage, ResponseMessage}; use super::{PeerRequest, PeerResponse}; diff --git a/p2p/monero-p2p/src/services.rs b/p2p/p2p-core/src/services.rs similarity index 95% rename from p2p/monero-p2p/src/services.rs rename to p2p/p2p-core/src/services.rs index a0ea2e7a..6fd6c15b 100644 --- a/p2p/monero-p2p/src/services.rs +++ b/p2p/p2p-core/src/services.rs @@ -1,5 +1,5 @@ -use monero_pruning::{PruningError, PruningSeed}; -use monero_wire::{CoreSyncData, PeerListEntryBase}; +use cuprate_pruning::{PruningError, PruningSeed}; +use cuprate_wire::{CoreSyncData, PeerListEntryBase}; use crate::{ client::InternalPeerID, handles::ConnectionHandle, NetZoneAddress, NetworkAddressIncorrectZone, @@ -44,7 +44,7 @@ pub struct ZoneSpecificPeerListEntryBase { pub rpc_credits_per_hash: u32, } -impl From> for monero_wire::PeerListEntryBase { +impl From> for cuprate_wire::PeerListEntryBase { fn from(value: ZoneSpecificPeerListEntryBase) -> Self { Self { adr: value.adr.into(), @@ -65,7 +65,7 @@ pub enum PeerListConversionError { PruningSeed(#[from] PruningError), } -impl TryFrom +impl TryFrom for ZoneSpecificPeerListEntryBase { type Error = PeerListConversionError; diff --git a/p2p/monero-p2p/tests/fragmented_handshake.rs b/p2p/p2p-core/tests/fragmented_handshake.rs similarity index 99% rename from p2p/monero-p2p/tests/fragmented_handshake.rs rename to p2p/p2p-core/tests/fragmented_handshake.rs index e9833cf3..2e96574c 100644 --- a/p2p/monero-p2p/tests/fragmented_handshake.rs +++ b/p2p/p2p-core/tests/fragmented_handshake.rs @@ -23,12 +23,12 @@ use tokio_util::{ use tower::{Service, ServiceExt}; use cuprate_helper::network::Network; -use monero_p2p::{ +use cuprate_p2p_core::{ client::{ConnectRequest, Connector, DoHandshakeRequest, HandShaker, InternalPeerID}, network_zones::ClearNetServerCfg, ConnectionDirection, NetworkZone, }; -use monero_wire::{ +use cuprate_wire::{ common::PeerSupportFlags, levin::{message::make_fragmented_messages, LevinMessage, Protocol}, BasicNodeData, Message, MoneroWireCodec, diff --git a/p2p/monero-p2p/tests/handles.rs b/p2p/p2p-core/tests/handles.rs similarity index 97% rename from p2p/monero-p2p/tests/handles.rs rename to p2p/p2p-core/tests/handles.rs index 6766f78f..e98cd2d4 100644 --- a/p2p/monero-p2p/tests/handles.rs +++ b/p2p/p2p-core/tests/handles.rs @@ -2,7 +2,7 @@ use std::{sync::Arc, time::Duration}; use tokio::sync::Semaphore; -use monero_p2p::handles::HandleBuilder; +use cuprate_p2p_core::handles::HandleBuilder; #[test] fn send_ban_signal() { diff --git a/p2p/monero-p2p/tests/handshake.rs b/p2p/p2p-core/tests/handshake.rs similarity index 98% rename from p2p/monero-p2p/tests/handshake.rs rename to p2p/p2p-core/tests/handshake.rs index b63a221b..f9792488 100644 --- a/p2p/monero-p2p/tests/handshake.rs +++ b/p2p/p2p-core/tests/handshake.rs @@ -10,9 +10,9 @@ use tokio_util::codec::{FramedRead, FramedWrite}; use tower::{Service, ServiceExt}; use cuprate_helper::network::Network; -use monero_wire::{common::PeerSupportFlags, BasicNodeData, MoneroWireCodec}; +use cuprate_wire::{common::PeerSupportFlags, BasicNodeData, MoneroWireCodec}; -use monero_p2p::{ +use cuprate_p2p_core::{ client::{ConnectRequest, Connector, DoHandshakeRequest, HandShaker, InternalPeerID}, network_zones::{ClearNet, ClearNetServerCfg}, ConnectionDirection, NetworkZone, diff --git a/p2p/monero-p2p/tests/sending_receiving.rs b/p2p/p2p-core/tests/sending_receiving.rs similarity index 94% rename from p2p/monero-p2p/tests/sending_receiving.rs rename to p2p/p2p-core/tests/sending_receiving.rs index fc5c369b..b4c42e2c 100644 --- a/p2p/monero-p2p/tests/sending_receiving.rs +++ b/p2p/p2p-core/tests/sending_receiving.rs @@ -4,9 +4,9 @@ use tokio::sync::Semaphore; use tower::{Service, ServiceExt}; use cuprate_helper::network::Network; -use monero_wire::{common::PeerSupportFlags, protocol::GetObjectsRequest, BasicNodeData}; +use cuprate_wire::{common::PeerSupportFlags, protocol::GetObjectsRequest, BasicNodeData}; -use monero_p2p::{ +use cuprate_p2p_core::{ client::{ConnectRequest, Connector, HandShaker}, network_zones::ClearNet, protocol::{PeerRequest, PeerResponse}, diff --git a/p2p/monero-p2p/tests/utils.rs b/p2p/p2p-core/tests/utils.rs similarity index 97% rename from p2p/monero-p2p/tests/utils.rs rename to p2p/p2p-core/tests/utils.rs index 9836cbfa..9587bb58 100644 --- a/p2p/monero-p2p/tests/utils.rs +++ b/p2p/p2p-core/tests/utils.rs @@ -7,7 +7,7 @@ use std::{ use futures::FutureExt; use tower::Service; -use monero_p2p::{ +use cuprate_p2p_core::{ services::{ AddressBookRequest, AddressBookResponse, CoreSyncDataRequest, CoreSyncDataResponse, PeerSyncRequest, PeerSyncResponse, @@ -54,7 +54,7 @@ impl Service for DummyCoreSyncSvc { fn call(&mut self, _: CoreSyncDataRequest) -> Self::Future { async move { - Ok(CoreSyncDataResponse(monero_wire::CoreSyncData { + Ok(CoreSyncDataResponse(cuprate_wire::CoreSyncData { cumulative_difficulty: 1, cumulative_difficulty_top64: 0, current_height: 1, diff --git a/p2p/cuprate-p2p/Cargo.toml b/p2p/p2p/Cargo.toml similarity index 77% rename from p2p/cuprate-p2p/Cargo.toml rename to p2p/p2p/Cargo.toml index ab477a83..507d3621 100644 --- a/p2p/cuprate-p2p/Cargo.toml +++ b/p2p/p2p/Cargo.toml @@ -6,13 +6,13 @@ license = "MIT" authors = ["Boog900"] [dependencies] -fixed-bytes = { path = "../../net/fixed-bytes" } -monero-wire = { path = "../../net/monero-wire" } -monero-p2p = { path = "../monero-p2p", features = ["borsh"] } -monero-address-book = { path = "../address-book" } -monero-pruning = { path = "../../pruning" } +cuprate-fixed-bytes = { path = "../../net/fixed-bytes" } +cuprate-wire = { path = "../../net/wire" } +cuprate-p2p-core = { path = "../p2p-core", features = ["borsh"] } +cuprate-address-book = { path = "../address-book" } +cuprate-pruning = { path = "../../pruning" } cuprate-helper = { path = "../../helper", features = ["asynch"], default-features = false } -async-buffer = { path = "../async-buffer" } +cuprate-async-buffer = { path = "../async-buffer" } monero-serai = { workspace = true, features = ["std"] } diff --git a/p2p/cuprate-p2p/src/block_downloader.rs b/p2p/p2p/src/block_downloader.rs similarity index 99% rename from p2p/cuprate-p2p/src/block_downloader.rs rename to p2p/p2p/src/block_downloader.rs index 3f7f7e73..7d0ab7e2 100644 --- a/p2p/cuprate-p2p/src/block_downloader.rs +++ b/p2p/p2p/src/block_downloader.rs @@ -21,13 +21,13 @@ use tokio::{ use tower::{Service, ServiceExt}; use tracing::{instrument, Instrument, Span}; -use async_buffer::{BufferAppender, BufferStream}; -use monero_p2p::{ +use cuprate_async_buffer::{BufferAppender, BufferStream}; +use cuprate_p2p_core::{ handles::ConnectionHandle, services::{PeerSyncRequest, PeerSyncResponse}, NetworkZone, PeerSyncSvc, }; -use monero_pruning::{PruningSeed, CRYPTONOTE_MAX_BLOCK_HEIGHT}; +use cuprate_pruning::{PruningSeed, CRYPTONOTE_MAX_BLOCK_HEIGHT}; use crate::{ client_pool::{ClientPool, ClientPoolDropGuard}, @@ -150,7 +150,7 @@ where + 'static, C::Future: Send + 'static, { - let (buffer_appender, buffer_stream) = async_buffer::new_buffer(config.buffer_size); + let (buffer_appender, buffer_stream) = cuprate_async_buffer::new_buffer(config.buffer_size); let block_downloader = BlockDownloader::new( client_pool, diff --git a/p2p/cuprate-p2p/src/block_downloader/block_queue.rs b/p2p/p2p/src/block_downloader/block_queue.rs similarity index 96% rename from p2p/cuprate-p2p/src/block_downloader/block_queue.rs rename to p2p/p2p/src/block_downloader/block_queue.rs index ada28256..b03d847d 100644 --- a/p2p/cuprate-p2p/src/block_downloader/block_queue.rs +++ b/p2p/p2p/src/block_downloader/block_queue.rs @@ -1,6 +1,6 @@ use std::{cmp::Ordering, collections::BinaryHeap}; -use async_buffer::BufferAppender; +use cuprate_async_buffer::BufferAppender; use super::{BlockBatch, BlockDownloadError}; @@ -120,7 +120,7 @@ mod tests { use tokio::sync::Semaphore; use tokio_test::block_on; - use monero_p2p::handles::HandleBuilder; + use cuprate_p2p_core::handles::HandleBuilder; use super::*; @@ -144,7 +144,7 @@ mod tests { #[test] fn block_queue_returns_items_in_order(batches in vec(ready_batch_strategy(), 0..10_000)) { block_on(async move { - let (buffer_tx, mut buffer_rx) = async_buffer::new_buffer(usize::MAX); + let (buffer_tx, mut buffer_rx) = cuprate_async_buffer::new_buffer(usize::MAX); let mut queue = BlockQueue::new(buffer_tx); diff --git a/p2p/cuprate-p2p/src/block_downloader/chain_tracker.rs b/p2p/p2p/src/block_downloader/chain_tracker.rs similarity index 97% rename from p2p/cuprate-p2p/src/block_downloader/chain_tracker.rs rename to p2p/p2p/src/block_downloader/chain_tracker.rs index 07bad7b6..786a0deb 100644 --- a/p2p/cuprate-p2p/src/block_downloader/chain_tracker.rs +++ b/p2p/p2p/src/block_downloader/chain_tracker.rs @@ -1,9 +1,9 @@ use std::{cmp::min, collections::VecDeque}; -use fixed_bytes::ByteArrayVec; +use cuprate_fixed_bytes::ByteArrayVec; -use monero_p2p::{client::InternalPeerID, handles::ConnectionHandle, NetworkZone}; -use monero_pruning::{PruningSeed, CRYPTONOTE_MAX_BLOCK_HEIGHT}; +use cuprate_p2p_core::{client::InternalPeerID, handles::ConnectionHandle, NetworkZone}; +use cuprate_pruning::{PruningSeed, CRYPTONOTE_MAX_BLOCK_HEIGHT}; use crate::constants::MEDIUM_BAN; diff --git a/p2p/cuprate-p2p/src/block_downloader/download_batch.rs b/p2p/p2p/src/block_downloader/download_batch.rs similarity index 97% rename from p2p/cuprate-p2p/src/block_downloader/download_batch.rs rename to p2p/p2p/src/block_downloader/download_batch.rs index 8cdde41e..e9dfcb45 100644 --- a/p2p/cuprate-p2p/src/block_downloader/download_batch.rs +++ b/p2p/p2p/src/block_downloader/download_batch.rs @@ -6,10 +6,10 @@ use tokio::time::timeout; use tower::{Service, ServiceExt}; use tracing::instrument; +use cuprate_fixed_bytes::ByteArrayVec; use cuprate_helper::asynch::rayon_spawn_async; -use fixed_bytes::ByteArrayVec; -use monero_p2p::{handles::ConnectionHandle, NetworkZone, PeerRequest, PeerResponse}; -use monero_wire::protocol::{GetObjectsRequest, GetObjectsResponse}; +use cuprate_p2p_core::{handles::ConnectionHandle, NetworkZone, PeerRequest, PeerResponse}; +use cuprate_wire::protocol::{GetObjectsRequest, GetObjectsResponse}; use crate::{ block_downloader::{BlockBatch, BlockDownloadError, BlockDownloadTaskResponse}, diff --git a/p2p/cuprate-p2p/src/block_downloader/request_chain.rs b/p2p/p2p/src/block_downloader/request_chain.rs similarity index 98% rename from p2p/cuprate-p2p/src/block_downloader/request_chain.rs rename to p2p/p2p/src/block_downloader/request_chain.rs index 7733aef9..f8b53194 100644 --- a/p2p/cuprate-p2p/src/block_downloader/request_chain.rs +++ b/p2p/p2p/src/block_downloader/request_chain.rs @@ -6,13 +6,13 @@ use tokio::{task::JoinSet, time::timeout}; use tower::{Service, ServiceExt}; use tracing::{instrument, Instrument, Span}; -use monero_p2p::{ +use cuprate_p2p_core::{ client::InternalPeerID, handles::ConnectionHandle, services::{PeerSyncRequest, PeerSyncResponse}, NetworkZone, PeerRequest, PeerResponse, PeerSyncSvc, }; -use monero_wire::protocol::{ChainRequest, ChainResponse}; +use cuprate_wire::protocol::{ChainRequest, ChainResponse}; use crate::{ block_downloader::{ diff --git a/p2p/cuprate-p2p/src/block_downloader/tests.rs b/p2p/p2p/src/block_downloader/tests.rs similarity index 97% rename from p2p/cuprate-p2p/src/block_downloader/tests.rs rename to p2p/p2p/src/block_downloader/tests.rs index 24360aef..07c30d5d 100644 --- a/p2p/cuprate-p2p/src/block_downloader/tests.rs +++ b/p2p/p2p/src/block_downloader/tests.rs @@ -18,15 +18,15 @@ use proptest::{collection::vec, prelude::*}; use tokio::{sync::Semaphore, time::timeout}; use tower::{service_fn, Service}; -use fixed_bytes::ByteArrayVec; -use monero_p2p::{ +use cuprate_fixed_bytes::ByteArrayVec; +use cuprate_p2p_core::{ client::{mock_client, Client, InternalPeerID, PeerInformation}, network_zones::ClearNet, services::{PeerSyncRequest, PeerSyncResponse}, ConnectionDirection, NetworkZone, PeerRequest, PeerResponse, }; -use monero_pruning::PruningSeed; -use monero_wire::{ +use cuprate_pruning::PruningSeed; +use cuprate_wire::{ common::{BlockCompleteEntry, TransactionBlobs}, protocol::{ChainResponse, GetObjectsResponse}, }; @@ -184,7 +184,7 @@ prop_compose! { fn mock_block_downloader_client(blockchain: Arc) -> Client { let semaphore = Arc::new(Semaphore::new(1)); - let (connection_guard, connection_handle) = monero_p2p::handles::HandleBuilder::new() + let (connection_guard, connection_handle) = cuprate_p2p_core::handles::HandleBuilder::new() .with_permit(semaphore.try_acquire_owned().unwrap()) .build(); diff --git a/p2p/cuprate-p2p/src/broadcast.rs b/p2p/p2p/src/broadcast.rs similarity index 98% rename from p2p/cuprate-p2p/src/broadcast.rs rename to p2p/p2p/src/broadcast.rs index b6e5e807..db7a41ee 100644 --- a/p2p/cuprate-p2p/src/broadcast.rs +++ b/p2p/p2p/src/broadcast.rs @@ -22,8 +22,10 @@ use tokio::{ use tokio_stream::wrappers::WatchStream; use tower::Service; -use monero_p2p::{client::InternalPeerID, BroadcastMessage, ConnectionDirection, NetworkZone}; -use monero_wire::{ +use cuprate_p2p_core::{ + client::InternalPeerID, BroadcastMessage, ConnectionDirection, NetworkZone, +}; +use cuprate_wire::{ common::{BlockCompleteEntry, TransactionBlobs}, protocol::{NewFluffyBlock, NewTransactions}, }; @@ -128,7 +130,7 @@ pub fn init_broadcast_channels( /// Only certain P2P messages are supported here: [`NewFluffyBlock`] and [`NewTransactions`]. These are the only /// P2P messages that make sense to broadcast to multiple peers. /// -/// [`NewBlock`](monero_wire::protocol::NewBlock) has been excluded as monerod has had fluffy blocks for a while and +/// [`NewBlock`](cuprate_wire::protocol::NewBlock) has been excluded as monerod has had fluffy blocks for a while and /// Cuprate sets fluffy blocks as a requirement during handshakes. pub enum BroadcastRequest { /// Broadcast a block to the network. The block will be broadcast as a fluffy block to all peers. @@ -400,8 +402,8 @@ mod tests { use tokio::time::timeout; use tower::{Service, ServiceExt}; + use cuprate_p2p_core::{client::InternalPeerID, BroadcastMessage, ConnectionDirection}; use cuprate_test_utils::test_netzone::TestNetZone; - use monero_p2p::{client::InternalPeerID, BroadcastMessage, ConnectionDirection}; use super::{init_broadcast_channels, BroadcastConfig, BroadcastRequest}; diff --git a/p2p/cuprate-p2p/src/client_pool.rs b/p2p/p2p/src/client_pool.rs similarity index 99% rename from p2p/cuprate-p2p/src/client_pool.rs rename to p2p/p2p/src/client_pool.rs index c5a83c8e..711491d0 100644 --- a/p2p/cuprate-p2p/src/client_pool.rs +++ b/p2p/p2p/src/client_pool.rs @@ -16,7 +16,7 @@ use dashmap::DashMap; use tokio::sync::mpsc; use tracing::{Instrument, Span}; -use monero_p2p::{ +use cuprate_p2p_core::{ client::{Client, InternalPeerID}, handles::ConnectionHandle, NetworkZone, diff --git a/p2p/cuprate-p2p/src/client_pool/disconnect_monitor.rs b/p2p/p2p/src/client_pool/disconnect_monitor.rs similarity index 96% rename from p2p/cuprate-p2p/src/client_pool/disconnect_monitor.rs rename to p2p/p2p/src/client_pool/disconnect_monitor.rs index e83fa325..f45d5e38 100644 --- a/p2p/cuprate-p2p/src/client_pool/disconnect_monitor.rs +++ b/p2p/p2p/src/client_pool/disconnect_monitor.rs @@ -14,7 +14,7 @@ use tokio::sync::mpsc; use tokio_util::sync::WaitForCancellationFutureOwned; use tracing::instrument; -use monero_p2p::{client::InternalPeerID, handles::ConnectionHandle, NetworkZone}; +use cuprate_p2p_core::{client::InternalPeerID, handles::ConnectionHandle, NetworkZone}; use super::ClientPool; diff --git a/p2p/cuprate-p2p/src/client_pool/drop_guard_client.rs b/p2p/p2p/src/client_pool/drop_guard_client.rs similarity index 95% rename from p2p/cuprate-p2p/src/client_pool/drop_guard_client.rs rename to p2p/p2p/src/client_pool/drop_guard_client.rs index d8c20c6e..b10c4e9c 100644 --- a/p2p/cuprate-p2p/src/client_pool/drop_guard_client.rs +++ b/p2p/p2p/src/client_pool/drop_guard_client.rs @@ -3,7 +3,7 @@ use std::{ sync::Arc, }; -use monero_p2p::{client::Client, NetworkZone}; +use cuprate_p2p_core::{client::Client, NetworkZone}; use crate::client_pool::ClientPool; diff --git a/p2p/cuprate-p2p/src/config.rs b/p2p/p2p/src/config.rs similarity index 93% rename from p2p/cuprate-p2p/src/config.rs rename to p2p/p2p/src/config.rs index a92ad9a2..90d7f8ff 100644 --- a/p2p/cuprate-p2p/src/config.rs +++ b/p2p/p2p/src/config.rs @@ -1,7 +1,7 @@ +use cuprate_address_book::AddressBookConfig; use cuprate_helper::network::Network; -use monero_address_book::AddressBookConfig; -use monero_p2p::NetworkZone; -use monero_wire::{common::PeerSupportFlags, BasicNodeData}; +use cuprate_p2p_core::NetworkZone; +use cuprate_wire::{common::PeerSupportFlags, BasicNodeData}; /// P2P config. #[derive(Clone, Debug)] diff --git a/p2p/cuprate-p2p/src/connection_maintainer.rs b/p2p/p2p/src/connection_maintainer.rs similarity index 99% rename from p2p/cuprate-p2p/src/connection_maintainer.rs rename to p2p/p2p/src/connection_maintainer.rs index 4ec66950..8e5c9bc3 100644 --- a/p2p/cuprate-p2p/src/connection_maintainer.rs +++ b/p2p/p2p/src/connection_maintainer.rs @@ -14,7 +14,7 @@ use tokio::{ use tower::{Service, ServiceExt}; use tracing::{instrument, Instrument, Span}; -use monero_p2p::{ +use cuprate_p2p_core::{ client::{Client, ConnectRequest, HandshakeError}, services::{AddressBookRequest, AddressBookResponse}, AddressBook, NetworkZone, diff --git a/p2p/cuprate-p2p/src/constants.rs b/p2p/p2p/src/constants.rs similarity index 100% rename from p2p/cuprate-p2p/src/constants.rs rename to p2p/p2p/src/constants.rs diff --git a/p2p/cuprate-p2p/src/inbound_server.rs b/p2p/p2p/src/inbound_server.rs similarity index 99% rename from p2p/cuprate-p2p/src/inbound_server.rs rename to p2p/p2p/src/inbound_server.rs index d8389e79..6bc1e6d8 100644 --- a/p2p/cuprate-p2p/src/inbound_server.rs +++ b/p2p/p2p/src/inbound_server.rs @@ -12,7 +12,7 @@ use tokio::{ use tower::{Service, ServiceExt}; use tracing::{instrument, Instrument, Span}; -use monero_p2p::{ +use cuprate_p2p_core::{ client::{Client, DoHandshakeRequest, HandshakeError, InternalPeerID}, services::{AddressBookRequest, AddressBookResponse}, AddressBook, ConnectionDirection, NetworkZone, diff --git a/p2p/cuprate-p2p/src/lib.rs b/p2p/p2p/src/lib.rs similarity index 95% rename from p2p/cuprate-p2p/src/lib.rs rename to p2p/p2p/src/lib.rs index aea0cac1..95154ec7 100644 --- a/p2p/cuprate-p2p/src/lib.rs +++ b/p2p/p2p/src/lib.rs @@ -4,7 +4,7 @@ //! a certain [`NetworkZone`] use std::sync::Arc; -use async_buffer::BufferStream; +use cuprate_async_buffer::BufferStream; use futures::FutureExt; use tokio::{ sync::{mpsc, watch}, @@ -14,7 +14,7 @@ use tokio_stream::wrappers::WatchStream; use tower::{buffer::Buffer, util::BoxCloneService, Service, ServiceExt}; use tracing::{instrument, Instrument, Span}; -use monero_p2p::{ +use cuprate_p2p_core::{ client::Connector, client::InternalPeerID, services::{AddressBookRequest, AddressBookResponse, PeerSyncRequest}, @@ -56,7 +56,7 @@ where CS: CoreSyncSvc + Clone, { let address_book = - monero_address_book::init_address_book(config.address_book_config.clone()).await?; + cuprate_address_book::init_address_book(config.address_book_config.clone()).await?; let address_book = Buffer::new( address_book, config.max_inbound_connections + config.outbound_connections, @@ -79,7 +79,7 @@ where basic_node_data.peer_id = 1; } - let outbound_handshaker = monero_p2p::client::HandShaker::new( + let outbound_handshaker = cuprate_p2p_core::client::HandShaker::new( address_book.clone(), sync_states_svc.clone(), core_sync_svc.clone(), @@ -88,7 +88,7 @@ where basic_node_data.clone(), ); - let inbound_handshaker = monero_p2p::client::HandShaker::new( + let inbound_handshaker = cuprate_p2p_core::client::HandShaker::new( address_book.clone(), sync_states_svc.clone(), core_sync_svc.clone(), diff --git a/p2p/cuprate-p2p/src/sync_states.rs b/p2p/p2p/src/sync_states.rs similarity index 97% rename from p2p/cuprate-p2p/src/sync_states.rs rename to p2p/p2p/src/sync_states.rs index 127b8d7e..1b4e81ae 100644 --- a/p2p/cuprate-p2p/src/sync_states.rs +++ b/p2p/p2p/src/sync_states.rs @@ -13,14 +13,14 @@ use futures::{stream::FuturesUnordered, StreamExt}; use tokio::sync::watch; use tower::Service; -use monero_p2p::{ +use cuprate_p2p_core::{ client::InternalPeerID, handles::ConnectionHandle, services::{PeerSyncRequest, PeerSyncResponse}, NetworkZone, }; -use monero_pruning::{PruningSeed, CRYPTONOTE_MAX_BLOCK_HEIGHT}; -use monero_wire::CoreSyncData; +use cuprate_pruning::{PruningSeed, CRYPTONOTE_MAX_BLOCK_HEIGHT}; +use cuprate_wire::CoreSyncData; use crate::{client_pool::disconnect_monitor::PeerDisconnectFut, constants::SHORT_BAN}; @@ -243,11 +243,13 @@ mod tests { use tokio::sync::Semaphore; use tower::{Service, ServiceExt}; - use monero_p2p::{client::InternalPeerID, handles::HandleBuilder, services::PeerSyncRequest}; - use monero_wire::CoreSyncData; + use cuprate_p2p_core::{ + client::InternalPeerID, handles::HandleBuilder, services::PeerSyncRequest, + }; + use cuprate_wire::CoreSyncData; + use cuprate_p2p_core::services::PeerSyncResponse; use cuprate_test_utils::test_netzone::TestNetZone; - use monero_p2p::services::PeerSyncResponse; use super::PeerSyncSvc; diff --git a/pruning/Cargo.toml b/pruning/Cargo.toml index bd609975..3f5bd271 100644 --- a/pruning/Cargo.toml +++ b/pruning/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "monero-pruning" +name = "cuprate-pruning" version = "0.1.0" edition = "2021" license = "MIT" diff --git a/pruning/src/lib.rs b/pruning/src/lib.rs index af6017a1..96c3609f 100644 --- a/pruning/src/lib.rs +++ b/pruning/src/lib.rs @@ -8,7 +8,7 @@ //! split into 8 parts): //! //! ```rust -//! use monero_pruning::PruningSeed; +//! use cuprate_pruning::PruningSeed; //! //! let seed: u32 = 386; // the seed you want to check is valid //! match PruningSeed::decompress_p2p_rules(seed) { diff --git a/rpc/json-rpc/Cargo.toml b/rpc/json-rpc/Cargo.toml index 12021eb5..777f3264 100644 --- a/rpc/json-rpc/Cargo.toml +++ b/rpc/json-rpc/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "json-rpc" +name = "cuprate-json-rpc" version = "0.0.0" edition = "2021" description = "JSON-RPC 2.0 implementation" diff --git a/rpc/json-rpc/README.md b/rpc/json-rpc/README.md index 00aa9e3d..9164fa08 100644 --- a/rpc/json-rpc/README.md +++ b/rpc/json-rpc/README.md @@ -30,7 +30,7 @@ and assumes the type within that `body` field is tagged properly, for example: ```rust # use pretty_assertions::assert_eq; use serde::{Deserialize, Serialize}; -use json_rpc::{Id, Request}; +use cuprate_json_rpc::{Id, Request}; // Parameter type. #[derive(Deserialize, Serialize)] @@ -83,7 +83,7 @@ This crate's serialized field order slightly differs compared to `monerod`. With that said, parsing should be not affected at all since a key-value map is used: ```rust # use pretty_assertions::assert_eq; -use json_rpc::{Id, Response}; +use cuprate_json_rpc::{Id, Response}; let response = Response::ok(Id::Num(123), "OK"); let response_json = serde_json::to_string_pretty(&response).unwrap(); @@ -147,7 +147,7 @@ A quick table showing some small differences between this crate and other JSON-R Allows any case for key fields excluding `method/params`: ```rust -# use json_rpc::Response; +# use cuprate_json_rpc::Response; # use serde_json::from_str; # use pretty_assertions::assert_eq; let json = r#"{"jsonrpc":"2.0","id":123,"result":"OK"}"#; @@ -161,7 +161,7 @@ assert_eq!(format!("{err}"), "missing field `jsonrpc` at line 1 column 40"); Allows unknown fields in main `{}`, and response/request objects: ```rust -# use json_rpc::Response; +# use cuprate_json_rpc::Response; # use serde_json::from_str; // unknown fields are allowed in main `{}` // v @@ -176,7 +176,7 @@ from_str::>(&json).unwrap(); Allows overwriting previous values upon duplicate fields (except [`Response`]'s `result/error` field) ```rust -# use json_rpc::{Id, Response}; +# use cuprate_json_rpc::{Id, Response}; # use serde_json::from_str; # use pretty_assertions::assert_eq; // duplicate fields will get overwritten by the latest one diff --git a/rpc/json-rpc/src/error/code.rs b/rpc/json-rpc/src/error/code.rs index 7874ac56..10000b81 100644 --- a/rpc/json-rpc/src/error/code.rs +++ b/rpc/json-rpc/src/error/code.rs @@ -26,7 +26,7 @@ use crate::error::constants::{ /// /// # Display /// ```rust -/// use json_rpc::error::ErrorCode; +/// use cuprate_json_rpc::error::ErrorCode; /// use serde_json::{to_value, from_value, Value}; /// /// for e in [ @@ -46,7 +46,7 @@ use crate::error::constants::{ /// # (De)serialization /// This type gets (de)serialized as the associated `i32`, for example: /// ```rust -/// use json_rpc::error::ErrorCode; +/// use cuprate_json_rpc::error::ErrorCode; /// use serde_json::{to_value, from_value, Value}; /// /// for e in [ @@ -69,7 +69,7 @@ use crate::error::constants::{ /// ``` /// /// ```rust,should_panic -/// # use json_rpc::error::ErrorCode; +/// # use cuprate_json_rpc::error::ErrorCode; /// # use serde_json::from_value; /// // A JSON string that contains an integer won't work. /// from_value::("-32700".into()).unwrap(); @@ -109,7 +109,7 @@ impl ErrorCode { /// [`From`] is the same as this function. /// /// ```rust - /// use json_rpc::error::{ + /// use cuprate_json_rpc::error::{ /// ErrorCode, /// INTERNAL_ERROR, INVALID_PARAMS, INVALID_REQUEST, METHOD_NOT_FOUND, PARSE_ERROR, /// }; @@ -147,7 +147,7 @@ impl ErrorCode { /// Returns `self`'s [`i32`] code representation. /// /// ```rust - /// use json_rpc::error::{ + /// use cuprate_json_rpc::error::{ /// ErrorCode, /// INTERNAL_ERROR, INVALID_PARAMS, INVALID_REQUEST, METHOD_NOT_FOUND, PARSE_ERROR, /// }; @@ -174,7 +174,7 @@ impl ErrorCode { /// Returns `self`'s human readable [`str`] message. /// /// ```rust - /// use json_rpc::error::{ + /// use cuprate_json_rpc::error::{ /// ErrorCode, /// INTERNAL_ERROR, INVALID_PARAMS, INVALID_REQUEST, METHOD_NOT_FOUND, PARSE_ERROR, SERVER_ERROR, /// }; diff --git a/rpc/json-rpc/src/error/object.rs b/rpc/json-rpc/src/error/object.rs index 6ad96a7e..dbaaab0b 100644 --- a/rpc/json-rpc/src/error/object.rs +++ b/rpc/json-rpc/src/error/object.rs @@ -22,7 +22,7 @@ use crate::error::{ /// /// # Display /// ```rust -/// use json_rpc::error::ErrorObject; +/// use cuprate_json_rpc::error::ErrorObject; /// /// // The format is `$CODE: $MESSAGE`. /// // If a message was not passed during construction, @@ -69,7 +69,7 @@ impl ErrorObject { /// /// ```rust /// use std::borrow::Cow; - /// use json_rpc::error::{ErrorCode, ErrorObject}; + /// use cuprate_json_rpc::error::{ErrorCode, ErrorObject}; /// /// for code in [ /// ErrorCode::ParseError, @@ -100,7 +100,7 @@ impl ErrorObject { /// /// ```rust /// use std::borrow::Cow; - /// use json_rpc::error::{ErrorCode, ErrorObject}; + /// use cuprate_json_rpc::error::{ErrorCode, ErrorObject}; /// /// let code = ErrorCode::ParseError; /// let object = ErrorObject::parse_error(); @@ -122,7 +122,7 @@ impl ErrorObject { /// /// ```rust /// use std::borrow::Cow; - /// use json_rpc::error::{ErrorCode, ErrorObject}; + /// use cuprate_json_rpc::error::{ErrorCode, ErrorObject}; /// /// let code = ErrorCode::InvalidRequest; /// let object = ErrorObject::invalid_request(); @@ -144,7 +144,7 @@ impl ErrorObject { /// /// ```rust /// use std::borrow::Cow; - /// use json_rpc::error::{ErrorCode, ErrorObject}; + /// use cuprate_json_rpc::error::{ErrorCode, ErrorObject}; /// /// let code = ErrorCode::MethodNotFound; /// let object = ErrorObject::method_not_found(); @@ -166,7 +166,7 @@ impl ErrorObject { /// /// ```rust /// use std::borrow::Cow; - /// use json_rpc::error::{ErrorCode, ErrorObject}; + /// use cuprate_json_rpc::error::{ErrorCode, ErrorObject}; /// /// let code = ErrorCode::InvalidParams; /// let object = ErrorObject::invalid_params(); @@ -189,7 +189,7 @@ impl ErrorObject { /// /// ```rust /// use std::borrow::Cow; - /// use json_rpc::error::{ErrorCode, ErrorObject}; + /// use cuprate_json_rpc::error::{ErrorCode, ErrorObject}; /// /// let code = ErrorCode::InternalError; /// let object = ErrorObject::internal_error(); @@ -213,7 +213,7 @@ impl ErrorObject { /// /// ```rust /// use std::borrow::Cow; - /// use json_rpc::error::{ErrorCode, ErrorObject}; + /// use cuprate_json_rpc::error::{ErrorCode, ErrorObject}; /// /// let code = ErrorCode::ServerError(0); /// let object = ErrorObject::server_error(0); diff --git a/rpc/json-rpc/src/id.rs b/rpc/json-rpc/src/id.rs index 7ee710d5..db894adc 100644 --- a/rpc/json-rpc/src/id.rs +++ b/rpc/json-rpc/src/id.rs @@ -26,7 +26,7 @@ use std::borrow::Cow; /// (or just manually create the `Cow`) for a non-allocating `Id`. /// /// ```rust -/// use json_rpc::Id; +/// use cuprate_json_rpc::Id; /// /// assert_eq!(Id::from(String::new()), Id::Str("".into())); /// assert_eq!(Id::from(Some(String::new())), Id::Str("".into())); @@ -39,7 +39,7 @@ pub enum Id { /// A JSON `null` value. /// /// ```rust - /// use json_rpc::Id; + /// use cuprate_json_rpc::Id; /// use serde_json::{from_value,to_value,json,Value}; /// /// assert_eq!(from_value::(json!(null)).unwrap(), Id::Null); @@ -61,7 +61,7 @@ pub enum Id { /// /// ```rust /// use std::borrow::Cow; - /// use json_rpc::Id; + /// use cuprate_json_rpc::Id; /// /// /// A program's static ID. /// const ID: &'static str = "my_id"; @@ -79,7 +79,7 @@ impl Id { /// This returns `Some(u64)` if [`Id`] is a number. /// /// ```rust - /// use json_rpc::Id; + /// use cuprate_json_rpc::Id; /// /// assert_eq!(Id::Num(0).as_u64(), Some(0)); /// assert_eq!(Id::Str("0".into()).as_u64(), None); @@ -95,7 +95,7 @@ impl Id { /// This returns `Some(&str)` if [`Id`] is a string. /// /// ```rust - /// use json_rpc::Id; + /// use cuprate_json_rpc::Id; /// /// assert_eq!(Id::Str("0".into()).as_str(), Some("0")); /// assert_eq!(Id::Num(0).as_str(), None); @@ -111,7 +111,7 @@ impl Id { /// Returns `true` if `self` is [`Id::Null`]. /// /// ```rust - /// use json_rpc::Id; + /// use cuprate_json_rpc::Id; /// /// assert!(Id::Null.is_null()); /// assert!(!Id::Num(0).is_null()); @@ -124,7 +124,7 @@ impl Id { /// Create a new [`Id::Str`] from a static string. /// /// ```rust - /// use json_rpc::Id; + /// use cuprate_json_rpc::Id; /// /// assert_eq!(Id::from_static_str("hi"), Id::Str("hi".into())); /// ``` diff --git a/rpc/json-rpc/src/request.rs b/rpc/json-rpc/src/request.rs index d760047a..d1f1e1e4 100644 --- a/rpc/json-rpc/src/request.rs +++ b/rpc/json-rpc/src/request.rs @@ -47,7 +47,7 @@ impl Request { /// Create a new [`Self`] with no [`Id`]. /// /// ```rust - /// use json_rpc::Request; + /// use cuprate_json_rpc::Request; /// /// assert_eq!(Request::new("").id, None); /// ``` @@ -62,7 +62,7 @@ impl Request { /// Create a new [`Self`] with an [`Id`]. /// /// ```rust - /// use json_rpc::{Id, Request}; + /// use cuprate_json_rpc::{Id, Request}; /// /// assert_eq!(Request::new_with_id(Id::Num(0), "").id, Some(Id::Num(0))); /// ``` @@ -79,7 +79,7 @@ impl Request { /// In other words, if `id` is [`None`], this returns `true`. /// /// ```rust - /// use json_rpc::{Id, Request}; + /// use cuprate_json_rpc::{Id, Request}; /// /// assert!(Request::new("").is_notification()); /// assert!(!Request::new_with_id(Id::Null, "").is_notification()); diff --git a/rpc/json-rpc/src/response.rs b/rpc/json-rpc/src/response.rs index b1c9483e..efd768b5 100644 --- a/rpc/json-rpc/src/response.rs +++ b/rpc/json-rpc/src/response.rs @@ -37,7 +37,7 @@ impl Response { /// Creates a successful response. /// /// ```rust - /// use json_rpc::{Id, Response}; + /// use cuprate_json_rpc::{Id, Response}; /// /// let ok = Response::ok(Id::Num(123), "OK"); /// let json = serde_json::to_string(&ok).unwrap(); @@ -54,7 +54,7 @@ impl Response { /// Creates an error response. /// /// ```rust - /// use json_rpc::{Id, Response, error::{ErrorObject, ErrorCode}}; + /// use cuprate_json_rpc::{Id, Response, error::{ErrorObject, ErrorCode}}; /// /// let err = ErrorObject { /// code: 0.into(), @@ -77,7 +77,7 @@ impl Response { /// Creates an error response using [`ErrorObject::parse_error`]. /// /// ```rust - /// use json_rpc::{Id, Response, error::{ErrorObject, ErrorCode}}; + /// use cuprate_json_rpc::{Id, Response, error::{ErrorObject, ErrorCode}}; /// /// let ok = Response::<()>::parse_error(Id::Num(0)); /// let json = serde_json::to_string(&ok).unwrap(); @@ -94,7 +94,7 @@ impl Response { /// Creates an error response using [`ErrorObject::invalid_request`]. /// /// ```rust - /// use json_rpc::{Id, Response, error::{ErrorObject, ErrorCode}}; + /// use cuprate_json_rpc::{Id, Response, error::{ErrorObject, ErrorCode}}; /// /// let ok = Response::<()>::invalid_request(Id::Num(0)); /// let json = serde_json::to_string(&ok).unwrap(); @@ -111,7 +111,7 @@ impl Response { /// Creates an error response using [`ErrorObject::method_not_found`]. /// /// ```rust - /// use json_rpc::{Id, Response, error::{ErrorObject, ErrorCode}}; + /// use cuprate_json_rpc::{Id, Response, error::{ErrorObject, ErrorCode}}; /// /// let ok = Response::<()>::method_not_found(Id::Num(0)); /// let json = serde_json::to_string(&ok).unwrap(); @@ -128,7 +128,7 @@ impl Response { /// Creates an error response using [`ErrorObject::invalid_params`]. /// /// ```rust - /// use json_rpc::{Id, Response, error::{ErrorObject, ErrorCode}}; + /// use cuprate_json_rpc::{Id, Response, error::{ErrorObject, ErrorCode}}; /// /// let ok = Response::<()>::invalid_params(Id::Num(0)); /// let json = serde_json::to_string(&ok).unwrap(); @@ -145,7 +145,7 @@ impl Response { /// Creates an error response using [`ErrorObject::internal_error`]. /// /// ```rust - /// use json_rpc::{Id, Response, error::{ErrorObject, ErrorCode}}; + /// use cuprate_json_rpc::{Id, Response, error::{ErrorObject, ErrorCode}}; /// /// let ok = Response::<()>::internal_error(Id::Num(0)); /// let json = serde_json::to_string(&ok).unwrap(); diff --git a/rpc/json-rpc/src/version.rs b/rpc/json-rpc/src/version.rs index 958d2150..30e507a4 100644 --- a/rpc/json-rpc/src/version.rs +++ b/rpc/json-rpc/src/version.rs @@ -26,7 +26,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; /// /// # Example /// ```rust -/// use json_rpc::Version; +/// use cuprate_json_rpc::Version; /// use serde_json::{to_string, to_string_pretty, from_str}; /// /// assert_eq!(Version::TWO, "2.0"); @@ -64,7 +64,7 @@ impl Version { /// Note that this does not have extra quotes to mark /// that it's a JSON string and not a float. /// ```rust - /// use json_rpc::Version; + /// use cuprate_json_rpc::Version; /// /// let string = format!("{}", Version); /// assert_eq!(string, "2.0"); diff --git a/rpc/cuprate-rpc-interface/Cargo.toml b/rpc/rpc-interface/Cargo.toml similarity index 100% rename from rpc/cuprate-rpc-interface/Cargo.toml rename to rpc/rpc-interface/Cargo.toml diff --git a/rpc/cuprate-rpc-interface/src/lib.rs b/rpc/rpc-interface/src/lib.rs similarity index 100% rename from rpc/cuprate-rpc-interface/src/lib.rs rename to rpc/rpc-interface/src/lib.rs diff --git a/rpc/monero-rpc-types/Cargo.toml b/rpc/rpc-types/Cargo.toml similarity index 90% rename from rpc/monero-rpc-types/Cargo.toml rename to rpc/rpc-types/Cargo.toml index a32eedb6..e299becc 100644 --- a/rpc/monero-rpc-types/Cargo.toml +++ b/rpc/rpc-types/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "monero-rpc-types" +name = "cuprate-rpc-types" version = "0.0.0" edition = "2021" description = "Monero RPC types" diff --git a/rpc/monero-rpc-types/src/lib.rs b/rpc/rpc-types/src/lib.rs similarity index 100% rename from rpc/monero-rpc-types/src/lib.rs rename to rpc/rpc-types/src/lib.rs diff --git a/storage/cuprate-blockchain/Cargo.toml b/storage/blockchain/Cargo.toml similarity index 98% rename from storage/cuprate-blockchain/Cargo.toml rename to storage/blockchain/Cargo.toml index e5b6bf67..eb5a27ea 100644 --- a/storage/cuprate-blockchain/Cargo.toml +++ b/storage/blockchain/Cargo.toml @@ -28,7 +28,7 @@ cfg-if = { workspace = true } cuprate-helper = { path = "../../helper", features = ["fs", "thread", "map"] } cuprate-types = { path = "../../types", features = ["blockchain"] } curve25519-dalek = { workspace = true } -monero-pruning = { path = "../../pruning" } +cuprate-pruning = { path = "../../pruning" } monero-serai = { workspace = true, features = ["std"] } paste = { workspace = true } page_size = { version = "0.6.0" } # Needed for database resizes, they must be a multiple of the OS page size. diff --git a/storage/cuprate-blockchain/README.md b/storage/blockchain/README.md similarity index 100% rename from storage/cuprate-blockchain/README.md rename to storage/blockchain/README.md diff --git a/storage/cuprate-blockchain/src/backend/heed/database.rs b/storage/blockchain/src/backend/heed/database.rs similarity index 100% rename from storage/cuprate-blockchain/src/backend/heed/database.rs rename to storage/blockchain/src/backend/heed/database.rs diff --git a/storage/cuprate-blockchain/src/backend/heed/env.rs b/storage/blockchain/src/backend/heed/env.rs similarity index 100% rename from storage/cuprate-blockchain/src/backend/heed/env.rs rename to storage/blockchain/src/backend/heed/env.rs diff --git a/storage/cuprate-blockchain/src/backend/heed/error.rs b/storage/blockchain/src/backend/heed/error.rs similarity index 100% rename from storage/cuprate-blockchain/src/backend/heed/error.rs rename to storage/blockchain/src/backend/heed/error.rs diff --git a/storage/cuprate-blockchain/src/backend/heed/mod.rs b/storage/blockchain/src/backend/heed/mod.rs similarity index 100% rename from storage/cuprate-blockchain/src/backend/heed/mod.rs rename to storage/blockchain/src/backend/heed/mod.rs diff --git a/storage/cuprate-blockchain/src/backend/heed/storable.rs b/storage/blockchain/src/backend/heed/storable.rs similarity index 100% rename from storage/cuprate-blockchain/src/backend/heed/storable.rs rename to storage/blockchain/src/backend/heed/storable.rs diff --git a/storage/cuprate-blockchain/src/backend/heed/transaction.rs b/storage/blockchain/src/backend/heed/transaction.rs similarity index 100% rename from storage/cuprate-blockchain/src/backend/heed/transaction.rs rename to storage/blockchain/src/backend/heed/transaction.rs diff --git a/storage/cuprate-blockchain/src/backend/heed/types.rs b/storage/blockchain/src/backend/heed/types.rs similarity index 100% rename from storage/cuprate-blockchain/src/backend/heed/types.rs rename to storage/blockchain/src/backend/heed/types.rs diff --git a/storage/cuprate-blockchain/src/backend/mod.rs b/storage/blockchain/src/backend/mod.rs similarity index 100% rename from storage/cuprate-blockchain/src/backend/mod.rs rename to storage/blockchain/src/backend/mod.rs diff --git a/storage/cuprate-blockchain/src/backend/redb/database.rs b/storage/blockchain/src/backend/redb/database.rs similarity index 100% rename from storage/cuprate-blockchain/src/backend/redb/database.rs rename to storage/blockchain/src/backend/redb/database.rs diff --git a/storage/cuprate-blockchain/src/backend/redb/env.rs b/storage/blockchain/src/backend/redb/env.rs similarity index 100% rename from storage/cuprate-blockchain/src/backend/redb/env.rs rename to storage/blockchain/src/backend/redb/env.rs diff --git a/storage/cuprate-blockchain/src/backend/redb/error.rs b/storage/blockchain/src/backend/redb/error.rs similarity index 100% rename from storage/cuprate-blockchain/src/backend/redb/error.rs rename to storage/blockchain/src/backend/redb/error.rs diff --git a/storage/cuprate-blockchain/src/backend/redb/mod.rs b/storage/blockchain/src/backend/redb/mod.rs similarity index 100% rename from storage/cuprate-blockchain/src/backend/redb/mod.rs rename to storage/blockchain/src/backend/redb/mod.rs diff --git a/storage/cuprate-blockchain/src/backend/redb/storable.rs b/storage/blockchain/src/backend/redb/storable.rs similarity index 100% rename from storage/cuprate-blockchain/src/backend/redb/storable.rs rename to storage/blockchain/src/backend/redb/storable.rs diff --git a/storage/cuprate-blockchain/src/backend/redb/transaction.rs b/storage/blockchain/src/backend/redb/transaction.rs similarity index 100% rename from storage/cuprate-blockchain/src/backend/redb/transaction.rs rename to storage/blockchain/src/backend/redb/transaction.rs diff --git a/storage/cuprate-blockchain/src/backend/redb/types.rs b/storage/blockchain/src/backend/redb/types.rs similarity index 100% rename from storage/cuprate-blockchain/src/backend/redb/types.rs rename to storage/blockchain/src/backend/redb/types.rs diff --git a/storage/cuprate-blockchain/src/backend/tests.rs b/storage/blockchain/src/backend/tests.rs similarity index 100% rename from storage/cuprate-blockchain/src/backend/tests.rs rename to storage/blockchain/src/backend/tests.rs diff --git a/storage/cuprate-blockchain/src/config/backend.rs b/storage/blockchain/src/config/backend.rs similarity index 100% rename from storage/cuprate-blockchain/src/config/backend.rs rename to storage/blockchain/src/config/backend.rs diff --git a/storage/cuprate-blockchain/src/config/config.rs b/storage/blockchain/src/config/config.rs similarity index 100% rename from storage/cuprate-blockchain/src/config/config.rs rename to storage/blockchain/src/config/config.rs diff --git a/storage/cuprate-blockchain/src/config/mod.rs b/storage/blockchain/src/config/mod.rs similarity index 100% rename from storage/cuprate-blockchain/src/config/mod.rs rename to storage/blockchain/src/config/mod.rs diff --git a/storage/cuprate-blockchain/src/config/reader_threads.rs b/storage/blockchain/src/config/reader_threads.rs similarity index 100% rename from storage/cuprate-blockchain/src/config/reader_threads.rs rename to storage/blockchain/src/config/reader_threads.rs diff --git a/storage/cuprate-blockchain/src/config/sync_mode.rs b/storage/blockchain/src/config/sync_mode.rs similarity index 100% rename from storage/cuprate-blockchain/src/config/sync_mode.rs rename to storage/blockchain/src/config/sync_mode.rs diff --git a/storage/cuprate-blockchain/src/constants.rs b/storage/blockchain/src/constants.rs similarity index 100% rename from storage/cuprate-blockchain/src/constants.rs rename to storage/blockchain/src/constants.rs diff --git a/storage/cuprate-blockchain/src/database.rs b/storage/blockchain/src/database.rs similarity index 100% rename from storage/cuprate-blockchain/src/database.rs rename to storage/blockchain/src/database.rs diff --git a/storage/cuprate-blockchain/src/env.rs b/storage/blockchain/src/env.rs similarity index 100% rename from storage/cuprate-blockchain/src/env.rs rename to storage/blockchain/src/env.rs diff --git a/storage/cuprate-blockchain/src/error.rs b/storage/blockchain/src/error.rs similarity index 100% rename from storage/cuprate-blockchain/src/error.rs rename to storage/blockchain/src/error.rs diff --git a/storage/cuprate-blockchain/src/free.rs b/storage/blockchain/src/free.rs similarity index 100% rename from storage/cuprate-blockchain/src/free.rs rename to storage/blockchain/src/free.rs diff --git a/storage/cuprate-blockchain/src/key.rs b/storage/blockchain/src/key.rs similarity index 100% rename from storage/cuprate-blockchain/src/key.rs rename to storage/blockchain/src/key.rs diff --git a/storage/cuprate-blockchain/src/lib.rs b/storage/blockchain/src/lib.rs similarity index 100% rename from storage/cuprate-blockchain/src/lib.rs rename to storage/blockchain/src/lib.rs diff --git a/storage/cuprate-blockchain/src/ops/block.rs b/storage/blockchain/src/ops/block.rs similarity index 100% rename from storage/cuprate-blockchain/src/ops/block.rs rename to storage/blockchain/src/ops/block.rs diff --git a/storage/cuprate-blockchain/src/ops/blockchain.rs b/storage/blockchain/src/ops/blockchain.rs similarity index 100% rename from storage/cuprate-blockchain/src/ops/blockchain.rs rename to storage/blockchain/src/ops/blockchain.rs diff --git a/storage/cuprate-blockchain/src/ops/key_image.rs b/storage/blockchain/src/ops/key_image.rs similarity index 100% rename from storage/cuprate-blockchain/src/ops/key_image.rs rename to storage/blockchain/src/ops/key_image.rs diff --git a/storage/cuprate-blockchain/src/ops/macros.rs b/storage/blockchain/src/ops/macros.rs similarity index 100% rename from storage/cuprate-blockchain/src/ops/macros.rs rename to storage/blockchain/src/ops/macros.rs diff --git a/storage/cuprate-blockchain/src/ops/mod.rs b/storage/blockchain/src/ops/mod.rs similarity index 100% rename from storage/cuprate-blockchain/src/ops/mod.rs rename to storage/blockchain/src/ops/mod.rs diff --git a/storage/cuprate-blockchain/src/ops/output.rs b/storage/blockchain/src/ops/output.rs similarity index 100% rename from storage/cuprate-blockchain/src/ops/output.rs rename to storage/blockchain/src/ops/output.rs diff --git a/storage/cuprate-blockchain/src/ops/property.rs b/storage/blockchain/src/ops/property.rs similarity index 97% rename from storage/cuprate-blockchain/src/ops/property.rs rename to storage/blockchain/src/ops/property.rs index 2e584d87..15b5f878 100644 --- a/storage/cuprate-blockchain/src/ops/property.rs +++ b/storage/blockchain/src/ops/property.rs @@ -3,7 +3,7 @@ //! SOMEDAY: the database `properties` table is not yet implemented. //---------------------------------------------------------------------------------------------------- Import -use monero_pruning::PruningSeed; +use cuprate_pruning::PruningSeed; use crate::{error::RuntimeError, ops::macros::doc_error}; //---------------------------------------------------------------------------------------------------- Free Functions diff --git a/storage/cuprate-blockchain/src/ops/tx.rs b/storage/blockchain/src/ops/tx.rs similarity index 100% rename from storage/cuprate-blockchain/src/ops/tx.rs rename to storage/blockchain/src/ops/tx.rs diff --git a/storage/cuprate-blockchain/src/resize.rs b/storage/blockchain/src/resize.rs similarity index 100% rename from storage/cuprate-blockchain/src/resize.rs rename to storage/blockchain/src/resize.rs diff --git a/storage/cuprate-blockchain/src/service/free.rs b/storage/blockchain/src/service/free.rs similarity index 100% rename from storage/cuprate-blockchain/src/service/free.rs rename to storage/blockchain/src/service/free.rs diff --git a/storage/cuprate-blockchain/src/service/mod.rs b/storage/blockchain/src/service/mod.rs similarity index 100% rename from storage/cuprate-blockchain/src/service/mod.rs rename to storage/blockchain/src/service/mod.rs diff --git a/storage/cuprate-blockchain/src/service/read.rs b/storage/blockchain/src/service/read.rs similarity index 100% rename from storage/cuprate-blockchain/src/service/read.rs rename to storage/blockchain/src/service/read.rs diff --git a/storage/cuprate-blockchain/src/service/tests.rs b/storage/blockchain/src/service/tests.rs similarity index 100% rename from storage/cuprate-blockchain/src/service/tests.rs rename to storage/blockchain/src/service/tests.rs diff --git a/storage/cuprate-blockchain/src/service/types.rs b/storage/blockchain/src/service/types.rs similarity index 100% rename from storage/cuprate-blockchain/src/service/types.rs rename to storage/blockchain/src/service/types.rs diff --git a/storage/cuprate-blockchain/src/service/write.rs b/storage/blockchain/src/service/write.rs similarity index 100% rename from storage/cuprate-blockchain/src/service/write.rs rename to storage/blockchain/src/service/write.rs diff --git a/storage/cuprate-blockchain/src/storable.rs b/storage/blockchain/src/storable.rs similarity index 100% rename from storage/cuprate-blockchain/src/storable.rs rename to storage/blockchain/src/storable.rs diff --git a/storage/cuprate-blockchain/src/table.rs b/storage/blockchain/src/table.rs similarity index 100% rename from storage/cuprate-blockchain/src/table.rs rename to storage/blockchain/src/table.rs diff --git a/storage/cuprate-blockchain/src/tables.rs b/storage/blockchain/src/tables.rs similarity index 100% rename from storage/cuprate-blockchain/src/tables.rs rename to storage/blockchain/src/tables.rs diff --git a/storage/cuprate-blockchain/src/tests.rs b/storage/blockchain/src/tests.rs similarity index 100% rename from storage/cuprate-blockchain/src/tests.rs rename to storage/blockchain/src/tests.rs diff --git a/storage/cuprate-blockchain/src/transaction.rs b/storage/blockchain/src/transaction.rs similarity index 100% rename from storage/cuprate-blockchain/src/transaction.rs rename to storage/blockchain/src/transaction.rs diff --git a/storage/cuprate-blockchain/src/types.rs b/storage/blockchain/src/types.rs similarity index 100% rename from storage/cuprate-blockchain/src/types.rs rename to storage/blockchain/src/types.rs diff --git a/storage/cuprate-blockchain/src/unsafe_sendable.rs b/storage/blockchain/src/unsafe_sendable.rs similarity index 100% rename from storage/cuprate-blockchain/src/unsafe_sendable.rs rename to storage/blockchain/src/unsafe_sendable.rs diff --git a/storage/database/Cargo.toml b/storage/database/Cargo.toml index 50bf0f7e..a0a46384 100644 --- a/storage/database/Cargo.toml +++ b/storage/database/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "database" +name = "cuprate-database" version = "0.0.0" edition = "2021" description = "Cuprate's database abstraction" diff --git a/storage/cuprate-txpool/Cargo.toml b/storage/txpool/Cargo.toml similarity index 100% rename from storage/cuprate-txpool/Cargo.toml rename to storage/txpool/Cargo.toml diff --git a/storage/cuprate-txpool/src/lib.rs b/storage/txpool/src/lib.rs similarity index 100% rename from storage/cuprate-txpool/src/lib.rs rename to storage/txpool/src/lib.rs diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 82f7e523..f9a5c6d9 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -8,8 +8,8 @@ authors = ["Boog900", "hinto-janai"] [dependencies] cuprate-types = { path = "../types" } cuprate-helper = { path = "../helper", features = ["map"] } -monero-wire = { path = "../net/monero-wire" } -monero-p2p = { path = "../p2p/monero-p2p", features = ["borsh"] } +cuprate-wire = { path = "../net/wire" } +cuprate-p2p-core = { path = "../p2p/p2p-core", features = ["borsh"] } hex = { workspace = true } hex-literal = { workspace = true } diff --git a/test-utils/src/test_netzone.rs b/test-utils/src/test_netzone.rs index e82e5532..f1f75826 100644 --- a/test-utils/src/test_netzone.rs +++ b/test-utils/src/test_netzone.rs @@ -15,12 +15,12 @@ use futures::Stream; use tokio::io::{DuplexStream, ReadHalf, WriteHalf}; use tokio_util::codec::{FramedRead, FramedWrite}; -use monero_wire::{ +use cuprate_wire::{ network_address::{NetworkAddress, NetworkAddressIncorrectZone}, MoneroWireCodec, }; -use monero_p2p::{NetZoneAddress, NetworkZone}; +use cuprate_p2p_core::{NetZoneAddress, NetworkZone}; /// An address on the test network #[derive(Debug, Clone, Copy, Eq, Hash, PartialEq, BorshSerialize, BorshDeserialize)]