-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb_setup.sh
executable file
·150 lines (128 loc) · 4.14 KB
/
db_setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/bin/bash
# MySQL/MariaDB connection parameters
DB_USER="root"
DB_PASS="temp123"
DB_NAME="quantum"
# Create the database and tables
mysql -u"$DB_USER" -p"$DB_PASS" -e "
CREATE DATABASE IF NOT EXISTS $DB_NAME;
USE $DB_NAME;
CREATE TABLE IF NOT EXISTS reduction_circuit (
circuit_id VARCHAR(255) PRIMARY KEY,
proving_key_path VARCHAR(255),
vk_path VARCHAR(255),
n_inner_pis INT,
n_inner_commitments INT DEFAULT NULL,
proving_scheme VARCHAR(255),
KEY idx_n_inner_commitments (n_inner_commitments)
);
CREATE TABLE IF NOT EXISTS protocol (
protocol_name varchar(255),
auth_token varchar(255) DEFAULT NULL,
is_proof_repeat_allowed INT DEFAULT 0,
PRIMARY KEY (protocol_name)
);
CREATE TABLE IF NOT EXISTS auth (
auth_token varchar(255),
is_master INT DEFAULT 0,
PRIMARY KEY (auth_token)
);
CREATE TABLE IF NOT EXISTS user_circuit_data (
circuit_hash VARCHAR(255) PRIMARY KEY,
vk_path VARCHAR(255),
reduction_circuit_id VARCHAR(255) DEFAULT NULL,
n_pis INT,
n_commitments INT DEFAULT NULL,
proving_scheme VARCHAR(255),
circuit_reduction_status INT,
bonsai_image_id varchar(255) DEFAULT NULL,
protocol_name VARCHAR(255),
version INT DEFAULT NULL,
cycle_intake int DEFAULT NULL,
FOREIGN KEY (reduction_circuit_id) REFERENCES reduction_circuit(circuit_id),
FOREIGN KEY (protocol_name) REFERENCES protocol(protocol_name)
);
CREATE TABLE IF NOT EXISTS task (
id INT AUTO_INCREMENT PRIMARY KEY,
user_circuit_hash VARCHAR(255),
task_type INT,
proof_hash VARCHAR(255),
proof_id INT,
task_status INT
);
CREATE INDEX id_task_status ON task(task_status);
CREATE TABLE IF NOT EXISTS proof (
id INT AUTO_INCREMENT PRIMARY KEY,
proof_hash VARCHAR(255),
pis_path VARCHAR(255),
proof_path VARCHAR(255),
reduction_proof_path VARCHAR(255),
reduction_proof_pis_path VARCHAR(255),
superproof_id INT,
reduction_time INT,
proof_status INT,
user_circuit_hash VARCHAR(255),
public_inputs varchar(1200) DEFAULT NULL,
input_id varchar(255) DEFAULT NULL,
session_id varchar(255) DEFAULT NULL,
reducded_proof_receipt_path varchar(255) DEFAULT NULL,
version INT DEFAULT NULL,
cycle_used int DEFAULT NULL,
FOREIGN KEY (user_circuit_hash) REFERENCES user_circuit_data(circuit_hash)
);
CREATE INDEX idx_proof_status ON proof(proof_status);
CREATE TABLE IF NOT EXISTS superproof (
id INT AUTO_INCREMENT PRIMARY KEY,
proof_ids VARCHAR(255),
superproof_proof_path VARCHAR(255),
superproof_pis_path VARCHAR(255),
transaction_hash VARCHAR(255),
gas_cost DECIMAL(18,3) DEFAULT NULL,
eth_price DECIMAL(18,3) DEFAULT NULL,
agg_time INT,
status INT,
superproof_root VARCHAR(255),
superproof_leaves_path VARCHAR(255),
onchain_submission_time datetime DEFAULT NULL,
total_proof_ver_cost decimal(18,2) DEFAULT NULL,
total_cost_usd decimal(18,2) DEFAULT NULL,
total_proving_time decimal(18,2) DEFAULT NULL,
previous_superproof_root varchar(255) DEFAULT NULL,
imt_proof_path VARCHAR(255) DEFAULT NULL,
imt_pis_path VARCHAR(255) DEFAULT NULL,
session_id varchar(255) DEFAULT NULL,
snark_session_id varchar(255) DEFAULT NULL,
receipt_path varchar(255) DEFAULT NULL,
snark_receipt_path varchar(255) DEFAULT NULL,
version int DEFAULT NULL,
agg_cycle_used int DEFAULT NULL,
total_cycle_used bigint DEFAULT NULL,
snark_cycle_used int DEFAULT NULL
);
CREATE TABLE IF NOT EXISTS bonsai_image (
image_id varchar(255) DEFAULT NULL,
elf_file_path varchar(255) DEFAULT NULL,
circuit_verifying_id varchar(255) DEFAULT NULL,
proving_scheme varchar(255) DEFAULT NULL,
is_aggregation_image_id int DEFAULT NULL
);
CREATE TABLE IF NOT EXISTS proof_submission_config (
proof_submission_time int DEFAULT NULL
);
CREATE TABLE IF NOT EXISTS proof_system (
proof_system varchar(255) DEFAULT NULL
);
CREATE TABLE IF NOT EXISTS protocol_ui (
protocol_name varchar(255) DEFAULT NULL,
is_aggregated int DEFAULT '0',
display_name varchar(255) DEFAULT NULL
);
CREATE TABLE IF NOT EXISTS superproof_contract_config (
address varchar(255) DEFAULT NULL
);
CREATE TABLE IF NOT EXISTS cost_saved (
total_gas_saved DECIMAL(18,2) DEFAULT 0,
total_usd_saved DECIMAL(18,2) DEFAULT 0
);
INSERT INTO cost_saved VALUES (0,0);
"