mirror of
https://github.com/logos-blockchain/logos-blockchain-pocs.git
synced 2026-01-02 13:13:09 +00:00
update constants
This commit is contained in:
parent
b95cfadb22
commit
11ef81c577
@ -221,7 +221,7 @@ if not core_or_leader in [0,1]:
|
||||
# 1) Core‐node registry Merkle‐proof
|
||||
# pick a random core_sk and derive its public key
|
||||
core_sk = F(randrange(0,p,1))
|
||||
pk_core = poseidon2_hash([ F(21826764258320138600520923299986619104225513357324915648346315894686032813), core_sk ])
|
||||
pk_core = poseidon2_hash([ F(1296193216988918402894), 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)]
|
||||
@ -238,13 +238,11 @@ for i in range(20):
|
||||
epoch_nonce = F(randrange(0, p,1))
|
||||
slot_number = F(randrange(0, 2**32,1))
|
||||
total_stake = F(5000)
|
||||
# compute t0,t1 via Taylor approx as before
|
||||
R = RealField(500)
|
||||
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)
|
||||
value = F(total_stake / 100)
|
||||
threshold = (t0 + t1 * value) * value
|
||||
starting_slot = randrange(max(0,slot_number-2**25+1),slot_number,1)
|
||||
|
||||
@ -262,15 +260,15 @@ for i in range(25):
|
||||
secret_root = poseidon2_hash([secret_root,slot_secret_path[i]])
|
||||
else:
|
||||
secret_root = poseidon2_hash([slot_secret_path[i],secret_root])
|
||||
sk = poseidon2_hash([F(11150412648077803043426715895344850926617969336834792805313291817007615912),starting_slot,secret_root])
|
||||
pk = poseidon2_hash([F(21826764258320138600520923299986619104225513357324915648346315894686032813),sk])
|
||||
sk = poseidon2_hash([F(256174383281726064679014503048630094),starting_slot,secret_root])
|
||||
pk = poseidon2_hash([F(1296193216988918402894),sk])
|
||||
|
||||
note_id = poseidon2_hash([F(103428471183212854509245604687159503481714203314000316436981831193757668857),tx_hash,output_number,value,pk])
|
||||
ticket = poseidon2_hash([F(153089612725445249076651564403687387970929622326972008703737063484757842721),F(epoch_nonce),F(slot_number),note_id,sk])
|
||||
note_id = poseidon2_hash([F(65580641562429851895355409762135920462),tx_hash,output_number,value,pk])
|
||||
ticket = poseidon2_hash([F(13887241025832268),F(epoch_nonce),F(slot_number),note_id,sk])
|
||||
while(ticket > threshold):
|
||||
output_number += 1
|
||||
note_id = poseidon2_hash([F(103428471183212854509245604687159503481714203314000316436981831193757668857),tx_hash,output_number,value,pk])
|
||||
ticket = poseidon2_hash([F(153089612725445249076651564403687387970929622326972008703737063484757842721),F(epoch_nonce),F(slot_number),note_id,sk])
|
||||
note_id = poseidon2_hash([F(65580641562429851895355409762135920462),tx_hash,output_number,value,pk])
|
||||
ticket = poseidon2_hash([F(13887241025832268),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)
|
||||
|
||||
@ -203,7 +203,6 @@ def PoseidonSponge(data, capacity, output_len):
|
||||
|
||||
return output
|
||||
|
||||
R = RealField(500) #Real numbers with precision 500 bits
|
||||
|
||||
if len(sys.argv) != Integer(4):
|
||||
print("Usage: <script> <epoch_nonce> <slot_number> <total_stake>")
|
||||
@ -224,7 +223,7 @@ t0 = F(0x27b6fe27507ca57ca369280400c79b5d2f58ff94d87cb0fbfc8294eb69eb1ea)
|
||||
t1 = F(0x104bfd09ebdd0a57772289d0973489b62662a4dc6f09da8b4af3c5cfb1dcdd)
|
||||
|
||||
|
||||
value = F(50)
|
||||
value = F(total_stake / 100)
|
||||
threshold = (t0 + t1 * value) * value
|
||||
starting_slot = randrange(max(0,slot_number-2**25+1),slot_number,1)
|
||||
|
||||
@ -242,15 +241,15 @@ for i in range(25):
|
||||
secret_root = poseidon2_hash([secret_root,slot_secret_path[i]])
|
||||
else:
|
||||
secret_root = poseidon2_hash([slot_secret_path[i],secret_root])
|
||||
sk = poseidon2_hash([F(11150412648077803043426715895344850926617969336834792805313291817007615912),starting_slot,secret_root])
|
||||
pk = poseidon2_hash([F(21826764258320138600520923299986619104225513357324915648346315894686032813),sk])
|
||||
sk = poseidon2_hash([F(256174383281726064679014503048630094),starting_slot,secret_root])
|
||||
pk = poseidon2_hash([F(1296193216988918402894),sk])
|
||||
|
||||
note_id = poseidon2_hash([F(103428471183212854509245604687159503481714203314000316436981831193757668857),tx_hash,output_number,value,pk])
|
||||
ticket = poseidon2_hash([F(153089612725445249076651564403687387970929622326972008703737063484757842721),F(epoch_nonce),F(slot_number),note_id,sk])
|
||||
note_id = poseidon2_hash([F(65580641562429851895355409762135920462),tx_hash,output_number,value,pk])
|
||||
ticket = poseidon2_hash([F(13887241025832268),F(epoch_nonce),F(slot_number),note_id,sk])
|
||||
while(ticket > threshold):
|
||||
output_number += 1
|
||||
note_id = poseidon2_hash([F(103428471183212854509245604687159503481714203314000316436981831193757668857),tx_hash,output_number,value,pk])
|
||||
ticket = poseidon2_hash([F(153089612725445249076651564403687387970929622326972008703737063484757842721),F(epoch_nonce),F(slot_number),note_id,sk])
|
||||
note_id = poseidon2_hash([F(65580641562429851895355409762135920462),tx_hash,output_number,value,pk])
|
||||
ticket = poseidon2_hash([F(13887241025832268),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)
|
||||
|
||||
@ -208,7 +208,7 @@ def PoseidonSponge(data, capacity, output_len):
|
||||
|
||||
|
||||
secret_voucher = F(randrange(0,p,1))
|
||||
reward_voucher = poseidon2_hash([F(204531649764949789513498796261435013892205118946219834864707175174206065125),secret_voucher])
|
||||
reward_voucher = poseidon2_hash([F(1668646695034522932676805048878418),secret_voucher])
|
||||
|
||||
merkle_nodes = [F(randrange(0,p,1)) for i in range(32)]
|
||||
selectors = randrange(0,2**32,1)
|
||||
|
||||
@ -4,61 +4,63 @@ pragma circom 2.1.9;
|
||||
include "../circomlib/circuits/bitify.circom";
|
||||
include "../circomlib/circuits/comparators.circom";
|
||||
|
||||
// int.from_bytes(hashlib.blake2b(b"LEAD_V1", digest_size=31).digest(), "little") = 153089612725445249076651564403687387970929622326972008703737063484757842721
|
||||
// int.from_bytes(b"LEAD_V1", byteorder="little") = 13887241025832268
|
||||
template LEAD_V1(){
|
||||
signal output out;
|
||||
out <== 153089612725445249076651564403687387970929622326972008703737063484757842721;
|
||||
}
|
||||
|
||||
|
||||
// int.from_bytes(hashlib.blake2b(b"NOMOS_POL_SK_V1", digest_size=31).digest(), "little") = 11150412648077803043426715895344850926617969336834792805313291817007615912
|
||||
// int.from_bytes(b"NOMOS_POL_SK_V1", byteorder="little") = 256174383281726064679014503048630094
|
||||
template NOMOS_POL_SK_V1(){
|
||||
signal output out;
|
||||
out <== 11150412648077803043426715895344850926617969336834792805313291817007615912;
|
||||
}
|
||||
|
||||
|
||||
// int.from_bytes(hashlib.blake2b(b"NOMOS_NONCE_CONTRIB_V1", digest_size=31).digest(), "little") = 38480566441084130729766917573705507194302645957068645172495738975468771576
|
||||
// int.from_bytes(b"NOMOS_NONCE_CONTRIB_V1", byteorder="little") = 18459309511848927313552932915476467038165525790019406
|
||||
template NOMOS_NONCE_CONTRIB_V1(){
|
||||
signal output out;
|
||||
out <== 38480566441084130729766917573705507194302645957068645172495738975468771576;
|
||||
}
|
||||
|
||||
|
||||
// int.from_bytes(hashlib.blake2b(b"NOMOS_KDF", digest_size=31).digest(), "little") = 21826764258320138600520923299986619104225513357324915648346315894686032813
|
||||
// int.from_bytes(b"NOMOS_KDF", byteorder="little") = 1296193216988918402894
|
||||
template NOMOS_KDF(){
|
||||
signal output out;
|
||||
out <== 21826764258320138600520923299986619104225513357324915648346315894686032813;
|
||||
}
|
||||
|
||||
|
||||
// int.from_bytes(hashlib.blake2b(b"NOMOS_NOTE_ID_V1", digest_size=31).digest(), "little") = 103428471183212854509245604687159503481714203314000316436981831193757668857
|
||||
// int.from_bytes(b"NOMOS_NOTE_ID_V1", byteorder="little") = 65580641562429851895355409762135920462
|
||||
template NOMOS_NOTE_ID_V1(){
|
||||
signal output out;
|
||||
out <== 103428471183212854509245604687159503481714203314000316436981831193757668857;
|
||||
}
|
||||
|
||||
|
||||
// int.from_bytes(hashlib.blake2b(b"SELECTION_RANDOMNESS_V1", digest_size=31).digest(), "little") = 309304781451234662769924433992168739004140182686192300697554287107153066081
|
||||
// int.from_bytes(b"SELECTION_RANDOMNESS_V1", byteorder="little") = 4725583332308041445519605499429790922252397838206780755
|
||||
template SELECTION_RANDOMNESS_V1(){
|
||||
signal output out;
|
||||
out <== 309304781451234662769924433992168739004140182686192300697554287107153066081;
|
||||
}
|
||||
|
||||
|
||||
// int.from_bytes(hashlib.blake2b(b"KEY_NULLIFIER_V1", digest_size=31).digest(), "little") = 115702876017784606171848900076836503482825215709927504981847970587763163030
|
||||
// int.from_bytes(b"KEY_NULLIFIER_V1", byteorder="little") = 65580642670359595206974785265459610955
|
||||
template KEY_NULLIFIER_V1(){
|
||||
signal output out;
|
||||
out <== 115702876017784606171848900076836503482825215709927504981847970587763163030;
|
||||
}
|
||||
|
||||
// int.from_bytes(hashlib.blake2b(b"REWARD_VOUCHER", digest_size=31).digest(), "little") = 204531649764949789513498796261435013892205118946219834864707175174206065125
|
||||
|
||||
// int.from_bytes(b"REWARD_VOUCHER", byteorder="little") = 1668646695034522932676805048878418
|
||||
template REWARD_VOUCHER(){
|
||||
signal output out;
|
||||
out <== 204531649764949789513498796261435013892205118946219834864707175174206065125;
|
||||
}
|
||||
|
||||
// int.from_bytes(hashlib.blake2b(b"VOUCHER_NF", digest_size=31).digest(), "little") = 321834789402285853089731413490239982799919282776258843204385507114302874674
|
||||
|
||||
// int.from_bytes(b"VOUCHER_NF", byteorder="little") = 332011368467182873038678
|
||||
template VOUCHER_NF(){
|
||||
signal output out;
|
||||
out <== 321834789402285853089731413490239982799919282776258843204385507114302874674;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user