diff --git a/circom_circuits/Operations/generate_inputs_for_pol.py b/circom_circuits/Operations/generate_inputs_for_pol.py index 53cf420..b1bf000 100755 --- a/circom_circuits/Operations/generate_inputs_for_pol.py +++ b/circom_circuits/Operations/generate_inputs_for_pol.py @@ -345,7 +345,7 @@ with open("input.json", "w") as file: file.write('],') else: file.write(',') - file.write('\n\t"unspent_root" :\t\t\t\t"'+str(cm_unspent_root)+'",') + file.write('\n\t"cm_unspent_root" :\t\t\t\t"'+str(cm_unspent_root)+'",') if anonymity == "private": file.write('\n\t"unspent_nodes" :\t\t\t\t\t[') for i in range(32): @@ -365,7 +365,7 @@ with open("input.json", "w") as file: file.write('],') else: file.write(',') - file.write('\n\t"unspent_root" :\t\t\t\t"'+str(nf_root)+'",') + file.write('\n\t"nf_unspent_root" :\t\t\t\t"'+str(nf_root)+'",') file.write('\n\t"starting_slot" :\t\t\t\t"'+str(starting_slot)+'",') file.write('\n\t"secrets_root" :\t\t\t\t"'+str(secret_root)+'",') file.write('\n\t"state" :\t\t\t\t"'+str(state)+'",') diff --git a/circom_circuits/Operations/pol.circom b/circom_circuits/Operations/pol.circom index 7ff7e18..1e157ce 100644 --- a/circom_circuits/Operations/pol.circom +++ b/circom_circuits/Operations/pol.circom @@ -81,7 +81,8 @@ template proof_of_leadership(){ signal input nf_next; signal input unspent_nodes[32]; signal input unspent_selectors[32]; // must be bits - signal input unspent_root; // It's either the nullifier (if selector = 0) or the commitment root of the last state + signal input nf_unspent_root; + signal input cm_unspent_root; //Part of the secret key signal input starting_slot; @@ -178,7 +179,7 @@ template proof_of_leadership(){ unspent_membership.nodes[i] <== unspent_nodes[i]; unspent_membership.selector[i] <== unspent_selectors[i]; } - unspent_membership.root <== unspent_root; + unspent_membership.root <== (cm_unspent_root - nf_unspent_root) * selector + nf_unspent_root; //Compute the leaf if it's a private note representing previous nf pointing to next in the IMT component hash = Poseidon2_hash(2); hash.inp[0] <== nf_previous; @@ -226,4 +227,4 @@ template proof_of_leadership(){ entropy_contrib <== entropy.out; } -component main {public [slot,epoch_nonce,t0,t1,commitments_aged_root,unspent_root,one_time_key]}= proof_of_leadership(); \ No newline at end of file +component main {public [slot,epoch_nonce,t0,t1,commitments_aged_root,nf_unspent_root,cm_unspent_root,one_time_key]}= proof_of_leadership(); \ No newline at end of file