mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
Add "net" feature.
This commit is contained in:
10
Cargo.toml
10
Cargo.toml
@@ -30,10 +30,12 @@ native-tls = {version = "0.2.8", optional = true}
|
||||
|
||||
# Encoding
|
||||
hex = {version = "0.4.3", optional = true}
|
||||
toml = {version = "0.5.8", optional = true}
|
||||
serde = {version = "1.0.133", features = ["derive"], optional = true}
|
||||
serde_json = {version = "1.0.74", optional = true}
|
||||
|
||||
# Utilities
|
||||
clap = {version = "3.0.7", features = ["derive"], optional = true}
|
||||
dirs = {version = "4.0.0", optional = true}
|
||||
url = {version = "2.2.2", optional = true}
|
||||
|
||||
@@ -58,11 +60,13 @@ optional = true
|
||||
async-runtime = ["async-std", "async-channel", "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"]
|
||||
util = ["hex", "serde", "serde_json", "dirs", "num-bigint"]
|
||||
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"]
|
||||
|
||||
# [dependencies.halo2_gadgets]
|
||||
# git = "https://github.com/parazyd/halo2_gadgets.git"
|
||||
|
||||
@@ -10,6 +10,7 @@ pub mod nullifier;
|
||||
pub mod proof;
|
||||
pub mod schnorr;
|
||||
pub mod spend_proof;
|
||||
pub mod types;
|
||||
pub mod util;
|
||||
|
||||
pub(crate) use mint_proof::MintRevealedValues;
|
||||
|
||||
42
src/error.rs
42
src/error.rs
@@ -38,8 +38,6 @@ pub enum Error {
|
||||
|
||||
#[error("No url found")]
|
||||
NoUrlFound,
|
||||
// #[error("Malformed packet")]
|
||||
// MalformedPacket,
|
||||
// #[error(transparent)]
|
||||
// AddrParseError(#[from] std::net::AddrParseError),
|
||||
// #[error(transparent)]
|
||||
@@ -61,8 +59,11 @@ pub enum Error {
|
||||
#[cfg(feature = "util")]
|
||||
#[error("Json serialization error: `{0}`")]
|
||||
SerdeJsonError(String),
|
||||
// #[error(transparent)]
|
||||
// TomlDeserializeError(#[from] toml::de::Error),
|
||||
|
||||
#[cfg(feature = "cli")]
|
||||
#[error(transparent)]
|
||||
TomlDeserializeError(#[from] toml::de::Error),
|
||||
|
||||
// #[error(transparent)]
|
||||
// TomlSerializeError(#[from] toml::ser::Error),
|
||||
// #[error("Bincode serialization error: `{0}`")]
|
||||
@@ -83,8 +84,6 @@ pub enum Error {
|
||||
// MissingParams,
|
||||
// #[error("Contract is poorly defined")]
|
||||
// BadContract,
|
||||
// #[error("Operation failed")]
|
||||
// OperationFailed,
|
||||
// #[error("PLONK error: `{0}`")]
|
||||
// PlonkError(String),
|
||||
// #[error("Unable to decrypt mint note")]
|
||||
@@ -135,21 +134,24 @@ pub enum Error {
|
||||
#[error("TungsteniteError: `{0}`")]
|
||||
TungsteniteError(String),
|
||||
|
||||
// /// Network
|
||||
// #[error("Connection failed")]
|
||||
// ConnectFailed,
|
||||
// #[error("Connection timed out")]
|
||||
// ConnectTimeout,
|
||||
// #[error("Channel stopped")]
|
||||
// ChannelStopped,
|
||||
// #[error("Channel timed out")]
|
||||
// ChannelTimeout,
|
||||
// #[error("Service stopped")]
|
||||
// ServiceStopped,
|
||||
#[error("Connection failed")]
|
||||
ConnectFailed,
|
||||
#[error("Connection timed out")]
|
||||
ConnectTimeout,
|
||||
#[error("Channel stopped")]
|
||||
ChannelStopped,
|
||||
#[error("Channel timed out")]
|
||||
ChannelTimeout,
|
||||
#[error("Service stopped")]
|
||||
ServiceStopped,
|
||||
#[error("Operation failed")]
|
||||
OperationFailed,
|
||||
#[error("Malformed packet")]
|
||||
MalformedPacket,
|
||||
|
||||
#[error("No config file detected. Please create one.")]
|
||||
ConfigNotFound,
|
||||
|
||||
// /// Util
|
||||
// #[error("No config file detected. Please create one.")]
|
||||
// ConfigNotFound,
|
||||
#[cfg(feature = "util")]
|
||||
#[error("No keypair file detected.")]
|
||||
KeypairPathNotFound,
|
||||
|
||||
21
src/lib.rs
21
src/lib.rs
@@ -1,30 +1,27 @@
|
||||
pub mod error;
|
||||
pub use error::{Error, Result};
|
||||
|
||||
#[cfg(feature = "cli")]
|
||||
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 = "node")]
|
||||
pub mod node;
|
||||
|
||||
#[cfg(feature = "node")]
|
||||
pub mod tx;
|
||||
|
||||
#[cfg(feature = "net")]
|
||||
pub mod net;
|
||||
|
||||
#[cfg(feature = "cli")]
|
||||
pub mod cli;
|
||||
|
||||
#[cfg(feature = "chain")]
|
||||
pub mod chain;
|
||||
|
||||
#[cfg(feature = "system")]
|
||||
pub mod system;
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ use rand::Rng;
|
||||
use std::{any::Any, collections::HashMap, io, io::Cursor, sync::Arc};
|
||||
|
||||
use crate::{
|
||||
error::{Error, Result},
|
||||
net::messages::Message,
|
||||
serial::{Decodable, Encodable},
|
||||
util::serial::{Decodable, Encodable},
|
||||
Error, Result,
|
||||
};
|
||||
|
||||
/// 64bit identifier for message subscription.
|
||||
|
||||
@@ -3,8 +3,8 @@ use log::*;
|
||||
use std::{io, net::SocketAddr};
|
||||
|
||||
use crate::{
|
||||
error::{Error, Result},
|
||||
serial::{Decodable, Encodable, VarInt},
|
||||
util::serial::{Decodable, Encodable, VarInt},
|
||||
Error, Result,
|
||||
};
|
||||
|
||||
const MAGIC_BYTES: [u8; 4] = [0xd9, 0xef, 0xb6, 0x7d];
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
#[cfg(feature = "async-runtime")]
|
||||
pub mod async_serial;
|
||||
#[cfg(feature = "async-runtime")]
|
||||
pub mod async_util;
|
||||
|
||||
pub mod endian;
|
||||
pub mod net_name;
|
||||
pub mod parse;
|
||||
pub mod path;
|
||||
pub mod serial;
|
||||
|
||||
#[cfg(feature = "async-runtime")]
|
||||
pub use async_util::sleep;
|
||||
|
||||
pub use net_name::NetworkName;
|
||||
pub use parse::{decode_base10, encode_base10};
|
||||
pub use path::{expand_path, join_config_path, load_keypair_to_str};
|
||||
|
||||
Reference in New Issue
Block a user