Skip to content

Commit

Permalink
Step 5
Browse files Browse the repository at this point in the history
  • Loading branch information
storojs72 committed Jul 25, 2023
1 parent 5cf97e6 commit 56a68f8
Show file tree
Hide file tree
Showing 7 changed files with 1,101 additions and 179 deletions.
65 changes: 57 additions & 8 deletions loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ def formatNumber(num):
f_W_snark_secondary_eval_val_C = f_W_snark_secondary['eval_val_C']
f_W_snark_secondary_eval_E_row = f_W_snark_secondary['eval_E_row']
f_W_snark_secondary_eval_E_col = f_W_snark_secondary['eval_E_col']
f_W_snark_secondary_eval_input_arr = f_W_snark_secondary['eval_input_arr']
#print(f_W_snark_secondary_eval_input_arr)
f_W_snark_secondary_eval_row_audit_ts = f_W_snark_secondary['eval_row_audit_ts']
f_W_snark_secondary_eval_row = f_W_snark_secondary['eval_row']
f_W_snark_secondary_eval_E_row_at_r_prod = f_W_snark_secondary['eval_E_row_at_r_prod']
f_W_snark_secondary_eval_row_read_ts = f_W_snark_secondary['eval_row_read_ts']



Expand Down Expand Up @@ -307,6 +313,12 @@ def formatNumber(num):
r_W_snark_primary_eval_E_row = r_W_snark_primary['eval_E_row']
r_W_snark_primary_eval_E_col = r_W_snark_primary['eval_E_col']

r_W_snark_primary_eval_input_arr = r_W_snark_primary['eval_input_arr']
r_W_snark_primary_eval_row_audit_ts = r_W_snark_primary['eval_row_audit_ts']
r_W_snark_primary_eval_row = r_W_snark_primary['eval_row']
r_W_snark_primary_eval_E_row_at_r_prod = r_W_snark_primary['eval_E_row_at_r_prod']
r_W_snark_primary_eval_row_read_ts = r_W_snark_primary['eval_row_read_ts']

ProofData = namedtuple(
'_ProofData', (
'l_u_secondary_comm_W_comm',
Expand Down Expand Up @@ -355,9 +367,11 @@ def formatNumber(num):
'f_W_snark_secondary_eval_val_C',
'f_W_snark_secondary_eval_E_row',
'f_W_snark_secondary_eval_E_col',



'f_W_snark_secondary_eval_input_arr',
'f_W_snark_secondary_eval_row_audit_ts',
'f_W_snark_secondary_eval_row',
'f_W_snark_secondary_eval_E_row_at_r_prod',
'f_W_snark_secondary_eval_row_read_ts',



Expand Down Expand Up @@ -392,6 +406,11 @@ def formatNumber(num):
'r_W_snark_primary_eval_val_C',
'r_W_snark_primary_eval_E_row',
'r_W_snark_primary_eval_E_col',
'r_W_snark_primary_eval_input_arr',
'r_W_snark_primary_eval_row_audit_ts',
'r_W_snark_primary_eval_row',
'r_W_snark_primary_eval_E_row_at_r_prod',
'r_W_snark_primary_eval_row_read_ts',
)
)

Expand Down Expand Up @@ -444,6 +463,11 @@ def formatNumber(num):
f_W_snark_secondary_eval_val_C,
f_W_snark_secondary_eval_E_row,
f_W_snark_secondary_eval_E_col,
f_W_snark_secondary_eval_input_arr,
f_W_snark_secondary_eval_row_audit_ts,
f_W_snark_secondary_eval_row,
f_W_snark_secondary_eval_E_row_at_r_prod,
f_W_snark_secondary_eval_row_read_ts,



Expand Down Expand Up @@ -478,6 +502,11 @@ def formatNumber(num):
r_W_snark_primary_eval_val_C,
r_W_snark_primary_eval_E_row,
r_W_snark_primary_eval_E_col,
r_W_snark_primary_eval_input_arr,
r_W_snark_primary_eval_row_audit_ts,
r_W_snark_primary_eval_row,
r_W_snark_primary_eval_E_row_at_r_prod,
r_W_snark_primary_eval_row_read_ts,
)

VerifierKey = namedtuple (
Expand Down Expand Up @@ -521,9 +550,18 @@ def formatNumber(num):
)

