Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
fix dependencies issues with patch.crates-io
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenfeizhang committed Oct 19, 2021
1 parent fbb6e6e commit f57672f
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 30 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Pending

- [\#66](https://github.com/arkworks-rs/curves/pull/66) Enabling GLV multiplication for bandersnatch curve.

### Breaking changes

### Features
Expand Down
22 changes: 14 additions & 8 deletions curve-constraint-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,22 @@ edition = "2018"

[dependencies]
ark-std = { version = "^0.3.0", default-features = false }
# ark-ff = { version = "^0.3.0", default-features = false }
# ark-ec = { version = "^0.3.0", default-features = false }
# ark-serialize = { version = "^0.3.0", default-features = false }
# ark-relations = { version = "^0.3.0", default-features = false }
ark-ff = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-ec = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-serialize = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-relations = { git = "https://github.com/arkworks-rs/snark", default-features = false }
ark-ff = { version = "^0.3.0", default-features = false }
ark-ec = { version = "^0.3.0", default-features = false }
ark-serialize = { version = "^0.3.0", default-features = false }
ark-relations = { version = "^0.3.0", default-features = false }
ark-r1cs-std = { version = "^0.3.0", default-features = false }

[features]
default = []
std = [ "ark-std/std", "ark-ff/std", "ark-serialize/std", "ark-ec/std", "ark-relations/std", "ark-r1cs-std/std" ]


# To be removed in the new release.
[patch.crates-io]
ark-ff = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-ec = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-std = { git = "https://github.com/arkworks-rs/std", default-features = false }
ark-r1cs-std = { git = "https://github.com/arkworks-rs/r1cs-std", default-features = false, optional = true }
ark-relations = { git = "https://github.com/arkworks-rs/snark", default-features = false }
ark-serialize = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
30 changes: 18 additions & 12 deletions ed_on_bls12_381_bandersnatch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,17 @@ license = "MIT/Apache-2.0"
edition = "2018"

[dependencies]
# ark-ff = { version = "^0.3.0", default-features = false }
# ark-ec = { version = "^0.3.0", default-features = false }
ark-ff = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-ec = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-ff = { version = "^0.3.0", default-features = false }
ark-ec = { version = "^0.3.0", default-features = false }
ark-std = { version = "^0.3.0", default-features = false }
ark-r1cs-std = { version = "^0.3.0", default-features = false, optional = true }
# ark-bls12-381 = { version = "^0.3.0", default-features = false, features = [ "scalar_field" ] }
ark-bls12-381 = { path = "../bls12_381", default-features = false, features = [ "scalar_field" ] }
ark-bls12-381 = { version = "^0.3.0", default-features = false, features = [ "scalar_field" ] }
num-bigint = { version = "0.4.0", default-features = false }

[dev-dependencies]
# ark-relations = { version = "^0.3.0", default-features = false }
# ark-serialize = { version = "^0.3.0", default-features = false }
ark-algebra-test-templates = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-relations = { git = "https://github.com/arkworks-rs/snark", default-features = false }
ark-serialize = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-relations = { version = "^0.3.0", default-features = false }
ark-serialize = { version = "^0.3.0", default-features = false }
ark-algebra-test-templates = { version = "^0.3.0", default-features = false }
ark-curve-constraint-tests = { path = "../curve-constraint-tests", default-features = false }

[features]
Expand All @@ -37,4 +32,15 @@ std = [
"ark-ec/std",
"ark-bls12-381/std"
]
r1cs = ["ark-r1cs-std"]
r1cs = ["ark-r1cs-std"]

# To be removed in the new release.
[patch.crates-io]
ark-ff = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-ec = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-std = { git = "https://github.com/arkworks-rs/std", default-features = false }
ark-r1cs-std = { git = "https://github.com/arkworks-rs/r1cs-std", default-features = false, optional = true }
ark-algebra-test-templates = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-relations = { git = "https://github.com/arkworks-rs/snark", default-features = false }
ark-serialize = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-bls12-381 = { path = "../bls12_381", default-features = false, features = [ "scalar_field" ] }
4 changes: 2 additions & 2 deletions ed_on_bls12_381_bandersnatch/src/curves/glv.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::{EdwardsParameters, Fq, Fr, FrParameters};
use crate::{BandersnatchParameters, Fq, Fr, FrParameters};
use ark_ec::{glv::GLVParameters, AffineCurve, ProjectiveCurve};
use ark_ff::{field_new, BigInteger, BigInteger256, FpParameters, One};
use ark_std::{cmp::max, Zero};
use num_bigint::BigUint;

impl GLVParameters for EdwardsParameters {
impl GLVParameters for BandersnatchParameters {
type CurveAffine = crate::EdwardsAffine;
type CurveProjective = crate::EdwardsProjective;

Expand Down
30 changes: 22 additions & 8 deletions ed_on_bls12_381_bandersnatch/src/curves/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,18 @@ fn test_montgomery_conversion() {

#[test]
fn test_psi() {
let base_point = EdwardsAffine::prime_subgroup_generator();
let base_point = EdwardsAffine::from_str(
"(29627151942733444043031429156003786749302466371339015363120350521834195802525, \
27488387519748396681411951718153463804682561779047093991696427532072116857978)",
)
.unwrap();
let psi_point = EdwardsAffine::from_str(
"(3995099504672814451457646880854530097687530507181962222512229786736061793535, \
33370049900732270411777328808452912493896532385897059012214433666611661340894)",
)
.unwrap();

let t = EdwardsParameters::endomorphism(&base_point);
let t = BandersnatchParameters::endomorphism(&base_point);
assert_eq!(t, psi_point);
}

Expand All @@ -145,18 +149,25 @@ fn test_decomp() {
);
let k1: Fr = field_new!(Fr, "30417741863887432744214758610616508258");
let k2: Fr = field_new!(Fr, "-6406990765953933188067911864924578940");
assert_eq!(EdwardsParameters::scalar_decomposition(&scalar), (k1, k2))
assert_eq!(
BandersnatchParameters::scalar_decomposition(&scalar),
(k1, k2)
)
}

#[test]
fn test_msm() {
let base_point = EdwardsAffine::prime_subgroup_generator();
let base_point = EdwardsAffine::from_str(
"(29627151942733444043031429156003786749302466371339015363120350521834195802525, \
27488387519748396681411951718153463804682561779047093991696427532072116857978)",
)
.unwrap();
let psi_point = EdwardsAffine::from_str(
"(3995099504672814451457646880854530097687530507181962222512229786736061793535, \
33370049900732270411777328808452912493896532385897059012214433666611661340894)",
)
.unwrap();
let t = EdwardsParameters::endomorphism(&base_point);
let t = BandersnatchParameters::endomorphism(&base_point);
assert_eq!(t, psi_point);

let scalar: Fr = field_new!(
Expand All @@ -165,7 +176,10 @@ fn test_msm() {
);
let k1: Fr = field_new!(Fr, "30417741863887432744214758610616508258");
let k2: Fr = field_new!(Fr, "-6406990765953933188067911864924578940");
assert_eq!(EdwardsParameters::scalar_decomposition(&scalar), (k1, k2));
assert_eq!(
BandersnatchParameters::scalar_decomposition(&scalar),
(k1, k2)
);

let res = EdwardsAffine::from_str(
"(6018810645516749504657411940673266094850700554607419759628157493373766067122, \
Expand All @@ -189,7 +203,7 @@ fn test_gen_mul() {
);

let b = a.mul(r);
let c = EdwardsParameters::glv_mul(&a, &r);
let c = BandersnatchParameters::glv_mul(&a, &r);

assert_eq!(b.into_affine(), c.into_affine())
}
Expand All @@ -204,7 +218,7 @@ fn test_rnd_mul() {
let r: Fr = rng.gen();

let b = a.mul(r);
let c = EdwardsParameters::glv_mul(&a, &r);
let c = BandersnatchParameters::glv_mul(&a, &r);

assert_eq!(b.into_affine(), c.into_affine())
}
Expand Down

0 comments on commit f57672f

Please sign in to comment.