Skip to content

Commit 6ee3b16

Browse files
committed
Merge branch 'main' into storage-alt-blocks
2 parents 4e00cd0 + 6502729 commit 6ee3b16

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1230
-172
lines changed

Cargo.lock

Lines changed: 78 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ opt-level = 1
4848
opt-level = 3
4949

5050
[workspace.dependencies]
51+
anyhow = { version = "1.0.87", default-features = false }
5152
async-trait = { version = "0.1.74", default-features = false }
5253
bitflags = { version = "2.4.2", default-features = false }
5354
borsh = { version = "1.2.1", default-features = false }
@@ -76,7 +77,7 @@ serde_bytes = { version = "0.11.12", default-features = false }
7677
serde_json = { version = "1.0.108", default-features = false }
7778
serde = { version = "1.0.190", default-features = false }
7879
thiserror = { version = "1.0.50", default-features = false }
79-
thread_local = { version = "1.1.7", default-features = false }
80+
thread_local = { version = "1.1.7", default-features = false }
8081
tokio-util = { version = "0.7.10", default-features = false }
8182
tokio-stream = { version = "0.1.14", default-features = false }
8283
tokio = { version = "1.33.0", default-features = false }
@@ -263,6 +264,7 @@ empty_enum_variants_with_brackets = "deny"
263264
empty_drop = "deny"
264265
clone_on_ref_ptr = "deny"
265266
upper_case_acronyms = "deny"
267+
allow_attributes = "deny"
266268

267269
# Hot
268270
# inline_always = "deny"

binaries/cuprated/Cargo.toml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,69 @@ authors = ["Boog900", "hinto-janai", "SyntheticBird45"]
88
repository = "https://github.com/Cuprate/cuprate/tree/main/binaries/cuprated"
99

1010
[dependencies]
11+
# TODO: after v1.0.0, remove unneeded dependencies.
12+
cuprate-consensus = { path = "../../consensus" }
13+
cuprate-fast-sync = { path = "../../consensus/fast-sync" }
14+
cuprate-consensus-rules = { path = "../../consensus/rules" }
15+
cuprate-cryptonight = { path = "../../cryptonight" }
16+
cuprate-helper = { path = "../../helper" }
17+
cuprate-epee-encoding = { path = "../../net/epee-encoding" }
18+
cuprate-fixed-bytes = { path = "../../net/fixed-bytes" }
19+
cuprate-levin = { path = "../../net/levin" }
20+
cuprate-wire = { path = "../../net/wire" }
21+
cuprate-p2p = { path = "../../p2p/p2p" }
22+
cuprate-p2p-core = { path = "../../p2p/p2p-core" }
23+
cuprate-dandelion-tower = { path = "../../p2p/dandelion-tower" }
24+
cuprate-async-buffer = { path = "../../p2p/async-buffer" }
25+
cuprate-address-book = { path = "../../p2p/address-book" }
26+
cuprate-blockchain = { path = "../../storage/blockchain" }
27+
cuprate-database-service = { path = "../../storage/service" }
28+
cuprate-txpool = { path = "../../storage/txpool" }
29+
cuprate-database = { path = "../../storage/database" }
30+
cuprate-pruning = { path = "../../pruning" }
31+
cuprate-test-utils = { path = "../../test-utils" }
32+
cuprate-types = { path = "../../types" }
33+
cuprate-json-rpc = { path = "../../rpc/json-rpc" }
34+
cuprate-rpc-interface = { path = "../../rpc/interface" }
35+
cuprate-rpc-types = { path = "../../rpc/types" }
36+
37+
# TODO: after v1.0.0, remove unneeded dependencies.
38+
anyhow = { workspace = true }
39+
async-trait = { workspace = true }
40+
bitflags = { workspace = true }
41+
borsh = { workspace = true }
42+
bytemuck = { workspace = true }
43+
bytes = { workspace = true }
44+
cfg-if = { workspace = true }
45+
clap = { workspace = true }
46+
chrono = { workspace = true }
47+
crypto-bigint = { workspace = true }
48+
crossbeam = { workspace = true }
49+
curve25519-dalek = { workspace = true }
50+
dashmap = { workspace = true }
51+
dirs = { workspace = true }
52+
futures = { workspace = true }
53+
hex = { workspace = true }
54+
hex-literal = { workspace = true }
55+
indexmap = { workspace = true }
56+
monero-serai = { workspace = true }
57+
paste = { workspace = true }
58+
pin-project = { workspace = true }
59+
randomx-rs = { workspace = true }
60+
rand = { workspace = true }
61+
rand_distr = { workspace = true }
62+
rayon = { workspace = true }
63+
serde_bytes = { workspace = true }
64+
serde_json = { workspace = true }
65+
serde = { workspace = true }
66+
thiserror = { workspace = true }
67+
thread_local = { workspace = true }
68+
tokio-util = { workspace = true }
69+
tokio-stream = { workspace = true }
70+
tokio = { workspace = true }
71+
tower = { workspace = true }
72+
tracing-subscriber = { workspace = true }
73+
tracing = { workspace = true }
1174

