Skip to content

Commit

Permalink
Move common deps into workspace
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Varlakov <[email protected]>
  • Loading branch information
survived committed Aug 22, 2024
1 parent 470fb60 commit 1106143
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 54 deletions.
37 changes: 37 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,40 @@ exclude = [
"wasm/nostd",
]

[workspace.dependencies]
generic-array = "0.14"

hex = { version = "0.4", default-features = false }

rand = "0.8"
rand_core = { version = "0.6", default-features = false }

serde = { version = "1", default-features = false }
serde_json = "1"
serde_with = { version = "2", default-features = false }

sha2 = { version = "0.10", default-features = false }

subtle = { version = "2.4", default-features = false }

udigest = { version = "0.2.0", default-features = false }

zeroize = { version = "1", default-features = false }

criterion = "0.5"
generic-tests = "0.1"
serde_test = "1"
rand_dev = "0.1"

[workspace.dependencies.curve25519]
package = "curve25519-dalek"
version = "4"
default-features = false

[patch.crates-io.udigest]
git = "https://github.com/dfns/udigest"
branch = "udigest_as"

[patch.crates-io.udigest-derive]
git = "https://github.com/dfns/udigest"
branch = "udigest_as"
10 changes: 5 additions & 5 deletions generic-ec-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ description = "Core traits of `generic-ec` crate"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
generic-array = "0.14"
subtle = { version = "2.4", default-features = false }
rand_core = { version = "0.6", default-features = false }
zeroize = { version = "1", default-features = false }
serde = { version = "1", default-features = false, features = ["derive"], optional = true }
generic-array.workspace = true
subtle.workspace = true
rand_core.workspace = true
zeroize.workspace = true
serde = { workspace = true, features = ["derive"], optional = true }

[features]
default = []
Expand Down
18 changes: 8 additions & 10 deletions generic-ec-curves/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,28 @@ repository = "https://github.com/dfns/generic-ec"
[dependencies]
generic-ec-core = { version = "0.2", path = "../generic-ec-core", default-features = false }

subtle = { version = "2.4", default-features = false }
rand_core = { version = "0.6", default-features = false }
zeroize = { version = "1", default-features = false, features = ["zeroize_derive"] }
subtle.workspace = true
rand_core.workspace = true
zeroize = { workspace = true, features = ["zeroize_derive"] }

elliptic-curve = { version = "0.13", default-features = false, features = ["sec1", "hash2curve"], optional = true }
k256 = { version = "0.13", optional = true, default-features = false, features = ["hash2curve"] }
p256 = { version = "0.13", optional = true, default-features = false, features = ["hash2curve"] }
sha2 = { version = "0.10", default-features = false, optional = true }
sha2 = { workspace = true, optional = true }
stark-curve = { version = "0.1", default-features = false, optional = true }

group = { version = "0.13", default-features = false, optional = true }

[dependencies.curve25519]
package = "curve25519-dalek"
version = "4"
default-features = false
workspace = true
features = ["group", "zeroize", "rand_core", "precomputed-tables"]
optional = true

[dev-dependencies]
rand = "0.8"
rand_dev = "0.1"
rand.workspace = true
rand_dev.workspace = true

criterion = { version = "0.5", features = ["html_reports"] }
criterion = { workspace = true, features = ["html_reports"] }

[features]
default = []
Expand Down
20 changes: 10 additions & 10 deletions generic-ec-zkp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ keywords = ["elliptic-curves", "zk-proof"]

[dependencies]
generic-ec = { version = "0.4.0", path = "../generic-ec", default-features = false }
udigest = { version = "0.2.0", features = ["derive"], optional = true }
udigest = { workspace = true, features = ["derive"], optional = true }

subtle = { version = "2.4", default-features = false }
rand_core = { version = "0.6", default-features = false }
subtle.workspace = true
rand_core.workspace = true

serde = { version = "1", default-features = false, features = ["derive"], optional = true }
serde = { workspace = true, features = ["derive"], optional = true }

# We don't depend on this crates directly, but need to specify features to make it compile
generic-array = "0.14"
generic-array.workspace = true

[dev-dependencies]
rand = "0.8"
rand_dev = "0.1"
sha2 = "0.10"
rand.workspace = true
rand_dev.workspace = true
sha2.workspace = true

generic-tests = "0.1"
generic-tests.workspace = true

criterion = { version = "0.5", features = ["html_reports"] }
criterion = { workspace = true, features = ["html_reports"] }

generic-ec = { version = "0.4.0", path = "../generic-ec", default-features = false, features = ["all-curves"] }

Expand Down
34 changes: 17 additions & 17 deletions generic-ec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,46 @@ keywords = ["elliptic-curves"]
[dependencies]
generic-ec-core = { version = "0.2", path = "../generic-ec-core" }
generic-ec-curves = { version = "0.2", path = "../generic-ec-curves", optional = true }
udigest = { version = "0.2.0", features = ["derive"], optional = true }
udigest = { workspace = true, features = ["derive"], optional = true }

