Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions packages/contracts-bedrock/interfaces/L2/IBaseFeeVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { Types } from "src/libraries/Types.sol";
interface IBaseFeeVault {
error FeeVault_OnlyProxyAdminOwner();

error InvalidInitialization();
error NotInitializing();

event Initialized(uint64 version);
event Withdrawal(uint256 value, address to, address from);
event Withdrawal(uint256 value, address to, address from, Types.WithdrawalNetwork withdrawalNetwork);
event MinWithdrawalAmountUpdated(uint256 oldWithdrawalAmount, uint256 newWithdrawalAmount);
Expand All @@ -16,6 +20,12 @@ interface IBaseFeeVault {

receive() external payable;

function initialize(
address _recipient,
uint256 _minWithdrawalAmount,
Types.WithdrawalNetwork _withdrawalNetwork
)
external;
function MIN_WITHDRAWAL_AMOUNT() external view returns (uint256);
function RECIPIENT() external view returns (address);
function WITHDRAWAL_NETWORK() external view returns (Types.WithdrawalNetwork);
Expand All @@ -29,11 +39,4 @@ interface IBaseFeeVault {
function setWithdrawalNetwork(Types.WithdrawalNetwork _newWithdrawalNetwork) external;

function version() external view returns (string memory);

function __constructor__(
address _recipient,
uint256 _minWithdrawalAmount,
Types.WithdrawalNetwork _withdrawalNetwork
)
external;
}
22 changes: 10 additions & 12 deletions packages/contracts-bedrock/interfaces/L2/IFeeVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { Types } from "src/libraries/Types.sol";

interface IFeeVault {
error FeeVault_OnlyProxyAdminOwner();
error InvalidInitialization();
error NotInitializing();

event Initialized(uint64 version);

event Withdrawal(uint256 value, address to, address from);
event Withdrawal(uint256 value, address to, address from, Types.WithdrawalNetwork withdrawalNetwork);
Expand All @@ -16,6 +20,12 @@ interface IFeeVault {

receive() external payable;

function initialize(
address _recipient,
uint256 _minWithdrawalAmount,
Types.WithdrawalNetwork _withdrawalNetwork
)
external;
function MIN_WITHDRAWAL_AMOUNT() external view returns (uint256);
function RECIPIENT() external view returns (address);
function WITHDRAWAL_NETWORK() external view returns (Types.WithdrawalNetwork);
Expand All @@ -30,15 +40,3 @@ interface IFeeVault {

function __constructor__() external;
}

interface IFeeVaultConstructor {
/// NOTE: This is the real constructor for the FeeVault contract, but can't be added to the main interface because
/// it is an abstract contract, and on the scripts it gets an empty constructor automatically generated that
/// makes the `interfaces-check` script fail.
function __constructor__(
address __recipient,
uint256 __minWithdrawalAmount,
Types.WithdrawalNetwork __withdrawalNetwork
)
external;
}
22 changes: 0 additions & 22 deletions packages/contracts-bedrock/interfaces/L2/IFeeVaultInitializer.sol

This file was deleted.

17 changes: 10 additions & 7 deletions packages/contracts-bedrock/interfaces/L2/IL1FeeVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { Types } from "src/libraries/Types.sol";
interface IL1FeeVault {
error FeeVault_OnlyProxyAdminOwner();

error InvalidInitialization();
error NotInitializing();

event Initialized(uint64 version);
event Withdrawal(uint256 value, address to, address from);
event Withdrawal(uint256 value, address to, address from, Types.WithdrawalNetwork withdrawalNetwork);
event MinWithdrawalAmountUpdated(uint256 oldWithdrawalAmount, uint256 newWithdrawalAmount);
Expand All @@ -16,6 +20,12 @@ interface IL1FeeVault {

receive() external payable;

function initialize(
address _recipient,
uint256 _minWithdrawalAmount,
Types.WithdrawalNetwork _withdrawalNetwork
)
external;
function MIN_WITHDRAWAL_AMOUNT() external view returns (uint256);
function RECIPIENT() external view returns (address);
function WITHDRAWAL_NETWORK() external view returns (Types.WithdrawalNetwork);
Expand All @@ -29,11 +39,4 @@ interface IL1FeeVault {
function setWithdrawalNetwork(Types.WithdrawalNetwork _newWithdrawalNetwork) external;

function version() external view returns (string memory);

function __constructor__(
address _recipient,
uint256 _minWithdrawalAmount,
Types.WithdrawalNetwork _withdrawalNetwork
)
external;
}
17 changes: 10 additions & 7 deletions packages/contracts-bedrock/interfaces/L2/IOperatorFeeVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { Types } from "src/libraries/Types.sol";
interface IOperatorFeeVault {
error FeeVault_OnlyProxyAdminOwner();

error InvalidInitialization();
error NotInitializing();

event Initialized(uint64 version);
event Withdrawal(uint256 value, address to, address from);
event Withdrawal(uint256 value, address to, address from, Types.WithdrawalNetwork withdrawalNetwork);
event MinWithdrawalAmountUpdated(uint256 oldWithdrawalAmount, uint256 newWithdrawalAmount);
Expand All @@ -16,6 +20,12 @@ interface IOperatorFeeVault {

receive() external payable;

function initialize(
address _recipient,
uint256 _minWithdrawalAmount,
Types.WithdrawalNetwork _withdrawalNetwork
)
external;
function MIN_WITHDRAWAL_AMOUNT() external view returns (uint256);
function RECIPIENT() external view returns (address);
function WITHDRAWAL_NETWORK() external view returns (Types.WithdrawalNetwork);
Expand All @@ -29,11 +39,4 @@ interface IOperatorFeeVault {
function setWithdrawalNetwork(Types.WithdrawalNetwork _newWithdrawalNetwork) external;

function version() external view returns (string memory);

function __constructor__(
address _recipient,
uint256 _minWithdrawalAmount,
Types.WithdrawalNetwork _withdrawalNetwork
)
external;
}
17 changes: 10 additions & 7 deletions packages/contracts-bedrock/interfaces/L2/ISequencerFeeVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { Types } from "src/libraries/Types.sol";
interface ISequencerFeeVault {
error FeeVault_OnlyProxyAdminOwner();

error InvalidInitialization();
error NotInitializing();

event Initialized(uint64 version);
event Withdrawal(uint256 value, address to, address from);
event Withdrawal(uint256 value, address to, address from, Types.WithdrawalNetwork withdrawalNetwork);
event MinWithdrawalAmountUpdated(uint256 oldWithdrawalAmount, uint256 newWithdrawalAmount);
Expand All @@ -16,6 +20,12 @@ interface ISequencerFeeVault {

receive() external payable;

function initialize(
address _recipient,
uint256 _minWithdrawalAmount,
Types.WithdrawalNetwork _withdrawalNetwork
)
external;
function MIN_WITHDRAWAL_AMOUNT() external view returns (uint256);
function RECIPIENT() external view returns (address);
function WITHDRAWAL_NETWORK() external view returns (Types.WithdrawalNetwork);
Expand All @@ -30,11 +40,4 @@ interface ISequencerFeeVault {

function version() external view returns (string memory);
function l1FeeWallet() external view returns (address);

function __constructor__(
address _recipient,
uint256 _minWithdrawalAmount,
Types.WithdrawalNetwork _withdrawalNetwork
)
external;
}
105 changes: 37 additions & 68 deletions packages/contracts-bedrock/scripts/L2Genesis.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { IGasPriceOracle } from "interfaces/L2/IGasPriceOracle.sol";
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 { IFeeVault } from "interfaces/L2/IFeeVault.sol";
import { IL1Withdrawer } from "interfaces/L2/IL1Withdrawer.sol";
import { ISuperchainRevSharesCalculator } from "interfaces/L2/ISuperchainRevSharesCalculator.sol";

Expand Down Expand Up @@ -320,24 +320,16 @@ contract L2Genesis is Script {
network = Types.WithdrawalNetwork(_input.sequencerFeeVaultWithdrawalNetwork);
}

ISequencerFeeVault vault = ISequencerFeeVault(
DeployUtils.create1({
_name: "SequencerFeeVault",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(
IFeeVaultConstructor.__constructor__,
(recipient, _input.sequencerFeeVaultMinimumWithdrawalAmount, network)
)
)
})
);

address impl = Predeploys.predeployToCodeNamespace(Predeploys.SEQUENCER_FEE_WALLET);
vm.etch(impl, address(vault).code);
address impl = _setImplementationCode(Predeploys.SEQUENCER_FEE_WALLET);

/// Reset so its not included state dump
vm.etch(address(vault), "");
vm.resetNonce(address(vault));
/// Initialize the implemenation using max value for min withdrawal amount to make it unusable
ISequencerFeeVault(payable(impl)).initialize(address(0), type(uint256).max, Types.WithdrawalNetwork.L1);
// Initialize the predeploy
ISequencerFeeVault(payable(Predeploys.SEQUENCER_FEE_WALLET)).initialize({
_recipient: recipient,
_minWithdrawalAmount: _input.sequencerFeeVaultMinimumWithdrawalAmount,
_withdrawalNetwork: network
});
}

/// @notice This predeploy is following the safety invariant #1.
Expand Down Expand Up @@ -418,24 +410,16 @@ contract L2Genesis is Script {
network = Types.WithdrawalNetwork(_input.baseFeeVaultWithdrawalNetwork);
}

IBaseFeeVault vault = IBaseFeeVault(
DeployUtils.create1({
_name: "BaseFeeVault",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(
IFeeVaultConstructor.__constructor__,
(recipient, _input.baseFeeVaultMinimumWithdrawalAmount, network)
)
)
})
);

address impl = Predeploys.predeployToCodeNamespace(Predeploys.BASE_FEE_VAULT);
vm.etch(impl, address(vault).code);
address impl = _setImplementationCode(Predeploys.BASE_FEE_VAULT);

/// Reset so its not included state dump
vm.etch(address(vault), "");
vm.resetNonce(address(vault));
/// Initialize the implementation using max value for min withdrawal amount to make it unusable
IBaseFeeVault(payable(impl)).initialize(address(0), type(uint256).max, Types.WithdrawalNetwork.L1);
// Initialize the predeploy
IBaseFeeVault(payable(Predeploys.BASE_FEE_VAULT)).initialize({
_recipient: recipient,
_minWithdrawalAmount: _input.baseFeeVaultMinimumWithdrawalAmount,
_withdrawalNetwork: network
});
}

/// @notice This predeploy is following the safety invariant #2.
Expand All @@ -450,23 +434,16 @@ contract L2Genesis is Script {
network = Types.WithdrawalNetwork(_input.l1FeeVaultWithdrawalNetwork);
}

IL1FeeVault vault = IL1FeeVault(
DeployUtils.create1({
_name: "L1FeeVault",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(
IFeeVaultConstructor.__constructor__, (recipient, _input.l1FeeVaultMinimumWithdrawalAmount, network)
)
)
})
);

address impl = Predeploys.predeployToCodeNamespace(Predeploys.L1_FEE_VAULT);
vm.etch(impl, address(vault).code);
address impl = _setImplementationCode(Predeploys.L1_FEE_VAULT);

/// Reset so its not included state dump
vm.etch(address(vault), "");
vm.resetNonce(address(vault));
/// Initialize the implementation using max value for min withdrawal amount to make it unusable
IL1FeeVault(payable(impl)).initialize(address(0), type(uint256).max, Types.WithdrawalNetwork.L1);
// Initialize the predeploy
IL1FeeVault(payable(Predeploys.L1_FEE_VAULT)).initialize({
_recipient: recipient,
_minWithdrawalAmount: _input.l1FeeVaultMinimumWithdrawalAmount,
_withdrawalNetwork: network
});
}

/// @notice This predeploy is following the safety invariant #2.
Expand All @@ -481,24 +458,16 @@ contract L2Genesis is Script {
network = Types.WithdrawalNetwork(_input.operatorFeeVaultWithdrawalNetwork);
}

IOperatorFeeVault vault = IOperatorFeeVault(
DeployUtils.create1({
_name: "OperatorFeeVault",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(
IFeeVaultConstructor.__constructor__,
(recipient, _input.operatorFeeVaultMinimumWithdrawalAmount, network)
)
)
})
);

address impl = Predeploys.predeployToCodeNamespace(Predeploys.OPERATOR_FEE_VAULT);
vm.etch(impl, address(vault).code);
address impl = _setImplementationCode(Predeploys.OPERATOR_FEE_VAULT);

/// Reset so its not included state dump
vm.etch(address(vault), "");
vm.resetNonce(address(vault));
/// Initialize the implementation using max value for min withdrawal amount to make it unusable
IOperatorFeeVault(payable(impl)).initialize(address(0), type(uint256).max, Types.WithdrawalNetwork.L1);
// Initialize the predeploy
IOperatorFeeVault(payable(Predeploys.OPERATOR_FEE_VAULT)).initialize({
_recipient: recipient,
_minWithdrawalAmount: _input.operatorFeeVaultMinimumWithdrawalAmount,
_withdrawalNetwork: network
});
}

/// @notice This predeploy is following the safety invariant #2.
Expand Down
Loading