[package]
name = "darkfi"
version = "0.5.0"
homepage = "https://dark.fi"
description = "Anonymous. Uncensored. Sovereign."
authors = ["Dyne.org foundation <foundation@dyne.org>"]
repository = "https://codeberg.org/darkrenaissance/darkfi"
license = "AGPL-3.0-only"
edition = "2021"

[lib]
name = "darkfi"
doctest = false
bench = false

#[profile.release]
#debug = true
#lto = "fat"
#codegen-units = 1

[workspace]
members = [
    "bin/zkas",
    "bin/darkfid",
    "bin/explorer/explorerd",
    "bin/drk",
    "bin/fud/fu",
    "bin/fud/fud",
    "bin/genev/genevd",
    "bin/genev/genev-cli",
    "bin/darkirc",
    #"bin/darkwallet",
    "bin/tau/taud",
    "bin/vanityaddr",
    "bin/lilith",

    "src/sdk",
    "src/sdk/python",

    #"src/serial",
    #"src/serial/derive",
    #"src/serial/derive-internal",

    "src/contract/test-harness",
    "src/contract/money",
    "src/contract/dao",
    "src/contract/deployooor",

    "example/dchat/dchatd",
]

[dependencies]
# Hard dependencies
libc = "0.2.178"
thiserror = "2.0.17"
tracing = "0.1.44"

# async-runtime
async-recursion = {version = "1.1.1", optional = true}
async-trait = {version = "0.1.89", optional = true}
futures = {version = "0.3.31", optional = true}
smol = {version = "2.0.2", optional = true}
pin-project-lite = {version = "0.2.16", optional = true}

# Networking
futures-rustls = {version = "0.26.0", default-features = false, features = ["logging", "tls12", "ring"], optional = true}

# Pluggable Transports
socket2 = {version = "0.6.1", features = ["all"], optional = true}
arti-client = {version = "0.37.0", default-features = false, features = ["async-std", "compression", "error_detail", "rustls", "onion-service-client", "onion-service-service"], optional = true}
tor-error = {version = "0.37.0", optional = true}
tor-rtcompat = {version = "0.37.0", features = ["async-std", "rustls"], optional = true}
tor-hscrypto = {version = "0.37.0", optional = true}
tor-hsservice = {version = "0.37.0", optional = true}
tor-proto = {version = "0.37.0", optional = true}
tor-cell = {version = "0.37.0", optional = true}

# TLS cert utilities
ed25519-compact = {version = "2.2.0", optional = true}
rcgen = {version = "0.14.6", optional = true, features = ["pem"]}
x509-parser = {version = "0.17.0", features = ["validate", "verify"], optional = true}

# Encoding
bs58 = {version = "0.5.1", optional = true}
hex = {version = "0.4.3", optional = true}
serde = {version = "1.0.228", features = ["derive"], optional = true}
tinyjson = {version = "2.5.1", optional = true}
httparse = {version = "1.10.1", optional = true}
primitive-types = {version = "0.14.0", optional = true}
semver = {version = "1.0.27", optional = true}
structopt = {version= "0.3.26", optional = true}
structopt-toml = {version= "0.5.1", optional = true}
toml = {version = "0.9.8", optional = true}

# Utilities
#darkfi-serial = {path = "src/serial", optional = true}
#darkfi-derive = {path = "src/serial/derive", optional = true}
darkfi-serial = {version = "0.5.1", optional = true}
darkfi-derive = {version = "0.5.1", optional = true}

# TODO: check chrono usage and impl our own
chrono = {version = "0.4.42", optional = true}
lazy_static = {version = "1.5.0", optional = true}
num-bigint = {version = "0.4.6", optional = true}
url = {version = "2.5.7", features = ["serde"], optional = true}

# Misc
regex = {version = "1.12.2", optional = true}
tracing-subscriber = { version = "0.3.22", default-features = false, features = ["fmt"], optional = true }
tracing-appender = {version = "0.2.4", optional = true }
nu-ansi-term = {version = "0.50.3", optional = true}


# Crypto
rand = {version = "0.8.5", optional = true}
blake3 = {version = "1.8.2", features = ["rayon"], optional = true}
crypto_api_chachapoly = {version = "0.5.0", optional = true}
halo2_proofs = {version = "0.3.2", features = ["circuit-params"], optional = true}
halo2_gadgets = {version = "0.4.0", features = ["circuit-params"], optional = true}
sha2 = {version = "0.10.9", optional = true}

# Smart contract runtime
darkfi-sdk = {path = "src/sdk", optional = true}
wasmer = {version = "6.1.0", features = ["singlepass"], optional = true}
wasmer-compiler-singlepass = {version = "6.1.0", optional = true}
wasmer-middlewares = {version = "6.1.0", optional = true}

# Blockchain store
sled-overlay = {version = "0.1.14", optional = true}

# Miner
randomx = {git = "https://codeberg.org/darkrenaissance/RandomX", optional = true}
monero = {version = "0.21.0", optional = true}
tiny-keccak = { version = "2.0.2", features = ["keccak"], optional = true }

