Skip to content

Commit 372d5cc

Browse files
committed
fix hack + enable it for cuprate-database
1 parent 95c0d8b commit 372d5cc

File tree

26 files changed

+96
-72
lines changed

26 files changed

+96
-72
lines changed

.github/workflows/hack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ jobs:
3232
3333
- name: Hack Check
3434
# TODO: remove the exclude when `cuprate-database` errors are fixed
35-
run: cargo hack --workspace --exclude cuprate-database check --feature-powerset --no-dev-deps
35+
run: cargo hack --workspace check --feature-powerset --no-dev-deps

Cargo.lock

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

consensus/fast-sync/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name = "cuprate-fast-sync-create-hashes"
99
path = "src/create.rs"
1010

1111
[dependencies]
12-
cuprate-blockchain = { workspace = true }
12+
cuprate-blockchain = { workspace = true, features = ["service"] }
1313
cuprate-consensus = { workspace = true }
1414
cuprate-consensus-rules = { workspace = true }
1515
cuprate-consensus-context = { workspace = true }

helper/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ asynch = ["dep:futures", "dep:rayon"]
1717
cast = []
1818
constants = []
1919
crypto = ["dep:curve25519-dalek", "dep:monero-serai", "std"]
20-
fs = ["dep:dirs"]
20+
fs = ["dep:dirs", "std"]
2121
num = []
2222
map = ["cast", "dep:monero-serai", "dep:cuprate-constants"]
2323
time = ["dep:chrono", "std"]

net/epee-encoding/src/container_as_blob.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use alloc::{string::ToString, vec, vec::Vec};
2+
13
use bytes::{Buf, BufMut, Bytes, BytesMut};
24
use ref_cast::RefCast;
35

net/epee-encoding/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ use hex as _;
6464

6565
extern crate alloc;
6666

67+
use alloc::string::ToString;
6768
use core::str::from_utf8 as str_from_utf8;
6869

6970
use bytes::{Buf, BufMut, Bytes, BytesMut};

p2p/address-book/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ authors = ["Boog900"]
99
[dependencies]
1010
cuprate-constants = { workspace = true }
1111
cuprate-pruning = { workspace = true }
12-
cuprate-p2p-core = { workspace = true }
12+
cuprate-p2p-core = { workspace = true, features = ["borsh"] }
1313

1414
tower = { workspace = true, features = ["util"] }
1515
tokio = { workspace = true, features = ["time", "fs", "rt"]}

pruning/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ default = []
1010
borsh = ["dep:borsh"]
1111

1212
[dependencies]
13-
cuprate-constants = { workspace = true }
13+
cuprate-constants = { workspace = true, features = ["block"] }
1414

1515
thiserror = { workspace = true }
1616

rpc/interface/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ keywords = ["cuprate", "rpc", "interface"]
1010

1111
[features]
1212
default = ["dummy", "serde"]
13-
dummy = []
13+
dummy = ["dep:cuprate-helper", "dep:futures"]
1414

1515
[dependencies]
1616
cuprate-epee-encoding = { workspace = true, default-features = false }
1717
cuprate-json-rpc = { workspace = true, default-features = false }
1818
cuprate-rpc-types = { workspace = true, features = ["serde", "epee"], default-features = false }
19-
cuprate-helper = { workspace = true, features = ["asynch"], default-features = false }
19+
cuprate-helper = { workspace = true, features = ["asynch"], default-features = false, optional = true }
2020

2121
anyhow = { workspace = true }
2222
axum = { version = "0.7.5", features = ["json"], default-features = false }
2323
serde = { workspace = true, optional = true }
24-
tower = { workspace = true }
24+
tower = { workspace = true, features = ["util"] }
2525
paste = { workspace = true }
26-
futures = { workspace = true }
26+
futures = { workspace = true, optional = true }
2727

2828
[dev-dependencies]
2929
cuprate-test-utils = { workspace = true }

rpc/types/src/bin.rs

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ use cuprate_types::BlockCompleteEntry;
2020

2121
use crate::{
2222
base::AccessResponseBase,
23-
defaults::{default_false, default_zero},
2423
macros::{define_request, define_request_and_response, define_request_and_response_doc},
25-
misc::{BlockOutputIndices, GetOutputsOut, OutKeyBin, PoolInfoExtent, PoolTxInfo, Status},
24+
misc::{BlockOutputIndices, GetOutputsOut, OutKeyBin, PoolTxInfo, Status},
2625
rpc_call::RpcCallValue,
2726
};
2827

