Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into akilesh/native-ecdsa
Browse files Browse the repository at this point in the history
  • Loading branch information
Akilesh Tangella authored and Akilesh Tangella committed Jul 3, 2023
2 parents da2991b + 8a60990 commit e834aa7
Show file tree
Hide file tree
Showing 29 changed files with 996 additions and 443 deletions.
1 change: 1 addition & 0 deletions circuit/src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ mod test {
assert!(res);
}

#[ignore = "Smart contract verifier is too big to run"]
#[test]
fn test_closed_graph_circut_evm() {
let s = vec![Scalar::from_u128(INITIAL_SCORE); NUM_NEIGHBOURS];
Expand Down
4 changes: 3 additions & 1 deletion circuit/src/dynamic_sets/ecdsa_native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ use std::collections::HashMap;
pub type ECDSAPublicKey = secp256k1::PublicKey;
/// ECDSA signature
pub type ECDSASignature = ecdsa::RecoverableSignature;
/// Rational score
pub type RationalScore = BigRational;

/// Construct an Ethereum address for the given ECDSA public key
pub fn address_from_pub_key(pub_key: &ECDSAPublicKey) -> Result<[u8; 20], &'static str> {
Expand Down Expand Up @@ -277,7 +279,7 @@ impl<const NUM_NEIGHBOURS: usize, const NUM_ITERATIONS: usize, const INITIAL_SCO
}

/// Compute the EigenTrust score using BigRational numbers
pub fn converge_rational(&self) -> Vec<BigRational> {
pub fn converge_rational(&self) -> Vec<RationalScore> {
let mut filtered_ops: HashMap<Fr, Vec<Fr>> = self.filter_peers_ops();

let mut ops = Vec::new();
Expand Down
7 changes: 4 additions & 3 deletions circuit/src/dynamic_sets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ mod test {
ops,
);

let k = 15;
let k = 14;
let prover = match MockProver::<Scalar>::run(k, &et, vec![res.to_vec()]) {
Ok(prover) => prover,
Err(e) => panic!("{}", e),
Expand Down Expand Up @@ -851,13 +851,14 @@ mod test {
ops,
);

let k = 15;
let k = 14;
let rng = &mut rand::thread_rng();
let params = generate_params(k);
let res = prove_and_verify::<Bn256, _, _>(params, et, &[&res], rng).unwrap();
assert!(res);
}

#[ignore = "Smart contract verifier is too big to run"]
#[test]
fn test_closed_graph_circut_evm() {
let ops: Vec<Vec<Scalar>> = vec![
Expand Down Expand Up @@ -908,7 +909,7 @@ mod test {
ops,
);

let k = 15;
let k = 14;
let params = read_params(k);
let pk = gen_pk(&params, &et);
let deployment_code = gen_evm_verifier(&params, pk.get_vk(), vec![NUM_NEIGHBOURS]);
Expand Down
2 changes: 1 addition & 1 deletion circuit/src/ecc/generic/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ where
) -> Vec<Self> {
let sliding_window_size = EC::window_size();
// AuxGens from article.
let (mut aux_init, mut aux_fin) = Self::aux(EC::window_size());
let (mut aux_init, mut aux_fin) = Self::aux(sliding_window_size);

let mut aux_inits: Vec<EcPoint<C, N, NUM_LIMBS, NUM_BITS, P, EC>> = Vec::new();
for _ in 0..points.len() {
Expand Down
Loading

0 comments on commit e834aa7

Please sign in to comment.