@@ -9,7 +9,7 @@ use derive_more::{Deref, From, IntoIterator};
9
9
use rayon:: prelude:: * ;
10
10
use serde:: { Deserialize , Serialize } ;
11
11
use serde_with:: serde_as;
12
- use std:: { iter:: successors, num:: NonZeroUsize } ;
12
+ use std:: { iter:: successors, num:: NonZeroUsize , ops :: Add } ;
13
13
14
14
use crate :: {
15
15
interpolation:: { interpolate, interpolate_in_exponent} ,
@@ -211,6 +211,30 @@ impl<C: CurveGroup> FeldmanCommitment<C> {
211
211
}
212
212
}
213
213
214
+ // Implementation of Add trait for FeldmanCommitment + &FeldmanCommitment
215
+ impl < C : CurveGroup > Add < & FeldmanCommitment < C > > for FeldmanCommitment < C > {
216
+ type Output = FeldmanCommitment < C > ;
217
+
218
+ fn add ( self , other : & FeldmanCommitment < C > ) -> Self :: Output {
219
+ & self + other
220
+ }
221
+ }
222
+
223
+ // Implementation of Add trait for &FeldmanCommitment + &FeldmanCommitment
224
+ impl < C : CurveGroup > Add < & FeldmanCommitment < C > > for & FeldmanCommitment < C > {
225
+ type Output = FeldmanCommitment < C > ;
226
+
227
+ fn add ( self , other : & FeldmanCommitment < C > ) -> Self :: Output {
228
+ let combined: Vec < C > = self
229
+ . comm
230
+ . iter ( )
231
+ . zip ( other. comm . iter ( ) )
232
+ . map ( |( x, y) | * x + y)
233
+ . collect ( ) ;
234
+ C :: normalize_batch ( & combined) . into ( )
235
+ }
236
+ }
237
+
214
238
impl < C : CurveGroup > KeyResharing < Self > for FeldmanVss < C > {
215
239
fn reshare < R : Rng > (
216
240
new_pp : & FeldmanVssPublicParam ,
0 commit comments