[dev-dependencies]
clap = {version = "4.4.11", features = ["derive"]}
halo2_proofs = {version = "0.3.1", features = ["dev-graph", "sanity-checks"]}
halo2_gadgets = "0.3.1"
plotters = "0.3.7"
easy-parallel = "3.3.1"
prettytable-rs = "0.10.0"
# Used for benchmarks
criterion = { version = "0.8.1", features = ["html_reports"] }

# -----BEGIN LIBRARY FEATURES-----
[features]
async-daemonize = ["system"]

async-serial = ["darkfi-serial/async"]

async-sdk = [
    "darkfi-sdk/async",

    "async-serial",
]

blockchain = [
    "sled-overlay/serial",
    "monero",
    "num-bigint",
    "primitive-types",
    "sha2",
    "tiny-keccak",

    "darkfi-serial/num-bigint",

    "tx",
    "util",
]

validator = [
    "crypto_api_chachapoly",
    "hex",
    "lazy_static",
    "monero",
    "randomx",
    "smol",

    "blockchain",
    "system",
    "wasm-runtime",
]

geode = [
    "blake3",
    "bs58",
    "futures",
    "smol",
]

event-graph = [
    "blake3",
    "num-bigint",
    "sled-overlay",
    "smol",
    "tinyjson",
    "bs58",

    "darkfi-serial",
    "darkfi-serial/collections",
    "darkfi-serial/hash",
    
    "rpc",
]

p2p-nym = []

p2p-tor = [
    "arti-client",
    "tor-hsservice",
    "tor-hscrypto",
    "tor-error",
    "tor-rtcompat",
    "tor-proto",
    "tor-cell",
]

net-defaults = [
    "async-trait",
    "ed25519-compact",
    "futures",
    "futures-rustls",
    "rcgen",
    "regex",
    "semver",
    "serde",
    "socket2",
    "structopt",
    "structopt-toml",
    "url",
    "x509-parser",

    "darkfi-serial/url",

    "async-serial",
    "system",
    "util",

    "p2p-tor",
    #"p2p-nym",
    "p2p-i2p",
]

p2p-unix = []

p2p-socks5 = []

p2p-i2p = [
    "p2p-socks5"
]

net = ["net-defaults"]

rpc = [
    "async-trait",
    "httparse",

    "net",
]

system = [
    "futures",
    "pin-project-lite",
    "rand",
    "smol",
]

tx = [
    "blake3",
    "rand",

    "async-sdk",
    "async-serial",
    "zk",
]

util = [
    "tinyjson",
    "tracing-subscriber",
    "tracing-appender",
    "nu-ansi-term",
    "smol",

    "darkfi-serial",
]

wasm-runtime = [
    "wasmer",
    "wasmer-compiler-singlepass",
    "wasmer-middlewares",

    "darkfi-sdk/wasm",

    "blockchain",
]

zk = [
    "halo2_proofs",
    "halo2_gadgets",
    "rand",

    "async-sdk",
    "zkas",
]

zkas = [
    "darkfi-serial",
]

dht = [
    "async-sdk",
    "blake3",
    "bs58",
    "futures",
    "num-bigint",
    "serde",
    "structopt",
    "structopt-toml",
    "smol",

    "darkfi-serial",
    "net",
]

# Could not get this to work. Complains manifest-key is ignored.
#[target.'cfg(target_family = "unix")'.features]
#net = ["net-defaults", "p2p-unix"]
#
#[target.'cfg(target_family = "windows")'.features]
#net = ["net-defaults"]

# -----END LIBRARY FEATURES-----

[patch.crates-io]
halo2_proofs = {git="https://github.com/parazyd/halo2", branch="v032"}
halo2_gadgets = {git="https://github.com/parazyd/halo2", branch="v032"}
# Forked "url" crate with added P2P schemas
url = {git="https://github.com/darkrenaissance/rust-url", branch="v257"}

[[bench]]
name = "zk_arith"
harness = false
path = "bench/zk_arith.rs"
[[bench]]
name = "zk_from_json"
harness = false
path = "bench/zk_from_json.rs"
[[bench]]
name = "sled"
harness = false
path = "bench/sled.rs"

# Crossbeam SkipMap vs Mutex protected HashMap.
# Uncomment to enable, and add the following to dev-dependencies:
#   crossbeam-skiplist = "0.1.3"
#   rand = "0.8.5"
#[[bench]]
#name = "crossbeam"
#harness = false
#path = "bench/crossbeam.rs"

# Top-level lints. Enabled optionally on a crate-level in their respective Cargo.toml files.
[workspace.lints.clippy]
#arithmetic_side_effects = "warn"
#eq_op = "warn"
#float_cmp = "warn"
# integer_division = "warn"
#large_futures = "warn"
#large_stack_arrays = "warn"
#large_stack_frames = "warn"
#lossy_float_literal = "warn"
#manual_slice_size_calculation = "warn"
#modulo_one = "warn"
#out_of_bounds_indexing = "warn"
#overflow_check_conditional = "warn"
#recursive_format_impl = "warn"
#unchecked_duration_subtraction = "warn"
