updated constants

This commit is contained in:
thomaslavaur 2025-08-26 11:37:19 +02:00
parent da383e1a87
commit cfbf7f3c4d
4 changed files with 23 additions and 25 deletions

View File

@ -221,7 +221,7 @@ if not core_or_leader in [0,1]:
# 1) Corenode registry Merkleproof
# pick a random core_sk and derive its public key
core_sk = F(randrange(0,p,1))
pk_core = poseidon2_hash([ F(71828171600713765359243601848789410494517675262904677980449468236927732106), core_sk ])
pk_core = poseidon2_hash([ F(212459341846278437262234987091558730706084889692483733611934435194121904625), core_sk ])
core_selectors = randrange(0,2**20,1)
core_selectors = format(int(core_selectors),'020b')
core_nodes = [F(randrange(0,p,1)) for i in range(20)]
@ -263,7 +263,7 @@ for i in range(25):
else:
secret_root = poseidon2_hash([slot_secret_path[i],secret_root])
sk = poseidon2_hash([F(368578955381705904513968556094561791019140317213076864424136877504260737058),starting_slot,secret_root])
pk = poseidon2_hash([F(71828171600713765359243601848789410494517675262904677980449468236927732106),sk])
pk = poseidon2_hash([F(212459341846278437262234987091558730706084889692483733611934435194121904625),sk])
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])

View File

@ -220,8 +220,8 @@ if total_stake >= p:
print("total stake must be less than p")
exit()
t0 = F(int((((- ln(R(0.95))) * R(p))) / R(total_stake) ))
t1 = F(int((((- ln(R(0.95))**2) * R(p))) / (R(2) * R(total_stake)**2 )))
t0 = F(0x27b6fe27507ca57ca369280400c79b5d2f58ff94d87cb0fbfc8294eb69eb1ea)
t1 = F(0x104bfd09ebdd0a57772289d0973489b62662a4dc6f09da8b4af3c5cfb1dcdd)
value = F(50)
@ -243,7 +243,7 @@ for i in range(25):
else:
secret_root = poseidon2_hash([slot_secret_path[i],secret_root])
sk = poseidon2_hash([F(368578955381705904513968556094561791019140317213076864424136877504260737058),starting_slot,secret_root])
pk = poseidon2_hash([F(71828171600713765359243601848789410494517675262904677980449468236927732106),sk])
pk = poseidon2_hash([F(212459341846278437262234987091558730706084889692483733611934435194121904625),sk])
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])

View File

@ -247,4 +247,4 @@ template proof_of_leadership(secret_depth){
}
//component main {public [sl,epoch_nonce,t0,t1,ledger_aged,ledger_latest,P_lead_part_one,P_lead_part_two]}= proof_of_leadership(25);
component main {public [sl,epoch_nonce,t0,t1,ledger_aged,ledger_latest,P_lead_part_one,P_lead_part_two]}= proof_of_leadership(25);

View File

@ -5,6 +5,7 @@ include "../circomlib/circuits/bitify.circom";
include "../circomlib/circuits/comparators.circom";
// If a or b isn't guaranteed to be less than p use SafeFullComparator
// See https://www.notion.so/nomos-tech/Comparisons-1fd261aa09df81feae1ff3e6612b92a0
template FullLessThan() {
signal input a;
signal input b;
@ -25,8 +26,8 @@ template FullLessThan() {
}
component A = LessThan(252);
A.in[0] <== numifier_a.out;
A.in[1] <== numifier_b.out;
A.in[0] <== numifier_b.out;
A.in[1] <== numifier_a.out;
component B = IsEqual();
B.in[0] <== numifier_a.out;
@ -48,14 +49,13 @@ template FullLessThan() {
F.in[0] <== bitifier_a.out[0];
F.in[1] <== 1;
signal intermediate_results[5];
intermediate_results[0] <== (1 - A.out) * B.out;
intermediate_results[1] <== C.out * (1-E.out);
intermediate_results[2] <== intermediate_results[1] * F.out;
intermediate_results[3] <== (1-C.out) * D.out;
intermediate_results[4] <== A.out * (1-B.out);
signal intermediate_results[4];
intermediate_results[0] <== (1 - C.out) * (1-D.out);
intermediate_results[1] <== (1 - C.out) * (1-E.out);
intermediate_results[2] <== intermediate_results[1] * (1- F.out);
intermediate_results[3] <== B.out * (intermediate_results[0] + intermediate_results[2]);
out <== intermediate_results[0] * (intermediate_results[2] + intermediate_results[3]) + intermediate_results[4];
out <== (1 - A.out) * ((1 - B.out) + intermediate_results[3]);
}
@ -79,8 +79,8 @@ template SafeFullLessThan() {
}
component A = LessThan(252);
A.in[0] <== numifier_a.out;
A.in[1] <== numifier_b.out;
A.in[0] <== numifier_b.out;
A.in[1] <== numifier_a.out;
component B = IsEqual();
B.in[0] <== numifier_a.out;
@ -102,15 +102,13 @@ template SafeFullLessThan() {
F.in[0] <== bitifier_a.out[0];
F.in[1] <== 1;
signal intermediate_results[5];
intermediate_results[0] <== (1 - A.out) * B.out;
intermediate_results[1] <== C.out * (1-E.out);
intermediate_results[2] <== intermediate_results[1] * F.out;
intermediate_results[3] <== (1-C.out) * D.out;
intermediate_results[4] <== A.out * (1-B.out);
out <== intermediate_results[0] * (intermediate_results[2] + intermediate_results[3]) + intermediate_results[4];
signal intermediate_results[4];
intermediate_results[0] <== (1 - C.out) * (1-D.out);
intermediate_results[1] <== (1 - C.out) * (1-E.out);
intermediate_results[2] <== intermediate_results[1] * (1- F.out);
intermediate_results[3] <== B.out * (intermediate_results[0] + intermediate_results[2]);
out <== (1 - A.out) * ((1 - B.out) + intermediate_results[3]);
}
// Safely compare two n-bit numbers