mirror of
https://github.com/logos-blockchain/logos-blockchain-pocs.git
synced 2026-01-07 07:33:12 +00:00
add a constant file and fixed a bad dst in commitment
This commit is contained in:
parent
4ca8f52ced
commit
3ea1442289
@ -1,8 +1,8 @@
|
||||
//test
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "poseidon2_hash.circom";
|
||||
include "comparator.circom";
|
||||
include "../hash_bn/poseidon2_hash.circom";
|
||||
include "../misc/comparator.circom";
|
||||
|
||||
// proof of Merkle membership of depth n
|
||||
// /!\ To call this function, it's important to check that each selector is a bit before!!!
|
||||
@ -11,7 +11,6 @@ template proof_of_membership(n) {
|
||||
signal input selector[n]; // it's the leaf's indice in big endian bits
|
||||
signal input root;
|
||||
signal input leaf;
|
||||
|
||||
|
||||
|
||||
component compression_hash[n];
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
//test
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "poseidon2_hash.circom";
|
||||
include "../hash_bn/poseidon2_hash.circom";
|
||||
include "merkle.circom";
|
||||
include "../misc/constants.circom";
|
||||
|
||||
// The unit of the note is supposed to be NMO
|
||||
template commitment(){
|
||||
@ -15,8 +16,8 @@ template commitment(){
|
||||
signal output out;
|
||||
|
||||
component hash = Poseidon2_hash(7);
|
||||
// int.from_bytes(hashlib.sha256(b"NOMOS_NOTE_CM").digest()[:-1], "little") = 181645510297841241569044198526601622686169271532834574969543446901055041748
|
||||
hash.inp[0] <== 181645510297841241569044198526601622686169271532834574969543446901055041748;
|
||||
component dst = NOMOS_NOTE_CM();
|
||||
hash.inp[0] <== dst.out;
|
||||
hash.inp[1] <== state;
|
||||
hash.inp[2] <== value;
|
||||
hash.inp[3] <== unit;
|
||||
@ -33,8 +34,8 @@ template nullifier(){
|
||||
signal output out;
|
||||
|
||||
component hash = Poseidon2_hash(3);
|
||||
// int.from_bytes(hashlib.sha256(b"NOMOS_NOTE_NF").digest()[:-1], "little") = 310945536431723660304787929213143698356852257431717126117833288836338828411
|
||||
hash.inp[0] <== 310945536431723660304787929213143698356852257431717126117833288836338828411;
|
||||
component dst = NOMOS_NOTE_NF();
|
||||
hash.inp[0] <== dst.out;
|
||||
hash.inp[1] <== commitment;
|
||||
hash.inp[2] <== secret_key;
|
||||
|
||||
@ -46,8 +47,8 @@ template derive_public_key(){
|
||||
signal output out;
|
||||
|
||||
component hash = Poseidon2_hash(2);
|
||||
// int.from_bytes(hashlib.sha256(b"NOMOS_KDF").digest()[:-1], "little") = 355994159511987982411097843485998670968942801951585260613801918349630142543
|
||||
hash.inp[0] <== 355994159511987982411097843485998670968942801951585260613801918349630142543;
|
||||
component dst = NOMOS_KDF();
|
||||
hash.inp[0] <== dst.out;
|
||||
hash.inp[1] <== secret_key;
|
||||
out <== hash.out;
|
||||
}
|
||||
|
||||
60
circom_circuits/misc/constants.circom
Normal file
60
circom_circuits/misc/constants.circom
Normal file
@ -0,0 +1,60 @@
|
||||
//test
|
||||
pragma circom 2.1.9;
|
||||
|
||||
include "../circomlib/circuits/bitify.circom";
|
||||
include "../circomlib/circuits/comparators.circom";
|
||||
|
||||
// int.from_bytes(hashlib.sha256(b"LEAD").digest()[:-1], "little") = 137836078329650723736739065075984465408055658421620421917147974048265460598
|
||||
template LEAD(){
|
||||
signal output out;
|
||||
out <== 137836078329650723736739065075984465408055658421620421917147974048265460598;
|
||||
}
|
||||
|
||||
|
||||
// int.from_bytes(hashlib.sha256(b"NOMOS_SECRET_KEY").digest()[:-1], "little") = 344114695764831179145057610008294480248205750382057360672614582644594850870
|
||||
template NOMOS_SECRET_KEY(){
|
||||
signal output out;
|
||||
out <== 344114695764831179145057610008294480248205750382057360672614582644594850870;
|
||||
}
|
||||
|
||||
|
||||
// int.from_bytes(hashlib.sha256(b"NOMOS_NONCE_CONTRIB").digest()[:-1], "little") = 193275670388587576544090216996849534520361117581542778964162861667418671481
|
||||
template NOMOS_NONCE_CONTRIB(){
|
||||
signal output out;
|
||||
out <== 193275670388587576544090216996849534520361117581542778964162861667418671481;
|
||||
}
|
||||
|
||||
|
||||
// int.from_bytes(hashlib.sha256(b"NMO").digest()[:-1], "little") = 161796427070100155131822184769584603407573991022311108406630770340454367555
|
||||
template NMO(){
|
||||
signal output out;
|
||||
out <== 161796427070100155131822184769584603407573991022311108406630770340454367555;
|
||||
}
|
||||
|
||||
|
||||
// int.from_bytes(hashlib.sha256(b"PAYMENT").digest()[:-1], "little") = 281646683567839822174419720505039861445414630574005374635737888376398200354
|
||||
template PAYMENT(){
|
||||
signal output out;
|
||||
out <== 281646683567839822174419720505039861445414630574005374635737888376398200354;
|
||||
}
|
||||
|
||||
|
||||
// int.from_bytes(hashlib.sha256(b"NOMOS_NOTE_CM").digest()[:-1], "little") = 181645510297841241569044198526601622686169271532834574969543446901055041748
|
||||
template NOMOS_NOTE_CM(){
|
||||
signal output out;
|
||||
out <== 181645510297841241569044198526601622686169271532834574969543446901055041748;
|
||||
}
|
||||
|
||||
|
||||
// int.from_bytes(hashlib.sha256(b"NOMOS_NOTE_NF").digest()[:-1], "little") = 310945536431723660304787929213143698356852257431717126117833288836338828411
|
||||
template NOMOS_NOTE_NF(){
|
||||
signal output out;
|
||||
out <== 310945536431723660304787929213143698356852257431717126117833288836338828411;
|
||||
}
|
||||
|
||||
|
||||
// int.from_bytes(hashlib.sha256(b"NOMOS_KDF").digest()[:-1], "little") = 355994159511987982411097843485998670968942801951585260613801918349630142543
|
||||
template NOMOS_KDF(){
|
||||
signal output out;
|
||||
out <== 355994159511987982411097843485998670968942801951585260613801918349630142543;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user