PRIVATE_KEY = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
CONTRACT_ADDRESS = "0x8f86403a4de0bb5791fa46b8e795c547942fe4cf"

PUSH_TO_PROOF_FUNC_SIG = "pushToProof(((uint256,uint256[]),(uint256,uint256,uint256[],uint256),(uint256,uint256,uint256[],uint256),uint256[],uint256[],uint256,(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256[],uint256[],((uint256[])[]),uint256[],uint256[],uint256[],uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256),(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256[],uint256[],((uint256[])[]),uint256[],uint256[],uint256[],uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256)))"
CONTRACT_ADDRESS = "0x2bdcc0de6be1f7d2ee689a0342d76f52e8efaba3"

PUSH_TO_PROOF_FUNC_SIG = "pushToProof((" \
"(uint256,uint256[])," \
"(uint256,uint256,uint256[],uint256)," \
"(uint256,uint256,uint256[],uint256)," \
"uint256[]," \
"uint256[]," \
"uint256," \
"(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256[],uint256[],((uint256[])[]),uint256[],uint256[],uint256[],uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256[],uint256,uint256,uint256,uint256)," \
"(uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256[],uint256[],((uint256[])[]),uint256[],uint256[],uint256[],uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256[],uint256,uint256,uint256,uint256)" \
"))"
PUSH_TO_VK_FUNC_SIG = "pushToVk((uint256,uint256,uint256,(uint256[],uint256[]),(uint256[],uint256[]),((uint256),uint256),(uint256,uint256,(uint256),uint256)))"

# expects hex number as string without '0x'
Expand Down Expand Up @@ -598,7 +636,13 @@ def pushToProof(data):
command = command + addNumber(data.f_W_snark_secondary_eval_val_B, True) + ','
command = command + addNumber(data.f_W_snark_secondary_eval_val_C, True) + ','
command = command + addNumber(data.f_W_snark_secondary_eval_E_row, True) + ','
command = command + addNumber(data.f_W_snark_secondary_eval_E_col, True) + '),('
command = command + addNumber(data.f_W_snark_secondary_eval_E_col, True) + ','
command = command + addNumbersArray(data.f_W_snark_secondary_eval_input_arr, True) + ','
command = command + addNumber(data.f_W_snark_secondary_eval_row_audit_ts, True) + ','
command = command + addNumber(data.f_W_snark_secondary_eval_row, True) + ','
command = command + addNumber(data.f_W_snark_secondary_eval_E_row_at_r_prod, True) + ','
command = command + addNumber(data.f_W_snark_secondary_eval_row_read_ts, True) + '),('

command = command + addNumber(data.r_W_snark_primary_comm_Az, False) + ','
command = command + addNumber(data.r_W_snark_primary_comm_Bz, False) + ','
command = command + addNumber(data.r_W_snark_primary_comm_Cz, False) + ','
Expand All @@ -621,7 +665,12 @@ def pushToProof(data):
command = command + addNumber(data.r_W_snark_primary_eval_val_B, True) + ','
command = command + addNumber(data.r_W_snark_primary_eval_val_C, True) + ','
command = command + addNumber(data.r_W_snark_primary_eval_E_row, True) + ','
command = command + addNumber(data.r_W_snark_primary_eval_E_col, True) + ')'
command = command + addNumber(data.r_W_snark_primary_eval_E_col, True) + ','
command = command + addNumbersArray(data.r_W_snark_primary_eval_input_arr, True) + ','
command = command + addNumber(data.r_W_snark_primary_eval_row_audit_ts, True) + ','
command = command + addNumber(data.r_W_snark_primary_eval_row, True) + ','
command = command + addNumber(data.r_W_snark_primary_eval_E_row_at_r_prod, True) + ','
command = command + addNumber(data.r_W_snark_primary_eval_row_read_ts, True) + ')'
command = command + ')\" --private-key ' + PRIVATE_KEY
#print(command)
os.system(command)
Expand Down
5 changes: 5 additions & 0 deletions src/NovaVerifierAbstractions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ library Abstractions {
uint256 eval_val_C;
uint256 eval_E_row;
uint256 eval_E_col;
uint256[] eval_input_arr;
uint256 eval_row_audit_ts;
uint256 eval_row;
uint256 eval_E_row_at_r_prod;
uint256 eval_row_read_ts;
}

struct CompressedSnark {
Expand Down
Loading

0 comments on commit 56a68f8

Please sign in to comment.