subtle = { version = "2.4", default-features = false }
rand_core = { version = "0.6", default-features = false }
zeroize = { version = "1", default-features = false, features = ["zeroize_derive"] }
subtle.workspace = true
rand_core.workspace = true
zeroize = { workspace = true, features = ["zeroize_derive"] }

serde = { version = "1", features = ["derive"], default-features = false, optional = true }
serde_with = { version = "2", features = ["macros"], default-features = false, optional = true }
hex = { version = "0.4", default-features = false, optional = true }
serde = { workspace = true, features = ["derive"], optional = true }
serde_with = { workspace = true, features = ["macros"], optional = true }
hex = { workspace = true, optional = true }

phantom-type = { version = "0.4", default-features = false }

digest = { version = "0.10", default-features = false, optional = true }
rand_hash = { version = "0.1.0", optional = true }
rand_hash = { version = "0.1", optional = true }

# We use this dependency when both `curve-ed25519` and `alloc` features are enabled,
# to provide `generic_ec::multiscalar::Dalek`
curve25519-dalek = { version = "4", default-features = false, optional = true }
curve25519 = { workspace = true, optional = true }

[dev-dependencies]
rand = "0.8"
rand_dev = "0.1"
sha2 = "0.10"
serde_json = "1"
serde_test = "1"
rand.workspace = true
rand_dev.workspace = true
sha2.workspace = true
serde_json.workspace = true
serde_test.workspace = true

generic-tests = "0.1"
generic-tests.workspace = true

[features]
default = ["std", "serde"]
std = ["alloc"]
alloc = ["hex/alloc", "curve25519-dalek?/alloc"]
alloc = ["hex/alloc", "curve25519?/alloc"]
serde = ["dep:serde", "generic-ec-core/serde", "hex", "serde_with"]
udigest = ["dep:udigest"]

curves = ["generic-ec-curves"]
curve-secp256k1 = ["curves", "generic-ec-curves/secp256k1"]
curve-secp256r1 = ["curves", "generic-ec-curves/secp256r1"]
curve-stark = ["curves", "generic-ec-curves/stark"]
curve-ed25519 = ["curves", "generic-ec-curves/ed25519", "curve25519-dalek"]
curve-ed25519 = ["curves", "generic-ec-curves/ed25519", "curve25519"]
all-curves = ["curve-secp256k1", "curve-secp256r1", "curve-stark", "curve-ed25519"]

hash-to-scalar = ["dep:rand_hash", "dep:digest", "udigest"]
Expand Down
4 changes: 2 additions & 2 deletions generic-ec/src/multiscalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl MultiscalarMul<crate::curves::Ed25519> for Dalek {
{
use alloc::vec::Vec;

use curve25519_dalek::traits::VartimeMultiscalarMul;
use curve25519::traits::VartimeMultiscalarMul;
use generic_ec_core::{OnCurve, SmallFactor};

use crate::as_raw::AsRaw;
Expand All @@ -140,7 +140,7 @@ impl MultiscalarMul<crate::curves::Ed25519> for Dalek {
let scalars = scalar_points.iter().map(|(s, _)| &s.as_ref().as_raw().0);
let points = scalar_points.iter().map(|(_, p)| &p.as_ref().as_raw().0);

let result = curve25519_dalek::EdwardsPoint::vartime_multiscalar_mul(scalars, points);
let result = curve25519::EdwardsPoint::vartime_multiscalar_mul(scalars, points);
let result = generic_ec_curves::ed25519::Point(result);

// Resulting point must be valid
Expand Down
18 changes: 9 additions & 9 deletions tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ anyhow = "1"
regex = "1.10"
tabled = { version = "0.15", default-features = false, features = ["std"] }

serde = { version = "1", features = ["derive"] }
serde_with = "2"
serde_test = "1"
serde_json = "1"
hex = "0.4"
serde = { workspace = true, features = ["derive"] }
serde_with.workspace = true
serde_test.workspace = true
serde_json.workspace = true
hex.workspace = true

[dev-dependencies]
generic-tests = "0.1"
rand_dev = "0.1"
rand = "0.8"
generic-tests.workspace = true
rand_dev.workspace = true
rand.workspace = true

criterion = { version = "0.5", features = ["html_reports"] }
criterion = { workspace = true, features = ["html_reports"] }

[features]
default = ["generic-ec/std"]
Expand Down
2 changes: 1 addition & 1 deletion wasm/wasm-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ crate-type = ["cdylib", "rlib"]

[dependencies]
generic-ec = { path = "../../generic-ec", features = ["all-curves"] }
rand_core = { version = "0.6", features = ["getrandom"] }
rand_core = { workspace = true, features = ["getrandom"] }
wasm-bindgen = "0.2.84"
getrandom = { version = "0.2", features = ["js"] }

Expand Down

0 comments on commit 1106143

Please sign in to comment.