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

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
duguorong009 committed Oct 27, 2023
1 parent 08d392c commit bcb9c94
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions eigentrust-zk/src/circuits/dynamic_sets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ where
unassigned_msg_hashes.push(msg_hashes_row);
unassigned_s_invs.push(s_inv_row);

// FIX: Here, if the pubkey is not given (None), the "default" pubkey is added automatically.
// This means that if there is only 1 real pubkey, the "unassigned_pks" would still be NUM_NEIGHBORS pubkeys with default pubkey.
// For example, 1 real pubkey, NUM_NEIGHBORS = 4, then 3 default pubkeys
let pk = pks[i].clone().unwrap_or(PublicKey::default());
let unassigned_pk = UnassignedPublicKey::new(pk);
unassigned_pks.push(unassigned_pk);
Expand Down Expand Up @@ -446,6 +449,7 @@ impl<
ops.push(opinions);
op_hashes.push(op_hash);
}
println!("halo2_op_hashes: \n{:?}\n", op_hashes);

let mut sponge = SH::init(&config.common, layouter.namespace(|| "op_hasher"))?;
sponge.update(&op_hashes);
Expand All @@ -461,6 +465,7 @@ impl<
let ctx = &mut RegionCtx::new(region, 0);
let op_hash = ctx.copy_assign(config.common.advice[0], ops_hash.clone())?;
let op_hash_res = ctx.copy_assign(config.common.advice[1], op_hash_res.clone())?;
println!("op_hash == op_hash_res \n{:?}\n{:?}", op_hash, op_hash_res);
ctx.constrain_equal(op_hash, op_hash_res)?;
Ok(())
},
Expand Down
5 changes: 5 additions & 0 deletions eigentrust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ impl Client {
)
.map_err(|e| EigenError::ProvingError(format!("Failed to generate proof: {}", e)))?;

let res = verify(&kzg_params, &[&et_setup.pub_inputs.to_vec()], &proof, proving_key.get_vk());
println!("verification success: {res:?}");

Ok(ETReport { pub_inputs: et_setup.pub_inputs, proof })
}

Expand Down Expand Up @@ -428,10 +431,12 @@ impl Client {
let (_, _, op_hash) = op.validate(scalar_set.clone());
op_hashes.push(op_hash)
}
// FIX: Here, the only existing pubkey can add to "op_hashes". For example, 1 hash since 1 pubkey.
}

let mut sponge = PoseidonNativeSponge::new();
sponge.update(&op_hashes);
println!("cli_op_hashes: \n{op_hashes:?}\n");
let opinions_hash = sponge.squeeze();

// Calculate scores
Expand Down

0 comments on commit bcb9c94

Please sign in to comment.