Implement "chain" feature.

This commit is contained in:
parazyd
2022-01-13 11:22:47 +01:00
parent fa17139c6a
commit 07d739d916
3 changed files with 28 additions and 27 deletions

View File

@@ -43,26 +43,28 @@ num-bigint = {version = "0.4.3", optional = true}
tungstenite = {version = "0.16.0", optional = true}
async-tungstenite = {version = "0.16.1", optional = true}
# Blockchain
[dependencies.rocksdb]
# TODO: Revert to upstream after bd966750ec861d687913d59a9939a1408ac53131 is merged.
git = "https://github.com/parazyd/rust-rocksdb"
rev = "bd966750ec861d687913d59a9939a1408ac53131"
default-features = false
features = ["zstd"]
optional = true
[features]
async-runtime = ["async-std", "async-executor", "async-trait", "futures", "smol"]
async-net = ["async-native-tls", "native-tls"]
websockets = ["tungstenite", "async-tungstenite"]
util = ["async-runtime", "hex", "serde", "serde_json", "dirs", "num-bigint"]
rpc = ["async-net", "util", "websockets", "url"]
chain = ["rocksdb", "util"]
# [dependencies.halo2_gadgets]
# git = "https://github.com/parazyd/halo2_gadgets.git"
# rev = "b45c527276bb2309f3b256eb5f45ccdcc5bd8c0f"
# features = ["dev-graph", "test-dependencies"]
# # blockchain dependencies
# [dependencies.rocksdb]
# # TODO: Revert to upstream after bd966750ec861d687913d59a9939a1408ac53131 is merged.
# git = "https://github.com/parazyd/rust-rocksdb"
# rev = "bd966750ec861d687913d59a9939a1408ac53131"
# default-features = false
# features = ["zstd"]
# optional = true
# [dependencies]
# # Crypto

View File

@@ -105,10 +105,9 @@ pub enum Error {
// CashierError(String),
// #[error("ZmqError: `{0}`")]
// ZmqError(String),
// /// Database/Sql errors
// #[error("Rocksdb error: `{0}`")]
// RocksdbError(String),
#[cfg(feature = "chain")]
#[error("Rocksdb error: `{0}`")]
RocksdbError(String),
// #[error("sqlx error: `{0}`")]
// SqlxError(String),
// #[error("SlabsStore Error: `{0}`")]
@@ -179,12 +178,12 @@ pub enum Error {
// }
// }
// #[cfg(feature = "chain")]
// impl From<rocksdb::Error> for Error {
// fn from(err: rocksdb::Error) -> Error {
// Error::RocksdbError(err.to_string())
// }
// }
#[cfg(feature = "chain")]
impl From<rocksdb::Error> for Error {
fn from(err: rocksdb::Error) -> Error {
Error::RocksdbError(err.to_string())
}
}
// #[cfg(feature = "node")]
// impl From<sqlx::error::Error> for Error {

View File

@@ -7,18 +7,21 @@ pub mod cli;
#[cfg(feature = "crypto")]
pub mod crypto;
#[cfg(feature = "crypto")]
pub mod zk;
#[cfg(feature = "crypto")]
pub mod types;
#[cfg(feature = "chain")]
pub mod chain;
#[cfg(feature = "net")]
pub mod net;
#[cfg(feature = "system")]
pub mod system;
#[cfg(feature = "crypto")]
pub mod types;
#[cfg(feature = "crypto")]
pub mod zk;
#[cfg(feature = "node")]
pub mod node;
@@ -28,9 +31,6 @@ pub mod tx;
#[cfg(feature = "tui")]
pub mod tui;
#[cfg(feature = "chain")]
pub mod chain;
#[cfg(feature = "util")]
pub mod util;