-
Notifications
You must be signed in to change notification settings - Fork 600
409 lines (396 loc) · 17.7 KB
/
deploy-rollup-contracts.yml
File metadata and controls
409 lines (396 loc) · 17.7 KB
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
name: Deploy Rollup Contracts
# This workflow is used to deploy rollup contracts to a cluster.
# It can be used to deploy to kind or a GKE cluster.
#
# Note that you can provide your own docker image. This helps to deploy into GKE.
# But if you're running against KIND, you can just load your aztecprotocol/aztec image with
# kind load docker-image aztecprotocol/aztec:yourtag
#
# example:
# export GOOGLE_APPLICATION_CREDENTIALS=/your/path/to/testnet-helm-sa.json
# alias lwfl=/your/path/to/aztec-clones/alpha/.github/local_workflow.sh
#
# lwfl deploy_rollup_contracts --input cluster=aztec-gke-private --input namespace=mitch-eth-devnet --input aztec_docker_image="iamjustmitch/aztec:8ebe8d7c45190b002c77e29358f2b307a23b5336" --input l1_rpc_urls="http://34.83.173.208:8545" --input mnemonic="test test test test test test test test test test test junk" --input l1_chain_id="1337" --input salt="456" --input sponsored_fpc=true --input real_verifier=true --input aztec_target_commitee_size=48
on:
workflow_call:
inputs:
cluster:
description: The cluster to deploy to, e.g. aztec-gke-private or kind
required: true
type: string
namespace:
description: The namespace to deploy to
required: true
type: string
ref:
description: The branch name to deploy from
required: true
type: string
aztec_docker_image:
description: Aztec Docker image with tag
required: true
type: string
l1_rpc_urls:
description: Comma-separated list of L1 RPC URLs
required: true
type: string
mnemonic:
description: Mnemonic for deployment
required: true
type: string
l1_chain_id:
description: L1 chain ID
required: true
type: string
salt:
description: Salt for deployment
required: true
type: string
validators:
description: Comma-separated list of validators
required: true
type: string
sponsored_fpc:
description: Enable sponsored FPC
required: true
type: boolean
real_verifier:
description: Deploy real verifier
required: true
type: boolean
# Aztec environment variables
aztec_slot_duration:
description: Aztec slot duration
required: true
type: string
aztec_epoch_duration:
description: Aztec epoch duration
required: true
type: string
aztec_target_committee_size:
description: Aztec target committee size
required: true
type: string
aztec_proof_submission_epochs:
description: Aztec proof submission epochs
required: true
type: string
aztec_activation_threshold:
description: Aztec activation threshold
required: true
type: string
aztec_ejection_threshold:
description: Aztec ejection threshold
required: true
type: string
aztec_slashing_quorum:
description: Aztec slashing quorum
required: true
type: string
aztec_slashing_round_size:
description: Aztec slashing round size
required: true
type: string
aztec_governance_proposer_quorum:
description: Aztec governance proposer quorum
required: true
type: string
aztec_governance_proposer_round_size:
description: Aztec governance proposer round size
required: true
type: string
aztec_mana_target:
description: Aztec mana target
required: true
type: string
aztec_proving_cost_per_mana:
description: Aztec proving cost per mana
required: true
type: string
secrets:
GCP_SA_KEY:
description: The JSON key for the GCP service account
required: true
KUBECONFIG_B64:
description: The base64 encoded kubeconfig
required: true
outputs:
registry_address:
description: The address of the registry contract
value: ${{ jobs.deploy_rollup_contracts.outputs.registry_address }}
slash_factory_address:
description: The address of the slash factory contract
value: ${{ jobs.deploy_rollup_contracts.outputs.slash_factory_address }}
fee_asset_handler_address:
description: The address of the fee asset handler contract
value: ${{ jobs.deploy_rollup_contracts.outputs.fee_asset_handler_address }}
governance_address:
description: The address of the governance contract
value: ${{ jobs.deploy_rollup_contracts.outputs.governance_address }}
governance_proposer_address:
description: The address of the governance proposer contract
value: ${{ jobs.deploy_rollup_contracts.outputs.governance_proposer_address }}
rollup_address:
description: The address of the rollup contract
value: ${{ jobs.deploy_rollup_contracts.outputs.rollup_address }}
inbox_address:
description: The address of the inbox contract
value: ${{ jobs.deploy_rollup_contracts.outputs.inbox_address }}
outbox_address:
description: The address of the outbox contract
value: ${{ jobs.deploy_rollup_contracts.outputs.outbox_address }}
fee_juice_portal_address:
description: The address of the fee juice portal contract
value: ${{ jobs.deploy_rollup_contracts.outputs.fee_juice_portal_address }}
zk_passport_verifier_address:
description: The address of the zk passport verifier contract
value: ${{ jobs.deploy_rollup_contracts.outputs.zk_passport_verifier_address }}
staking_asset_handler_address:
description: The address of the staking asset handler contract
value: ${{ jobs.deploy_rollup_contracts.outputs.staking_asset_handler_address }}
staking_asset_address:
description: The address of the staking asset contract
value: ${{ jobs.deploy_rollup_contracts.outputs.staking_asset_address }}
reward_distributor_address:
description: The address of the reward distributor contract
value: ${{ jobs.deploy_rollup_contracts.outputs.reward_distributor_address }}
gse_address:
description: The address of the gse contract
value: ${{ jobs.deploy_rollup_contracts.outputs.gse_address }}
coin_issuer_address:
description: The address of the coin issuer contract
value: ${{ jobs.deploy_rollup_contracts.outputs.coin_issuer_address }}
workflow_dispatch:
inputs:
cluster:
description: The cluster to deploy to, e.g. aztec-gke-private or kind
required: true
type: string
namespace:
description: The namespace to deploy to
required: true
type: string
ref:
description: The branch name to deploy from
required: true
type: string
aztec_docker_image:
description: Aztec Docker image with tag that will actually run deploy-l1-contracts
required: true
type: string
l1_rpc_urls:
description: Comma-separated list of L1 RPC URLs
required: true
type: string
mnemonic:
description: Mnemonic for deployment
required: true
type: string
l1_chain_id:
description: L1 chain ID
required: true
type: string
salt:
description: Salt for deployment
required: true
type: string
validators:
description: Comma-separated list of validators
required: true
type: string
default: ""
sponsored_fpc:
description: Enable sponsored FPC
required: true
type: boolean
real_verifier:
description: Deploy real verifier
required: true
type: boolean
# Aztec environment variables
aztec_slot_duration:
description: Aztec slot duration
required: true
type: string
aztec_epoch_duration:
description: Aztec epoch duration
required: true
type: string
aztec_target_committee_size:
description: Aztec target committee size
required: true
type: string
aztec_proof_submission_epochs:
description: Aztec proof submission epochs
required: true
type: string
aztec_activation_threshold:
description: Aztec activation threshold
required: true
type: string
aztec_ejection_threshold:
description: Aztec ejection threshold
required: true
type: string
aztec_slashing_quorum:
description: Aztec slashing quorum
required: true
type: string
aztec_slashing_round_size:
description: Aztec slashing round size
required: true
type: string
aztec_governance_proposer_quorum:
description: Aztec governance proposer quorum
required: true
type: string
aztec_governance_proposer_round_size:
description: Aztec governance proposer round size
required: true
type: string
aztec_mana_target:
description: Aztec mana target
required: true
type: string
aztec_proving_cost_per_mana:
description: Aztec proving cost per mana
required: true
type: string
jobs:
deploy_rollup_contracts:
runs-on: ubuntu-latest
outputs:
registry_address: ${{ steps.get-rollup-contracts-results.outputs.registry_address }}
slash_factory_address: ${{ steps.get-rollup-contracts-results.outputs.slash_factory_address }}
fee_asset_handler_address: ${{ steps.get-rollup-contracts-results.outputs.fee_asset_handler_address }}
governance_address: ${{ steps.get-rollup-contracts-results.outputs.governance_address }}
governance_proposer_address: ${{ steps.get-rollup-contracts-results.outputs.governance_proposer_address }}
rollup_address: ${{ steps.get-rollup-contracts-results.outputs.rollup_address }}
inbox_address: ${{ steps.get-rollup-contracts-results.outputs.inbox_address }}
outbox_address: ${{ steps.get-rollup-contracts-results.outputs.outbox_address }}
fee_juice_portal_address: ${{ steps.get-rollup-contracts-results.outputs.fee_juice_portal_address }}
zk_passport_verifier_address: ${{ steps.get-rollup-contracts-results.outputs.zk_passport_verifier_address }}
staking_asset_handler_address: ${{ steps.get-rollup-contracts-results.outputs.staking_asset_handler_address }}
staking_asset_address: ${{ steps.get-rollup-contracts-results.outputs.staking_asset_address }}
reward_distributor_address: ${{ steps.get-rollup-contracts-results.outputs.reward_distributor_address }}
gse_address: ${{ steps.get-rollup-contracts-results.outputs.gse_address }}
coin_issuer_address: ${{ steps.get-rollup-contracts-results.outputs.coin_issuer_address }}
env:
TF_STATE_BUCKET: aztec-terraform
REGION: us-west1-a
# Common Terraform variables as environment variables
TF_VAR_NAMESPACE: ${{ inputs.namespace }}
TF_VAR_AZTEC_DOCKER_IMAGE: ${{ inputs.aztec_docker_image }}
TF_VAR_L1_RPC_URLS: ${{ inputs.l1_rpc_urls }}
TF_VAR_MNEMONIC: ${{ inputs.mnemonic }}
TF_VAR_L1_CHAIN_ID: ${{ inputs.l1_chain_id }}
TF_VAR_SALT: ${{ inputs.salt }}
TF_VAR_VALIDATORS: ${{ inputs.validators }}
TF_VAR_SPONSORED_FPC: ${{ inputs.sponsored_fpc }}
TF_VAR_REAL_VERIFIER: ${{ inputs.real_verifier }}
TF_VAR_AZTEC_SLOT_DURATION: ${{ inputs.aztec_slot_duration }}
TF_VAR_AZTEC_EPOCH_DURATION: ${{ inputs.aztec_epoch_duration }}
TF_VAR_AZTEC_TARGET_COMMITTEE_SIZE: ${{ inputs.aztec_target_committee_size }}
TF_VAR_AZTEC_PROOF_SUBMISSION_EPOCHS: ${{ inputs.aztec_proof_submission_epochs }}
TF_VAR_AZTEC_ACTIVATION_THRESHOLD: ${{ inputs.aztec_activation_threshold }}
TF_VAR_AZTEC_EJECTION_THRESHOLD: ${{ inputs.aztec_ejection_threshold }}
TF_VAR_AZTEC_SLASHING_QUORUM: ${{ inputs.aztec_slashing_quorum }}
TF_VAR_AZTEC_SLASHING_ROUND_SIZE: ${{ inputs.aztec_slashing_round_size }}
TF_VAR_AZTEC_GOVERNANCE_PROPOSER_QUORUM: ${{ inputs.aztec_governance_proposer_quorum }}
TF_VAR_AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE: ${{ inputs.aztec_governance_proposer_round_size }}
TF_VAR_AZTEC_MANA_TARGET: ${{ inputs.aztec_mana_target }}
TF_VAR_AZTEC_PROVING_COST_PER_MANA: ${{ inputs.aztec_proving_cost_per_mana }}
steps:
- name: debug inputs
run: |
echo "cluster: ${{ inputs.cluster }}"
echo "namespace: ${{ inputs.namespace }}"
echo "ref: ${{ inputs.ref }}"
echo "aztec_docker_image: ${{ inputs.aztec_docker_image }}"
echo "l1_rpc_urls: ${{ inputs.l1_rpc_urls }}"
echo "l1_chain_id: ${{ inputs.l1_chain_id }}"
echo "validators: ${{ inputs.validators }}"
echo "sponsored_fpc: ${{ inputs.sponsored_fpc }}"
echo "real_verifier: ${{ inputs.real_verifier }}"
- name: Setup K8s and Terraform
uses: ./.github/actions/setup-k8s-terraform
with:
cluster: ${{ inputs.cluster }}
namespace: ${{ inputs.namespace }}
ref: ${{ inputs.ref || github.ref }}
gcp_sa_key: ${{ secrets.GCP_SA_KEY }}
kubeconfig_b64: ${{ secrets.KUBECONFIG_B64 }}
terraform_dir: spartan/terraform/deploy-rollup-contracts
tf_state_prefix: deploy-rollup-contracts
additional_state_path: ${{ inputs.salt }}
- name: Terraform Plan
working-directory: spartan/terraform/deploy-rollup-contracts
run: |
# All variables are now set as TF_VAR_ environment variables
terraform plan -out=tfplan
- name: Terraform Apply
working-directory: spartan/terraform/deploy-rollup-contracts
run: |
terraform apply tfplan
- name: Get deployment results
id: get-rollup-contracts-results
working-directory: spartan/terraform/deploy-rollup-contracts
run: |
echo "=== Deployment Results ==="
echo "Job Name: $(terraform output -raw job_name)"
if [ "$(terraform output -raw deployment_successful)" = "true" ]; then
REGISTRY_ADDRESS=$(terraform output -raw registry_address)
SLASH_FACTORY_ADDRESS=$(terraform output -raw slash_factory_address)
FEE_ASSET_HANDLER_ADDRESS=$(terraform output -raw fee_asset_handler_address)
GOVERNANCE_ADDRESS=$(terraform output -raw governance_address)
GOVERNANCE_PROPOSER_ADDRESS=$(terraform output -raw governance_proposer_address)
ROLLUP_ADDRESS=$(terraform output -raw rollup_address)
INBOX_ADDRESS=$(terraform output -raw inbox_address)
OUTBOX_ADDRESS=$(terraform output -raw outbox_address)
FEE_JUICE_PORTAL_ADDRESS=$(terraform output -raw fee_juice_portal_address)
ZK_PASSPORT_VERIFIER_ADDRESS=$(terraform output -raw zk_passport_verifier_address)
STAKING_ASSET_HANDLER_ADDRESS=$(terraform output -raw staking_asset_handler_address)
STAKING_ASSET_ADDRESS=$(terraform output -raw staking_asset_address)
REWARD_DISTRIBUTOR_ADDRESS=$(terraform output -raw reward_distributor_address)
GSE_ADDRESS=$(terraform output -raw gse_address)
COIN_ISSUER_ADDRESS=$(terraform output -raw coin_issuer_address)
echo "registry_address=$REGISTRY_ADDRESS" >> $GITHUB_OUTPUT
echo "slash_factory_address=$SLASH_FACTORY_ADDRESS" >> $GITHUB_OUTPUT
echo "fee_asset_handler_address=$FEE_ASSET_HANDLER_ADDRESS" >> $GITHUB_OUTPUT
echo "governance_address=$GOVERNANCE_ADDRESS" >> $GITHUB_OUTPUT
echo "governance_proposer_address=$GOVERNANCE_PROPOSER_ADDRESS" >> $GITHUB_OUTPUT
echo "rollup_address=$ROLLUP_ADDRESS" >> $GITHUB_OUTPUT
echo "inbox_address=$INBOX_ADDRESS" >> $GITHUB_OUTPUT
echo "outbox_address=$OUTBOX_ADDRESS" >> $GITHUB_OUTPUT
echo "fee_juice_portal_address=$FEE_JUICE_PORTAL_ADDRESS" >> $GITHUB_OUTPUT
echo "zk_passport_verifier_address=$ZK_PASSPORT_VERIFIER_ADDRESS" >> $GITHUB_OUTPUT
echo "staking_asset_handler_address=$STAKING_ASSET_HANDLER_ADDRESS" >> $GITHUB_OUTPUT
echo "staking_asset_address=$STAKING_ASSET_ADDRESS" >> $GITHUB_OUTPUT
echo "reward_distributor_address=$REWARD_DISTRIBUTOR_ADDRESS" >> $GITHUB_OUTPUT
echo "gse_address=$GSE_ADDRESS" >> $GITHUB_OUTPUT
echo "coin_issuer_address=$COIN_ISSUER_ADDRESS" >> $GITHUB_OUTPUT
echo "✅ Rollup contracts deployed successfully!"
echo ""
echo "Contract Addresses:"
echo " Registry Address: $REGISTRY_ADDRESS"
echo " Slash Factory Address: $SLASH_FACTORY_ADDRESS"
echo " Fee Asset Handler Address: $FEE_ASSET_HANDLER_ADDRESS"
echo " Governance Address: $GOVERNANCE_ADDRESS"
echo " Governance Proposer Address: $GOVERNANCE_PROPOSER_ADDRESS"
echo " Rollup Address: $ROLLUP_ADDRESS"
echo " Inbox Address: $INBOX_ADDRESS"
echo " Outbox Address: $OUTBOX_ADDRESS"
echo " Fee Juice Portal Address: $FEE_JUICE_PORTAL_ADDRESS"
echo " ZK Passport Verifier Address: $ZK_PASSPORT_VERIFIER_ADDRESS"
echo " Staking Asset Handler Address: $STAKING_ASSET_HANDLER_ADDRESS"
echo " Staking Asset Address: $STAKING_ASSET_ADDRESS"
echo " Reward Distributor Address: $REWARD_DISTRIBUTOR_ADDRESS"
echo " GSE Address: $GSE_ADDRESS"
echo " Coin Issuer Address: $COIN_ISSUER_ADDRESS"
echo ""
else
echo "⚠️ JSON output not found in logs, but job completed."
echo "Raw output:"
terraform output -json contract_addresses_json
exit 1
fi