init cuprated

This commit is contained in:
Boog900 2024-05-30 01:09:41 +01:00
parent c50d9642be
commit 317b6a79dd
No known key found for this signature in database
GPG key ID: 42AB1287CB0041C2
8 changed files with 80 additions and 3 deletions

16
Cargo.lock generated
View file

@ -643,6 +643,20 @@ dependencies = [
"serde",
]
[[package]]
name = "cuprated"
version = "0.1.0"
dependencies = [
"bytes",
"cuprate-blockchain",
"cuprate-consensus",
"cuprate-p2p",
"dandelion-tower",
"futures",
"monero-p2p",
"tokio",
]
[[package]]
name = "curve25519-dalek"
version = "4.1.2"
@ -690,7 +704,7 @@ dependencies = [
]
[[package]]
name = "dandelion_tower"
name = "dandelion-tower"
version = "0.1.0"
dependencies = [
"futures",

View file

@ -19,7 +19,7 @@ members = [
"storage/database",
"pruning",
"test-utils",
"types",
"types", "binaries/cuprated",
]
[profile.release]

View file

@ -0,0 +1,26 @@
[package]
name = "cuprated"
version = "0.1.0"
edition = "2021"
license = "AGPL-3-only"
authors = ["Boog900", "hinto-janai", "SyntheticBird45"]
[dependencies]
# P2P
cuprate-p2p = { path = "../../p2p/cuprate-p2p" }
monero-p2p = { path = "../../p2p/monero-p2p" }
dandelion-tower = { path = "../../p2p/dandelion" }
# Databases
cuprate-blockchain = { path = "../../storage/cuprate-blockchain" }
# Consensus
cuprate-consensus = { path = "../../consensus" }
# Async
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
futures = { workspace = true }
# Utils
bytes = { workspace = true }

View file

@ -0,0 +1,7 @@
mod network;
mod p2p_request_handler;
mod syncer;
fn main() {
println!("Hello, world!");
}

View file

@ -0,0 +1,26 @@
use bytes::Bytes;
use dandelion_tower::TxState;
use futures::Stream;
/// A trait representing the whole P2P network, including all network zones.
///
/// [`cuprate_p2p`] provides a per [`NetworkZone`](monero_p2p::NetworkZone) abstraction in [`TODO`], this trait
/// provides a full abstraction, just exposing a minimal interface for Cuprate to interact with.
///
/// It's methods will handle routing to the different [`NetworkZone`](monero_p2p::NetworkZone)s when required.
///
/// This is kept generic for testing purposes.
trait P2PNetwork: Clone {
/// An identifier for a node on any [`NetworkZone`](monero_p2p::NetworkZone)
type PeerID;
/// The block downloader stream.
type BlockDownloader: Stream<Item = ()>;
/// Broadcasts a block to the network.
fn broadcast_block(&mut self, block_bytes: Bytes, chain_height: u64);
/// Broadcasts a transaction to the network.
fn broadcast_transaction(&mut self, tx_bytes: Bytes, state: TxState<Self::PeerID>);
fn block_downloader(&mut self) -> Self::BlockDownloader;
}

View file

@ -0,0 +1,4 @@
//! # The Syncer
//!
//! The syncer is the part of Cuprate that handles keeping the blockchain state, it handles syncing if
//! we have fallen behind, and it handles incoming blocks.

View file

@ -1,5 +1,5 @@
[package]
name = "dandelion_tower"
name = "dandelion-tower"
version = "0.1.0"
edition = "2021"
license = "MIT"