Przeglądaj źródła

Rename "chain" module to "blockchain".

parazyd 4 lat temu
rodzic
commit
cfa2d5d955

+ 64 - 77
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,81 +111,68 @@ 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",
 ]
-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"]
+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",
+]
+
 
 # [[example]]
 # name = "net"

+ 0 - 0
src/chain/mod.rs → src/blockchain/mod.rs


+ 0 - 0
src/chain/rocks.rs → src/blockchain/rocks.rs


+ 0 - 0
src/chain/slab.rs → src/blockchain/slab.rs


+ 0 - 0
src/chain/slabstore.rs → src/blockchain/slabstore.rs


+ 2 - 2
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<zeromq::ZmqError> for Error {
     }
 }
 
-#[cfg(feature = "chain")]
+#[cfg(feature = "blockchain")]
 impl From<rocksdb::Error> for Error {
     fn from(err: rocksdb::Error) -> Error {
         Error::RocksdbError(err.to_string())

+ 2 - 2
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;

+ 1 - 1
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,

+ 1 - 1
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,
 };

+ 1 - 1
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},