Clean up API and add comments

This commit is contained in:
Sean Bowe 2018-04-05 18:41:15 -06:00
parent 462a681a1d
commit 2196f97fb7
No known key found for this signature in database
GPG Key ID: 95684257D8F8B031
2 changed files with 583 additions and 354 deletions

@ -184,46 +184,20 @@ fn main() {
constants: &constants
};
phase2::new_parameters(c).unwrap()
phase2::MPCParameters::new(c).unwrap()
};
let old_params = params.clone();
let (pubkey, privkey) = phase2::keypair(rng, &params);
params.transform(&pubkey, &privkey);
params.contribute(&pubkey, &privkey);
{
let mut w = vec![];
pubkey.write(&mut w).unwrap();
let deser = phase2::PublicKey::read(&w[..]).unwrap();
assert!(pubkey == deser);
}
phase2::verify_transform(MiMCDemo::<Bls12> {
phase2::verify_contribution(MiMCDemo::<Bls12> {
xl: None,
xr: None,
constants: &constants
}, &old_params, &params).unwrap();
let old_params = params.clone();
let (pubkey, privkey) = phase2::keypair(rng, &params);
params.transform(&pubkey, &privkey);
phase2::verify_transform(MiMCDemo::<Bls12> {
xl: None,
xr: None,
constants: &constants
}, &old_params, &params).unwrap();
{
let mut w = vec![];
params.write(&mut w).unwrap();
let deser = phase2::MPCParameters::read(&w[..], true).unwrap();
assert!(params == deser);
}
let params = params.params();
let params = params.get_params();
// Prepare the verification key (for proof verification)
let pvk = prepare_verifying_key(&params.vk);

File diff suppressed because it is too large Load Diff