mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-08 22:28:12 -05:00
Update project dependencies.
This commit is contained in:
716
Cargo.lock
generated
716
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
48
Cargo.toml
48
Cargo.toml
@@ -54,21 +54,21 @@ members = [
|
||||
|
||||
[dependencies]
|
||||
# Hard dependencies
|
||||
libc = "0.2.139"
|
||||
libc = "0.2.141"
|
||||
log = "0.4.17"
|
||||
thiserror = "1.0.38"
|
||||
thiserror = "1.0.40"
|
||||
|
||||
# async-runtime
|
||||
async-std = {version = "1.12.0", features = ["attributes"], optional = true}
|
||||
async-trait = {version = "0.1.64", optional = true}
|
||||
futures = {version = "0.3.26", optional = true}
|
||||
async-trait = {version = "0.1.68", optional = true}
|
||||
futures = {version = "0.3.28", optional = true}
|
||||
smol = {version = "1.3.0", optional = true}
|
||||
|
||||
# Networking
|
||||
futures-rustls = {version = "0.22.2", features = ["dangerous_configuration"], optional = true}
|
||||
futures-rustls = {version = "0.24.0", features = ["dangerous_configuration"], optional = true}
|
||||
iprange = {version = "0.6.7", optional = true}
|
||||
ipnet = {version = "2.7.1", optional = true}
|
||||
socket2 = {version = "0.4.7", optional = true}
|
||||
ipnet = {version = "2.7.2", optional = true}
|
||||
socket2 = {version = "0.5.2", optional = true, features = ["all"]}
|
||||
|
||||
# TLS cert utilities
|
||||
ed25519-compact = {version = "2.0.4", features = ["pem"], optional = true}
|
||||
@@ -78,21 +78,21 @@ rustls-pemfile = {version = "1.0.2", optional = true}
|
||||
# Encoding
|
||||
bs58 = {version = "0.4.0", optional = true}
|
||||
hex = {version = "0.4.3", optional = true}
|
||||
serde_json = {version = "1.0.91", optional = true}
|
||||
serde = {version = "1.0.152", features = ["derive"], optional = true}
|
||||
serde_json = {version = "1.0.96", optional = true}
|
||||
serde = {version = "1.0.160", features = ["derive"], optional = true}
|
||||
structopt = {version= "0.3.26", optional = true}
|
||||
structopt-toml = {version= "0.5.1", optional = true}
|
||||
toml = {version = "0.7.1", optional = true}
|
||||
toml = {version = "0.7.3", optional = true}
|
||||
# Big float high precision arithmetics
|
||||
dashu = { version = "0.3.0", optional=true }
|
||||
dashu = { version = "0.3.1", optional=true }
|
||||
|
||||
# Utilities
|
||||
# TODO: check chrono usage and impl our own
|
||||
chrono = {version = "0.4.23", optional = true}
|
||||
chrono = {version = "0.4.24", optional = true}
|
||||
darkfi-serial = {path = "src/serial", optional = true}
|
||||
darkfi-derive = {path = "src/serial/derive", optional = true}
|
||||
darkfi-derive-internal = {path = "src/serial/derive-internal", optional = true}
|
||||
indexmap = {version = "1.9.2", optional = true}
|
||||
indexmap = {version = "1.9.3", optional = true}
|
||||
itertools = {version = "0.10.5", optional = true}
|
||||
lazy_static = {version = "1.4.0", optional = true}
|
||||
# TODO: Test without serde
|
||||
@@ -101,11 +101,11 @@ url = {version = "2.3.1", features = ["serde"], optional = true}
|
||||
# Misc
|
||||
# TODO: Implement something simple and kill these deps
|
||||
indicatif = {version = "0.17.3", optional = true}
|
||||
simplelog = {version = "0.12.0", optional = true}
|
||||
simplelog = {version = "0.12.1", optional = true}
|
||||
ripemd = {version = "0.1.3", optional = true}
|
||||
|
||||
# Websockets
|
||||
async-tungstenite = {version = "0.19.0", optional = true}
|
||||
async-tungstenite = {version = "0.21.0", optional = true}
|
||||
|
||||
# socks5
|
||||
fast-socks5 = {version = "0.4.3", optional = true}
|
||||
@@ -114,29 +114,29 @@ fast-socks5 = {version = "0.4.3", optional = true}
|
||||
rand = {version = "0.8.5", optional = true}
|
||||
blake3 = {version = "1.3.3", optional = true}
|
||||
crypto_api_chachapoly = {version = "0.5.0", optional = true}
|
||||
halo2_proofs = {version = "0.2.0", optional = true}
|
||||
halo2_gadgets = {version = "0.2.0", optional = true}
|
||||
halo2_proofs = {version = "0.3.0", optional = true}
|
||||
halo2_gadgets = {version = "0.3.0", optional = true}
|
||||
|
||||
# Smart contract runtime
|
||||
darkfi-sdk = {path = "src/sdk", optional = true}
|
||||
wasmer = {version = "3.1.1", optional = true}
|
||||
wasmer-compiler-singlepass = {version = "3.1.1", optional = true}
|
||||
wasmer-middlewares = {version = "3.1.1", optional = true}
|
||||
wasmer = {version = "3.2.0-beta.2", optional = true}
|
||||
wasmer-compiler-singlepass = {version = "3.2.0-beta.2", optional = true}
|
||||
wasmer-middlewares = {version = "3.2.0-beta.2", optional = true}
|
||||
|
||||
# Wallet management
|
||||
libsqlite3-sys = {version = "0.24.1", features = ["bundled-sqlcipher"], optional = true }
|
||||
sqlx = {version = "0.6.2", features = ["runtime-async-std-rustls", "sqlite"], optional = true}
|
||||
sqlx = {version = "0.6.3", features = ["runtime-async-std-rustls", "sqlite"], optional = true}
|
||||
|
||||
# Blockchain store
|
||||
sled = {version = "0.34.7", optional = true}
|
||||
sled-overlay = {version = "0.0.3", optional = true}
|
||||
|
||||
[dev-dependencies]
|
||||
clap = {version = "4.1.4", features = ["derive"]}
|
||||
clap = {version = "4.2.2", features = ["derive"]}
|
||||
halo2_proofs = {version = "0.2.0", features = ["dev-graph", "gadget-traces", "sanity-checks"]}
|
||||
halo2_gadgets = {version = "0.2.0", features = ["dev-graph", "test-dependencies"]}
|
||||
plotters = "0.3.4"
|
||||
easy-parallel = "3.2.0"
|
||||
easy-parallel = "3.3.0"
|
||||
|
||||
# -----BEGIN LIBRARY FEATURES-----
|
||||
[features]
|
||||
@@ -326,4 +326,4 @@ path = "example/zk-inclusion-proof.rs"
|
||||
required-features = ["zk"]
|
||||
|
||||
[patch.crates-io]
|
||||
halo2_proofs = {git="https://github.com/parazyd/halo2", branch="vk-ser"}
|
||||
halo2_proofs = {git="https://github.com/parazyd/halo2", branch="v3"}
|
||||
|
||||
@@ -15,49 +15,49 @@ features = ["wallet", "node", "rpc"]
|
||||
[dependencies]
|
||||
# Async
|
||||
smol = "1.3.0"
|
||||
futures = "0.3.26"
|
||||
futures = "0.3.28"
|
||||
async-std = "1.12.0"
|
||||
async-trait = "0.1.64"
|
||||
async-trait = "0.1.68"
|
||||
async-channel = "1.8.0"
|
||||
async-executor = "1.5.0"
|
||||
easy-parallel = "3.2.0"
|
||||
async-executor = "1.5.1"
|
||||
easy-parallel = "3.3.0"
|
||||
|
||||
# Crypto
|
||||
rand = "0.8.5"
|
||||
|
||||
# Misc
|
||||
clap = {version = "4.1.4", features = ["derive"]}
|
||||
clap = {version = "4.2.2", features = ["derive"]}
|
||||
log = "0.4.17"
|
||||
num_cpus = "1.15.0"
|
||||
simplelog = "0.12.0"
|
||||
thiserror = "1.0.38"
|
||||
simplelog = "0.12.1"
|
||||
thiserror = "1.0.40"
|
||||
url = "2.3.1"
|
||||
|
||||
# Encoding and parsing
|
||||
serde = {version = "1.0.152", features = ["derive"]}
|
||||
serde_json = "1.0.91"
|
||||
serde = {version = "1.0.160", features = ["derive"]}
|
||||
serde_json = "1.0.96"
|
||||
|
||||
# Bitcoin bridge dependencies
|
||||
bdk = {version = "0.26.0", optional = true}
|
||||
anyhow = {version = "1.0.68", optional = true}
|
||||
bitcoin = {version = "0.29.1", optional = true}
|
||||
secp256k1 = {version = "0.26.0", default-features = false, features = ["rand-std"], optional = true}
|
||||
bdk = {version = "0.28.0", optional = true}
|
||||
anyhow = {version = "1.0.70", optional = true}
|
||||
bitcoin = {version = "0.30.0", optional = true}
|
||||
secp256k1 = {version = "0.27.0", default-features = false, features = ["rand-std"], optional = true}
|
||||
|
||||
# Ethereum bridge dependencies
|
||||
hex = {version = "0.4.3", optional = true}
|
||||
hash-db = {version = "0.15.2", optional = true}
|
||||
hash-db = {version = "0.16.0", optional = true}
|
||||
lazy_static = {version = "1.4.0", optional = true}
|
||||
keccak-hasher = {version = "0.15.3", optional = true}
|
||||
keccak-hasher = {version = "0.16.0", optional = true}
|
||||
num-bigint = {version = "0.4.3", features = ["rand", "serde"], optional = true}
|
||||
|
||||
# Solana bridge dependencies
|
||||
native-tls = {version = "0.2.11", optional = true}
|
||||
async-native-tls = {version = "0.4.0", optional = true}
|
||||
solana-client = {version = "1.14.13", optional = true}
|
||||
async-native-tls = {version = "0.5.0", optional = true}
|
||||
solana-client = {version = "1.14.17", optional = true}
|
||||
solana-sdk = {version = "1.14.13", optional = true}
|
||||
spl-associated-token-account = {version = "1.1.2", features = ["no-entrypoint"], optional = true}
|
||||
spl-associated-token-account = {version = "1.1.3", features = ["no-entrypoint"], optional = true}
|
||||
spl-token = {version = "3.5.0", features = ["no-entrypoint"], optional = true}
|
||||
tungstenite = {version = "0.18.0", optional = true}
|
||||
tungstenite = {version = "0.19.0", optional = true}
|
||||
|
||||
[features]
|
||||
btc = [
|
||||
|
||||
@@ -10,23 +10,23 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
async-std = "1.12.0"
|
||||
async-trait = "0.1.64"
|
||||
async-trait = "0.1.68"
|
||||
blake3 = "1.3.3"
|
||||
bs58 = "0.4.0"
|
||||
ctrlc = { version = "3.2.4", features = ["termination"] }
|
||||
ctrlc = { version = "3.2.5", features = ["termination"] }
|
||||
darkfi = {path = "../../", features = ["blockchain", "wallet", "rpc", "net"]}
|
||||
darkfi-sdk = {path = "../../src/sdk"}
|
||||
darkfi-serial = {path = "../../src/serial"}
|
||||
easy-parallel = "3.2.0"
|
||||
easy-parallel = "3.3.0"
|
||||
log = "0.4.17"
|
||||
serde_json = "1.0.91"
|
||||
simplelog = "0.12.0"
|
||||
serde_json = "1.0.96"
|
||||
simplelog = "0.12.1"
|
||||
sled = "0.34.7"
|
||||
smol = "1.3.0"
|
||||
sqlx = {version = "0.6.2", features = ["runtime-async-std-rustls", "sqlite"]}
|
||||
sqlx = {version = "0.6.3", features = ["runtime-async-std-rustls", "sqlite"]}
|
||||
url = "2.3.1"
|
||||
|
||||
# Argument parsing
|
||||
serde = {version = "1.0.152", features = ["derive"]}
|
||||
serde = {version = "1.0.160", features = ["derive"]}
|
||||
structopt = "0.3.26"
|
||||
structopt-toml = "0.5.1"
|
||||
|
||||
@@ -14,17 +14,17 @@ darkfi = {path = "../../../", features = ["rpc"]}
|
||||
# Async
|
||||
smol = "1.3.0"
|
||||
async-std = {version = "1.12.0", features = ["attributes"]}
|
||||
async-trait = "0.1.64"
|
||||
async-trait = "0.1.68"
|
||||
async-channel = "1.8.0"
|
||||
futures = "0.3.26"
|
||||
futures = "0.3.28"
|
||||
|
||||
# Misc
|
||||
log = "0.4.17"
|
||||
simplelog = "0.12.0"
|
||||
simplelog = "0.12.1"
|
||||
rand = "0.8.5"
|
||||
url = "2.3.1"
|
||||
|
||||
# Encoding and parsing
|
||||
serde = {version = "1.0.152", features = ["derive"]}
|
||||
serde_json = "1.0.91"
|
||||
serde = {version = "1.0.160", features = ["derive"]}
|
||||
serde_json = "1.0.96"
|
||||
structopt = "0.3.26"
|
||||
|
||||
@@ -10,25 +10,25 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
async-std = "1.12.0"
|
||||
async-trait = "0.1.64"
|
||||
async-trait = "0.1.68"
|
||||
blake3 = "1.3.3"
|
||||
bs58 = "0.4.0"
|
||||
darkfi = {path = "../../../", features = ["raft", "rpc", "util"]}
|
||||
darkfi-serial = {path = "../../../src/serial"}
|
||||
dryoc = "0.4.3"
|
||||
easy-parallel = "3.2.0"
|
||||
futures = "0.3.26"
|
||||
dryoc = "0.5.0"
|
||||
easy-parallel = "3.3.0"
|
||||
futures = "0.3.28"
|
||||
lazy_static = "1.4.0"
|
||||
log = "0.4.17"
|
||||
serde = "1.0.152"
|
||||
serde_derive = "1.0.152"
|
||||
serde_json = "1.0.91"
|
||||
serde = "1.0.160"
|
||||
serde_derive = "1.0.160"
|
||||
serde_json = "1.0.96"
|
||||
signal-hook-async-std = "0.2.2"
|
||||
signal-hook = "0.3.14"
|
||||
simplelog = "0.12.0"
|
||||
signal-hook = "0.3.15"
|
||||
simplelog = "0.12.1"
|
||||
structopt = "0.3.26"
|
||||
structopt-toml = "0.5.1"
|
||||
smol = "1.3.0"
|
||||
toml = "0.7.1"
|
||||
toml = "0.7.3"
|
||||
unicode-segmentation = "1.10.1"
|
||||
url = "2.3.1"
|
||||
|
||||
@@ -20,19 +20,19 @@ tui = {version = "0.19.0", features = ["termion"]}
|
||||
# Async
|
||||
smol = "1.3.0"
|
||||
async-std = {version = "1.12.0", features = ["attributes"]}
|
||||
easy-parallel = "3.2.0"
|
||||
easy-parallel = "3.3.0"
|
||||
async-channel = "1.8.0"
|
||||
|
||||
# Misc
|
||||
clap = {version = "4.1.4", features = ["derive"]}
|
||||
clap = {version = "4.2.2", features = ["derive"]}
|
||||
rand = "0.8.5"
|
||||
simplelog = "0.12.0"
|
||||
simplelog = "0.12.1"
|
||||
log = "0.4.17"
|
||||
num_cpus = "1.15.0"
|
||||
url = "2.3.1"
|
||||
thiserror = "1.0.38"
|
||||
thiserror = "1.0.40"
|
||||
|
||||
# Encoding and parsing
|
||||
serde_json = "1.0.91"
|
||||
serde = {version = "1.0.152", features = ["derive"]}
|
||||
serde_json = "1.0.96"
|
||||
serde = {version = "1.0.160", features = ["derive"]}
|
||||
hex = "0.4.3"
|
||||
|
||||
@@ -12,12 +12,12 @@ edition = "2021"
|
||||
pkg-config = "0.3.26"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.68"
|
||||
anyhow = "1.0.70"
|
||||
async-std = {version = "1.12.0", features = ["attributes"]}
|
||||
blake3 = "1.3.3"
|
||||
bs58 = "0.4.0"
|
||||
clap = {version = "4.1.4", features = ["derive"]}
|
||||
clap_complete = "4.1.2"
|
||||
clap = {version = "4.2.2", features = ["derive"]}
|
||||
clap_complete = "4.2.0"
|
||||
darkfi = {path = "../../", features = ["blockchain", "rpc", "util", "wallet"]}
|
||||
darkfi-sdk = {path = "../../src/sdk"}
|
||||
darkfi-serial = {path = "../../src/serial", features = ["derive", "crypto"]}
|
||||
@@ -25,11 +25,11 @@ darkfi-money-contract = {path = "../../src/contract/money", features = ["no-entr
|
||||
darkfi-dao-contract = {path = "../../src/contract/dao", features = ["no-entrypoint", "client"]}
|
||||
prettytable-rs = "0.10.0"
|
||||
rand = "0.8.5"
|
||||
serde_json = "1.0.91"
|
||||
serde_json = "1.0.96"
|
||||
smol = "1.3.0"
|
||||
simplelog = "0.12.0"
|
||||
simplelog = "0.12.1"
|
||||
signal-hook-async-std = "0.2.2"
|
||||
signal-hook = "0.3.14"
|
||||
sqlx = {version = "0.6.2", features = ["runtime-async-std-rustls", "sqlite"]}
|
||||
signal-hook = "0.3.15"
|
||||
sqlx = {version = "0.6.3", features = ["runtime-async-std-rustls", "sqlite"]}
|
||||
url = "2.3.1"
|
||||
play = {version = "0.5.3", optional = true}
|
||||
|
||||
@@ -156,8 +156,8 @@ impl Drk {
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
let txs_hashes: Vec<String> = txs.into_iter().map(|tx| tx.hash().to_string()).collect();
|
||||
let txs_hashes_string = format!("{:?}", txs_hashes).replace("[", "(").replace("]", ")");
|
||||
let txs_hashes: Vec<String> = txs.iter().map(|tx| tx.hash().to_string()).collect();
|
||||
let txs_hashes_string = format!("{:?}", txs_hashes).replace('[', "(").replace(']', ")");
|
||||
let query = format!(
|
||||
"UPDATE {} SET {} = ?1 WHERE {} IN {};",
|
||||
WALLET_TXS_HISTORY_TABLE,
|
||||
|
||||
@@ -10,26 +10,26 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
async-std = "1.12.0"
|
||||
async-trait = "0.1.64"
|
||||
async-trait = "0.1.68"
|
||||
blake3 = "1.3.3"
|
||||
chrono = "0.4.23"
|
||||
chrono = "0.4.24"
|
||||
darkfi = {path = "../../", features = ["blockchain", "wallet", "rpc", "net", "zkas"]}
|
||||
darkfi-serial = {path = "../../src/serial"}
|
||||
darkfi-sdk = {path = "../../src/sdk"}
|
||||
darkfi-money-contract = {path = "../../src/contract/money", features = ["no-entrypoint", "client"]}
|
||||
easy-parallel = "3.2.0"
|
||||
easy-parallel = "3.3.0"
|
||||
log = "0.4.17"
|
||||
rand = "0.8.5"
|
||||
serde_json = "1.0.91"
|
||||
serde_json = "1.0.96"
|
||||
signal-hook = "0.3.15"
|
||||
signal-hook-async-std = "0.2.2"
|
||||
simplelog = "0.12.0"
|
||||
simplelog = "0.12.1"
|
||||
sled = "0.34.7"
|
||||
smol = "1.3.0"
|
||||
sqlx = {version = "0.6.2", features = ["runtime-async-std-rustls", "sqlite"]}
|
||||
sqlx = {version = "0.6.3", features = ["runtime-async-std-rustls", "sqlite"]}
|
||||
url = "2.3.1"
|
||||
|
||||
# Argument parsing
|
||||
serde = {version = "1.0.152", features = ["derive"]}
|
||||
serde = {version = "1.0.160", features = ["derive"]}
|
||||
structopt = "0.3.26"
|
||||
structopt-toml = "0.5.1"
|
||||
|
||||
@@ -15,8 +15,8 @@ darkfi = {path = "../../../", features = ["util", "rpc"]}
|
||||
async-std = {version = "1.12.0", features = ["attributes"]}
|
||||
|
||||
# Misc
|
||||
clap = {version = "4.1.4", features = ["derive"]}
|
||||
clap = {version = "4.2.2", features = ["derive"]}
|
||||
log = "0.4.17"
|
||||
serde_json = "1.0.91"
|
||||
simplelog = "0.12.0"
|
||||
serde_json = "1.0.96"
|
||||
simplelog = "0.12.1"
|
||||
url = "2.3.1"
|
||||
|
||||
@@ -14,19 +14,19 @@ darkfi-serial = {path = "../../../src/serial"}
|
||||
|
||||
# Async
|
||||
async-std = "1.12.0"
|
||||
async-trait = "0.1.64"
|
||||
ctrlc = { version = "3.2.4", features = ["termination"] }
|
||||
easy-parallel = "3.2.0"
|
||||
async-trait = "0.1.68"
|
||||
ctrlc = { version = "3.2.5", features = ["termination"] }
|
||||
easy-parallel = "3.3.0"
|
||||
smol = "1.3.0"
|
||||
|
||||
# Misc
|
||||
blake3 = "1.3.3"
|
||||
log = "0.4.17"
|
||||
serde_json = "1.0.91"
|
||||
simplelog = "0.12.0"
|
||||
serde_json = "1.0.96"
|
||||
simplelog = "0.12.1"
|
||||
url = "2.3.1"
|
||||
|
||||
# Argument parsing
|
||||
serde = {version = "1.0.152", features = ["derive"]}
|
||||
serde = {version = "1.0.160", features = ["derive"]}
|
||||
structopt = "0.3.26"
|
||||
structopt-toml = "0.5.1"
|
||||
|
||||
@@ -13,10 +13,10 @@ darkfi = {path = "../../../", features = ["event-graph", "rpc", "bs58"]}
|
||||
darkfi-serial = {path = "../../../src/serial"}
|
||||
|
||||
async-std = {version = "1.12.0", features = ["attributes"]}
|
||||
clap = {version = "4.1.6", features = ["derive"]}
|
||||
clap = {version = "4.2.2", features = ["derive"]}
|
||||
log = "0.4.17"
|
||||
simplelog = "0.12.0"
|
||||
serde = {version = "1.0.152", features = ["derive"]}
|
||||
serde_json = "1.0.93"
|
||||
simplelog = "0.12.1"
|
||||
serde = {version = "1.0.160", features = ["derive"]}
|
||||
serde_json = "1.0.96"
|
||||
url = "2.3.1"
|
||||
|
||||
|
||||
@@ -13,16 +13,16 @@ darkfi = {path = "../../../", features = ["event-graph", "rpc", "bs58", "util"]}
|
||||
darkfi-serial = {path = "../../../src/serial"}
|
||||
|
||||
async-std = {version = "1.12.0", features = ["attributes"]}
|
||||
async-trait = "0.1.64"
|
||||
async-trait = "0.1.68"
|
||||
ctrlc = { version = "3.2.5", features = ["termination"] }
|
||||
easy-parallel = "3.2.0"
|
||||
simplelog = "0.12.0"
|
||||
easy-parallel = "3.3.0"
|
||||
simplelog = "0.12.1"
|
||||
smol = "1.3.0"
|
||||
log = "0.4.17"
|
||||
url = "2.3.1"
|
||||
|
||||
# Argument parsing
|
||||
serde = {version = "1.0.152", features = ["derive"]}
|
||||
serde_json = "1.0.93"
|
||||
serde = {version = "1.0.160", features = ["derive"]}
|
||||
serde_json = "1.0.96"
|
||||
structopt = "0.3.26"
|
||||
structopt-toml = "0.5.1"
|
||||
@@ -14,32 +14,32 @@ darkfi-serial = {path = "../../src/serial"}
|
||||
|
||||
# Async
|
||||
smol = "1.3.0"
|
||||
futures = "0.3.26"
|
||||
futures-rustls = "0.22.2"
|
||||
futures = "0.3.28"
|
||||
futures-rustls = "0.24.0"
|
||||
rustls-pemfile = "1.0.2"
|
||||
async-std = "1.12.0"
|
||||
async-trait = "0.1.64"
|
||||
easy-parallel = "3.2.0"
|
||||
async-recursion = "1.0.2"
|
||||
async-trait = "0.1.68"
|
||||
easy-parallel = "3.3.0"
|
||||
async-recursion = "1.0.4"
|
||||
|
||||
# Crypto
|
||||
crypto_box = "0.8.2"
|
||||
rand = "0.8.5"
|
||||
|
||||
# Misc
|
||||
clap = {version = "4.1.4", features = ["derive"]}
|
||||
clap = {version = "4.2.2", features = ["derive"]}
|
||||
log = "0.4.17"
|
||||
simplelog = "0.12.0"
|
||||
ctrlc = { version = "3.2.4", features = ["termination"] }
|
||||
simplelog = "0.12.1"
|
||||
ctrlc = { version = "3.2.5", features = ["termination"] }
|
||||
url = "2.3.1"
|
||||
chrono = "0.4.23"
|
||||
chrono = "0.4.24"
|
||||
ripemd = "0.1.3"
|
||||
|
||||
# Encoding and parsing
|
||||
serde_json = "1.0.91"
|
||||
serde = {version = "1.0.152", features = ["derive"]}
|
||||
serde_json = "1.0.96"
|
||||
serde = {version = "1.0.160", features = ["derive"]}
|
||||
structopt = "0.3.26"
|
||||
structopt-toml = "0.5.1"
|
||||
bs58 = "0.4.0"
|
||||
toml = "0.7.1"
|
||||
toml = "0.7.3"
|
||||
hex = "0.4.3"
|
||||
|
||||
@@ -14,12 +14,12 @@ darkfi-serial = {path = "../../src/serial"}
|
||||
|
||||
# Async
|
||||
smol = "1.3.0"
|
||||
futures = "0.3.25"
|
||||
futures-rustls = "0.22.2"
|
||||
rustls-pemfile = "1.0.1"
|
||||
futures = "0.3.28"
|
||||
futures-rustls = "0.24.0"
|
||||
rustls-pemfile = "1.0.2"
|
||||
async-std = "1.12.0"
|
||||
async-trait = "0.1.60"
|
||||
easy-parallel = "3.2.0"
|
||||
async-trait = "0.1.68"
|
||||
easy-parallel = "3.3.0"
|
||||
|
||||
# Crypto
|
||||
crypto_box = "0.8.2"
|
||||
@@ -29,19 +29,19 @@ rand = "0.8.5"
|
||||
sled = "0.34.7"
|
||||
|
||||
# Misc
|
||||
clap = {version = "4.0.32", features = ["derive"]}
|
||||
clap = {version = "4.2.2", features = ["derive"]}
|
||||
log = "0.4.17"
|
||||
simplelog = "0.12.0"
|
||||
ctrlc = { version = "3.2.4", features = ["termination"] }
|
||||
simplelog = "0.12.1"
|
||||
ctrlc = { version = "3.2.5", features = ["termination"] }
|
||||
url = "2.3.1"
|
||||
chrono = "0.4.23"
|
||||
chrono = "0.4.24"
|
||||
ripemd = "0.1.3"
|
||||
|
||||
# Encoding and parsing
|
||||
serde_json = "1.0.91"
|
||||
serde = {version = "1.0.152", features = ["derive"]}
|
||||
serde_json = "1.0.96"
|
||||
serde = {version = "1.0.160", features = ["derive"]}
|
||||
structopt = "0.3.26"
|
||||
structopt-toml = "0.5.1"
|
||||
bs58 = "0.4.0"
|
||||
toml = "0.5.10"
|
||||
toml = "0.7.3"
|
||||
hex = "0.4.3"
|
||||
|
||||
@@ -156,6 +156,7 @@ impl IrcServer {
|
||||
// message.
|
||||
// TODO: This needs to be protected from adversaries doing
|
||||
// remote execution.
|
||||
#[allow(clippy::single_match)]
|
||||
match msg.target.to_lowercase().as_str() {
|
||||
NICK_NICKSERV => {
|
||||
//self.nickserv.act(msg);
|
||||
|
||||
@@ -71,14 +71,9 @@ impl NickServ {
|
||||
|
||||
"IDENTIFY" => self.identify(),
|
||||
|
||||
"HELP" => return Ok(Self::usage()),
|
||||
"HELP" => Ok(Self::usage()),
|
||||
|
||||
c => {
|
||||
return Err(vec![
|
||||
format!("Invalid command {}", c),
|
||||
"Type HELP to get help".to_string(),
|
||||
])
|
||||
}
|
||||
c => Err(vec![format!("Invalid command {}", c), "Type HELP to get help".to_string()]),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,19 +13,19 @@ darkfi = {path = "../../", features = ["net", "rpc"]}
|
||||
|
||||
# Async
|
||||
async-std = "1.12.0"
|
||||
async-trait = "0.1.64"
|
||||
ctrlc = { version = "3.2.4", features = ["termination"] }
|
||||
easy-parallel = "3.2.0"
|
||||
async-trait = "0.1.68"
|
||||
ctrlc = { version = "3.2.5", features = ["termination"] }
|
||||
easy-parallel = "3.3.0"
|
||||
smol = "1.3.0"
|
||||
|
||||
# Misc
|
||||
log = "0.4.17"
|
||||
serde_json = "1.0.91"
|
||||
simplelog = "0.12.0"
|
||||
serde_json = "1.0.96"
|
||||
simplelog = "0.12.1"
|
||||
url = "2.3.1"
|
||||
|
||||
# Argument parsing
|
||||
serde = {version = "1.0.152", features = ["derive"]}
|
||||
serde = {version = "1.0.160", features = ["derive"]}
|
||||
structopt = "0.3.26"
|
||||
structopt-toml = "0.5.1"
|
||||
toml = "0.7.1"
|
||||
toml = "0.7.3"
|
||||
|
||||
@@ -10,15 +10,15 @@ repository = "https://github.com/darkrenaissance/darkfi"
|
||||
|
||||
[dependencies]
|
||||
async-std = {version = "1.12.0", features = ["attributes"]}
|
||||
chrono = "0.4.23"
|
||||
clap = {version = "4.1.4", features = ["derive"]}
|
||||
chrono = "0.4.24"
|
||||
clap = {version = "4.2.2", features = ["derive"]}
|
||||
colored = "2.0.0"
|
||||
darkfi = { path = "../../../", features = ["rpc"]}
|
||||
log = "0.4.17"
|
||||
prettytable-rs = "0.10.0"
|
||||
serde = {version = "1.0.152", features = ["derive"]}
|
||||
serde_json = "1.0.91"
|
||||
simplelog = "0.12.0"
|
||||
serde = {version = "1.0.160", features = ["derive"]}
|
||||
serde_json = "1.0.96"
|
||||
simplelog = "0.12.1"
|
||||
term_grid = { git = "https://github.com/Dastan-glitch/rust-term-grid.git" }
|
||||
textwrap = "0.15.2"
|
||||
url = "2.3.1"
|
||||
|
||||
@@ -15,26 +15,26 @@ darkfi-serial = { path = "../../../src/serial" }
|
||||
# Async
|
||||
smol = "1.3.0"
|
||||
async-std = {version = "1.12.0", features = ["attributes"]}
|
||||
async-trait = "0.1.64"
|
||||
easy-parallel = "3.2.0"
|
||||
futures = "0.3.26"
|
||||
async-trait = "0.1.68"
|
||||
easy-parallel = "3.3.0"
|
||||
futures = "0.3.28"
|
||||
|
||||
# Misc
|
||||
libc = "0.2.139"
|
||||
libc = "0.2.141"
|
||||
log = "0.4.17"
|
||||
simplelog = "0.12.0"
|
||||
simplelog = "0.12.1"
|
||||
rand = "0.8.5"
|
||||
chrono = "0.4.23"
|
||||
thiserror = "1.0.38"
|
||||
ctrlc = { version = "3.2.4", features = ["termination"] }
|
||||
chrono = "0.4.24"
|
||||
thiserror = "1.0.40"
|
||||
ctrlc = { version = "3.2.5", features = ["termination"] }
|
||||
url = "2.3.1"
|
||||
|
||||
# Encoding and parsing
|
||||
serde = {version = "1.0.152", features = ["derive"]}
|
||||
serde_json = "1.0.91"
|
||||
serde = {version = "1.0.160", features = ["derive"]}
|
||||
serde_json = "1.0.96"
|
||||
structopt = "0.3.26"
|
||||
structopt-toml = "0.5.1"
|
||||
crypto_box = {version = "0.8.2", features = ["std"]}
|
||||
hex = "0.4.3"
|
||||
bs58 = "0.4.0"
|
||||
toml = "0.7.1"
|
||||
toml = "0.7.3"
|
||||
|
||||
@@ -10,11 +10,11 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
bs58 = "0.4.0"
|
||||
clap = {version = "4.1.4", features = ["derive"]}
|
||||
ctrlc = "3.2.4"
|
||||
clap = {version = "4.2.2", features = ["derive"]}
|
||||
ctrlc = "3.2.5"
|
||||
darkfi = {path = "../../"}
|
||||
darkfi-sdk = {path = "../../src/sdk"}
|
||||
indicatif = "0.17.3"
|
||||
num_cpus = "1.15.0"
|
||||
rand = "0.8.5"
|
||||
rayon = "1.6.1"
|
||||
rayon = "1.7.0"
|
||||
|
||||
@@ -9,5 +9,5 @@ license = "AGPL-3.0-only"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
clap = {version = "4.1.4", features = ["derive"]}
|
||||
clap = {version = "4.2.2", features = ["derive"]}
|
||||
darkfi = {path = "../../", features = ["zkas"]}
|
||||
|
||||
@@ -9,7 +9,7 @@ license = "AGPL-3.0-only"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
clap = {version = "4.1.4", features = ["derive"]}
|
||||
clap = {version = "4.2.2", features = ["derive"]}
|
||||
darkfi = {path = "../../", features = ["zkas"]}
|
||||
darkfi-sdk = {path = "../../src/sdk"}
|
||||
|
||||
|
||||
@@ -12,30 +12,30 @@ darkfi-sdk = {path = "../../src/sdk"}
|
||||
|
||||
# Async
|
||||
smol = "1.3.0"
|
||||
futures = "0.3.26"
|
||||
futures = "0.3.28"
|
||||
async-std = {version = "1.12.0", features = ["attributes"]}
|
||||
async-trait = "0.1.64"
|
||||
async-trait = "0.1.68"
|
||||
async-channel = "1.8.0"
|
||||
async-executor = "1.5.0"
|
||||
easy-parallel = "3.2.0"
|
||||
async-executor = "1.5.1"
|
||||
easy-parallel = "3.3.0"
|
||||
|
||||
# Misc
|
||||
log = "0.4.17"
|
||||
num_cpus = "1.15.0"
|
||||
simplelog = "0.12.0"
|
||||
thiserror = "1.0.38"
|
||||
simplelog = "0.12.1"
|
||||
thiserror = "1.0.40"
|
||||
|
||||
# Crypto
|
||||
incrementalmerkletree = "0.3.0"
|
||||
pasta_curves = "0.4.1"
|
||||
halo2_gadgets = "0.2.0"
|
||||
halo2_proofs = "0.2.0"
|
||||
incrementalmerkletree = "0.3.1"
|
||||
pasta_curves = "0.5.1"
|
||||
halo2_gadgets = "0.3.0"
|
||||
halo2_proofs = "0.3.0"
|
||||
rand = "0.8.5"
|
||||
chacha20poly1305 = "0.10.1"
|
||||
group = "0.13.0"
|
||||
|
||||
# Encoding and parsing
|
||||
serde_json = "1.0.91"
|
||||
serde_json = "1.0.96"
|
||||
bs58 = "0.4.0"
|
||||
fxhash = "0.2.1"
|
||||
|
||||
|
||||
1
example/dao2/.gitignore
vendored
1
example/dao2/.gitignore
vendored
@@ -2,3 +2,4 @@
|
||||
*.wasm
|
||||
*.zk.bin
|
||||
target/
|
||||
Cargo.lock
|
||||
|
||||
3666
example/dao2/Cargo.lock
generated
3666
example/dao2/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -21,30 +21,30 @@ sled = "0.34.7"
|
||||
|
||||
# Async
|
||||
smol = "1.3.0"
|
||||
futures = "0.3.26"
|
||||
futures = "0.3.28"
|
||||
async-std = {version = "1.12.0", features = ["attributes"]}
|
||||
async-trait = "0.1.64"
|
||||
async-trait = "0.1.68"
|
||||
async-channel = "1.8.0"
|
||||
async-executor = "1.5.0"
|
||||
easy-parallel = "3.2.0"
|
||||
async-executor = "1.5.1"
|
||||
easy-parallel = "3.3.0"
|
||||
|
||||
# Misc
|
||||
log = "0.4.17"
|
||||
num_cpus = "1.15.0"
|
||||
simplelog = "0.12.0"
|
||||
thiserror = "1.0.38"
|
||||
simplelog = "0.12.1"
|
||||
thiserror = "1.0.40"
|
||||
|
||||
# Crypto
|
||||
incrementalmerkletree = "0.3.0"
|
||||
pasta_curves = "0.4.1"
|
||||
halo2_gadgets = "0.2.0"
|
||||
halo2_proofs = "0.2.0"
|
||||
incrementalmerkletree = "0.3.1"
|
||||
pasta_curves = "0.5.1"
|
||||
halo2_gadgets = "0.3.0"
|
||||
halo2_proofs = "0.3.0"
|
||||
rand = "0.8.5"
|
||||
chacha20poly1305 = "0.10.1"
|
||||
group = "0.13.0"
|
||||
|
||||
# Encoding and parsing
|
||||
serde_json = "1.0.91"
|
||||
serde_json = "1.0.96"
|
||||
bs58 = "0.4.0"
|
||||
fxhash = "0.2.1"
|
||||
|
||||
|
||||
@@ -16,16 +16,16 @@ darkfi-serial = {path = "../../src/serial"}
|
||||
|
||||
# ANCHOR: dependencies
|
||||
async-std = "1.12.0"
|
||||
async-trait = "0.1.64"
|
||||
easy-parallel = "3.2.0"
|
||||
async-trait = "0.1.68"
|
||||
easy-parallel = "3.3.0"
|
||||
smol = "1.3.0"
|
||||
num_cpus = "1.15.0"
|
||||
|
||||
log = "0.4.17"
|
||||
simplelog = "0.12.0"
|
||||
simplelog = "0.12.1"
|
||||
url = "2.3.1"
|
||||
|
||||
serde_json = "1.0.91"
|
||||
serde = {version = "1.0.152", features = ["derive"]}
|
||||
toml = "0.7.1"
|
||||
serde_json = "1.0.96"
|
||||
serde = {version = "1.0.160", features = ["derive"]}
|
||||
toml = "0.7.3"
|
||||
# ANCHOR_END: dependencies
|
||||
|
||||
@@ -13,22 +13,22 @@ edition = "2021"
|
||||
darkfi = {path = "../../", features = ["net", "rpc"]}
|
||||
# Async
|
||||
smol = "1.3.0"
|
||||
futures = "0.3.26"
|
||||
futures = "0.3.28"
|
||||
async-std = "1.12.0"
|
||||
async-trait = "0.1.64"
|
||||
async-trait = "0.1.68"
|
||||
async-channel = "1.8.0"
|
||||
async-executor = "1.5.0"
|
||||
easy-parallel = "3.2.0"
|
||||
async-executor = "1.5.1"
|
||||
easy-parallel = "3.3.0"
|
||||
|
||||
# Crypto
|
||||
rand = "0.8.5"
|
||||
|
||||
# Misc
|
||||
clap = {version = "4.1.4", features = ["derive"]}
|
||||
clap = {version = "4.2.2", features = ["derive"]}
|
||||
log = "0.4.17"
|
||||
simplelog = "0.12.0"
|
||||
simplelog = "0.12.1"
|
||||
fxhash = "0.2.1"
|
||||
url = "2.3.1"
|
||||
|
||||
# Encoding and parsing
|
||||
serde_json = "1.0.91"
|
||||
serde_json = "1.0.96"
|
||||
|
||||
@@ -8,7 +8,7 @@ edition = "2021"
|
||||
[workspace]
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.69"
|
||||
anyhow = "1.0.70"
|
||||
async-std = {version = "1.12.0", features = ["attributes"]}
|
||||
arti-client = {version = "0.8.2", default-features = false, features = ["async-std", "pt-client", "rustls", "compression"]}
|
||||
arti-client = {version = "0.8.3", default-features = false, features = ["async-std", "pt-client", "rustls", "compression"]}
|
||||
simplelog = "0.12.1"
|
||||
|
||||
@@ -11,7 +11,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
blake3 = "1.3.3"
|
||||
clap = {version = "4.1.4", features = ["derive"]}
|
||||
clap = {version = "4.2.2", features = ["derive"]}
|
||||
darkfi = {path = "../../../", features = ["blockchain", "wallet", "rpc"]}
|
||||
darkfi-sdk = {path = "../../../src/sdk"}
|
||||
sled = "0.34.7"
|
||||
|
||||
@@ -11,21 +11,21 @@ features = ["dht"]
|
||||
|
||||
[dependencies]
|
||||
async-channel = "1.8.0"
|
||||
async-executor = "1.5.0"
|
||||
async-executor = "1.5.1"
|
||||
async-std = "1.12.0"
|
||||
async-trait = "0.1.64"
|
||||
async-trait = "0.1.68"
|
||||
blake3 = "1.3.3"
|
||||
ctrlc = { version = "3.2.4", features = ["termination"] }
|
||||
easy-parallel = "3.2.0"
|
||||
futures-lite = "1.12.0"
|
||||
ctrlc = { version = "3.2.5", features = ["termination"] }
|
||||
easy-parallel = "3.3.0"
|
||||
futures-lite = "1.13.0"
|
||||
log = "0.4.17"
|
||||
serde_json = "1.0.91"
|
||||
simplelog = "0.12.0"
|
||||
serde_json = "1.0.96"
|
||||
simplelog = "0.12.1"
|
||||
url = "2.3.1"
|
||||
|
||||
# Argument parsing
|
||||
serde = "1.0.152"
|
||||
serde_derive = "1.0.152"
|
||||
serde = "1.0.160"
|
||||
serde_derive = "1.0.160"
|
||||
structopt = "0.3.26"
|
||||
structopt-toml = "0.5.1"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
async-std = "1.12.0"
|
||||
dashu = { version = "0.2.0", git = "https://github.com/ertosns/dashu" }
|
||||
dashu = { version = "0.3.1", git = "https://github.com/ertosns/dashu" }
|
||||
darkfi = {path = "../../../", features = ["blockchain"]}
|
||||
darkfi-sdk = {path = "../../../src/sdk"}
|
||||
rand = "0.8.5"
|
||||
|
||||
@@ -12,26 +12,26 @@ darkfi = {path = "../../../", features = ["raft"]}
|
||||
# Async
|
||||
smol = "1.3.0"
|
||||
async-std = {version = "1.12.0", features = ["attributes"]}
|
||||
async-trait = "0.1.64"
|
||||
async-trait = "0.1.68"
|
||||
async-channel = "1.8.0"
|
||||
async-executor = "1.5.0"
|
||||
easy-parallel = "3.2.0"
|
||||
futures = "0.3.26"
|
||||
async-executor = "1.5.1"
|
||||
easy-parallel = "3.3.0"
|
||||
futures = "0.3.28"
|
||||
|
||||
# Misc
|
||||
log = "0.4.17"
|
||||
simplelog = "0.12.0"
|
||||
simplelog = "0.12.1"
|
||||
rand = "0.8.5"
|
||||
chrono = "0.4.23"
|
||||
thiserror = "1.0.38"
|
||||
ctrlc = { version = "3.2.4", features = ["termination"] }
|
||||
chrono = "0.4.24"
|
||||
thiserror = "1.0.40"
|
||||
ctrlc = { version = "3.2.5", features = ["termination"] }
|
||||
url = "2.3.1"
|
||||
fxhash = "0.2.1"
|
||||
|
||||
# Encoding and parsing
|
||||
serde = {version = "1.0.152", features = ["derive"]}
|
||||
serde_json = "1.0.91"
|
||||
serde = {version = "1.0.160", features = ["derive"]}
|
||||
serde_json = "1.0.96"
|
||||
structopt = "0.3.26"
|
||||
hex = "0.4.3"
|
||||
bs58 = "0.4.0"
|
||||
toml = "0.7.1"
|
||||
toml = "0.7.3"
|
||||
|
||||
@@ -14,4 +14,4 @@ lazy_static = "1.4.0"
|
||||
rand = "0.8.5"
|
||||
|
||||
[patch.crates-io]
|
||||
halo2_proofs = {git="https://github.com/parazyd/halo2", branch="vk-ser"}
|
||||
halo2_proofs = {git="https://github.com/parazyd/halo2", branch="v3"}
|
||||
|
||||
@@ -8,5 +8,5 @@ edition = "2021"
|
||||
[workspace]
|
||||
|
||||
[dependencies]
|
||||
pasta_curves = "0.5.0"
|
||||
pasta_curves = "0.5.1"
|
||||
rand = "0.8.5"
|
||||
|
||||
@@ -8,4 +8,4 @@ edition = "2021"
|
||||
[workspace]
|
||||
|
||||
[dependencies]
|
||||
tfhe = {version = "0.1.7", features = ["boolean", "shortint", "x86_64"]}
|
||||
tfhe = {version = "0.2.0", features = ["boolean", "shortint", "x86_64"]}
|
||||
|
||||
@@ -12,6 +12,6 @@ sha2 = "0.10.6"
|
||||
digest = "0.10.6"
|
||||
rand = "0.8.5"
|
||||
aes-gcm-siv = "0.11.1"
|
||||
curve25519-dalek = {version = "4.0.0-rc.1", features = ["digest"]}
|
||||
ed25519-dalek = "2.0.0-pre.0"
|
||||
x25519-dalek = "2.0.0-pre.1"
|
||||
curve25519-dalek = {version = "4.0.0-rc.2", features = ["digest"]}
|
||||
ed25519-dalek = "2.0.0-rc.2"
|
||||
x25519-dalek = "2.0.0-rc.2"
|
||||
|
||||
@@ -10,11 +10,10 @@ edition = "2021"
|
||||
[dependencies]
|
||||
darkfi = {path = "../../../../", features = ["zk"]}
|
||||
darkfi-sdk = {path = "../../../../src/sdk"}
|
||||
halo2_proofs = "0.2.0"
|
||||
halo2_gadgets = "0.2.0"
|
||||
halo2_proofs = "0.3.0"
|
||||
halo2_gadgets = "0.3.0"
|
||||
rand = "0.8.5"
|
||||
hex = "0.4.3"
|
||||
|
||||
[patch.crates-io]
|
||||
halo2_proofs = {git="https://github.com/parazyd/halo2", branch="vk-ser"}
|
||||
|
||||
halo2_proofs = {git="https://github.com/parazyd/halo2", branch="v3"}
|
||||
|
||||
@@ -23,7 +23,6 @@ use halo2_gadgets::{
|
||||
utilities::lookup_range_check::LookupRangeCheckConfig,
|
||||
};
|
||||
use halo2_proofs::{
|
||||
arithmetic::FieldExt,
|
||||
circuit::{AssignedCell, Chip, Layouter, Region, SimpleFloorPlanner, Value},
|
||||
plonk::{
|
||||
Advice, Circuit, Column, ConstraintSystem, Error, Fixed, Instance as InstanceColumn,
|
||||
|
||||
@@ -243,7 +243,7 @@ impl Blockchain {
|
||||
/// as the input transactions.
|
||||
pub fn add_pending_txs(&self, txs: &[Transaction]) -> Result<Vec<blake3::Hash>> {
|
||||
// TODO: Make db writes here completely atomic
|
||||
let txs_hashes = self.pending_txs.insert(&txs)?;
|
||||
let txs_hashes = self.pending_txs.insert(txs)?;
|
||||
self.pending_txs_order.insert(&txs_hashes)?;
|
||||
|
||||
Ok(txs_hashes)
|
||||
|
||||
@@ -113,6 +113,10 @@ impl TxStore {
|
||||
pub fn len(&self) -> usize {
|
||||
self.0.len()
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.0.len() == 0
|
||||
}
|
||||
}
|
||||
|
||||
/// The `PendingTxStore` is a `sled` tree storing all the node pending
|
||||
|
||||
@@ -288,7 +288,7 @@ impl ValidatorState {
|
||||
}
|
||||
};
|
||||
if !erroneous_txs.is_empty() {
|
||||
filtered_txs.retain(|x| !erroneous_txs.contains(&x));
|
||||
filtered_txs.retain(|x| !erroneous_txs.contains(x));
|
||||
}
|
||||
|
||||
if let Err(e) = self.blockchain.add_pending_txs(&filtered_txs) {
|
||||
@@ -349,7 +349,7 @@ impl ValidatorState {
|
||||
// Verify transactions and filter erroneous ones
|
||||
let erroneous_txs = self.verify_transactions(&unproposed_txs[..], false).await?;
|
||||
if !erroneous_txs.is_empty() {
|
||||
unproposed_txs.retain(|x| !erroneous_txs.contains(&x));
|
||||
unproposed_txs.retain(|x| !erroneous_txs.contains(x));
|
||||
}
|
||||
let mut tree = BridgeTree::<MerkleNode, MERKLE_DEPTH>::new(100);
|
||||
// The following is pretty weird, so something better should be done.
|
||||
|
||||
@@ -18,7 +18,7 @@ bs58 = "0.4.0"
|
||||
# probably shouldn't be in WASM
|
||||
chacha20poly1305 = { version = "0.10.1", optional = true }
|
||||
darkfi = { path = "../../../", features = ["zk", "rpc", "blockchain"], optional = true }
|
||||
halo2_proofs = { version = "0.2.0", optional = true }
|
||||
halo2_proofs = { version = "0.3.0", optional = true }
|
||||
log = { version = "0.4.17", optional = true }
|
||||
rand = { version = "0.8.5", optional = true }
|
||||
|
||||
@@ -27,9 +27,9 @@ rand = { version = "0.8.5", optional = true }
|
||||
async-std = {version = "1.12.0", features = ["attributes"]}
|
||||
darkfi = {path = "../../../", features = ["tx", "blockchain"]}
|
||||
darkfi-money-contract = { path = "../money", features = ["client", "no-entrypoint"] }
|
||||
simplelog = "0.12.0"
|
||||
simplelog = "0.12.1"
|
||||
sled = "0.34.7"
|
||||
sqlx = {version = "0.6.2", features = ["runtime-async-std-rustls", "sqlite"]}
|
||||
sqlx = {version = "0.6.3", features = ["runtime-async-std-rustls", "sqlite"]}
|
||||
|
||||
# We need to disable random using "custom" which makes the crate a noop
|
||||
# so the wasm32-unknown-unknown target is enabled.
|
||||
|
||||
@@ -11,13 +11,13 @@ crate-type = ["cdylib", "rlib"]
|
||||
[dependencies]
|
||||
darkfi-sdk = { path = "../../sdk" }
|
||||
darkfi-serial = { path = "../../serial", features = ["derive", "crypto"] }
|
||||
thiserror = "1.0.38"
|
||||
thiserror = "1.0.40"
|
||||
|
||||
# The following dependencies are used for the client API and
|
||||
# probably shouldn't be in WASM
|
||||
chacha20poly1305 = { version = "0.10.1", optional = true }
|
||||
darkfi = { path = "../../../", features = ["zk", "rpc", "blockchain"], optional = true }
|
||||
halo2_proofs = { version = "0.2.0", optional = true }
|
||||
halo2_proofs = { version = "0.3.0", optional = true }
|
||||
log = { version = "0.4.17", optional = true }
|
||||
rand = { version = "0.8.5", optional = true }
|
||||
|
||||
@@ -26,9 +26,9 @@ rand = { version = "0.8.5", optional = true }
|
||||
async-std = {version = "1.12.0", features = ["attributes"]}
|
||||
bs58 = "0.4.0"
|
||||
darkfi = {path = "../../../", features = ["tx", "blockchain"]}
|
||||
simplelog = "0.12.0"
|
||||
simplelog = "0.12.1"
|
||||
sled = "0.34.7"
|
||||
sqlx = {version = "0.6.2", features = ["runtime-async-std-rustls", "sqlite"]}
|
||||
sqlx = {version = "0.6.3", features = ["runtime-async-std-rustls", "sqlite"]}
|
||||
|
||||
# We need to disable random using "custom" which makes the crate a noop
|
||||
# so the wasm32-unknown-unknown target is enabled.
|
||||
|
||||
@@ -27,7 +27,7 @@ use futures_rustls::{
|
||||
kx_group::X25519,
|
||||
server::{ClientCertVerified, ClientCertVerifier},
|
||||
version::TLS13,
|
||||
Certificate, ClientConfig, DistinguishedNames, ServerConfig, ServerName,
|
||||
Certificate, ClientConfig, DistinguishedName, ServerConfig, ServerName,
|
||||
},
|
||||
TlsAcceptor, TlsConnector, TlsStream,
|
||||
};
|
||||
@@ -67,8 +67,8 @@ impl ServerCertVerifier for ServerCertificateVerifier {
|
||||
|
||||
struct ClientCertificateVerifier;
|
||||
impl ClientCertVerifier for ClientCertificateVerifier {
|
||||
fn client_auth_root_subjects(&self) -> Option<DistinguishedNames> {
|
||||
Some(vec![])
|
||||
fn client_auth_root_subjects(&self) -> &[DistinguishedName] {
|
||||
&[]
|
||||
}
|
||||
|
||||
fn verify_client_cert(
|
||||
|
||||
@@ -13,7 +13,7 @@ doctest = false
|
||||
|
||||
[dependencies]
|
||||
# Error handling
|
||||
thiserror = "1.0.38"
|
||||
thiserror = "1.0.40"
|
||||
|
||||
# Serialization
|
||||
darkfi-serial = {version = "0.4.1", path = "../serial", features = ["derive", "pasta_curves"]}
|
||||
@@ -22,14 +22,14 @@ darkfi-serial = {version = "0.4.1", path = "../serial", features = ["derive", "p
|
||||
bs58 = "0.4.0"
|
||||
|
||||
# Cryptography
|
||||
blake2b_simd = "1.0.0"
|
||||
blake2b_simd = "1.0.1"
|
||||
blake3 = "1.3.3"
|
||||
chacha20poly1305 = "0.10.1"
|
||||
halo2_gadgets = "0.2.0"
|
||||
incrementalmerkletree = "0.3.0"
|
||||
halo2_gadgets = "0.3.0"
|
||||
incrementalmerkletree = "0.3.1"
|
||||
num-bigint = "0.4.3"
|
||||
num-traits = "0.2.15"
|
||||
pasta_curves = "0.4.1"
|
||||
pasta_curves = "0.5.1"
|
||||
rand_core = "0.6.4"
|
||||
sha2 = "0.10.6"
|
||||
|
||||
@@ -38,10 +38,9 @@ lazy_static = "1.4.0"
|
||||
subtle = "2.4.1"
|
||||
|
||||
[dev-dependencies]
|
||||
halo2_proofs = "0.2.0"
|
||||
halo2_proofs = "0.3.0"
|
||||
halo2_gadgets = {version = "0.2.0", features = ["test-dependencies"]}
|
||||
rand = "0.8.5"
|
||||
|
||||
[patch.crates-io]
|
||||
halo2_proofs = {git="https://github.com/parazyd/halo2", branch="vk-ser"}
|
||||
|
||||
halo2_proofs = {git="https://github.com/parazyd/halo2", branch="v3"}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use chacha20poly1305::{AeadInPlace, ChaCha20Poly1305, KeyInit};
|
||||
use darkfi_serial::{Decodable, Encodable, SerialDecodable, SerialEncodable};
|
||||
use pasta_curves::pallas;
|
||||
use pasta_curves::{group::ff::Field, pallas};
|
||||
use rand_core::{CryptoRng, RngCore};
|
||||
|
||||
use super::{diffie_hellman, poseidon_hash, util::mod_r_p, PublicKey, SecretKey};
|
||||
@@ -96,12 +96,12 @@ impl<const N: usize> ElGamalEncryptedNote<N> {
|
||||
let (ss_x, ss_y) = PublicKey::from(public.inner() * mod_r_p(ephem_secret.inner())).xy();
|
||||
let shared_secret = poseidon_hash([ss_x, ss_y]);
|
||||
|
||||
let mut blinds = [pallas::Base::zero(); N];
|
||||
for i in 0..N {
|
||||
blinds[i] = poseidon_hash([shared_secret, pallas::Base::from(i as u64 + 1)]);
|
||||
let mut blinds = [pallas::Base::ZERO; N];
|
||||
for (i, item) in blinds.iter_mut().enumerate().take(N) {
|
||||
*item = poseidon_hash([shared_secret, pallas::Base::from(i as u64 + 1)]);
|
||||
}
|
||||
|
||||
let mut encrypted_values = [pallas::Base::zero(); N];
|
||||
let mut encrypted_values = [pallas::Base::ZERO; N];
|
||||
for i in 0..N {
|
||||
encrypted_values[i] = values[i] + blinds[i];
|
||||
}
|
||||
@@ -115,12 +115,12 @@ impl<const N: usize> ElGamalEncryptedNote<N> {
|
||||
PublicKey::from(self.ephem_public.inner() * mod_r_p(secret.inner())).xy();
|
||||
let shared_secret = poseidon_hash([ss_x, ss_y]);
|
||||
|
||||
let mut blinds = [pallas::Base::zero(); N];
|
||||
for i in 0..N {
|
||||
blinds[i] = poseidon_hash([shared_secret, pallas::Base::from(i as u64 + 1)]);
|
||||
let mut blinds = [pallas::Base::ZERO; N];
|
||||
for (i, item) in blinds.iter_mut().enumerate().take(N) {
|
||||
*item = poseidon_hash([shared_secret, pallas::Base::from(i as u64 + 1)]);
|
||||
}
|
||||
|
||||
let mut decrypted_values = [pallas::Base::zero(); N];
|
||||
let mut decrypted_values = [pallas::Base::ZERO; N];
|
||||
for i in 0..N {
|
||||
decrypted_values[i] = self.encrypted_values[i] - blinds[i];
|
||||
}
|
||||
|
||||
@@ -55,25 +55,31 @@ use halo2_gadgets::poseidon::{
|
||||
primitives as poseidon,
|
||||
primitives::{ConstantLength, P128Pow5T3, Spec},
|
||||
};
|
||||
use pasta_curves::arithmetic::FieldExt;
|
||||
use pasta_curves::group::ff::{FromUniformBytes, WithSmallOrderMulGroup};
|
||||
|
||||
use crate::error::{ContractError, GenericResult};
|
||||
|
||||
pub trait FieldHasher<F: FieldExt, const L: usize> {
|
||||
pub trait FieldHasher<F: WithSmallOrderMulGroup<3> + Ord, const L: usize> {
|
||||
fn hash(&self, inputs: [F; L]) -> GenericResult<F>;
|
||||
fn hasher() -> Self;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Poseidon<F: FieldExt, const L: usize>(PhantomData<F>);
|
||||
pub struct Poseidon<F: WithSmallOrderMulGroup<3> + Ord, const L: usize>(PhantomData<F>);
|
||||
|
||||
impl<F: FieldExt, const L: usize> Poseidon<F, L> {
|
||||
impl<F: WithSmallOrderMulGroup<3> + Ord, const L: usize> Poseidon<F, L> {
|
||||
pub fn new() -> Self {
|
||||
Poseidon(PhantomData::default())
|
||||
}
|
||||
}
|
||||
|
||||
impl<F: FieldExt, const L: usize> FieldHasher<F, L> for Poseidon<F, L>
|
||||
impl<F: WithSmallOrderMulGroup<3> + Ord, const L: usize> Default for Poseidon<F, L> {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl<F: WithSmallOrderMulGroup<3> + Ord, const L: usize> FieldHasher<F, L> for Poseidon<F, L>
|
||||
where
|
||||
P128Pow5T3: Spec<F, 3, 2>,
|
||||
{
|
||||
@@ -92,14 +98,14 @@ where
|
||||
/// Each pair is used to identify whether an incremental Merkle root construction
|
||||
/// is valid at each intermediate step.
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct Path<F: FieldExt, H: FieldHasher<F, 2>, const N: usize> {
|
||||
pub struct Path<F: WithSmallOrderMulGroup<3> + Ord, H: FieldHasher<F, 2>, const N: usize> {
|
||||
/// The path represented as a sequence of sibling pairs.
|
||||
pub path: [(F, F); N],
|
||||
/// The phantom hasher type used to reconstruct the Merkle root.
|
||||
pub marker: PhantomData<H>,
|
||||
}
|
||||
|
||||
impl<F: FieldExt, H: FieldHasher<F, 2>, const N: usize> Path<F, H, N> {
|
||||
impl<F: WithSmallOrderMulGroup<3> + Ord, H: FieldHasher<F, 2>, const N: usize> Path<F, H, N> {
|
||||
/// Assumes leaf contains leaf-level data, i.e. hashes of secrets stored on
|
||||
/// leaf-level.
|
||||
pub fn calculate_root(&self, leaf: &F, hasher: &H) -> GenericResult<F> {
|
||||
@@ -109,7 +115,7 @@ impl<F: FieldExt, H: FieldHasher<F, 2>, const N: usize> Path<F, H, N> {
|
||||
|
||||
let mut prev = *leaf;
|
||||
// Check levels between leaf level and root
|
||||
for &(ref left_hash, ref right_hash) in &self.path {
|
||||
for (left_hash, right_hash) in &self.path {
|
||||
if &prev != left_hash && &prev != right_hash {
|
||||
return Err(ContractError::SmtInvalidPathNodes)
|
||||
}
|
||||
@@ -135,10 +141,10 @@ impl<F: FieldExt, H: FieldHasher<F, 2>, const N: usize> Path<F, H, N> {
|
||||
}
|
||||
|
||||
let mut prev = *leaf;
|
||||
let mut index = F::zero();
|
||||
let mut twopower = F::one();
|
||||
let mut index = F::ZERO;
|
||||
let mut twopower = F::ONE;
|
||||
// Check levels between leaf level and root
|
||||
for &(ref left_hash, ref right_hash) in &self.path {
|
||||
for (left_hash, right_hash) in &self.path {
|
||||
// Check if the previous hash is for a left or right ndoe
|
||||
if &prev != left_hash {
|
||||
index += twopower;
|
||||
@@ -156,7 +162,11 @@ impl<F: FieldExt, H: FieldHasher<F, 2>, const N: usize> Path<F, H, N> {
|
||||
///
|
||||
/// SMT stores a set of leaves represented in a map and a set of empty
|
||||
/// hashes that it uses to represent the sparse areas of the tree.
|
||||
pub struct SparseMerkleTree<F: FieldExt, H: FieldHasher<F, 2>, const N: usize> {
|
||||
pub struct SparseMerkleTree<
|
||||
F: WithSmallOrderMulGroup<3> + Ord,
|
||||
H: FieldHasher<F, 2>,
|
||||
const N: usize,
|
||||
> {
|
||||
/// A map from leaf indices to leaf data stored as field elements.
|
||||
pub tree: BTreeMap<u64, F>,
|
||||
/// An array of default hashes hashed with themselves `N` times.
|
||||
@@ -165,7 +175,12 @@ pub struct SparseMerkleTree<F: FieldExt, H: FieldHasher<F, 2>, const N: usize> {
|
||||
marker: PhantomData<H>,
|
||||
}
|
||||
|
||||
impl<F: FieldExt, H: FieldHasher<F, 2>, const N: usize> SparseMerkleTree<F, H, N> {
|
||||
impl<
|
||||
F: WithSmallOrderMulGroup<3> + Ord + FromUniformBytes<64>,
|
||||
H: FieldHasher<F, 2>,
|
||||
const N: usize,
|
||||
> SparseMerkleTree<F, H, N>
|
||||
{
|
||||
/// Creates a new SMT from a map of indices to field elements.
|
||||
pub fn new(
|
||||
leaves: &BTreeMap<u32, F>,
|
||||
@@ -243,7 +258,7 @@ impl<F: FieldExt, H: FieldHasher<F, 2>, const N: usize> SparseMerkleTree<F, H, N
|
||||
/// Give the path leading from the leaf at `index` up to the root. This is
|
||||
/// a "proof" in the sense of "valid path in a Merkle tree", not a ZK argument.
|
||||
pub fn generate_membership_proof(&self, index: u64) -> Path<F, H, N> {
|
||||
let mut path = [(F::zero(), F::zero()); N];
|
||||
let mut path = [(F::ZERO, F::ZERO); N];
|
||||
|
||||
let tree_index = convert_index_to_last_level(index, N);
|
||||
|
||||
@@ -278,13 +293,17 @@ impl<F: FieldExt, H: FieldHasher<F, 2>, const N: usize> SparseMerkleTree<F, H, N
|
||||
/// `default_leaf` hashed with itself and repeated `N` times with the
|
||||
/// intermediate results. These are used to initialize the sparse portion
|
||||
/// of the SMT.
|
||||
pub fn gen_empty_hashes<F: FieldExt, H: FieldHasher<F, 2>, const N: usize>(
|
||||
pub fn gen_empty_hashes<
|
||||
F: WithSmallOrderMulGroup<3> + Ord + FromUniformBytes<64>,
|
||||
H: FieldHasher<F, 2>,
|
||||
const N: usize,
|
||||
>(
|
||||
hasher: &H,
|
||||
default_leaf: &[u8; 64],
|
||||
) -> GenericResult<[F; N]> {
|
||||
let mut empty_hashes = [F::zero(); N];
|
||||
let mut empty_hashes = [F::ZERO; N];
|
||||
|
||||
let mut empty_hash = F::from_bytes_wide(default_leaf);
|
||||
let mut empty_hash = F::from_uniform_bytes(default_leaf);
|
||||
for item in empty_hashes.iter_mut().take(N) {
|
||||
*item = empty_hash;
|
||||
empty_hash = hasher.hash([empty_hash, empty_hash])?;
|
||||
@@ -369,7 +388,11 @@ mod tests {
|
||||
use rand::rngs::OsRng;
|
||||
|
||||
/// Helper to change leaves array to BTreeMap and then create SMT.
|
||||
fn create_merkle_tree<F: FieldExt, H: FieldHasher<F, 2>, const N: usize>(
|
||||
fn create_merkle_tree<
|
||||
F: WithSmallOrderMulGroup<3> + Ord,
|
||||
H: FieldHasher<F, 2>,
|
||||
const N: usize,
|
||||
>(
|
||||
hasher: H,
|
||||
leaves: &[F],
|
||||
default_leaf: &[u8; 64],
|
||||
|
||||
@@ -17,7 +17,10 @@
|
||||
*/
|
||||
|
||||
use halo2_gadgets::poseidon::primitives as poseidon;
|
||||
use pasta_curves::{arithmetic::FieldExt, group::ff::PrimeField, pallas};
|
||||
use pasta_curves::{
|
||||
group::ff::{FromUniformBytes, PrimeField},
|
||||
pallas,
|
||||
};
|
||||
|
||||
/// Hash `a` and `b` together with a prefix `persona` and return a `pallas::Scalar`
|
||||
/// element from the digest.
|
||||
@@ -26,7 +29,7 @@ pub fn hash_to_scalar(persona: &[u8], a: &[u8], b: &[u8]) -> pallas::Scalar {
|
||||
hasher.update(a);
|
||||
hasher.update(b);
|
||||
let ret = hasher.finalize();
|
||||
pallas::Scalar::from_bytes_wide(ret.as_array())
|
||||
pallas::Scalar::from_uniform_bytes(ret.as_array())
|
||||
}
|
||||
|
||||
/// Converts from pallas::Base to pallas::Scalar (aka $x \pmod{r_\mathbb{P}}$).
|
||||
|
||||
@@ -10,12 +10,12 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
darkfi-derive = {version = "0.4.1", path = "./derive", optional = true}
|
||||
futures-lite = {version = "1.12.0", optional = true}
|
||||
futures-lite = {version = "1.13.0", optional = true}
|
||||
|
||||
# Supported types for encoding
|
||||
blake3 = {version = "1.3.3", optional = true}
|
||||
incrementalmerkletree = {version = "0.3.0", optional = true}
|
||||
pasta_curves = {version = "0.4.1", optional = true}
|
||||
incrementalmerkletree = {version = "0.3.1", optional = true}
|
||||
pasta_curves = {version = "0.5.1", optional = true}
|
||||
url = {version = "2.3.1", optional = true}
|
||||
|
||||
[features]
|
||||
|
||||
@@ -9,6 +9,6 @@ license = "AGPL-3.0-only"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = "1.0.50"
|
||||
quote = "1.0.23"
|
||||
syn = {version = "1.0.107", features = ["full", "fold"]}
|
||||
proc-macro2 = "1.0.56"
|
||||
quote = "1.0.26"
|
||||
syn = {version = "1.0.109", features = ["full", "fold"]}
|
||||
|
||||
@@ -12,8 +12,8 @@ edition = "2021"
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
proc-macro-crate = "1.3.0"
|
||||
proc-macro2 = "1.0.50"
|
||||
syn = {version = "1.0.107", features = ["full", "fold"]}
|
||||
proc-macro-crate = "1.3.1"
|
||||
proc-macro2 = "1.0.56"
|
||||
syn = {version = "1.0.109", features = ["full", "fold"]}
|
||||
|
||||
darkfi-derive-internal = {version = "0.4.1", path = "../derive-internal"}
|
||||
|
||||
@@ -20,14 +20,6 @@ use std::{iter::FromIterator, str::FromStr};
|
||||
|
||||
use crate::{Error, Result};
|
||||
|
||||
fn is_digit(c: char) -> bool {
|
||||
('0'..='9').contains(&c)
|
||||
}
|
||||
|
||||
fn char_eq(a: char, b: char) -> bool {
|
||||
a == b
|
||||
}
|
||||
|
||||
pub fn decode_base10(amount: &str, decimal_places: usize, strict: bool) -> Result<u64> {
|
||||
let mut s: Vec<char> = amount.to_string().chars().collect();
|
||||
|
||||
@@ -41,7 +33,7 @@ pub fn decode_base10(amount: &str, decimal_places: usize, strict: bool) -> Resul
|
||||
|
||||
// Only digits should remain
|
||||
for i in &s {
|
||||
if !is_digit(*i) {
|
||||
if !i.is_ascii_digit() {
|
||||
return Err(Error::ParseFailed("Found non-digits"))
|
||||
}
|
||||
}
|
||||
@@ -57,7 +49,7 @@ pub fn decode_base10(amount: &str, decimal_places: usize, strict: bool) -> Resul
|
||||
if actual_places > decimal_places {
|
||||
let end = point + decimal_places;
|
||||
for i in &s[end..s.len()] {
|
||||
if !char_eq(*i, '0') {
|
||||
if *i != '0' {
|
||||
round = true;
|
||||
break
|
||||
}
|
||||
|
||||
@@ -17,15 +17,14 @@
|
||||
*/
|
||||
|
||||
use halo2_proofs::{
|
||||
arithmetic::FieldExt,
|
||||
circuit::{AssignedCell, Chip, Layouter},
|
||||
pasta::pallas,
|
||||
pasta::{group::ff::WithSmallOrderMulGroup, pallas},
|
||||
plonk,
|
||||
plonk::{Advice, Column, ConstraintSystem, Constraints, Selector},
|
||||
poly::Rotation,
|
||||
};
|
||||
|
||||
pub trait ArithInstruction<F: FieldExt>: Chip<F> {
|
||||
pub trait ArithInstruction<F: WithSmallOrderMulGroup<3> + Ord>: Chip<F> {
|
||||
fn add(
|
||||
&self,
|
||||
layouter: impl Layouter<F>,
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
use core::marker::PhantomData;
|
||||
|
||||
use halo2_proofs::{
|
||||
arithmetic::FieldExt,
|
||||
circuit::{AssignedCell, Chip, Layouter, Region, Value},
|
||||
pasta::group::ff::WithSmallOrderMulGroup,
|
||||
plonk::{Advice, Column, ConstraintSystem, Error, Expression, Selector},
|
||||
poly::Rotation,
|
||||
};
|
||||
@@ -31,18 +31,18 @@ use halo2_proofs::{
|
||||
pub const NUM_OF_UTILITY_ADVICE_COLUMNS: usize = 4;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ConditionalSelectConfig<F: FieldExt> {
|
||||
pub struct ConditionalSelectConfig<F: WithSmallOrderMulGroup<3> + Ord> {
|
||||
advices: [Column<Advice>; NUM_OF_UTILITY_ADVICE_COLUMNS],
|
||||
s_cs: Selector,
|
||||
_marker: PhantomData<F>,
|
||||
}
|
||||
|
||||
pub struct ConditionalSelectChip<F: FieldExt> {
|
||||
pub struct ConditionalSelectChip<F: WithSmallOrderMulGroup<3> + Ord> {
|
||||
config: ConditionalSelectConfig<F>,
|
||||
_marker: PhantomData<F>,
|
||||
}
|
||||
|
||||
impl<F: FieldExt> Chip<F> for ConditionalSelectChip<F> {
|
||||
impl<F: WithSmallOrderMulGroup<3> + Ord> Chip<F> for ConditionalSelectChip<F> {
|
||||
type Config = ConditionalSelectConfig<F>;
|
||||
type Loaded = ();
|
||||
|
||||
@@ -55,7 +55,7 @@ impl<F: FieldExt> Chip<F> for ConditionalSelectChip<F> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<F: FieldExt> ConditionalSelectChip<F> {
|
||||
impl<F: WithSmallOrderMulGroup<3> + Ord> ConditionalSelectChip<F> {
|
||||
pub fn construct(
|
||||
config: <Self as Chip<F>>::Config,
|
||||
_loaded: <Self as Chip<F>>::Loaded,
|
||||
@@ -78,7 +78,7 @@ impl<F: FieldExt> ConditionalSelectChip<F> {
|
||||
let out = meta.query_advice(advices[2], Rotation::cur());
|
||||
let cond = meta.query_advice(advices[3], Rotation::cur());
|
||||
let s_cs = meta.query_selector(s_cs);
|
||||
let one = Expression::Constant(F::one());
|
||||
let one = Expression::Constant(F::ONE);
|
||||
|
||||
vec![
|
||||
// cond is 0 or 1
|
||||
@@ -110,7 +110,7 @@ impl<F: FieldExt> ConditionalSelectChip<F> {
|
||||
let cond = cond.copy_advice(|| "copy cond", &mut region, config.advices[3], 0)?;
|
||||
|
||||
let selected =
|
||||
if cond.value().copied().to_field() == Value::known(F::one()).to_field() {
|
||||
if cond.value().copied().to_field() == Value::known(F::ONE).to_field() {
|
||||
a.value().copied()
|
||||
} else {
|
||||
b.value().copied()
|
||||
@@ -126,18 +126,18 @@ impl<F: FieldExt> ConditionalSelectChip<F> {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct IsEqualConfig<F: FieldExt> {
|
||||
pub struct IsEqualConfig<F: WithSmallOrderMulGroup<3> + Ord> {
|
||||
s_is_eq: Selector,
|
||||
advices: [Column<Advice>; NUM_OF_UTILITY_ADVICE_COLUMNS],
|
||||
_marker: PhantomData<F>,
|
||||
}
|
||||
|
||||
pub struct IsEqualChip<F: FieldExt> {
|
||||
pub struct IsEqualChip<F: WithSmallOrderMulGroup<3> + Ord> {
|
||||
config: IsEqualConfig<F>,
|
||||
_marker: PhantomData<F>,
|
||||
}
|
||||
|
||||
impl<F: FieldExt> Chip<F> for IsEqualChip<F> {
|
||||
impl<F: WithSmallOrderMulGroup<3> + Ord> Chip<F> for IsEqualChip<F> {
|
||||
type Config = IsEqualConfig<F>;
|
||||
type Loaded = ();
|
||||
|
||||
@@ -150,7 +150,7 @@ impl<F: FieldExt> Chip<F> for IsEqualChip<F> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<F: FieldExt> IsEqualChip<F> {
|
||||
impl<F: WithSmallOrderMulGroup<3> + Ord> IsEqualChip<F> {
|
||||
pub fn construct(
|
||||
config: <Self as Chip<F>>::Config,
|
||||
_loaded: <Self as Chip<F>>::Loaded,
|
||||
@@ -169,7 +169,7 @@ impl<F: FieldExt> IsEqualChip<F> {
|
||||
let out = meta.query_advice(advices[2], Rotation::cur());
|
||||
let delta_invert = meta.query_advice(advices[3], Rotation::cur());
|
||||
let s_is_eq = meta.query_selector(s_is_eq);
|
||||
let one = Expression::Constant(F::one());
|
||||
let one = Expression::Constant(F::ONE);
|
||||
|
||||
vec![
|
||||
// out is 0 or 1
|
||||
@@ -211,7 +211,7 @@ impl<F: FieldExt> IsEqualChip<F> {
|
||||
0,
|
||||
|| {
|
||||
if a_field == b_field {
|
||||
Value::known(F::one())
|
||||
Value::known(F::ONE)
|
||||
} else {
|
||||
let delta = a_field - b_field;
|
||||
delta.invert().evaluate()
|
||||
@@ -219,11 +219,8 @@ impl<F: FieldExt> IsEqualChip<F> {
|
||||
},
|
||||
)?;
|
||||
|
||||
let is_eq = if a_field == b_field {
|
||||
Value::known(F::one())
|
||||
} else {
|
||||
Value::known(F::zero())
|
||||
};
|
||||
let is_eq =
|
||||
if a_field == b_field { Value::known(F::ONE) } else { Value::known(F::ZERO) };
|
||||
|
||||
let cell = region.assign_advice(|| "is_eq", config.advices[2], 0, || is_eq)?;
|
||||
Ok(cell)
|
||||
@@ -235,18 +232,18 @@ impl<F: FieldExt> IsEqualChip<F> {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct AssertEqualConfig<F: FieldExt> {
|
||||
pub struct AssertEqualConfig<F: WithSmallOrderMulGroup<3> + Ord> {
|
||||
s_eq: Selector,
|
||||
advices: [Column<Advice>; 2],
|
||||
_marker: PhantomData<F>,
|
||||
}
|
||||
|
||||
pub struct AssertEqualChip<F: FieldExt> {
|
||||
pub struct AssertEqualChip<F: WithSmallOrderMulGroup<3> + Ord> {
|
||||
config: AssertEqualConfig<F>,
|
||||
_marker: PhantomData<F>,
|
||||
}
|
||||
|
||||
impl<F: FieldExt> Chip<F> for AssertEqualChip<F> {
|
||||
impl<F: WithSmallOrderMulGroup<3> + Ord> Chip<F> for AssertEqualChip<F> {
|
||||
type Config = AssertEqualConfig<F>;
|
||||
type Loaded = ();
|
||||
|
||||
@@ -259,7 +256,7 @@ impl<F: FieldExt> Chip<F> for AssertEqualChip<F> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<F: FieldExt> AssertEqualChip<F> {
|
||||
impl<F: WithSmallOrderMulGroup<3> + Ord> AssertEqualChip<F> {
|
||||
pub fn construct(
|
||||
config: <Self as Chip<F>>::Config,
|
||||
_loaded: <Self as Chip<F>>::Loaded,
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
use halo2_proofs::{
|
||||
arithmetic::FieldExt,
|
||||
circuit::{Region, Value},
|
||||
pasta::group::ff::WithSmallOrderMulGroup,
|
||||
plonk::{Advice, Column, ConstraintSystem, Error, Expression, VirtualCells},
|
||||
poly::Rotation,
|
||||
};
|
||||
@@ -29,17 +29,17 @@ pub struct IsZeroConfig<F> {
|
||||
pub is_zero_expr: Expression<F>,
|
||||
}
|
||||
|
||||
impl<F: FieldExt> IsZeroConfig<F> {
|
||||
impl<F: WithSmallOrderMulGroup<3> + Ord> IsZeroConfig<F> {
|
||||
pub fn expr(&self) -> Expression<F> {
|
||||
self.is_zero_expr.clone()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct IsZeroChip<F: FieldExt> {
|
||||
pub struct IsZeroChip<F: WithSmallOrderMulGroup<3> + Ord> {
|
||||
config: IsZeroConfig<F>,
|
||||
}
|
||||
|
||||
impl<F: FieldExt> IsZeroChip<F> {
|
||||
impl<F: WithSmallOrderMulGroup<3> + Ord> IsZeroChip<F> {
|
||||
pub fn construct(config: IsZeroConfig<F>) -> Self {
|
||||
Self { config }
|
||||
}
|
||||
@@ -50,7 +50,7 @@ impl<F: FieldExt> IsZeroChip<F> {
|
||||
value: impl FnOnce(&mut VirtualCells<'_, F>) -> Expression<F>,
|
||||
value_inv: Column<Advice>,
|
||||
) -> IsZeroConfig<F> {
|
||||
let mut is_zero_expr = Expression::Constant(F::zero());
|
||||
let mut is_zero_expr = Expression::Constant(F::ZERO);
|
||||
|
||||
meta.create_gate("is_zero", |meta| {
|
||||
//
|
||||
@@ -65,7 +65,7 @@ impl<F: FieldExt> IsZeroChip<F> {
|
||||
let q_enable = q_enable(meta);
|
||||
let value_inv = meta.query_advice(value_inv, Rotation::cur());
|
||||
|
||||
is_zero_expr = Expression::Constant(F::one()) - value.clone() * value_inv;
|
||||
is_zero_expr = Expression::Constant(F::ONE) - value.clone() * value_inv;
|
||||
vec![q_enable * value * is_zero_expr.clone()]
|
||||
});
|
||||
|
||||
@@ -78,7 +78,7 @@ impl<F: FieldExt> IsZeroChip<F> {
|
||||
offset: usize,
|
||||
value: Value<F>,
|
||||
) -> Result<(), Error> {
|
||||
let value_inv = value.map(|value| value.invert().unwrap_or(F::zero()));
|
||||
let value_inv = value.map(|value| value.invert().unwrap_or(F::ZERO));
|
||||
region.assign_advice(|| "value inv", self.config.value_inv, offset, || value_inv)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
use halo2_proofs::{
|
||||
arithmetic::FieldExt,
|
||||
arithmetic::Field,
|
||||
circuit::{AssignedCell, Chip, Layouter, Region, Value},
|
||||
pasta::pallas,
|
||||
plonk::{Advice, Column, ConstraintSystem, Error, Expression, Selector, TableColumn},
|
||||
@@ -120,7 +120,7 @@ impl<const WINDOW_SIZE: usize, const NUM_OF_BITS: usize, const NUM_OF_WINDOWS: u
|
||||
let b = meta.query_advice(config.b, Rotation::cur());
|
||||
let a_offset = meta.query_advice(config.a_offset, Rotation::cur());
|
||||
let two_pow_m =
|
||||
Expression::Constant(pallas::Base::from(2).pow(&[NUM_OF_BITS as u64, 0, 0, 0]));
|
||||
Expression::Constant(pallas::Base::from(2).pow([NUM_OF_BITS as u64, 0, 0, 0]));
|
||||
// a_offset - 2^m + b - a = 0
|
||||
vec![s_lt * (a_offset - two_pow_m + b - a)]
|
||||
});
|
||||
@@ -237,7 +237,7 @@ impl<const WINDOW_SIZE: usize, const NUM_OF_BITS: usize, const NUM_OF_WINDOWS: u
|
||||
self.config.s_lt.enable(&mut region, offset)?;
|
||||
|
||||
// assign `a + offset`
|
||||
let two_pow_m = pallas::Base::from(2).pow(&[NUM_OF_BITS as u64, 0, 0, 0]);
|
||||
let two_pow_m = pallas::Base::from(2).pow([NUM_OF_BITS as u64, 0, 0, 0]);
|
||||
let a_offset = a.value().zip(b.value()).map(|(a, b)| *a + (two_pow_m - b));
|
||||
let a_offset =
|
||||
region.assign_advice(|| "a_offset", self.config.a_offset, offset, || a_offset)?;
|
||||
|
||||
@@ -17,9 +17,8 @@
|
||||
*/
|
||||
|
||||
use halo2_proofs::{
|
||||
arithmetic::FieldExt,
|
||||
circuit::{AssignedCell, Chip, Layouter},
|
||||
pasta::pallas,
|
||||
pasta::{group::ff::WithSmallOrderMulGroup, pallas},
|
||||
plonk,
|
||||
plonk::{Advice, Column, ConstraintSystem, Constraints, Expression, Selector},
|
||||
poly::Rotation,
|
||||
@@ -27,7 +26,10 @@ use halo2_proofs::{
|
||||
|
||||
/// Checks that an expression is in the small range [0..range),
|
||||
/// i.e. 0 ≤ word < range.
|
||||
pub fn range_check<F: FieldExt>(word: Expression<F>, range: u8) -> Expression<F> {
|
||||
pub fn range_check<F: WithSmallOrderMulGroup<3> + Ord>(
|
||||
word: Expression<F>,
|
||||
range: u8,
|
||||
) -> Expression<F> {
|
||||
(1..(range as usize))
|
||||
.fold(word.clone(), |acc, i| acc * (Expression::Constant(F::from(i as u64)) - word.clone()))
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@ use super::error::ErrorEmitter;
|
||||
const SPECIAL_CHARS: [char; 7] = ['{', '}', '(', ')', ',', ';', '='];
|
||||
|
||||
fn is_letter(ch: char) -> bool {
|
||||
('a'..='z').contains(&ch) || ('A'..='Z').contains(&ch) || ch == '_'
|
||||
ch.is_ascii_lowercase() || ch.is_ascii_uppercase() || ch == '_'
|
||||
}
|
||||
|
||||
fn is_digit(ch: char) -> bool {
|
||||
('0'..='9').contains(&ch)
|
||||
ch.is_ascii_digit()
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
|
||||
Reference in New Issue
Block a user