-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/algebra' into fix/algebra-fork-ark-algebra
- Loading branch information
Showing
7 changed files
with
813 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,45 @@ | ||
use ark_ec::{group::Group, AffineCurve}; | ||
use ark_ff::prelude::*; | ||
use ark_ff::ToBytes; | ||
use ark_serialize::{ | ||
CanonicalDeserialize, CanonicalDeserializeWithFlags, CanonicalSerialize, | ||
CanonicalSerializeWithFlags, | ||
}; | ||
use std::fmt::Debug; | ||
use std::hash::Hash; | ||
|
||
pub trait GroupShare<G: Group> {} | ||
pub trait GroupShare<G: Group>: | ||
Clone | ||
+ Copy | ||
+ Debug | ||
+ Send | ||
+ Sync | ||
+ Eq | ||
+ Hash | ||
+ CanonicalSerialize | ||
+ CanonicalDeserialize | ||
+ CanonicalSerializeWithFlags | ||
+ CanonicalDeserializeWithFlags | ||
+ UniformRand | ||
+ ToBytes | ||
+ 'static | ||
{ | ||
} | ||
|
||
pub trait GroupAffineShare<G: AffineCurve> {} | ||
// pub trait GroupAffineShare<G: AffineCurve>: | ||
// Clone | ||
// + Copy | ||
// + Debug | ||
// + Send | ||
// + Sync | ||
// + Hash | ||
// + Ord | ||
// + CanonicalSerialize | ||
// + CanonicalDeserialize | ||
// + CanonicalSerializeWithFlags | ||
// + CanonicalDeserializeWithFlags | ||
// + UniformRand | ||
// + ToBytes | ||
// + 'static | ||
// { | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,66 @@ | ||
use ark_ec::PairingEngine; | ||
use ark_ec::{group::Group, AffineCurve, PairingEngine, ProjectiveCurve}; | ||
|
||
use super::{ | ||
field::{ExtFieldShare, FieldShare}, | ||
group::{GroupAffineShare, GroupShare}, | ||
group::GroupShare, | ||
}; | ||
|
||
pub trait PairingShare<E: PairingEngine>: 'static + Send + Sync { | ||
use std::{fmt::Debug, ops::MulAssign}; | ||
|
||
pub trait ExtendedPairingEngine: PairingEngine { | ||
type GroupedG1Projective: ProjectiveCurve< | ||
BaseField = Self::Fq, | ||
ScalarField = Self::Fr, | ||
Affine = Self::GroupedG1Affine, | ||
> + From<Self::GroupedG1Affine> | ||
+ Into<Self::GroupedG1Affine> | ||
+ MulAssign<Self::Fr> | ||
// needed due to https://github.com/rust-lang/rust/issues/69640 | ||
+ Group<ScalarField = Self::Fr>; | ||
|
||
type GroupedG1Affine: AffineCurve< | ||
BaseField = Self::Fq, | ||
ScalarField = Self::Fr, | ||
Projective = Self::GroupedG1Projective, | ||
> + From<Self::GroupedG1Projective> | ||
+ Into<Self::GroupedG1Projective> | ||
+ Into<Self::G1Prepared> | ||
+ Group<ScalarField = Self::Fr>; | ||
|
||
type GroupedG2Projective: ProjectiveCurve< | ||
BaseField = Self::Fqe, | ||
ScalarField = Self::Fr, | ||
Affine = Self::GroupedG2Affine, | ||
> + From<Self::GroupedG2Affine> | ||
+ Into<Self::GroupedG2Affine> | ||
+ MulAssign<Self::Fr> | ||
// needed due to https://github.com/rust-lang/rust/issues/69640 | ||
+ Group<ScalarField = Self::Fr>; | ||
|
||
type GroupedG2Affine: AffineCurve< | ||
BaseField = Self::Fqe, | ||
ScalarField = Self::Fr, | ||
Projective = Self::GroupedG2Projective, | ||
> + From<Self::GroupedG2Projective> | ||
+ Into<Self::GroupedG2Projective> | ||
+ Into<Self::G2Prepared> | ||
+ Group<ScalarField = Self::Fr>; | ||
} | ||
|
||
pub trait PairingShare<E: ExtendedPairingEngine>: | ||
Clone + Copy + Debug + 'static + Send + Sync + PartialEq + Eq | ||
{ | ||
type FrShare: FieldShare<E::Fr>; | ||
type FqShare: FieldShare<E::Fq>; | ||
type FqeShare: ExtFieldShare<E::Fqe>; | ||
|
||
// warning: maybe wrong | ||
type FqkShare: ExtFieldShare<E::Fqk>; | ||
|
||
type G1AffineShare: GroupAffineShare<E::G1Affine>; | ||
type G2AffineShare: GroupAffineShare<E::G2Affine>; | ||
type G1ProjectiveShare: GroupShare<E::G1Projective>; | ||
type G2ProjectiveShare: GroupShare<E::G2Projective>; | ||
// type hoge: E::G1Affine; | ||
|
||
type G1AffineShare: GroupShare<E::GroupedG1Affine>; | ||
type G2AffineShare: GroupShare<E::GroupedG2Affine>; | ||
type G1ProjectiveShare: GroupShare<E::GroupedG1Projective>; | ||
type G2ProjectiveShare: GroupShare<E::GroupedG2Projective>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.