From 6b1ecffd8fa14fa9d0965807a39d8f5856003444 Mon Sep 17 00:00:00 2001 From: 0xDiscotech <131301107+0xDiscotech@users.noreply.github.com> Date: Thu, 18 Sep 2025 23:07:52 -0300 Subject: [PATCH 1/3] fix: use encode call on constructors --- .../contracts-bedrock/scripts/L2Genesis.s.sol | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/contracts-bedrock/scripts/L2Genesis.s.sol b/packages/contracts-bedrock/scripts/L2Genesis.s.sol index 7dcdd99b912..6507404e397 100644 --- a/packages/contracts-bedrock/scripts/L2Genesis.s.sol +++ b/packages/contracts-bedrock/scripts/L2Genesis.s.sol @@ -33,7 +33,8 @@ import { IL1Block } from "interfaces/L2/IL1Block.sol"; import { IFeeSplitter } from "interfaces/L2/IFeeSplitter.sol"; import { ISharesCalculator } from "interfaces/L2/ISharesCalculator.sol"; import { IFeeVault, IFeeVaultConstructor } from "interfaces/L2/IFeeVault.sol"; - +import { IL1Withdrawer } from "interfaces/L2/IL1Withdrawer.sol"; +import { ISuperchainRevSharesCalculator } from "interfaces/L2/ISuperchainRevSharesCalculator.sol"; /// @title L2Genesis /// @notice Generates the genesis state for the L2 network. /// The following safety invariants are used when setting state: @@ -41,6 +42,7 @@ import { IFeeVault, IFeeVaultConstructor } from "interfaces/L2/IFeeVault.sol"; /// effects in the constructor and no immutables in the bytecode. /// 2. A contract must be deployed using the `new` syntax if there are immutables in the code. /// Any other side effects from the init code besides setting the immutables must be cleaned up afterwards. + contract L2Genesis is Script { error L2Genesis_ChainFeesRecipientCannotBeZero(); error L2Genesis_L1FeesDepositorCannotBeZero(); @@ -84,7 +86,7 @@ contract L2Genesis is Script { uint256 internal constant PRECOMPILE_COUNT = 256; uint80 internal constant DEV_ACCOUNT_FUND_AMT = 10_000 ether; - uint256 internal constant WITHDRAWAL_MIN_GAS_LIMIT = 300_000; + uint96 internal constant WITHDRAWAL_MIN_GAS_LIMIT = 300_000; uint256 internal constant MIN_WITHDRAWAL_AMOUNT_THRESHOLD = 10 ether; /// @notice Default Anvil dev accounts. Only funded if `cfg.fundDevAccounts == true`. @@ -661,7 +663,10 @@ contract L2Genesis is Script { address l1Withdrawer = DeployUtils.create2({ _name: "L1Withdrawer.sol:L1Withdrawer", _args: DeployUtils.encodeConstructor( - abi.encode(MIN_WITHDRAWAL_AMOUNT_THRESHOLD, _input.l1FeesDepositor, WITHDRAWAL_MIN_GAS_LIMIT) + abi.encodeCall( + IL1Withdrawer.__constructor__, + (MIN_WITHDRAWAL_AMOUNT_THRESHOLD, _input.l1FeesDepositor, WITHDRAWAL_MIN_GAS_LIMIT) + ) ), _salt: l1WithdrawerSalt }); @@ -670,7 +675,12 @@ contract L2Genesis is Script { bytes32 calcSalt = keccak256("SuperchainRevSharesCalculator"); revSharesCalculator = DeployUtils.create2({ _name: "SuperchainRevSharesCalculator.sol:SuperchainRevSharesCalculator", - _args: DeployUtils.encodeConstructor(abi.encode(payable(l1Withdrawer), payable(_input.chainFeesRecipient))), + _args: DeployUtils.encodeConstructor( + abi.encodeCall( + ISuperchainRevSharesCalculator.__constructor__, + (payable(l1Withdrawer), payable(_input.chainFeesRecipient)) + ) + ), _salt: calcSalt }); } From 1f017a201ade7b040d753fefd94f34b75eb3861d Mon Sep 17 00:00:00 2001 From: 0xDiscotech <131301107+0xDiscotech@users.noreply.github.com> Date: Thu, 18 Sep 2025 23:09:36 -0300 Subject: [PATCH 2/3] fix: spacing --- packages/contracts-bedrock/scripts/L2Genesis.s.sol | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/contracts-bedrock/scripts/L2Genesis.s.sol b/packages/contracts-bedrock/scripts/L2Genesis.s.sol index 6507404e397..f2b9a3a52bc 100644 --- a/packages/contracts-bedrock/scripts/L2Genesis.s.sol +++ b/packages/contracts-bedrock/scripts/L2Genesis.s.sol @@ -35,6 +35,7 @@ import { ISharesCalculator } from "interfaces/L2/ISharesCalculator.sol"; import { IFeeVault, IFeeVaultConstructor } from "interfaces/L2/IFeeVault.sol"; import { IL1Withdrawer } from "interfaces/L2/IL1Withdrawer.sol"; import { ISuperchainRevSharesCalculator } from "interfaces/L2/ISuperchainRevSharesCalculator.sol"; + /// @title L2Genesis /// @notice Generates the genesis state for the L2 network. /// The following safety invariants are used when setting state: From b456085191efce455ca9f0007601761a00742bec Mon Sep 17 00:00:00 2001 From: 0xDiscotech <131301107+0xDiscotech@users.noreply.github.com> Date: Thu, 18 Sep 2025 23:10:08 -0300 Subject: [PATCH 3/3] fix: spacing --- packages/contracts-bedrock/scripts/L2Genesis.s.sol | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/contracts-bedrock/scripts/L2Genesis.s.sol b/packages/contracts-bedrock/scripts/L2Genesis.s.sol index f2b9a3a52bc..9132b9677fb 100644 --- a/packages/contracts-bedrock/scripts/L2Genesis.s.sol +++ b/packages/contracts-bedrock/scripts/L2Genesis.s.sol @@ -43,7 +43,6 @@ import { ISuperchainRevSharesCalculator } from "interfaces/L2/ISuperchainRevShar /// effects in the constructor and no immutables in the bytecode. /// 2. A contract must be deployed using the `new` syntax if there are immutables in the code. /// Any other side effects from the init code besides setting the immutables must be cleaned up afterwards. - contract L2Genesis is Script { error L2Genesis_ChainFeesRecipientCannotBeZero(); error L2Genesis_L1FeesDepositorCannotBeZero();