Skip to content

feat: add NUT Bundle generation#19248

Open
0xniha wants to merge 21 commits intoethereum-optimism:developfrom
defi-wonderland:feat/l2cm-l2-fork-test
Open

feat: add NUT Bundle generation#19248
0xniha wants to merge 21 commits intoethereum-optimism:developfrom
defi-wonderland:feat/l2cm-l2-fork-test

Conversation

@0xniha
Copy link
Contributor

@0xniha 0xniha commented Feb 19, 2026

Description

Adds infrastructure for generating Network Upgrade Transaction (NUT) bundles for L2 hardfork upgrades.

  • GenerateNUTBundle: Script that generates deterministic upgrade transaction bundles.
  • GenerateNUTBundleUtils: Helper contract for constructing deployment and upgrade transactions.
  • NetworkUpgradeTxns: Library for serializing/deserializing NUT artifacts to JSON with DepositTx-compatible metadata

Closes 18834

Pending

  • L2CM deployment and upgrade steps are currently commented out pending L2CM merge.
  • Tests for GenerateNUTBundleUtils.

@0xniha 0xniha requested a review from a team as a code owner February 19, 2026 21:05
@0xniha 0xniha requested a review from ajsutton February 19, 2026 21:05
@0xniha 0xniha marked this pull request as draft February 19, 2026 21:05
/// @param fork The hardfork this bundle is for (e.g., Fork.JOVIAN, Fork.KRYPTON).
/// @param salt CREATE2 salt for deterministic address computation.
struct Input {
Fork fork;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that we should specify the fork here. Rather, the JSON output should just be used for whatever the next fork is, and that fork will be identified that time of canonicalization.

Copy link
Contributor Author

@0xniha 0xniha Feb 24, 2026

Choose a reason for hiding this comment

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

The intention here is to make the script reusable to generate a bundle for different forks, and also make explicit the additional deployments/upgrades that are specific to a given fork.
e.g: deploy cd.

An alternative approach would be to include the additional deployments/upgrades, with comments explicitly stating that they are fork-specific.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the input arguments here: 1aed88f.

The only input left is l1ChainId that is needed for OptimismMintableERC721Factory constructor. We should consider upgrading it to use the Initializable pattern.
This will allow to satisfy the determinism property of the script.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, I think we should upgrade it to use the Initializable pattern. It probably makes sense to do it in the PR since it's a small change, and will allow us to get it right from the start, what do you think @0xniha?

Also, we should update the 'safety invariants' in L2Genesis.s.sol, as I don't think we'll have invariant #2 anymore (and we stopped using the "new" keyword a long time ago.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree! I’ll implement it in this PR, and if the diff turns out to be too large, I’ll split it into a separate one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed here: 4e6c17e

…idate utils into UpgradeUtils

* refactor: remove fork, salt and cgt from bundle script input

* refactor: comments and constants

* refactor: consolidate nut bundle utilities into UpgradeUtils

* fix: proxy admin get code

* fix: remove unused import Fork
@0xniha
Copy link
Contributor Author

0xniha commented Feb 25, 2026

/ci authorize 1aed88f

@0xniha 0xniha marked this pull request as ready for review February 25, 2026 16:22
@aliersh
Copy link
Contributor

aliersh commented Feb 25, 2026

@0xniha I added a comment to #18834 as an FMA follow-up to consider

@0xniha
Copy link
Contributor Author

0xniha commented Feb 25, 2026

/ci authorize 66e55f8

@0xniha
Copy link
Contributor Author

0xniha commented Feb 25, 2026

/ci authorize 8f55173

// Phase 1: Pre-implementation deployments
// Add fork-specific deployment or upgrade txns that must occur prior to the implementation deployments
// phase.
_preImplementationDeployments();
Copy link
Contributor

Choose a reason for hiding this comment

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

How do you think we should handle these transactions once the first fork has been executed? I would be open to keeping the logic simple, and just adding a TODO + Issue to come in here and remove the CD deployment afterwards.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I think adding a TODO + Issue would work!

@0xniha
Copy link
Contributor Author

0xniha commented Feb 27, 2026

/ci authorize 66ce05e

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.

[L2CM Upgrades] Create Solidity script to generate deterministic JSON NUT bundles

4 participants