Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Boog900 committed Nov 1, 2024
1 parent 6470c16 commit b915777
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 27 deletions.
2 changes: 1 addition & 1 deletion binaries/cuprated/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cuprate-p2p-core = { workspace = true }
cuprate-dandelion-tower = { workspace = true, features = ["txpool"] }
cuprate-async-buffer = { workspace = true }
cuprate-address-book = { workspace = true }
cuprate-blockchain = { workspace = true, features = ["service"] }
cuprate-blockchain = { workspace = true }
cuprate-database-service = { workspace = true }
cuprate-txpool = { workspace = true }
cuprate-database = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion consensus/fast-sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name = "cuprate-fast-sync-create-hashes"
path = "src/create.rs"

[dependencies]
cuprate-blockchain = { workspace = true, features = ["service"] }
cuprate-blockchain = { workspace = true }
cuprate-consensus = { workspace = true }
cuprate-consensus-rules = { workspace = true }
cuprate-consensus-context = { workspace = true }
Expand Down
14 changes: 6 additions & 8 deletions storage/blockchain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,31 @@ repository = "https://github.com/Cuprate/cuprate/tree/main/storage/cuprate-bloc
keywords = ["cuprate", "blockchain", "database"]

[features]
default = ["heed", "service"]
default = ["heed"]
# default = ["redb", "service"]
# default = ["redb-memory", "service"]
heed = ["cuprate-database/heed"]
redb = ["cuprate-database/redb"]
redb-memory = ["cuprate-database/redb-memory"]
service = ["dep:tower", "dep:thread_local", "dep:rayon", "dep:rand", "cuprate-helper/thread"]
serde = ["dep:serde", "cuprate-database/serde", "cuprate-database-service/serde"]

[dependencies]
cuprate-database = { workspace = true }
cuprate-database-service = { workspace = true }
cuprate-helper = { workspace = true, features = ["fs", "map", "crypto", "tx"] }
cuprate-helper = { workspace = true, features = ["fs", "map", "crypto", "tx", "thread"] }
cuprate-types = { workspace = true, features = ["blockchain"] }
cuprate-pruning = { workspace = true }

bitflags = { workspace = true, features = ["std", "serde", "bytemuck"] }
bytemuck = { workspace = true, features = ["must_cast", "derive", "min_const_generics", "extern_crate_alloc"] }
curve25519-dalek = { workspace = true }
rand = { workspace = true, features = ["std", "std_rng"], optional = true }
rand = { workspace = true, features = ["std", "std_rng"] }
monero-serai = { workspace = true, features = ["std"] }
serde = { workspace = true, optional = true }

# `service` feature.
tower = { workspace = true, optional = true }
thread_local = { workspace = true, optional = true }
rayon = { workspace = true, optional = true }
tower = { workspace = true }
thread_local = { workspace = true }
rayon = { workspace = true }

[dev-dependencies]
cuprate-constants = { workspace = true }
Expand Down
5 changes: 1 addition & 4 deletions storage/blockchain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ use cuprate_blockchain::{
This ensures the types/traits used from `cuprate_database` are the same ones used by `cuprate_blockchain` internally.

# Feature flags
The `service` module requires the `service` feature to be enabled.
See the module for more documentation.

Different database backends are enabled by the feature flags:
- `heed` (LMDB)
- `redb`
Expand All @@ -45,7 +42,7 @@ The default is `heed`.
<!-- FIXME: tracing should be behind a feature flag -->

# Invariants when not using `service`
`cuprate_blockchain` can be used without the `service` feature enabled but
`cuprate_blockchain` can be used without the `service` module but
there are some things that must be kept in mind when doing so.

Failing to uphold these invariants may cause panics.
Expand Down
6 changes: 1 addition & 5 deletions storage/blockchain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,12 @@ pub use free::open;

pub mod config;
pub mod ops;
pub mod service;
pub mod tables;
pub mod types;

//---------------------------------------------------------------------------------------------------- Feature-gated
#[cfg(feature = "service")]
pub mod service;

//---------------------------------------------------------------------------------------------------- Private
#[cfg(test)]
pub(crate) mod tests;

#[cfg(feature = "service")] // only needed in `service` for now
pub(crate) mod unsafe_sendable;
2 changes: 0 additions & 2 deletions storage/blockchain/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
//!
//! The system is managed by this crate, and only requires [`init`] by the user.
//!
//! This module must be enabled with the `service` feature.
//!
//! ## Handles
//! The 2 handles to the database are:
//! - [`BlockchainReadHandle`]
Expand Down
4 changes: 0 additions & 4 deletions storage/txpool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ use cuprate_txpool::{
This ensures the types/traits used from `cuprate_database` are the same ones used by `cuprate_txpool` internally.

# Feature flags

The `service` module requires the `service` feature to be enabled.
See the module for more documentation.

Different database backends are enabled by the feature flags:

- `heed` (LMDB)
Expand Down
1 change: 1 addition & 0 deletions storage/txpool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
clippy::significant_drop_tightening
)]

// Used in docs: <https://github.com/Cuprate/cuprate/pull/170#discussion_r1823644357>.
use tower as _;

pub mod config;
Expand Down
2 changes: 0 additions & 2 deletions storage/txpool/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
//!
//! The system is managed by this crate, and only requires [`init`] by the user.
//!
//! This module must be enabled with the `service` feature.
//!
//! ## Handles
//! The 2 handles to the database are:
//! - [`TxpoolReadHandle`]
Expand Down

0 comments on commit b915777

Please sign in to comment.