-
Notifications
You must be signed in to change notification settings - Fork 35
/
justfile
175 lines (141 loc) · 5.15 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
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.
cost-estimator start end:
#!/usr/bin/env bash
cargo run --bin cost-estimator --release -- --start {{start}} --end {{end}}
# 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
VERIFY_FLAGS=""
if [ ! -z "$ETHERSCAN_API_KEY" ]; then
VERIFY_FLAGS="--verify --verifier etherscan --etherscan-api-key $ETHERSCAN_API_KEY"
fi
cd contracts
forge script script/DeployMockVerifier.s.sol:DeployMockVerifier \
--rpc-url $L1_RPC \
--private-key $PRIVATE_KEY \
--broadcast \
$VERIFY_FLAGS
# 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
# Run the forge deployment script
forge script script/OPSuccinctDeployer.s.sol:OPSuccinctDeployer \
--rpc-url $L1_RPC \
--private-key $PRIVATE_KEY \
--broadcast \
--verify \
--verifier etherscan \
--etherscan-api-key $ETHERSCAN_API_KEY
# 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
if [ "${EXECUTE_UPGRADE_CALL:-true}" = "false" ]; then
L2OO_ADDRESS=$L2OO_ADDRESS forge script script/OPSuccinctUpgrader.s.sol:OPSuccinctUpgrader \
--rpc-url $L1_RPC \
--private-key $PRIVATE_KEY \
--etherscan-api-key $ETHERSCAN_API_KEY
else
L2OO_ADDRESS=$L2OO_ADDRESS 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
if [ "${EXECUTE_UPGRADE_CALL:-true}" = "false" ]; then
L2OO_ADDRESS=$L2OO_ADDRESS forge script script/OPSuccinctParameterUpdater.s.sol:OPSuccinctParameterUpdater \
--rpc-url $L1_RPC \
--private-key $PRIVATE_KEY
else
L2OO_ADDRESS=$L2OO_ADDRESS forge script script/OPSuccinctParameterUpdater.s.sol:OPSuccinctParameterUpdater \
--rpc-url $L1_RPC \
--private-key $PRIVATE_KEY \
--broadcast
fi