MCPcopy Create free account
hub / github.com/docknetwork/crypto / aggregate

Method aggregate

bbs_plus/src/threshold/threshold_bbs.rs:170–191  ·  view source on GitHub ↗
(sig_shares: Vec<Self>)

Source from the content-addressed store, hash-verified

168 }
169
170 pub fn aggregate(sig_shares: Vec<Self>) -> Result<Signature23G1<E>, BBSPlusError> {
171 // TODO: Ensure correct threshold. Share should contain threshold and share id
172 let mut sum_R = E::G1::zero();
173 let mut sum_u = E::ScalarField::zero();
174 let mut expected_e = E::ScalarField::zero();
175 for (i, share) in sig_shares.into_iter().enumerate() {
176 if i == 0 {
177 expected_e = share.e;
178 } else {
179 if expected_e != share.e {
180 return Err(BBSPlusError::IncorrectEByParticipant(share.id));
181 }
182 }
183 sum_u += share.u;
184 sum_R += share.R;
185 }
186 let A = sum_R * sum_u.inverse().unwrap();
187 Ok(Signature23G1 {
188 A: A.into_affine(),
189 e: expected_e,
190 })
191 }
192}
193
194#[cfg(test)]

Callers

nothing calls this directly

Calls 1

into_iterMethod · 0.45

Tested by

no test coverage detected