From f32cb409292416e4b4f02363a63790541affea6c Mon Sep 17 00:00:00 2001 From: Sean Bowe Date: Mon, 20 Nov 2017 12:22:51 -0700 Subject: [PATCH 1/3] Engine should always be 'static, for flexibility in downstream code. --- src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index c6d5536..f58df58 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,7 +34,8 @@ use std::io::{self, Read, Write}; /// An "engine" is a collection of types (fields, elliptic curve groups, etc.) /// with well-defined relationships. In particular, the G1/G2 curve groups are /// of prime order `r`, and are equipped with a bilinear pairing function. -pub trait Engine: Sized { +pub trait Engine: Sized + 'static +{ /// This is the scalar field of the G1/G2 groups. type Fr: PrimeField; From 4b366a143dcc45ff031a261f7b21c6115f51be36 Mon Sep 17 00:00:00 2001 From: Sean Bowe Date: Mon, 20 Nov 2017 23:20:11 -0700 Subject: [PATCH 2/3] Ensure `Engine`'s are always Clone. --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index f58df58..c695f3a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,7 +34,7 @@ use std::io::{self, Read, Write}; /// An "engine" is a collection of types (fields, elliptic curve groups, etc.) /// with well-defined relationships. In particular, the G1/G2 curve groups are /// of prime order `r`, and are equipped with a bilinear pairing function. -pub trait Engine: Sized + 'static +pub trait Engine: Sized + 'static + Clone { /// This is the scalar field of the G1/G2 groups. type Fr: PrimeField; From 4a1ac947995f9e38b783e0b987cdcb391ed4c9a8 Mon Sep 17 00:00:00 2001 From: Sean Bowe Date: Mon, 20 Nov 2017 23:53:58 -0700 Subject: [PATCH 3/3] Implement `Clone` for Bls12. --- src/bls12_381/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bls12_381/mod.rs b/src/bls12_381/mod.rs index 341df67..9213b88 100644 --- a/src/bls12_381/mod.rs +++ b/src/bls12_381/mod.rs @@ -21,7 +21,7 @@ use super::{Engine, CurveAffine, Field, BitIterator}; const BLS_X: u64 = 0xd201000000010000; const BLS_X_IS_NEGATIVE: bool = true; -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct Bls12; impl Engine for Bls12 {