-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathjustfile
226 lines (180 loc) · 6.74 KB
/
justfile
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
default:
@just --list
# Runs the op-succinct program for a single block.
run-single l2_block_num use-cache="false" prove="false":
#!/usr/bin/env bash
CACHE_FLAG=""
if [ "{{use-cache}}" = "true" ]; then
CACHE_FLAG="--use-cache"
fi
PROVE_FLAG=""
if [ "{{prove}}" = "true" ]; then
PROVE_FLAG="--prove"
fi
cargo run --bin single --release -- --l2-block {{l2_block_num}} $CACHE_FLAG $PROVE_FLAG
# Runs the op-succinct program for multiple blocks.
run-multi start end use-cache="false" prove="false":
#!/usr/bin/env bash
CACHE_FLAG=""
if [ "{{use-cache}}" = "true" ]; then
CACHE_FLAG="--use-cache"
fi
PROVE_FLAG=""
if [ "{{prove}}" = "true" ]; then
PROVE_FLAG="--prove"
fi
cargo run --bin multi --release -- --start {{start}} --end {{end}} $CACHE_FLAG $PROVE_FLAG
# Runs the cost estimator for a given block range.
# If no range is provided, runs for the last 5 finalized blocks.
cost-estimator *args='':
#!/usr/bin/env bash
if [ -z "{{args}}" ]; then
cargo run --bin cost-estimator --release
else
cargo run --bin cost-estimator --release -- {{args}}
fi
# Output the data required for the ZKVM execution.
echo "$L1_HEAD $L2_OUTPUT_ROOT $L2_CLAIM $L2_BLOCK_NUMBER $L2_CHAIN_ID"
upgrade-l2oo l1_rpc admin_pk etherscan_api_key="":
#!/usr/bin/env bash
CHAIN_ID=$(jq -r '.chainId' contracts/opsuccinctl2ooconfig.json)
if [ "$CHAIN_ID" = "0" ] || [ -z "$CHAIN_ID" ]; then
echo "Are you sure you've filled out your opsuccinctl2ooconfig.json? Your chain ID is currently set to 0."
exit 1
fi
VERIFY=""
ETHERSCAN_API_KEY="{{etherscan_api_key}}"
if [ $ETHERSCAN_API_KEY != "" ]; then
VERIFY="--verify --verifier etherscan --etherscan-api-key $ETHERSCAN_API_KEY"
fi
L1_RPC="{{l1_rpc}}"
ADMIN_PK="{{admin_pk}}"
cd contracts && forge script script/OPSuccinctUpgrader.s.sol:OPSuccinctUpgrader --rpc-url $L1_RPC --private-key $ADMIN_PK $VERIFY --broadcast --slow
# Deploy mock verifier
deploy-mock-verifier env_file=".env":
#!/usr/bin/env bash
set -a
source {{env_file}}
set +a
if [ -z "$L1_RPC" ]; then
echo "L1_RPC not set in {{env_file}}"
exit 1
fi
if [ -z "$PRIVATE_KEY" ]; then
echo "PRIVATE_KEY not set in {{env_file}}"
exit 1
fi
cd contracts
VERIFY=""
if [ $ETHERSCAN_API_KEY != "" ]; then
VERIFY="--verify --verifier etherscan --etherscan-api-key $ETHERSCAN_API_KEY"
fi
forge script script/DeployMockVerifier.s.sol:DeployMockVerifier \
--rpc-url $L1_RPC \
--private-key $PRIVATE_KEY \
--broadcast \
$VERIFY
# Deploy the OPSuccinct L2 Output Oracle
deploy-oracle env_file=".env":
#!/usr/bin/env bash
set -euo pipefail
# First fetch rollup config using the env file
RUST_LOG=info cargo run --bin fetch-rollup-config --release -- --env-file {{env_file}}
# Load environment variables
source {{env_file}}
# cd into contracts directory
cd contracts
# forge install
forge install
VERIFY=""
if [ $ETHERSCAN_API_KEY != "" ]; then
VERIFY="--verify --verifier etherscan --etherscan-api-key $ETHERSCAN_API_KEY"
fi
ENV_VARS=""
if [ -n "${ADMIN_PK:-}" ]; then ENV_VARS="$ENV_VARS ADMIN_PK=$ADMIN_PK"; fi
if [ -n "${DEPLOY_PK:-}" ]; then ENV_VARS="$ENV_VARS DEPLOY_PK=$DEPLOY_PK"; fi
# Run the forge deployment script
$ENV_VARS forge script script/OPSuccinctDeployer.s.sol:OPSuccinctDeployer \
--rpc-url $L1_RPC \
--private-key $PRIVATE_KEY \
--broadcast \
$VERIFY
# Upgrade the OPSuccinct L2 Output Oracle
upgrade-oracle env_file=".env":
#!/usr/bin/env bash
set -euo pipefail
# First fetch rollup config using the env file
RUST_LOG=info cargo run --bin fetch-rollup-config --release -- --env-file {{env_file}}
# Load environment variables
source {{env_file}}
# cd into contracts directory
cd contracts
# forge install
forge install
# Run the forge upgrade script
ENV_VARS="L2OO_ADDRESS=$L2OO_ADDRESS"
if [ -n "${EXECUTE_UPGRADE_CALL:-}" ]; then ENV_VARS="$ENV_VARS EXECUTE_UPGRADE_CALL=$EXECUTE_UPGRADE_CALL"; fi
if [ -n "${ADMIN_PK:-}" ]; then ENV_VARS="$ENV_VARS ADMIN_PK=$ADMIN_PK"; fi
if [ -n "${DEPLOY_PK:-}" ]; then ENV_VARS="$ENV_VARS DEPLOY_PK=$DEPLOY_PK"; fi
if [ "${EXECUTE_UPGRADE_CALL:-true}" = "false" ]; then
$ENV_VARS forge script script/OPSuccinctUpgrader.s.sol:OPSuccinctUpgrader \
--rpc-url $L1_RPC \
--private-key $PRIVATE_KEY \
--etherscan-api-key $ETHERSCAN_API_KEY
else
$ENV_VARS forge script script/OPSuccinctUpgrader.s.sol:OPSuccinctUpgrader \
--rpc-url $L1_RPC \
--private-key $PRIVATE_KEY \
--verify \
--verifier etherscan \
--etherscan-api-key $ETHERSCAN_API_KEY \
--broadcast
fi
# Update the parameters of the OPSuccinct L2 Output Oracle
update-parameters env_file=".env":
#!/usr/bin/env bash
set -euo pipefail
# First fetch rollup config using the env file
RUST_LOG=info cargo run --bin fetch-rollup-config --release -- --env-file {{env_file}}
# Load environment variables
source {{env_file}}
# cd into contracts directory
cd contracts
# forge install
forge install
# Run the forge upgrade script
ENV_VARS="L2OO_ADDRESS=$L2OO_ADDRESS"
if [ -n "${EXECUTE_UPGRADE_CALL:-}" ]; then ENV_VARS="$ENV_VARS EXECUTE_UPGRADE_CALL=$EXECUTE_UPGRADE_CALL"; fi
if [ -n "${ADMIN_PK:-}" ]; then ENV_VARS="$ENV_VARS ADMIN_PK=$ADMIN_PK"; fi
if [ -n "${DEPLOY_PK:-}" ]; then ENV_VARS="$ENV_VARS DEPLOY_PK=$DEPLOY_PK"; fi
if [ "${EXECUTE_UPGRADE_CALL:-true}" = "false" ]; then
$ENV_VARS forge script script/OPSuccinctParameterUpdater.s.sol:OPSuccinctParameterUpdater \
--rpc-url $L1_RPC \
--private-key $PRIVATE_KEY \
--broadcast
else
$ENV_VARS forge script script/OPSuccinctParameterUpdater.s.sol:OPSuccinctParameterUpdater \
--rpc-url $L1_RPC \
--private-key $PRIVATE_KEY \
--broadcast
fi
deploy-dispute-game-factory env_file=".env":
#!/usr/bin/env bash
set -euo pipefail
# Load environment variables
source {{env_file}}
# cd into contracts directory
cd contracts
# forge install
forge install
VERIFY=""
if [ $ETHERSCAN_API_KEY != "" ]; then
VERIFY="--verify --verifier etherscan --etherscan-api-key $ETHERSCAN_API_KEY"
fi
# Run the forge deployment script
L2OO_ADDRESS=$L2OO_ADDRESS forge script script/OPSuccinctDGFDeployer.s.sol:OPSuccinctDFGDeployer \
--rpc-url $L1_RPC \
--private-key $PRIVATE_KEY \
--broadcast \
$VERIFY
fi