diff --git a/src/consensus/leadcoin.rs b/src/consensus/leadcoin.rs index d5bd7ffb9..5481ce07b 100644 --- a/src/consensus/leadcoin.rs +++ b/src/consensus/leadcoin.rs @@ -239,27 +239,30 @@ impl LeadCoin { let pubkey = PublicKey::from_secret(self.secret_key); let (pub_x, pub_y) = pubkey.xy(); - let c2_cm = self.coin2_commitment.coordinates().unwrap(); + let c2_cm = self.coin2_commitment.to_affine().coordinates().unwrap(); + // rho // Initialize circuit with witnesses let lottery_msg_input = [self.coin1_sk_root.inner(), self.nonce]; let lottery_msg = poseidon_hash(lottery_msg_input); let rho = pedersen_commitment_base(lottery_msg, mod_r_p(self.rho_mu)); - let rho_coord = rho.coordinates().unwrap(); + let rho_coord = rho.to_affine().coordinates().unwrap(); vec![ self.coin1_commitment_root.inner(), self.sn, - *c2_cm.x(), *c2_cm.y(), - *rho_coord.x(), *rho_coord.y(), + *c2_cm.x(), + *c2_cm.y(), + *rho_coord.x(), + *rho_coord.y(), self.nonce_cm, - pub_x, pub_y, - y + pub_x, + pub_y, + y, ] } /// Try to create a ZK proof of consensus leadership pub fn create_lead_proof(&self, pk: &ProvingKey) -> Result { - let circuit = LeadContract { coin1_commit_merkle_path: Value::known(self.coin1_commitment_merkle_path), coin1_commit_leaf_pos: Value::known(self.idx), @@ -271,7 +274,7 @@ impl LeadCoin { coin1_blind: Value::known(self.coin1_blind), coin1_value: Value::known(pallas::Base::from(self.value)), coin2_blind: Value::known(self.coin2_blind), - coin2_commit: Value::known(self.coin2_commitment), + //coin2_commit: Value::known(self.coin2_commitment), rho_mu: Value::known(mod_r_p(self.rho_mu)), y_mu: Value::known(mod_r_p(self.y_mu)), sigma1: Value::known(self.sigma1), diff --git a/src/consensus/mod.rs b/src/consensus/mod.rs index 99e4c9d2b..39556ebd4 100644 --- a/src/consensus/mod.rs +++ b/src/consensus/mod.rs @@ -53,5 +53,3 @@ pub mod utils; /// Wallet functions pub mod wallet; - -pub mod ouroboros; diff --git a/src/consensus/utils.rs b/src/consensus/utils.rs index 1c7cbee8e..3149ab930 100644 --- a/src/consensus/utils.rs +++ b/src/consensus/utils.rs @@ -66,12 +66,12 @@ pub fn fbig2base(f: Float10) -> pallas::Base { mod tests { use dashu::integer::IBig; - use crate::consensus::{types::Float10, utils::fbig2ibig, RADIX_BITS}; + use crate::consensus::{constants::RADIX_BITS, types::Float10, utils::fbig2ibig}; #[test] fn dashu_fbig2ibig() { let f = - Float10::from_str_native("234234223.000").unwrap().with_precision(*RADIX_BITS).value(); + Float10::from_str_native("234234223.000").unwrap().with_precision(RADIX_BITS).value(); let i: IBig = fbig2ibig(f); let sig = IBig::from(234234223); assert_eq!(i, sig);