Skip to content

Comments

feat(l2cm): add transaction generation script & L2ContractsManager#656

Merged
0xiamflux merged 8 commits intosc-feat/l2contracts-managerfrom
poc/l2cu-tx-gen-scripts
Nov 14, 2025
Merged

feat(l2cm): add transaction generation script & L2ContractsManager#656
0xiamflux merged 8 commits intosc-feat/l2contracts-managerfrom
poc/l2cu-tx-gen-scripts

Conversation

@0xniha
Copy link

@0xniha 0xniha commented Oct 29, 2025

Closes OPT-1271

Adds a Solidity-based NUT library and scripts to deploy predeploy implementations via CREATE2 and orchestrate proxy upgrades through a new L2 Contracts Manager; bumps L1Block to v1.8.0 and extends ProxyAdmin for delegatecall execution.

  • Contracts/Managers:
    • Introduces L2ContractsManager (abstract) with execute/hooks and proxy upgrade loop.
    • Adds XForkContractsManager concrete manager (no-op hooks).
    • Adds L2ImplementationsDeployer to deploy implementations via preinstall Create2Deployer with auth and idempotency.
    • Extends ProxyAdmin with performDelegateCall to delegatecall L2ContractsManager.execute.
  • Libraries:
    • New NetworkUpgradeTxns to build DepositTx-compatible NUTs and read/write JSON artifacts.
  • Interfaces:
    • New ICreate2Deployer for CREATE2 deployments and address computation.
  • Scripts:
    • PredeployHelper to gather supported predeploys, build init code, and compute CREATE2 addresses (handles constructor-arg cases).
    • TransactionGeneration.s.sol to compose NUTs: deploy implementations, deploy L2CM via CREATE2, then execute upgrades; writes deployments/nut-xfork-upgrade-transactions.json.
  • Protocol:
    • L1Block.version() bumped to 1.8.0.
  • Tests:
    • Add comprehensive tests for NUT building/roundtrip and transaction generation/execution.
  • Repo:
    • .gitignore: ignore deployments/nut-*.json.

Note

Adds Solidity-based tooling to deploy predeploy implementations via CREATE2 and orchestrate proxy upgrades through a new L2 Contracts Manager with generated Network Upgrade Transactions.

  • L2 Upgrade Orchestration:
    • Add src/L2/L2ContractsManager.sol (abstract manager with execute hooks) and src/L2/XForkContractsManager.sol (concrete) to batch proxy upgrades.
    • Add src/L2/L2ImplementationsDeployer.sol to compute/deploy implementations via preinstall Create2Deployer with auth/idempotency.
  • Transaction Generation:
    • New library src/libraries/NetworkUpgradeTxns.sol to build DepositTx-compatible NUT artifacts and read/write JSON.
    • Add scripts scripts/deploy/PredeployHelper.sol (collects predeploys, builds init code, computes CREATE2 addrs) and scripts/deploy/TransactionGeneration.s.sol (deploy impls, deploy L2CM via CREATE2, then execute upgrades; writes deployments/nut-*.json).
  • Proxy Admin:
    • Extend src/universal/ProxyAdmin.sol with performDelegateCall to delegatecall L2ContractsManager.execute (auth-gated).
  • Interfaces:
    • Add interfaces/preinstalls/ICreate2Deployer.sol for CREATE2 deploy/address computation.
  • Tests:
    • Add test/libraries/NetworkUpgradeTxns.t.sol (hash vectors, JSON roundtrip) and test/scripts/TransactionGeneration.t.sol (end-to-end deployment/execute, structure, idempotency).
  • Repo:
    • .gitignore: ignore deployments/nut-*.json.

Written by Cursor Bugbot for commit 3516df7. This will update automatically on new commits. Configure here.

@0xniha 0xniha self-assigned this Oct 29, 2025
@linear
Copy link

linear bot commented Oct 29, 2025

@0xiamflux
Copy link

This is great, I think we might want to serialize an array of transactions instead of just a bunch of objects, other than that I love this.

0xiamflux
0xiamflux previously approved these changes Oct 30, 2025
Copy link
Member

@0xOneTony 0xOneTony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good so far! 🔥 It would be cool to use the library to create the whole set of txs for a previous set of NUTs e.g. Jovian, Isthmus and compare the json and the txs that we create against the txs of the go scripts

@0xiamflux
Copy link

This looks good so far! 🔥 It would be cool to use the library to create the whole set of txs for a previous set of NUTs e.g. Jovian, Isthmus and compare the json and the txs that we create against the txs of the go scripts

Added a test checking the file generation here

@0xiamflux 0xiamflux marked this pull request as ready for review October 30, 2025 16:40
@0xOneTony 0xOneTony changed the title feat(l2cu): add NUT lib feat(l2cm): add NUT lib Oct 30, 2025
0xniha and others added 2 commits October 31, 2025 13:33
#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 <205694301+0xniha@users.noreply.github.com>
/// @param gas Gas limit
/// @param forgeArtifactPath Contract artifact path (e.g., "GasPriceOracle.sol:GasPriceOracle")
/// @return Upgrade transaction struct
function newDeploymentTx(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this, tracking it here

@0xiamflux 0xiamflux changed the base branch from poc/l2-contract-upgrades to sc-feat/l2contracts-manager November 10, 2025 19:54
@0xiamflux 0xiamflux dismissed their stale review November 10, 2025 19:54

The base branch was changed.

@0xiamflux 0xiamflux changed the title feat(l2cm): add NUT lib feat(l2cm): add transaction generation script & L2ContractsManager Nov 10, 2025
* 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
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@0xiamflux 0xiamflux merged commit 7b281a0 into sc-feat/l2contracts-manager Nov 14, 2025
2 checks passed
@0xiamflux 0xiamflux deleted the poc/l2cu-tx-gen-scripts branch November 14, 2025 15:51
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.

4 participants