Commit c3f55fa
authored
refactor: aztec l1 contracts deployed w/ forge (#18622)
Part of
https://linear.app/aztec-labs/issue/A-316/consolidate-contract-deployments
This PR refactors the deployment pipeline for governance and rollup
contracts. The typescript deployment mechanism is fully replaced with
Forge. The forge scripts take configuration using environment variables.
They write their deployed contract addresses to a JSON file, parsed by
the caller. The results are intended to be exactly the same, barring
minor things (e.g. deploying the mock zkpassport verifier in more
cases).
Core files added:
- DeployAztecL1Contracts.s.sol - Full deployment (fresh network)
- DeployRollupForUpgrade.s.sol - Upgrade-only deployment
- DeployRollupLib.sol - Shared rollup deployment library
- DeploymentConfiguration.sol - Full deployment config. Reads env vars,
provides defaults based on network label
- RollupConfiguration.sol - Rollup-specific config (genesis state,
staking stuff, initial validators etc.)
Then lots of work making sure the right glue was in place for the
typescript side.
#
Why move to Forge for deployments?
L1 contract deployment was being done in TypeScript but clearly from the
network launching using foundry scripts, this was not ideal.
Benefits:
- forge --verify automatically posts to etherscan for us, avoiding the
complicated custom logic we had to implement
- forge simulation means we catch any problems in the entire deployment
flow early. Stuff like the previous validateConfig() that guarded
against reverts are now redundant.
- forge is able to broadcast these in transaction batches, I got 2-3
slots on Sepolia for a deploy (24-40s)
- better separation of concerns, l1-contracts now can fully own the
deployment
- foundry tests are very effective at asserting things about our
deployments under different conditions
Weirdness:
- we work around a problem in solidity where MockBlobLib was not
deployable through forge but it feels a bit hacky. I think it's
preferable to needing to rebuild with a different forge profile like
ignition-monorepo did.
Cut features:
- Deploying with a salt is no longer supported. While nice for
deterministic deployments, the reason the salt was useful before was
mainly to batch deployments. We do this with Forge, so forego the
complexity of supporting this.
This is feasible to bring back if it comes up, just would add a bunch of
conditionality to the script.
Comments on future work:
- It feels like the definition of networks is a bit sprawling and a bit
hard to analyze, as the env vars that trigger deployment can be set very
high up in the stack, in e.g. test scenario YAMLs. It would be best IMO
to make each value only defined in a specific module. Given our limited
set of distinct scenarios, we could lean in to the network label
approach like in previous ethereum/config.ts (and now
DeploymentConfiguration).
In that world, l1-contracts would choose the parameters based on a
network label and no other part of the stack could inject values thru
env vars, making analysis easier. This would be more like the
ignition-monorepo deploys (but they had fewer variations to contend
with).
For now it is a bit of a mix as network-specific governance
configuration definitions (local, staging, testnet, mainnet) from
TypeScript's config.ts have been moved to DeploymentConfiguration.sol
but it allows for a lot to be overridden with env variables.File tree
104 files changed
+2473
-3663
lines changed- .github
- docs
- developer_versioned_docs/version-v3.0.0-nightly.20251212/docs/aztec-cli
- docs-developers/docs/aztec-cli
- docs-network/reference
- l1-contracts
- scripts
- script/deploy
- src
- core
- interfaces
- libraries/rollup
- mock/libraries
- test/script
- playground/src/wallet
- release-image
- spartan
- environments
- scripts
- terraform/deploy-rollup-contracts
- yarn-project
- accounts/src
- schnorr
- single_key
- aztec/src
- cli
- local-network
- cli/src
- cmds/l1
- utils
- end-to-end/src
- bench/client_flows
- composed
- web3signer
- e2e_cross_chain_messaging
- e2e_epochs
- e2e_fees
- e2e_l1_publisher
- e2e_multi_validator
- e2e_p2p
- e2e_public_testnet
- e2e_sequencer
- fixtures
- spartan
- ethereum
- src
- contracts
- test
- foundation/src/config
- prover-node/src
- stdlib/src/l1-contracts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
104 files changed
+2473
-3663
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
| 137 | + | |
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1418 | 1418 | | |
1419 | 1419 | | |
1420 | 1420 | | |
1421 | | - | |
1422 | | - | |
1423 | | - | |
1424 | | - | |
1425 | 1421 | | |
1426 | 1422 | | |
1427 | 1423 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
617 | 617 | | |
618 | 618 | | |
619 | 619 | | |
620 | | - | |
621 | 620 | | |
622 | 621 | | |
623 | 622 | | |
| |||
1418 | 1417 | | |
1419 | 1418 | | |
1420 | 1419 | | |
1421 | | - | |
1422 | | - | |
1423 | | - | |
1424 | | - | |
1425 | 1420 | | |
1426 | 1421 | | |
1427 | 1422 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | 60 | | |
64 | 61 | | |
65 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
| 64 | + | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
99 | 98 | | |
100 | 99 | | |
101 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
60 | 59 | | |
61 | 60 | | |
62 | 61 | | |
63 | | - | |
| 62 | + | |
64 | 63 | | |
65 | | - | |
66 | 64 | | |
67 | 65 | | |
68 | 66 | | |
| |||
78 | 76 | | |
79 | 77 | | |
80 | 78 | | |
81 | | - | |
82 | 79 | | |
83 | 80 | | |
84 | 81 | | |
| |||
91 | 88 | | |
92 | 89 | | |
93 | 90 | | |
94 | | - | |
95 | 91 | | |
96 | 92 | | |
97 | 93 | | |
| |||
0 commit comments