adjust public inputs

This commit is contained in:
thomaslavaur 2025-04-04 15:28:52 +02:00
parent 40e92abdb0
commit 769b1f193e
2 changed files with 6 additions and 5 deletions

View File

@ -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)+'",')

View File

@ -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();
component main {public [slot,epoch_nonce,t0,t1,commitments_aged_root,nf_unspent_root,cm_unspent_root,one_time_key]}= proof_of_leadership();