mirror of
https://github.com/logos-blockchain/logos-blockchain-pocs.git
synced 2026-01-05 14:43:08 +00:00
remove deprecated proof
This commit is contained in:
parent
11b9d06357
commit
36d2c7a31c
@ -203,11 +203,10 @@ def PoseidonSponge(data, capacity, output_len):
|
||||
return output
|
||||
|
||||
if len(sys.argv) != Integer(3):
|
||||
print("Usage: <script> <private or public> <number of input>")
|
||||
print("Usage: <script> <number of input>")
|
||||
exit()
|
||||
|
||||
selector = str(sys.argv[Integer(1)])
|
||||
nInput = int(sys.argv[Integer(2)])
|
||||
nInput = int(sys.argv[Integer(1)])
|
||||
|
||||
value = [F(randrange(0,2**64 - 1,1)) for i in range(nInput)]
|
||||
unit = F(19676183153323264216568033390884511718872104179761154996527087027500271872825)
|
||||
@ -218,107 +217,19 @@ sk = [F(randrange(0,p,1)) for i in range(nInput)]
|
||||
|
||||
data_msg = F(randrange(0,p,1))
|
||||
|
||||
if selector == "private":
|
||||
if nInput == 1:
|
||||
with open("input.json", "w") as file:
|
||||
file.write('{\n\t"state":\t\t\t\t\t\t"'+str(state[0])+'",')
|
||||
file.write('\n\t"value":\t\t\t\t\t\t"'+str(value[0])+'",')
|
||||
file.write('\n\t"nonce" :\t\t\t\t\t\t"'+str(nonce[0])+'",')
|
||||
file.write('\n\t"zoneID" :\t\t\t\t\t\t"'+str(zoneID[0])+'",')
|
||||
file.write('\n\t"secret_key" :\t\t\t\t\t\t"'+str(sk[0])+'",')
|
||||
file.write('\n\t"minting_covenant" :\t\t\t\t\t\t"'+str(0)+'",')
|
||||
file.write('\n\t"transfer_covenant" :\t\t\t\t\t\t"'+str(0)+'",')
|
||||
file.write('\n\t"burning_covenant" :\t\t\t\t\t\t"'+str(0)+'",')
|
||||
file.write('\n\t"attached_data" :\t\t\t\t\t\t"'+str(data_msg)+'"}')
|
||||
else:
|
||||
with open("input.json", "w") as file:
|
||||
file.write('{\n\t"state" :\t\t\t\t\t[')
|
||||
for i in range(nInput):
|
||||
file.write('"')
|
||||
file.write(str(state[i]))
|
||||
file.write('"')
|
||||
if i == nInput - 1:
|
||||
file.write('],')
|
||||
else:
|
||||
file.write(',')
|
||||
file.write('\n\t"value" :\t\t\t\t\t[')
|
||||
for i in range(nInput):
|
||||
file.write('"')
|
||||
file.write(str(value[i]))
|
||||
file.write('"')
|
||||
if i == nInput - 1:
|
||||
file.write('],')
|
||||
else:
|
||||
file.write(',')
|
||||
file.write('\n\t"nonce" :\t\t\t\t\t[')
|
||||
for i in range(nInput):
|
||||
file.write('"')
|
||||
file.write(str(nonce[i]))
|
||||
file.write('"')
|
||||
if i == nInput - 1:
|
||||
file.write('],')
|
||||
else:
|
||||
file.write(',')
|
||||
file.write('\n\t"zoneID" :\t\t\t\t\t[')
|
||||
for i in range(nInput):
|
||||
file.write('"')
|
||||
file.write(str(zoneID[i]))
|
||||
file.write('"')
|
||||
if i == nInput - 1:
|
||||
file.write('],')
|
||||
else:
|
||||
file.write(',')
|
||||
file.write('\n\t"secret_key" :\t\t\t\t\t[')
|
||||
for i in range(nInput):
|
||||
file.write('"')
|
||||
file.write(str(sk[i]))
|
||||
file.write('"')
|
||||
if i == nInput - 1:
|
||||
file.write('],')
|
||||
else:
|
||||
file.write(',')
|
||||
file.write('\n\t"minting_covenant" :\t\t\t\t\t[')
|
||||
for i in range(nInput):
|
||||
file.write('"')
|
||||
file.write(str(0))
|
||||
file.write('"')
|
||||
if i == nInput - 1:
|
||||
file.write('],')
|
||||
else:
|
||||
file.write(',')
|
||||
file.write('\n\t"transfer_covenant" :\t\t\t\t\t[')
|
||||
for i in range(nInput):
|
||||
file.write('"')
|
||||
file.write(str(0))
|
||||
file.write('"')
|
||||
if i == nInput - 1:
|
||||
file.write('],')
|
||||
else:
|
||||
file.write(',')
|
||||
file.write('\n\t"burning_covenant" :\t\t\t\t\t[')
|
||||
for i in range(nInput):
|
||||
file.write('"')
|
||||
file.write(str(0))
|
||||
file.write('"')
|
||||
if i == nInput - 1:
|
||||
file.write('],')
|
||||
else:
|
||||
file.write(',')
|
||||
file.write('\n\t"attached_data" :\t\t\t\t\t\t"'+str(data_msg)+'"}')
|
||||
if selector == "public":
|
||||
if nInput == 1:
|
||||
with open("input.json", "w") as file:
|
||||
file.write('{\n\t"secret_key" :\t\t\t\t\t\t"'+str(sk[0])+'",')
|
||||
file.write('\n\t"attached_data" :\t\t\t\t\t\t"'+str(data_msg)+'"}')
|
||||
else:
|
||||
with open("input.json", "w") as file:
|
||||
file.write('{\n\t"secret_key" :\t\t\t\t\t[')
|
||||
for i in range(nInput):
|
||||
file.write('"')
|
||||
file.write(str(sk[i]))
|
||||
file.write('"')
|
||||
if i == nInput - 1:
|
||||
file.write('],')
|
||||
else:
|
||||
file.write(',')
|
||||
file.write('\n\t"attached_data" :\t\t\t\t\t\t"'+str(data_msg)+'"}')
|
||||
if nInput == 1:
|
||||
with open("input.json", "w") as file:
|
||||
file.write('{\n\t"secret_key" :\t\t\t\t\t\t"'+str(sk[0])+'",')
|
||||
file.write('\n\t"attached_data" :\t\t\t\t\t\t"'+str(data_msg)+'"}')
|
||||
else:
|
||||
with open("input.json", "w") as file:
|
||||
file.write('{\n\t"secret_key" :\t\t\t\t\t[')
|
||||
for i in range(nInput):
|
||||
file.write('"')
|
||||
file.write(str(sk[i]))
|
||||
file.write('"')
|
||||
if i == nInput - 1:
|
||||
file.write('],')
|
||||
else:
|
||||
file.write(',')
|
||||
file.write('\n\t"attached_data" :\t\t\t\t\t\t"'+str(data_msg)+'"}')
|
||||
@ -4,51 +4,7 @@ pragma circom 2.1.9;
|
||||
include "../ledger/notes.circom";
|
||||
include "../misc/constants.circom";
|
||||
|
||||
template proof_of_private_note_ownership(maxInput){
|
||||
signal input state[maxInput];
|
||||
signal input value[maxInput];
|
||||
signal input nonce[maxInput];
|
||||
signal input zoneID[maxInput];
|
||||
signal input secret_key[maxInput];
|
||||
signal input minting_covenant[maxInput];
|
||||
signal input spending_covenant[maxInput];
|
||||
signal input burning_covenant[maxInput];
|
||||
|
||||
signal input attached_data;
|
||||
|
||||
signal output commitment[maxInput];
|
||||
|
||||
component pk[maxInput];
|
||||
for(var i =0; i<maxInput; i++){
|
||||
pk[i] = derive_public_key();
|
||||
pk[i].secret_key <== secret_key[i];
|
||||
}
|
||||
|
||||
component unit[maxInput];
|
||||
for(var i=0; i< maxInput; i++){
|
||||
unit[i] = derive_unit();
|
||||
unit[i].minting_covenant <== minting_covenant[i];
|
||||
unit[i].spending_covenant <== spending_covenant[i];
|
||||
unit[i].burning_covenant <== burning_covenant[i];
|
||||
}
|
||||
|
||||
component cm[maxInput];
|
||||
for(var i =0; i< maxInput; i++){
|
||||
cm[i] = commitment();
|
||||
cm[i].state <== state[i];
|
||||
cm[i].value <== value[i];
|
||||
cm[i].unit <== unit[i].out;
|
||||
cm[i].nonce <== nonce[i];
|
||||
cm[i].zoneID <== zoneID[i];
|
||||
cm[i].public_key <== pk[i].out;
|
||||
}
|
||||
|
||||
// dummy constraint to avoid unused public input to be erased after compilation optimisation
|
||||
signal dummy;
|
||||
dummy <== attached_data * attached_data;
|
||||
}
|
||||
|
||||
template proof_of_public_note_ownership(maxInput){
|
||||
template proof_of_unshielded_note_ownership(maxInput){
|
||||
signal input secret_key[maxInput];
|
||||
|
||||
signal input attached_data;
|
||||
@ -67,4 +23,4 @@ template proof_of_public_note_ownership(maxInput){
|
||||
dummy <== attached_data * attached_data;
|
||||
}
|
||||
|
||||
component main {public [attached_data]}= proof_of_public_note_ownership(1);
|
||||
component main {public [attached_data]}= proof_of_unshielded_note_ownership(1);
|
||||
Loading…
x
Reference in New Issue
Block a user