1275
[lints]
1376
workspace = true

binaries/cuprated/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# `cuprated`
2+
TODO

binaries/cuprated/src/main.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
#![doc = include_str!("../README.md")]
2+
#![cfg_attr(docsrs, feature(doc_cfg))]
3+
#![allow(
4+
unused_imports,
5+
unreachable_pub,
6+
unused_crate_dependencies,
7+
dead_code,
8+
unused_variables,
9+
clippy::needless_pass_by_value,
10+
clippy::unused_async,
11+
reason = "TODO: remove after v1.0.0"
12+
)]
13+
114
mod blockchain;
215
mod config;
316
mod p2p;

binaries/cuprated/src/rpc.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22
//!
33
//! Will contain the code to initiate the RPC and a request handler.
44
5-
mod request_handler;
5+
mod bin;
6+
mod handler;
7+
mod json;
8+
mod other;
9+
10+
pub use handler::{CupratedRpcHandler, CupratedRpcHandlerState};

binaries/cuprated/src/rpc/bin.rs

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
use anyhow::Error;
2+
3+
use cuprate_rpc_types::{
4+
bin::{
5+
BinRequest, BinResponse, GetBlocksByHeightRequest, GetBlocksByHeightResponse,
6+
GetBlocksRequest, GetBlocksResponse, GetHashesRequest, GetHashesResponse,
7+
GetOutputIndexesRequest, GetOutputIndexesResponse, GetOutsRequest, GetOutsResponse,
8+
GetTransactionPoolHashesRequest, GetTransactionPoolHashesResponse,
9+
},
10+
json::{GetOutputDistributionRequest, GetOutputDistributionResponse},
11+
};
12+
13+
use crate::rpc::CupratedRpcHandlerState;
14+
15+
/// Map a [`BinRequest`] to the function that will lead to a [`BinResponse`].
16+
pub(super) async fn map_request(
17+
state: CupratedRpcHandlerState,
18+
request: BinRequest,
19+
) -> Result<BinResponse, Error> {
20+
use BinRequest as Req;
21+
use BinResponse as Resp;
22+
23+
Ok(match request {
24+
Req::GetBlocks(r) => Resp::GetBlocks(get_blocks(state, r).await?),
25+
Req::GetBlocksByHeight(r) => Resp::GetBlocksByHeight(get_blocks_by_height(state, r).await?),
26+
Req::GetHashes(r) => Resp::GetHashes(get_hashes(state, r).await?),
27+
Req::GetOutputIndexes(r) => Resp::GetOutputIndexes(get_output_indexes(state, r).await?),
28+
Req::GetOuts(r) => Resp::GetOuts(get_outs(state, r).await?),
29+
Req::GetTransactionPoolHashes(r) => {
30+
Resp::GetTransactionPoolHashes(get_transaction_pool_hashes(state, r).await?)
31+
}
32+
Req::GetOutputDistribution(r) => {
33+
Resp::GetOutputDistribution(get_output_distribution(state, r).await?)
34+
}
35+
})
36+
}
37+
38+
async fn get_blocks(
39+
state: CupratedRpcHandlerState,
40+
request: GetBlocksRequest,
41+
) -> Result<GetBlocksResponse, Error> {
42+
todo!()
43+
}
44+
45+
async fn get_blocks_by_height(
46+
state: CupratedRpcHandlerState,
47+
request: GetBlocksByHeightRequest,
48+
) -> Result<GetBlocksByHeightResponse, Error> {
49+
todo!()
50+
}
51+
52+
async fn get_hashes(
53+
state: CupratedRpcHandlerState,
54+
request: GetHashesRequest,
55+
) -> Result<GetHashesResponse, Error> {
56+
todo!()
57+
}
58+
59+
async fn get_output_indexes(
60+
state: CupratedRpcHandlerState,
61+
request: GetOutputIndexesRequest,
62+
) -> Result<GetOutputIndexesResponse, Error> {
63+
todo!()
64+
}
65+
66+
async fn get_outs(
67+
state: CupratedRpcHandlerState,
68+
request: GetOutsRequest,
69+
) -> Result<GetOutsResponse, Error> {
70+
todo!()
71+
}
72+
73+
async fn get_transaction_pool_hashes(
74+
state: CupratedRpcHandlerState,
75+
request: GetTransactionPoolHashesRequest,
76+
) -> Result<GetTransactionPoolHashesResponse, Error> {
77+
todo!()
78+
}
79+
80+
async fn get_output_distribution(
81+
state: CupratedRpcHandlerState,
82+
request: GetOutputDistributionRequest,
83+
) -> Result<GetOutputDistributionResponse, Error> {
84+
todo!()
85+
}

0 commit comments

Comments
 (0)