From cfa2d5d955ca82e783f35a6dd696daff020daa68 Mon Sep 17 00:00:00 2001 From: parazyd Date: Thu, 13 Jan 2022 12:53:25 +0100 Subject: [PATCH] Rename "chain" module to "blockchain". --- Cargo.toml | 139 +++++++++++-------------- src/{chain => blockchain}/mod.rs | 0 src/{chain => blockchain}/rocks.rs | 0 src/{chain => blockchain}/slab.rs | 0 src/{chain => blockchain}/slabstore.rs | 0 src/error.rs | 4 +- src/lib.rs | 4 +- src/node/client.rs | 2 +- src/node/service/gateway.rs | 2 +- src/node/state.rs | 2 +- 10 files changed, 70 insertions(+), 83 deletions(-) rename src/{chain => blockchain}/mod.rs (100%) rename src/{chain => blockchain}/rocks.rs (100%) rename src/{chain => blockchain}/slab.rs (100%) rename src/{chain => blockchain}/slabstore.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 7fdb036bd..ea3549d0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,6 @@ name = "darkfi" [dependencies] log = "0.4.14" -rand = "0.8.4" thiserror = "1.0.30" # async-runtime @@ -36,6 +35,7 @@ bytes = {version = "1.1.0", optional = true} serde = {version = "1.0.133", features = ["derive"], optional = true} serde_json = {version = "1.0.74", optional = true} bincode = {version = "1.3.3", optional = true} +num-bigint = {version = "0.4.3", optional = true} # Utilities clap = {version = "3.0.7", features = ["derive"], optional = true} @@ -45,7 +45,6 @@ lazy_static = {version = "1.4.0", optional = true} subtle = {version = "2.4.1", optional = true} # Misc -num-bigint = {version = "0.4.3", optional = true} termion = {version = "1.5.6", optional = true} # Websockets @@ -53,6 +52,7 @@ tungstenite = {version = "0.16.0", optional = true} async-tungstenite = {version = "0.16.1", optional = true} # Crypto +rand = {version = "0.8.4", optional = true} blake2b_simd = {version = "1.0.0", optional = true} pasta_curves = {version = "0.2.1", optional = true} halo2 = {version = "=0.1.0-beta.1", features = ["dev-graph", "gadget-traces", "sanity-checks"], optional = true} @@ -73,7 +73,6 @@ zeromq = {version = "0.3.3", default-features = false, features = ["async-std-ru signal-hook = {version = "0.3.13", optional = true} signal-hook-async-std = {version = "0.2.2", optional = true} - [dependencies.rocksdb] # TODO: Revert to upstream after bd966750ec861d687913d59a9939a1408ac53131 is merged. git = "https://github.com/parazyd/rust-rocksdb" @@ -83,6 +82,7 @@ features = ["zstd"] optional = true [dependencies.halo2_gadgets] +# TODO: Use upstream when published git = "https://github.com/parazyd/halo2_gadgets.git" rev = "b45c527276bb2309f3b256eb5f45ccdcc5bd8c0f" features = ["dev-graph", "test-dependencies"] @@ -111,82 +111,69 @@ util = [ "serde", "serde_json", "dirs", - "num-bigint" + "num-bigint", +] +rpc = [ + "async-runtime", + "async-net", + "util", + "websockets", + "url", +] +blockchain = [ + "async-runtime", + "rocksdb", + "util", +] +tui = [ + "async-std", + "termion", +] +system = [ + "async-runtime", +] +cli = [ + "toml", + "clap", + "util", +] +net = [ + "util", + "system", +] +crypto = [ + "pasta_curves", + "blake2b_simd", + "incrementalmerkletree", + "halo2", + "halo2_gadgets", + "subtle", + "lazy_static", + "group", + "util", + "arrayvec", + "crypto_api_chachapoly", + "sha2", + "bs58", +] +wallet = [ + "sqlx", + "libsqlite3-sys" +] +node = [ + "url", + "async-runtime", + "bytes", + "crypto", + "wallet", + "blockchain", + "util", + "zeromq", + "signal-hook", + "signal-hook-async-std", ] -rpc = ["async-runtime", "async-net", "util", "websockets", "url"] -chain = ["async-runtime", "rocksdb", "util"] -tui = ["async-std", "termion"] -system = ["async-runtime"] -cli = ["toml", "serde", "clap", "util"] -net = ["async-runtime", "util", "system"] -crypto = ["pasta_curves", "blake2b_simd", "incrementalmerkletree", "halo2", "halo2_gadgets", "subtle", "lazy_static", "group", "util", "arrayvec", "crypto_api_chachapoly", "sha2", "bs58"] -wallet = ["sqlx", "libsqlite3-sys"] -node = ["url", "async-runtime", "bytes", "crypto", "wallet", "chain", "util", "zeromq", "signal-hook", "signal-hook-async-std"] -# [dependencies] -# # Crypto -# pasta_curves = "0.2.1" -# rand = "0.8.4" -# num-bigint = {version = "0.4.3", features = ["rand", "serde"]} -# blake2b_simd = "1.0.0" -# arrayvec = "0.7.2" -# sha2 = "0.9.8" - -# # Encoding and parsing -# bincode = "1.3.3" -# bs58 = "0.4.0" -# bytes = "1.1.0" -# hex = "0.4.3" -# toml = "0.5.8" -# url = "2.2.2" -# serde_json = "1.0.72" -# serde = {version = "1.0.130", features = ["derive"]} - -# # Async -# async-std = "1.10.0" -# async-trait = "0.1.51" -# async-channel = "1.6.1" -# native-tls = "0.2.8" -# async-native-tls = "0.4.0" -# async-executor = "1.4.1" -# futures = "0.3.17" -# smol = "1.2.5" - -# # Utilities -# anyhow = "1.0.49" -# clap = { version = "3.0.0", features = ["derive"] } -# dirs = "4.0.0" -# failure = "0.1.8" -# lazy_static = "1.4.0" -# log = "0.4.14" -# num_cpus = "1.13.0" -# simplelog = "0.11.1" -# subtle = "2.4.1" -# thiserror = "1.0.30" - -# # Used for Websockets client implementation. -# async-tungstenite = "0.16.0" -# tungstenite = "0.16.0" - -# #tui dependencies -# crossbeam-channel = { version = "0.5.1", optional = true} -# libc = { version = "0.2.112", optional = true} -# termion = { version = "1.5.6", optional = true} - -# # node dependencies -# ## Used for wallet management. -# ## Used for gatewayd network transport. - -# [workspace] -# members = ["bin/drk", "bin/darkfid", "bin/gateway"] -# exclude = ["bin/cashier", "bin/ircd", "bin/map"] - -# [features] -# chain = ["rocksdb"] -# node = ["sqlx", "libsqlite3-sys", "zeromq", "signal-hook-async-std"] -# tui = ["termion", "libc", "crossbeam-channel"] - # [[example]] # name = "net" # path = "example/net.rs" diff --git a/src/chain/mod.rs b/src/blockchain/mod.rs similarity index 100% rename from src/chain/mod.rs rename to src/blockchain/mod.rs diff --git a/src/chain/rocks.rs b/src/blockchain/rocks.rs similarity index 100% rename from src/chain/rocks.rs rename to src/blockchain/rocks.rs diff --git a/src/chain/slab.rs b/src/blockchain/slab.rs similarity index 100% rename from src/chain/slab.rs rename to src/blockchain/slab.rs diff --git a/src/chain/slabstore.rs b/src/blockchain/slabstore.rs similarity index 100% rename from src/chain/slabstore.rs rename to src/blockchain/slabstore.rs diff --git a/src/error.rs b/src/error.rs index a28c3b2ee..e2cf721bb 100644 --- a/src/error.rs +++ b/src/error.rs @@ -106,7 +106,7 @@ pub enum Error { // CashierError(String), #[error("ZmqError: `{0}`")] ZmqError(String), - #[cfg(feature = "chain")] + #[cfg(feature = "blockchain")] #[error("Rocksdb error: `{0}`")] RocksdbError(String), @@ -189,7 +189,7 @@ impl From for Error { } } -#[cfg(feature = "chain")] +#[cfg(feature = "blockchain")] impl From for Error { fn from(err: rocksdb::Error) -> Error { Error::RocksdbError(err.to_string()) diff --git a/src/lib.rs b/src/lib.rs index 3431e0180..78fdf962a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,8 +19,8 @@ pub mod net; #[cfg(feature = "cli")] pub mod cli; -#[cfg(feature = "chain")] -pub mod chain; +#[cfg(feature = "blockchain")] +pub mod blockchain; #[cfg(feature = "system")] pub mod system; diff --git a/src/node/client.rs b/src/node/client.rs index c2e8ea68e..579b0ed3a 100644 --- a/src/node/client.rs +++ b/src/node/client.rs @@ -6,7 +6,7 @@ use smol::Executor; use url::Url; use crate::{ - chain::{rocks::columns, Rocks, RocksColumn, Slab}, + blockchain::{rocks::columns, Rocks, RocksColumn, Slab}, crypto::{ address::Address, coin::Coin, diff --git a/src/node/service/gateway.rs b/src/node/service/gateway.rs index ebd73ed0a..44ec28a2c 100644 --- a/src/node/service/gateway.rs +++ b/src/node/service/gateway.rs @@ -10,7 +10,7 @@ use url::Url; use super::reqrep::{PeerId, Publisher, RepProtocol, Reply, ReqProtocol, Request, Subscriber}; use crate::{ - chain::{rocks::columns, RocksColumn, Slab, SlabStore}, + blockchain::{rocks::columns, RocksColumn, Slab, SlabStore}, util::serial::{deserialize, serialize}, Error, Result, }; diff --git a/src/node/state.rs b/src/node/state.rs index b052fa123..ea6a402c5 100644 --- a/src/node/state.rs +++ b/src/node/state.rs @@ -2,7 +2,7 @@ use incrementalmerkletree::{bridgetree::BridgeTree, Frontier, Tree}; use log::{debug, error}; use crate::{ - chain::{rocks::columns, RocksColumn}, + blockchain::{rocks::columns, RocksColumn}, crypto::{ coin::Coin, keypair::{PublicKey, SecretKey},