From 7cd5f9b3ea1e9332a8d5a7005eb58d60834ee0ca Mon Sep 17 00:00:00 2001 From: mgonen Date: Tue, 27 May 2025 11:41:50 +0300 Subject: [PATCH] Wire PoL inputs into PoQ circuit --- .DS_Store | Bin 0 -> 6148 bytes circom_circuits/.DS_Store | Bin 0 -> 8196 bytes circom_circuits/Blend/poq.circom | 47 +++++++++++++++++++++++++++---- 3 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 .DS_Store create mode 100644 circom_circuits/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d0dc4dab225f63ba619ebaac372d788e566bec75 GIT binary patch literal 6148 zcmeHK!Ab)$5S_HuZYg393OxqA7Ob|4;$^Az2VBvEO6|5q7q^?z-L;2O*t7nSU*h*T zlcZv);z1B8Gcb9R$xK3CmdpkKL@Vv@0aO6MK_$$Uu=zr0oODTY)|{mWo5=~T8(Rg`ptXfW0ZL4SZDH&;Q_SCf`XqkgP&Ju~2x zoKmM!olYA^$2ECSZ_a9Rdc0q+$!6nlHY+*XJG&?6oyTw(sb@p2z^_othQ&F&pz*^l zpS*Dts^}gg=d;YS8JPiQfEidd2JAiOlvizIydP$O8Td5=bU#Q`Lf2wuP+uL`(C;IS z7YIqvrndy4wCGyQ4B`liFsXi=txKDuS}RfSP)R5*Gx(8$ jhAzbzOQpDqss;U$3`EyrW)M9n{3D=g;D#CaQwH7v4yRHE literal 0 HcmV?d00001 diff --git a/circom_circuits/.DS_Store b/circom_circuits/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c556871be6ea3a80a7d5f145dbe3942bcd34ad86 GIT binary patch literal 8196 zcmeHMO>fgc6nxvJ?M4MD2as~K#5EFu7DUCxGUdnxBRBvGb{(}A?rvo}is?7CQ?`7|J)i)e zC`;$nMOx^zGnO0J0d{~LU0*f_LQe5T7Dgr^FhVhBe^e_)0KLywI^Ma_y&rpQD zI(UH{P9k*3ksV+Mx(=A!eTO0{Xi91&fB%_Y6nRyT$G^nZc5i2QPwvTm`8ht*^SDmx zSrsMaM|1X0>mt28PSW@JbUqn8c%@aH-WqKaznaV25ja`TA%l>3A zTr3V=9F2l!gaug=d7qUx;IAeHBBwOJ$#dM%+OK(9mmHJ?(y;`b^CTrt{tF$K{dsUYaCh%f=$PPHXR3E{b7jX07DHY a^w>B=3(8-A5wQN*3-AASW^nkE4*Uj0*s*y4 literal 0 HcmV?d00001 diff --git a/circom_circuits/Blend/poq.circom b/circom_circuits/Blend/poq.circom index 1d385e7..be8a05c 100644 --- a/circom_circuits/Blend/poq.circom +++ b/circom_circuits/Blend/poq.circom @@ -13,6 +13,7 @@ include "../Mantle/pol.circom"; // defines proof_of_leadership * * - 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 */ template ProofOfQuota(nLevelsPK, nLevelsPol, bitsQuota) { // Public Inputs @@ -24,7 +25,7 @@ template ProofOfQuota(nLevelsPK, nLevelsPol, bitsQuota) { signal input latest_root; // PoL: latest notes root signal input K; // Blend: one-time signature public key - signal output nullifier; + signal output nullifier; //key_nullifier // Private Inputs signal input selector; // 0 = core, 1 = leader @@ -35,8 +36,21 @@ template ProofOfQuota(nLevelsPK, nLevelsPol, bitsQuota) { signal input core_path[nLevelsPK]; // Merkle path for core PK signal input core_selectors[nLevelsPK]; // path selectors (bits) - // Leaders inputs (all PoL inputs) - component pol = proof_of_leadership(); + // 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 transaction_hash; + signal input output_number; + signal input latest_nodes[32]; + signal input latest_selectors[32]; + // Constraints @@ -63,10 +77,33 @@ template ProofOfQuota(nLevelsPK, nLevelsPol, bitsQuota) { // enforce PoL // (All constraints inside pol ensure LeadershipVerify) // /!\ copy the PoL constraints here /!\ - is_winning <== //0 or 1 for PoL + component win = is_winning_leadership(nLevelsPol); + win.slot <== slot; + win.epoch_nonce <== epoch_nonce; + win.t0 <== t0; + win.t1 <== t1; + win.slot_secret <== slot_secret; + for (var i = 0; i < nLevelsPol; i++) { + win.slot_secret_path[i] <== slot_secret_path[i]; + } + for (var i = 0; i < 32; i++) { + win.aged_nodes[i] <== aged_nodes[i]; + win.aged_selectors[i] <== aged_selectors[i]; + win.latest_nodes[i] <== latest_nodes[i]; + win.latest_selectors[i]<== latest_selectors[i]; + } + win.aged_root <== aged_root; + win.transaction_hash <== transaction_hash; + win.output_number <== output_number; + win.latest_root <== latest_root; + win.starting_slot <== starting_slot; + win.secrets_root <== secrets_root; + win.value <== value; + + signal is_leader = win.out; // 1 if PoL passed // Enforce the selected role is correct - selector * (is_winning - coreReg.out) + coreReg.out === 1; + selector * (is_leader - coreReg.out) + coreReg.out === 1;