diff --git a/Cargo.toml b/Cargo.toml index 156679b19..68fda84a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 diff --git a/src/error.rs b/src/error.rs index 933f6d11e..251dc9e26 100644 --- a/src/error.rs +++ b/src/error.rs @@ -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 for Error { -// fn from(err: rocksdb::Error) -> Error { -// Error::RocksdbError(err.to_string()) -// } -// } +#[cfg(feature = "chain")] +impl From for Error { + fn from(err: rocksdb::Error) -> Error { + Error::RocksdbError(err.to_string()) + } +} // #[cfg(feature = "node")] // impl From for Error { diff --git a/src/lib.rs b/src/lib.rs index bc0151fe5..d72d7dd2d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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;