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

Achimcc/arkworks integration remove affine hostcalls #13971

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions primitives/arkworks/src/bls12_377.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,3 @@ pub fn mul_projective_g1(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()>
pub fn mul_projective_g2(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
mul_projective_generic::<g2::Config>(base, scalar)
}

/// Compute a affine scalar multiplication for short_weierstrass through arkworks on G1
pub fn mul_affine_g1(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
mul_affine_generic::<g1::Config>(base, scalar)
}

/// Compute a affine scalar multiplication for short_weierstrass through arkworks on G2
pub fn mul_affine_g2(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
mul_affine_generic::<g2::Config>(base, scalar)
}
10 changes: 0 additions & 10 deletions primitives/arkworks/src/bls12_381.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,3 @@ pub fn mul_projective_g1(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()>
pub fn mul_projective_g2(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
mul_projective_generic::<g2::Config>(base, scalar)
}

/// Compute a affine scalar multiplication for short_weierstrass through arkworks on G1
pub fn mul_affine_g1(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
mul_affine_generic::<g1::Config>(base, scalar)
}

/// Compute a affine scalar multiplication for short_weierstrass through arkworks on G2
pub fn mul_affine_g2(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
mul_affine_generic::<g2::Config>(base, scalar)
}
10 changes: 0 additions & 10 deletions primitives/arkworks/src/bw6_761.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,3 @@ pub fn mul_projective_g1(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()>
pub fn mul_projective_g2(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
mul_projective_generic::<g2::Config>(base, scalar)
}

/// Compute a affine scalar multiplication for short_weierstrass through arkworks on G1
pub fn mul_affine_g1(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
mul_affine_generic::<g1::Config>(base, scalar)
}

/// Compute a affine scalar multiplication for short_weierstrass through arkworks on G2
pub fn mul_affine_g2(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
mul_affine_generic::<g2::Config>(base, scalar)
}
5 changes: 0 additions & 5 deletions primitives/arkworks/src/ed_on_bls12_377.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ pub fn mul_projective(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
mul_projective_te_generic::<EdwardsConfig>(base, scalar)
}

/// Compute a scalar multiplication for twisted_edwards through arkworks
pub fn mul_affine(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
mul_affine_te_generic::<EdwardsConfig>(base, scalar)
}

/// Compute a multi scalar mulitplication for twisted_edwards through arkworks
pub fn msm(bases: Vec<u8>, scalars: Vec<u8>) -> Result<Vec<u8>, ()> {
msm_te_generic::<EdwardsConfig>(bases, scalars)
Expand Down
10 changes: 0 additions & 10 deletions primitives/arkworks/src/ed_on_bls12_381.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,11 @@ pub fn sw_mul_projective(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()>
mul_projective_generic::<JubjubConfig>(base, scalar)
}

/// Compute a affine scalar multiplication for short_weierstrass through arkworks
pub fn sw_mul_affine(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
mul_affine_generic::<JubjubConfig>(base, scalar)
}

/// Compute a projective scalar multiplication for twisted_edwards through arkworks
pub fn te_mul_projective(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
mul_projective_te_generic::<JubjubConfig>(base, scalar)
}

/// Compute a scalar multiplication for twisted_edwards through arkworks
pub fn te_mul_affine(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
mul_affine_te_generic::<JubjubConfig>(base, scalar)
}

/// Compute a multi scalar mulitplication for twisted_edwards through arkworks
pub fn te_msm(bases: Vec<u8>, scalars: Vec<u8>) -> Result<Vec<u8>, ()> {
msm_te_generic::<JubjubConfig>(bases, scalars)
Expand Down
10 changes: 5 additions & 5 deletions primitives/arkworks/test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ sp-io = { version = "7.0.0", path = "../../io", default-features = false }
sp-arkworks = { path = "../" }
ark-ec = { version = "0.4.0", default-features = false }
ark-algebra-test-templates = { version = "0.4.0", default-features = false }
sp-ark-bls12-377 = { version = "0.4.0", git = "https://github.com/paritytech/ark-substrate", default-features = false }
sp-ark-bls12-381 = { version = "0.4.0", git = "https://github.com/paritytech/ark-substrate", defult-features = false }
sp-ark-bw6-761 = { version = "0.4.0",git = "https://github.com/paritytech/ark-substrate", default-features = false }
sp-ark-ed-on-bls12-377 = { version = "0.4.0", git = "https://github.com/paritytech/ark-substrate", default-features = false }
sp-ark-ed-on-bls12-381 = { version = "0.4.0", git = "https://github.com/paritytech/ark-substrate", default-features = false }
sp-ark-bls12-377 = { version = "0.4.0", git = "https://github.com/paritytech/ark-substrate", branch= "remove-affine-host-calls", default-features = false }
sp-ark-bls12-381 = { version = "0.4.0", git = "https://github.com/paritytech/ark-substrate", branch= "remove-affine-host-calls", defult-features = false }
sp-ark-bw6-761 = { version = "0.4.0",git = "https://github.com/paritytech/ark-substrate", branch= "remove-affine-host-calls", default-features = false }
sp-ark-ed-on-bls12-377 = { version = "0.4.0", git = "https://github.com/paritytech/ark-substrate", branch= "remove-affine-host-calls", default-features = false }
sp-ark-ed-on-bls12-381 = { version = "0.4.0", git = "https://github.com/paritytech/ark-substrate", branch= "remove-affine-host-calls", default-features = false }

[features]
default = [ "std" ]
Expand Down
6 changes: 0 additions & 6 deletions primitives/arkworks/test/tests/bls12_377.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,9 @@ impl HostFunctions for Host {
fn bls12_377_mul_projective_g1(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::bls12_377_mul_projective_g1(base, scalar)
}
fn bls12_377_mul_affine_g1(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::bls12_377_mul_affine_g1(base, scalar)
}
fn bls12_377_mul_projective_g2(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::bls12_377_mul_projective_g2(base, scalar)
}
fn bls12_377_mul_affine_g2(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::bls12_377_mul_affine_g2(base, scalar)
}
}

test_group!(g1; sp_ark_bls12_377::G1Projective<super::Host>; sw);
Expand Down
6 changes: 0 additions & 6 deletions primitives/arkworks/test/tests/bls12_381/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,9 @@ impl HostFunctions for Host {
fn bls12_381_mul_projective_g1(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::bls12_381_mul_projective_g1(base, scalar)
}
fn bls12_381_mul_affine_g1(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::bls12_381_mul_affine_g1(base, scalar)
}
fn bls12_381_mul_projective_g2(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::bls12_381_mul_projective_g2(base, scalar)
}
fn bls12_381_mul_affine_g2(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::bls12_381_mul_affine_g2(base, scalar)
}
}

type G1Projective = G1Projective_Host<Host>;
Expand Down
6 changes: 0 additions & 6 deletions primitives/arkworks/test/tests/bw6_761.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ impl HostFunctions for Host {
fn bw6_761_mul_projective_g2(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::bw6_761_mul_projective_g2(base, scalar)
}
fn bw6_761_mul_affine_g1(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::bw6_761_mul_affine_g1(base, scalar)
}
fn bw6_761_mul_affine_g2(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::bw6_761_mul_affine_g2(base, scalar)
}
}

test_group!(g1; sp_ark_bw6_761::g1::G1Projective<super::Host>; sw);
Expand Down
3 changes: 0 additions & 3 deletions primitives/arkworks/test/tests/ed_on_bls12_377.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ impl HostFunctions for Host {
fn ed_on_bls12_377_msm(bases: Vec<u8>, scalars: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::ed_on_bls12_377_msm(bases, scalars)
}
fn ed_on_bls12_377_mul_affine(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::ed_on_bls12_377_mul_affine(base, scalar)
}
fn ed_on_bls12_377_mul_projective(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::ed_on_bls12_377_mul_projective(base, scalar)
}
Expand Down
6 changes: 0 additions & 6 deletions primitives/arkworks/test/tests/ed_on_bls12_381.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,9 @@ impl HostFunctions for Host {
fn ed_on_bls12_381_sw_msm(bases: Vec<u8>, scalars: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::ed_on_bls12_381_sw_msm(bases, scalars)
}
fn ed_on_bls12_381_sw_mul_affine(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::ed_on_bls12_381_sw_mul_affine(base, scalar)
}
fn ed_on_bls12_381_te_mul_projective(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::ed_on_bls12_381_te_mul_projective(base, scalar)
}
fn ed_on_bls12_381_te_mul_affine(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::ed_on_bls12_381_te_mul_affine(base, scalar)
}
fn ed_on_bls12_381_sw_mul_projective(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_io::elliptic_curves::ed_on_bls12_381_sw_mul_projective(base, scalar)
}
Expand Down
45 changes: 0 additions & 45 deletions primitives/io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1160,21 +1160,11 @@ pub trait EllipticCurves {
sp_arkworks::bls12_381::mul_projective_g1(base, scalar)
}

/// Compute a projective multiplication on G1 for bls12_381
fn bls12_381_mul_affine_g1(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_arkworks::bls12_381::mul_affine_g1(base, scalar)
}

/// Compute a projective multiplication on G2 for bls12_381
fn bls12_381_mul_projective_g2(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_arkworks::bls12_381::mul_projective_g2(base, scalar)
}

/// Compute a affine multiplication on G2 for bls12_381
fn bls12_381_mul_affine_g2(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_arkworks::bls12_381::mul_affine_g2(base, scalar)
}

/// Compute a msm on G1 for bls12_381
fn bls12_381_msm_g1(bases: Vec<u8>, scalars: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_arkworks::bls12_381::msm_g1(bases, scalars)
Expand All @@ -1200,21 +1190,11 @@ pub trait EllipticCurves {
sp_arkworks::bls12_377::mul_projective_g1(base, scalar)
}

/// Compute a affine multiplication on G1 for bls12_377
fn bls12_377_mul_affine_g1(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_arkworks::bls12_377::mul_affine_g1(base, scalar)
}

/// Compute a projective multiplication on G2 for bls12_377
fn bls12_377_mul_projective_g2(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_arkworks::bls12_377::mul_projective_g2(base, scalar)
}

/// Compute a affine multiplication on G2 for bls12_377
fn bls12_377_mul_affine_g2(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_arkworks::bls12_377::mul_affine_g2(base, scalar)
}

/// Compute a msm on G1 for bls12_377
fn bls12_377_msm_g1(bases: Vec<u8>, scalars: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_arkworks::bls12_377::msm_g1(bases, scalars)
Expand Down Expand Up @@ -1245,16 +1225,6 @@ pub trait EllipticCurves {
sp_arkworks::bw6_761::mul_projective_g2(base, scalar)
}

/// Compute a affine multiplication on G1 for bw6_761
fn bw6_761_mul_affine_g1(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_arkworks::bw6_761::mul_affine_g1(base, scalar)
}

/// Compute a affine multiplication on G2 for bw6_761
fn bw6_761_mul_affine_g2(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_arkworks::bw6_761::mul_affine_g2(base, scalar)
}

/// Compute a msm on G1 for bw6_761
fn bw6_761_msm_g1(bases: Vec<u8>, bigints: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_arkworks::bw6_761::msm_g1(bases, bigints)
Expand All @@ -1265,21 +1235,11 @@ pub trait EllipticCurves {
sp_arkworks::bw6_761::msm_g2(bases, bigints)
}

/// Compute a short weierstrass affine multiplication on ed_on_bls12_381
fn ed_on_bls12_381_sw_mul_affine(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_arkworks::ed_on_bls12_381::sw_mul_affine(base, scalar)
}

/// Compute twisted edwards projective multiplication on ed_on_bls12_381
fn ed_on_bls12_381_te_mul_projective(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_arkworks::ed_on_bls12_381::te_mul_projective(base, scalar)
}

/// Compute twisted edwards affine multiplication on ed_on_bls12_381
fn ed_on_bls12_381_te_mul_affine(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_arkworks::ed_on_bls12_381::te_mul_affine(base, scalar)
}

/// Compute short weierstrass projective multiplication on ed_on_bls12_381
fn ed_on_bls12_381_sw_mul_projective(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_arkworks::ed_on_bls12_381::sw_mul_projective(base, scalar)
Expand All @@ -1295,11 +1255,6 @@ pub trait EllipticCurves {
sp_arkworks::ed_on_bls12_381::sw_msm(bases, scalars)
}

/// Compute affine multiplication on ed_on_bls12_377
fn ed_on_bls12_377_mul_affine(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_arkworks::ed_on_bls12_377::mul_affine(base, scalar)
}

/// Compute projective multiplication on ed_on_bls12_377
fn ed_on_bls12_377_mul_projective(base: Vec<u8>, scalar: Vec<u8>) -> Result<Vec<u8>, ()> {
sp_arkworks::ed_on_bls12_377::mul_projective(base, scalar)
Expand Down