28+
#[cfg(any(feature = "epee", feature = "serde"))]
29+
use crate::defaults::{default_false, default_zero};
30+
2931
//---------------------------------------------------------------------------------------------------- Definitions
3032
define_request_and_response! {
3133
get_blocks_by_heightbin,
@@ -137,15 +139,15 @@ define_request! {
137139
core_rpc_server_commands_defs, h, 162, 262,
138140
)]
139141
///
140-
/// This response's variant depends upon [`PoolInfoExtent`].
142+
/// This response's variant depends upon [`crate::misc::PoolInfoExtent`].
141143
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
142144
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
143145
pub enum GetBlocksResponse {
144-
/// Will always serialize a [`PoolInfoExtent::None`] field.
146+
/// Will always serialize a [`crate::misc::PoolInfoExtent::None`] field.
145147
PoolInfoNone(GetBlocksResponsePoolInfoNone),
146-
/// Will always serialize a [`PoolInfoExtent::Incremental`] field.
148+
/// Will always serialize a [`crate::misc::PoolInfoExtent::Incremental`] field.
147149
PoolInfoIncremental(GetBlocksResponsePoolInfoIncremental),
148-
/// Will always serialize a [`PoolInfoExtent::Full`] field.
150+
/// Will always serialize a [`crate::misc::PoolInfoExtent::Full`] field.
149151
PoolInfoFull(GetBlocksResponsePoolInfoFull),
150152
}
151153

@@ -254,7 +256,7 @@ pub struct __GetBlocksResponseEpeeBuilder {
254256
pub current_height: Option<u64>,
255257
pub output_indices: Option<Vec<BlockOutputIndices>>,
256258
pub daemon_time: Option<u64>,
257-
pub pool_info_extent: Option<PoolInfoExtent>,
259+
pub pool_info_extent: Option<crate::misc::PoolInfoExtent>,
258260
pub added_pool_txs: Option<Vec<PoolTxInfo>>,
259261
pub remaining_added_pool_txids: Option<ByteArrayVec<32>>,
260262
pub removed_pool_txids: Option<ByteArrayVec<32>>,
@@ -304,7 +306,7 @@ impl EpeeObjectBuilder<GetBlocksResponse> for __GetBlocksResponseEpeeBuilder {
304306
let pool_info_extent = self.pool_info_extent.ok_or(ELSE)?;
305307

306308
let this = match pool_info_extent {
307-
PoolInfoExtent::None => {
309+
crate::misc::PoolInfoExtent::None => {
308310
GetBlocksResponse::PoolInfoNone(GetBlocksResponsePoolInfoNone {
309311
status,
310312
untrusted,
@@ -315,7 +317,7 @@ impl EpeeObjectBuilder<GetBlocksResponse> for __GetBlocksResponseEpeeBuilder {
315317
daemon_time,
316318
})
317319
}
318-
PoolInfoExtent::Incremental => {
320+
crate::misc::PoolInfoExtent::Incremental => {
319321
GetBlocksResponse::PoolInfoIncremental(GetBlocksResponsePoolInfoIncremental {
320322
status,
321323
untrusted,
@@ -329,7 +331,7 @@ impl EpeeObjectBuilder<GetBlocksResponse> for __GetBlocksResponseEpeeBuilder {
329331
removed_pool_txids: self.removed_pool_txids.ok_or(ELSE)?,
330332
})
331333
}
332-
PoolInfoExtent::Full => {
334+
crate::misc::PoolInfoExtent::Full => {
333335
GetBlocksResponse::PoolInfoFull(GetBlocksResponsePoolInfoFull {
334336
status,
335337
untrusted,
@@ -353,7 +355,7 @@ impl EpeeObject for GetBlocksResponse {
353355
type Builder = __GetBlocksResponseEpeeBuilder;
354356

355357
fn number_of_fields(&self) -> u64 {
356-
// [`PoolInfoExtent`] + inner struct fields.
358+
// [`crate::misc::PoolInfoExtent`] + inner struct fields.
357359
let inner_fields = match self {
358360
Self::PoolInfoNone(s) => s.number_of_fields(),
359361
Self::PoolInfoIncremental(s) => s.number_of_fields(),
@@ -367,15 +369,27 @@ impl EpeeObject for GetBlocksResponse {
367369
match self {
368370
Self::PoolInfoNone(s) => {
369371
s.write_fields(w)?;
370-
write_field(PoolInfoExtent::None.to_u8(), "pool_info_extent", w)?;
372+
write_field(
373+
crate::misc::PoolInfoExtent::None.to_u8(),
374+
"pool_info_extent",
375+
w,
376+
)?;
371377
}
372378
Self::PoolInfoIncremental(s) => {
373379
s.write_fields(w)?;
374-
write_field(PoolInfoExtent::Incremental.to_u8(), "pool_info_extent", w)?;
380+
write_field(
381+
crate::misc::PoolInfoExtent::Incremental.to_u8(),
382+
"pool_info_extent",
383+
w,
384+
)?;
375385
}
376386
Self::PoolInfoFull(s) => {
377387
s.write_fields(w)?;
378-
write_field(PoolInfoExtent::Full.to_u8(), "pool_info_extent", w)?;
388+
write_field(
389+
crate::misc::PoolInfoExtent::Full.to_u8(),
390+
"pool_info_extent",
391+
w,
392+
)?;
379393
}
380394
}
381395

0 commit comments

Comments
 (0)