Merge pull request #103 from logos-co/revert-101-tl/fix_pol_cst

Revert "swhitch to big endian everywhere"
This commit is contained in:
thomaslavaur 2025-09-30 09:47:49 +02:00 committed by GitHub
commit 27f0074d18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 32 additions and 32 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(1444560348471047701574), 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)]
@ -263,15 +263,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(406607590443025360526585251810465329),starting_slot,secret_root])
pk = poseidon2_hash([F(1444560348471047701574),sk])
sk = poseidon2_hash([F(256174383281726064679014503048630094),starting_slot,secret_root])
pk = poseidon2_hash([F(1296193216988918402894),sk])
note_id = poseidon2_hash([F(104091543153414482850642014312194856497),tx_hash,output_number,value,pk])
ticket = poseidon2_hash([F(21468244852299313),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(104091543153414482850642014312194856497),tx_hash,output_number,value,pk])
ticket = poseidon2_hash([F(21468244852299313),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)

View File

@ -244,15 +244,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(406607590443025360526585251810465329),starting_slot,secret_root])
pk = poseidon2_hash([F(1444560348471047701574),sk])
sk = poseidon2_hash([F(256174383281726064679014503048630094),starting_slot,secret_root])
pk = poseidon2_hash([F(1296193216988918402894),sk])
note_id = poseidon2_hash([F(104091543153414482850642014312194856497),tx_hash,output_number,value,pk])
ticket = poseidon2_hash([F(21468244852299313),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(104091543153414482850642014312194856497),tx_hash,output_number,value,pk])
ticket = poseidon2_hash([F(21468244852299313),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)

View File

@ -208,7 +208,7 @@ def PoseidonSponge(data, capacity, output_len):
secret_voucher = F(randrange(0,p,1))
reward_voucher = poseidon2_hash([F(1668651334877449245987336926807378),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)

View File

@ -4,64 +4,64 @@ pragma circom 2.1.9;
include "../circomlib/circuits/bitify.circom";
include "../circomlib/circuits/comparators.circom";
// int.from_bytes(b"LEAD_V1", byteorder="big") = 21468244852299313
// int.from_bytes(b"LEAD_V1", byteorder="little") = 13887241025832268
template LEAD_V1(){
signal output out;
out <== 21468244852299313;
out <== 13887241025832268;
}
// int.from_bytes(b"NOMOS_POL_SK_V1", byteorder="big") = 406607590443025360526585251810465329
// int.from_bytes(b"NOMOS_POL_SK_V1", byteorder="little") = 256174383281726064679014503048630094
template NOMOS_POL_SK_V1(){
signal output out;
out <== 406607590443025360526585251810465329;
out <== 256174383281726064679014503048630094;
}
// int.from_bytes(b"NOMOS_NONCE_CONTRIB_V1", byteorder="big") = 29299164684883585569547934353856711107288148897388081
// int.from_bytes(b"NOMOS_NONCE_CONTRIB_V1", byteorder="little") = 18459309511848927313552932915476467038165525790019406
template NOMOS_NONCE_CONTRIB_V1(){
signal output out;
out <== 29299164684883585569547934353856711107288148897388081;
out <== 18459309511848927313552932915476467038165525790019406;
}
// int.from_bytes(b"NOMOS_KDF", byteorder="big") = 1444560348471047701574
// int.from_bytes(b"NOMOS_KDF", byteorder="little") = 1296193216988918402894
template NOMOS_KDF(){
signal output out;
out <== 1444560348471047701574;
out <== 1296193216988918402894;
}
// int.from_bytes(b"NOMOS_NOTE_ID_V1", byteorder="big") = 104091543153414482850642014312194856497
// int.from_bytes(b"NOMOS_NOTE_ID_V1", byteorder="little") = 65580641562429851895355409762135920462
template NOMOS_NOTE_ID_V1(){
signal output out;
out <== 104091543153414482850642014312194856497;
out <== 65580641562429851895355409762135920462;
}
// int.from_bytes(b"SELECTION_RANDOMNESS_V1", byteorder="big") = 7975748052709904163696334751877473705917106215133861425
// int.from_bytes(b"SELECTION_RANDOMNESS_V1", byteorder="little") = 4725583332308041445519605499429790922252397838206780755
template SELECTION_RANDOMNESS_V1(){
signal output out;
out <== 7975748052709904163696334751877473705917106215133861425;
out <== 4725583332308041445519605499429790922252397838206780755;
}
// int.from_bytes(b"KEY_NULLIFIER_V1", byteorder="big") = 100052180852480707195751331170348914225
// int.from_bytes(b"KEY_NULLIFIER_V1", byteorder="little") = 65580642670359595206974785265459610955
template KEY_NULLIFIER_V1(){
signal output out;
out <== 100052180852480707195751331170348914225;
out <== 65580642670359595206974785265459610955;
}
// int.from_bytes(b"REWARD_VOUCHER", byteorder="big") = 1668651334877449245987336926807378
// int.from_bytes(b"REWARD_VOUCHER", byteorder="little") = 1668646695034522932676805048878418
template REWARD_VOUCHER(){
signal output out;
out <== 1668651334877449245987336926807378;
out <== 1668646695034522932676805048878418;
}
// int.from_bytes(b"VOUCHER_NF", byteorder="big") = 407586954142391778364998
// int.from_bytes(b"VOUCHER_NF", byteorder="little") = 332011368467182873038678
template VOUCHER_NF(){
signal output out;
out <== 407586954142391778364998;
out <== 332011368467182873038678;
}