From 01e02e4e7e5662a2baec611262a9e50f1ae34d04 Mon Sep 17 00:00:00 2001 From: mgonen Date: Wed, 11 Jun 2025 12:54:16 +0300 Subject: [PATCH] delete DS_Store and gitignore --- .../Blend/generate_inputs_for_poq.py | 11 ++++++----- circom_circuits/Blend/poq.circom | 18 ++++++++---------- circom_circuits/Mantle/pol.circom | 4 ++-- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/circom_circuits/Blend/generate_inputs_for_poq.py b/circom_circuits/Blend/generate_inputs_for_poq.py index bafc75e..6ffbf68 100644 --- a/circom_circuits/Blend/generate_inputs_for_poq.py +++ b/circom_circuits/Blend/generate_inputs_for_poq.py @@ -269,13 +269,14 @@ while(ticket > threshold): output_number += 1 note_id = poseidon2_hash([F(103012852986292465873069134523609422197952925946768565674230228608985708879),tx_hash,output_number,value,pk]) ticket = poseidon2_hash([F(328840406439552832830196247813274442341678919395186087927998764150429312516),F(epoch_nonce),F(slot_number),note_id,sk]) - -aged_nodes = [F(randrange(0,p,1)) for i in range(32)] -aged_selectors = randrange(0,2**32,1) + +zoneTreeDepth = 32 +aged_nodes = [F(randrange(0,p,1)) for i in range(zoneTreeDepth)] +aged_selectors = randrange(0,2**zoneTreeDepth,1) aged_selectors = format(aged_selectors,'032b') aged_root = note_id -for i in range(32): - if int(aged_selectors[31-i]) == 0: +for i in range(zoneTreeDepth): + if int(aged_selectors[zoneTreeDepth-1-i]) == 0: aged_root = poseidon2_hash([aged_root,aged_nodes[i]]) else: aged_root = poseidon2_hash([aged_nodes[i],aged_root]) diff --git a/circom_circuits/Blend/poq.circom b/circom_circuits/Blend/poq.circom index 0b4ee9c..0443dd5 100644 --- a/circom_circuits/Blend/poq.circom +++ b/circom_circuits/Blend/poq.circom @@ -8,11 +8,12 @@ include "../circomlib/circuits/bitify.circom"; include "../Mantle/pol.circom"; // defines proof_of_leadership /** - * ProofOfQuota(nLevelsPK, nLevelsPol) + * ProofOfQuota(nLevelsPK, nLevelsPol, bitsQuota, zoneTreeDepth) * * - nLevelsPK : depth of the core-node public-key registry Merkle tree * - nLevelsPol : depth of the slot-secret tree used in PoL (25) * - bitsQuota : bit-width for the index comparator + * - zoneTreeDepth : depth of the zone’s aged notes Merkle tree (32) */ template ProofOfQuota(nLevelsPK, nLevelsPol, bitsQuota) { // Public Inputs @@ -23,6 +24,7 @@ template ProofOfQuota(nLevelsPK, nLevelsPol, bitsQuota) { signal input aged_root; // PoL: aged notes root signal input K; // Blend: one-time signature public key + // Although K is listed as a public input in the circuit, it’s conceptually generated by the prover and thus considered an output of the proof process. signal dummy; dummy <== K * K; @@ -38,15 +40,11 @@ template ProofOfQuota(nLevelsPK, nLevelsPol, bitsQuota) { signal input core_selectors[nLevelsPK]; // path selectors (bits) // PoL branch inputs (all the PoL private data) - signal input slot; - signal input epoch_nonce; - signal input t0; - signal input t1; signal input slot_secret; signal input slot_secret_path[nLevelsPol]; - signal input aged_nodes[32]; - signal input aged_selectors[32]; + signal input aged_nodes[zoneTreeDepth]; + signal input aged_selectors[zoneTreeDepth]; signal input transaction_hash; signal input output_number; @@ -88,7 +86,7 @@ template ProofOfQuota(nLevelsPK, nLevelsPol, bitsQuota) { for (var i = 0; i < nLevelsPol; i++) { would_win.slot_secret_path[i] <== slot_secret_path[i]; } - for (var i = 0; i < 32; i++) { + for (var i = 0; i < zoneTreeDepth; i++) { would_win.aged_nodes[i] <== aged_nodes[i]; would_win.aged_selectors[i] <== aged_selectors[i]; } @@ -129,5 +127,5 @@ template ProofOfQuota(nLevelsPK, nLevelsPol, bitsQuota) { } // Instantiate with chosen depths: 20 for core PK tree, 25 for PoL slot tree -component main { public [ session, Qc, Ql, pk_root, aged_root, K ] } - = ProofOfQuota(20, 25, 20); \ No newline at end of file +component main { public [ session, Qc, Ql, pk_root, aged_root, slot, epoch_nonce, t0, t1, K ] } + = ProofOfQuota(20, 25, 20, 32); \ No newline at end of file diff --git a/circom_circuits/Mantle/pol.circom b/circom_circuits/Mantle/pol.circom index 5ab5688..0a14923 100644 --- a/circom_circuits/Mantle/pol.circom +++ b/circom_circuits/Mantle/pol.circom @@ -57,7 +57,7 @@ template derive_entropy(){ out <== hash.out; } -template is_winning_leadership(secret_depth){ +template would_win_leadership(secret_depth){ signal input slot; signal input epoch_nonce; signal input t0; @@ -222,7 +222,7 @@ template proof_of_leadership(secret_depth){ signal input value; // Verify the note is winning the lottery - component lottery_checker = is_winning_leadership(secret_depth); + component lottery_checker = would_win_leadership(secret_depth); lottery_checker.slot <== slot; lottery_checker.epoch_nonce <== epoch_nonce; lottery_checker.t0 <== t0;