Skip to content

Conversation

@0xiamflux
Copy link
Contributor

@0xiamflux 0xiamflux commented Nov 14, 2025

Add L2 Upgrade Transaction Generation

Adds support for generating Network Upgrade Transactions to deploy and upgrade L2 predeploy contracts during hard forks.

Changes

TransactionGeneration.s.sol

  • Generates sequence of NUTs: deploy predeploy implementations → deploy L2ContractsManager → execute upgrades
  • Uses L2ImplementationsDeployer for predeploy deployments and CREATE2 for L2ContractsManager
  • Outputs JSON artifact with all transactions

PredeployHelper.sol

  • Manages predeploy configurations and computes CREATE2 addresses
  • Handles constructor args for fee vaults and OptimismMintableERC721Factory
  • Supports all 17 predeploys

ProxyAdmin.sol

  • Adds function allowing DEPOSITOR_ACCOUNT to execute L2ContractsManager upgrades

L2ImplementationsDeployer.sol

  • A wrapper around Create2Deployer for conditional deployment of contracts, in case of an address collision simply returns the address without reverting.

NOTE: Some of the contracts and functions will be eventually renamed in future PRs to adhere to Specifications Documents, for example:

  • ProxyAdmin -> L2ProxyAdmin
  • L2ImplementationsDeployer -> ConditionalDeployer

Design Docs
Specs

)

* feat: add NUT lib

* refactor: makes txn artifact lib to produce array instead of using keys

* refactor: rename "artifactPath" to "forgeArtifactPath"

* test: add test that checks the file is generated correctly

* refactor: rename UpgradeTxn to NetworkUpgradeTxn

* feat: add readArtifact to lib & fix writeArtifact test

* feat(l2cm): add a generation script using NUT library, add sample L2CM (#663)

* feat: add a generation script using NUT library, add sample L2CM

* chore: rename script to match doc terms

* feat(l2cm): add deterministic upgrades (#665)

* feat: add deterministic upgrades to TransactionGeneration script & ProxyUpgrade struct to L2CM

* fix: predeploy deployments with constructor

* feat: add separate interface file for create2 preinstall

* docs: add natspec

* refactor: add single getChangedPredeploys

* feat: add L2ImplementationsDeployer

* refactor: add addFeeVault helper

* refactor: remove l2impldeployer from script

* fix: replace performDelegateCall signature with selector

* refactor: move proxy upgrades logic to L2CM

* refactor: use only upgradeTo

* fix: revert console log

---------

Co-authored-by: niha <[email protected]>

* feat: l2cm poc fixes (#674)

* test: add idempotent upgrade test & hard fork name input param

* fix: remove newDeploymentTx helper from NUT lib

* fix: skip proxyadmin accordingly

* fix: move tx gen script test to /scripts

* fix: remove l1block check

* refactor: l2cm execute without args

* test: add implementation checks

* refactor: remove returndata from l2cm functions

* fix: remove extra comment on predeployhelper

* docs: add natspec for XForkContractsManager

* fix: remove xforkcm constructor checks

* test: add expect upgrade event emission

---------

Co-authored-by: Flux <[email protected]>
@0xiamflux
Copy link
Contributor Author

Closing in favor of these other PRs here and here

@0xiamflux 0xiamflux closed this Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants