diff --git a/scripts/foundry/DeployL1BridgeContracts.s.sol b/scripts/foundry/DeployL1BridgeContracts.s.sol index 5044e150..0373c416 100644 --- a/scripts/foundry/DeployL1BridgeContracts.s.sol +++ b/scripts/foundry/DeployL1BridgeContracts.s.sol @@ -16,6 +16,8 @@ import {L1ERC721Gateway} from "../../src/L1/gateways/L1ERC721Gateway.sol"; import {L1ETHGateway} from "../../src/L1/gateways/L1ETHGateway.sol"; import {L1GatewayRouter} from "../../src/L1/gateways/L1GatewayRouter.sol"; import {L1MessageQueueV1WithGasPriceOracle} from "../../src/L1/rollup/L1MessageQueueV1WithGasPriceOracle.sol"; +import {L1MessageQueueV2} from "../../src/L1/rollup/L1MessageQueueV2.sol"; +import {SystemConfig} from "../../src/L1/system-contract/SystemConfig.sol"; import {L1ScrollMessenger} from "../../src/L1/L1ScrollMessenger.sol"; import {L1StandardERC20Gateway} from "../../src/L1/gateways/L1StandardERC20Gateway.sol"; import {L1WETHGateway} from "../../src/L1/gateways/L1WETHGateway.sol"; @@ -44,8 +46,10 @@ contract DeployL1BridgeContracts is Script { address L1_PROXY_ADMIN_ADDR = vm.envAddress("L1_PROXY_ADMIN_ADDR"); address L1_SCROLL_CHAIN_PROXY_ADDR = vm.envAddress("L1_SCROLL_CHAIN_PROXY_ADDR"); - address L1_MESSAGE_QUEUE_PROXY_ADDR = vm.envAddress("L1_MESSAGE_QUEUE_PROXY_ADDR"); + address L1_MESSAGE_QUEUE_V1_PROXY_ADDR = vm.envAddress("L1_MESSAGE_QUEUE_V1_PROXY_ADDR"); + address L1_MESSAGE_QUEUE_V2_PROXY_ADDR = vm.envAddress("L1_MESSAGE_QUEUE_V2_PROXY_ADDR"); address L1_SCROLL_MESSENGER_PROXY_ADDR = vm.envAddress("L1_SCROLL_MESSENGER_PROXY_ADDR"); + address L1_SYSTEM_CONFIG_PROXY_ADDR = vm.envAddress("L1_SYSTEM_CONFIG_PROXY_ADDR"); address L2_SCROLL_MESSENGER_PROXY_ADDR = vm.envAddress("L2_SCROLL_MESSENGER_PROXY_ADDR"); address L2_CUSTOM_ERC20_GATEWAY_PROXY_ADDR = vm.envAddress("L2_CUSTOM_ERC20_GATEWAY_PROXY_ADDR"); @@ -71,6 +75,7 @@ contract DeployL1BridgeContracts is Script { deployZkEvmVerifier(); deployMultipleVersionRollupVerifier(); deployL1Whitelist(); + deploySystemConfig(); deployEnforcedTxGateway(); deployL1MessageQueue(); deployL2GasPriceOracle(); @@ -110,33 +115,47 @@ contract DeployL1BridgeContracts is Script { logAddress("L1_WHITELIST_ADDR", address(whitelist)); } + function deploySystemConfig() internal { + SystemConfig sysConfig = new SystemConfig(); + logAddress("L1_SYSTEM_CONFIG_IMPLEMENTATION_ADDR", address(sysConfig)); + } + function deployScrollChain() internal { ScrollChain impl = new ScrollChain( CHAIN_ID_L2, - L1_MESSAGE_QUEUE_PROXY_ADDR, - L1_MESSAGE_QUEUE_PROXY_ADDR, + L1_MESSAGE_QUEUE_V1_PROXY_ADDR, + L1_MESSAGE_QUEUE_V2_PROXY_ADDR, address(rollupVerifier), - address(0) + L1_SYSTEM_CONFIG_PROXY_ADDR ); logAddress("L1_SCROLL_CHAIN_IMPLEMENTATION_ADDR", address(impl)); } function deployL1MessageQueue() internal { - L1MessageQueueV1WithGasPriceOracle impl = new L1MessageQueueV1WithGasPriceOracle( + L1MessageQueueV1WithGasPriceOracle v1_impl = new L1MessageQueueV1WithGasPriceOracle( L1_SCROLL_MESSENGER_PROXY_ADDR, L1_SCROLL_CHAIN_PROXY_ADDR, address(enforcedTxGateway) ); - logAddress("L1_MESSAGE_QUEUE_IMPLEMENTATION_ADDR", address(impl)); + logAddress("L1_MESSAGE_QUEUE_V1_IMPLEMENTATION_ADDR", address(v1_impl)); + + L1MessageQueueV2 v2_impl = new L1MessageQueueV2( + L1_SCROLL_MESSENGER_PROXY_ADDR, + L1_SCROLL_CHAIN_PROXY_ADDR, + address(enforcedTxGateway), + L1_MESSAGE_QUEUE_V1_PROXY_ADDR, + L1_SYSTEM_CONFIG_PROXY_ADDR + ); + logAddress("L1_MESSAGE_QUEUE_V2_IMPLEMENTATION_ADDR", address(v2_impl)); } function deployL1ScrollMessenger() internal { L1ScrollMessenger impl = new L1ScrollMessenger( L2_SCROLL_MESSENGER_PROXY_ADDR, L1_SCROLL_CHAIN_PROXY_ADDR, - L1_MESSAGE_QUEUE_PROXY_ADDR, - L1_MESSAGE_QUEUE_PROXY_ADDR + L1_MESSAGE_QUEUE_V1_PROXY_ADDR, + L1_MESSAGE_QUEUE_V2_PROXY_ADDR ); logAddress("L1_SCROLL_MESSENGER_IMPLEMENTATION_ADDR", address(impl)); diff --git a/scripts/foundry/DeployL1BridgeProxyPlaceholder.s.sol b/scripts/foundry/DeployL1BridgeProxyPlaceholder.s.sol index 2d9afe4e..03808f04 100644 --- a/scripts/foundry/DeployL1BridgeProxyPlaceholder.s.sol +++ b/scripts/foundry/DeployL1BridgeProxyPlaceholder.s.sol @@ -25,7 +25,8 @@ contract DeployL1BridgeProxyPlaceholder is Script { deployProxyAdmin(); deployPlaceHolder(); - deployL1MessageQueue(); + deploySystemConfig(); + deployMessageQueue(); deployScrollChain(); deployL1ETHGateway(); deployL1WETHGateway(); @@ -50,6 +51,16 @@ contract DeployL1BridgeProxyPlaceholder is Script { logAddress("L1_PROXY_IMPLEMENTATION_PLACEHOLDER_ADDR", address(placeholder)); } + function deploySystemConfig() internal { + TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy( + address(placeholder), + address(proxyAdmin), + new bytes(0) + ); + + logAddress("L1_SYSTEM_CONFIG_PROXY_ADDR", address(proxy)); + } + function deployScrollChain() internal { TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy( address(placeholder), @@ -60,13 +71,20 @@ contract DeployL1BridgeProxyPlaceholder is Script { logAddress("L1_SCROLL_CHAIN_PROXY_ADDR", address(proxy)); } - function deployL1MessageQueue() internal { - TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy( + function deployMessageQueue() internal { + TransparentUpgradeableProxy v1_proxy = new TransparentUpgradeableProxy( + address(placeholder), + address(proxyAdmin), + new bytes(0) + ); + logAddress("L1_MESSAGE_QUEUE_V1_PROXY_ADDR", address(v1_proxy)); + + TransparentUpgradeableProxy v2_proxy = new TransparentUpgradeableProxy( address(placeholder), address(proxyAdmin), new bytes(0) ); - logAddress("L1_MESSAGE_QUEUE_PROXY_ADDR", address(proxy)); + logAddress("L1_MESSAGE_QUEUE_V2_PROXY_ADDR", address(v2_proxy)); } function deployL1StandardERC20Gateway() internal { diff --git a/scripts/foundry/DeployL1SystemConfig.s.sol b/scripts/foundry/DeployL1SystemConfig.s.sol deleted file mode 100644 index 1f59beda..00000000 --- a/scripts/foundry/DeployL1SystemConfig.s.sol +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.24; - -import {Script} from "forge-std/Script.sol"; -import {SystemConfig} from "../../src/L1/system-contract/SystemConfig.sol"; // adjust the relative path as necessary -import {console} from "forge-std/console.sol"; - -contract DeployL1SystemConfig is Script { - function run() external { - // Retrieve the deployer private key from environment variables - uint256 deployerKey = vm.envUint("L1_DEPLOYER_PRIVATE_KEY"); - - vm.startBroadcast(deployerKey); - - // Deploy the SystemConfig contract with the specified owner. - SystemConfig sysConfig = new SystemConfig(); - - console.log("Deployed SystemConfig Implementation at address:", address(sysConfig)); - - vm.stopBroadcast(); - } -} diff --git a/scripts/foundry/InitializeL1BridgeContracts.s.sol b/scripts/foundry/InitializeL1BridgeContracts.s.sol index fce9bc20..cbc8cc63 100644 --- a/scripts/foundry/InitializeL1BridgeContracts.s.sol +++ b/scripts/foundry/InitializeL1BridgeContracts.s.sol @@ -18,6 +18,8 @@ import {MultipleVersionRollupVerifier} from "../../src/L1/rollup/MultipleVersion import {ScrollChain} from "../../src/L1/rollup/ScrollChain.sol"; import {L1MessageQueueV1} from "../../src/L1/rollup/L1MessageQueueV1.sol"; import {L1MessageQueueV1WithGasPriceOracle} from "../../src/L1/rollup/L1MessageQueueV1WithGasPriceOracle.sol"; +import {L1MessageQueueV2} from "../../src/L1/rollup/L1MessageQueueV2.sol"; +import {SystemConfig} from "../../src/L1/system-contract/SystemConfig.sol"; import {L2GasPriceOracle} from "../../src/L1/rollup/L2GasPriceOracle.sol"; import {EnforcedTxGateway} from "../../src/L1/gateways/EnforcedTxGateway.sol"; @@ -31,6 +33,9 @@ contract InitializeL1BridgeContracts is Script { uint256 CHAIN_ID_L2 = vm.envUint("CHAIN_ID_L2"); uint256 MAX_TX_IN_CHUNK = vm.envUint("MAX_TX_IN_CHUNK"); uint256 MAX_L1_MESSAGE_GAS_LIMIT = vm.envUint("MAX_L1_MESSAGE_GAS_LIMIT"); + uint256 FINALIZE_BATCH_DEADLINE_SEC = vm.envUint("FINALIZE_BATCH_DEADLINE_SEC"); + uint256 RELAY_MESSAGE_DEADLINE_SEC = vm.envUint("RELAY_MESSAGE_DEADLINE_SEC"); + address L2GETH_SIGNER_ADDRESS = vm.envAddress("L2GETH_SIGNER_ADDRESS"); address L1_COMMIT_SENDER_ADDRESS = vm.envAddress("L1_COMMIT_SENDER_ADDRESS"); address L1_FINALIZE_SENDER_ADDRESS = vm.envAddress("L1_FINALIZE_SENDER_ADDRESS"); address L1_FEE_VAULT_ADDR = vm.envAddress("L1_FEE_VAULT_ADDR"); @@ -41,8 +46,12 @@ contract InitializeL1BridgeContracts is Script { address L1_WHITELIST_ADDR = vm.envAddress("L1_WHITELIST_ADDR"); address L1_SCROLL_CHAIN_PROXY_ADDR = vm.envAddress("L1_SCROLL_CHAIN_PROXY_ADDR"); address L1_SCROLL_CHAIN_IMPLEMENTATION_ADDR = vm.envAddress("L1_SCROLL_CHAIN_IMPLEMENTATION_ADDR"); - address L1_MESSAGE_QUEUE_PROXY_ADDR = vm.envAddress("L1_MESSAGE_QUEUE_PROXY_ADDR"); - address L1_MESSAGE_QUEUE_IMPLEMENTATION_ADDR = vm.envAddress("L1_MESSAGE_QUEUE_IMPLEMENTATION_ADDR"); + address L1_MESSAGE_QUEUE_V1_PROXY_ADDR = vm.envAddress("L1_MESSAGE_QUEUE_V1_PROXY_ADDR"); + address L1_MESSAGE_QUEUE_V1_IMPLEMENTATION_ADDR = vm.envAddress("L1_MESSAGE_QUEUE_V1_IMPLEMENTATION_ADDR"); + address L1_MESSAGE_QUEUE_V2_PROXY_ADDR = vm.envAddress("L1_MESSAGE_QUEUE_V2_PROXY_ADDR"); + address L1_MESSAGE_QUEUE_V2_IMPLEMENTATION_ADDR = vm.envAddress("L1_MESSAGE_QUEUE_V2_IMPLEMENTATION_ADDR"); + address L1_SYSTEM_CONFIG_PROXY_ADDR = vm.envAddress("L1_SYSTEM_CONFIG_PROXY_ADDR"); + address L1_SYSTEM_CONFIG_IMPLEMENTATION_ADDR = vm.envAddress("L1_SYSTEM_CONFIG_IMPLEMENTATION_ADDR"); address L2_GAS_PRICE_ORACLE_PROXY_ADDR = vm.envAddress("L2_GAS_PRICE_ORACLE_PROXY_ADDR"); address L1_SCROLL_MESSENGER_PROXY_ADDR = vm.envAddress("L1_SCROLL_MESSENGER_PROXY_ADDR"); address L1_SCROLL_MESSENGER_IMPLEMENTATION_ADDR = vm.envAddress("L1_SCROLL_MESSENGER_IMPLEMENTATION_ADDR"); @@ -81,6 +90,26 @@ contract InitializeL1BridgeContracts is Script { // note: we use call upgrade(...) and initialize(...) instead of upgradeAndCall(...), // otherwise the contract owner would become ProxyAdmin. + // initialize system config + proxyAdmin.upgrade( + ITransparentUpgradeableProxy(L1_SYSTEM_CONFIG_PROXY_ADDR), + L1_SYSTEM_CONFIG_IMPLEMENTATION_ADDR + ); + + SystemConfig(L1_SYSTEM_CONFIG_PROXY_ADDR).initialize( + vm.addr(L1_DEPLOYER_PRIVATE_KEY), + L2GETH_SIGNER_ADDRESS, + SystemConfig.MessageQueueParameters({ + maxGasLimit: uint32(MAX_L1_MESSAGE_GAS_LIMIT), + baseFeeOverhead: 1000000000, + baseFeeScalar: 1000000000 + }), + SystemConfig.EnforcedBatchParameters({ + maxDelayEnterEnforcedMode: uint24(FINALIZE_BATCH_DEADLINE_SEC), + maxDelayMessageQueue: uint24(RELAY_MESSAGE_DEADLINE_SEC) + }) + ); + // initialize ScrollChain proxyAdmin.upgrade( ITransparentUpgradeableProxy(L1_SCROLL_CHAIN_PROXY_ADDR), @@ -88,11 +117,13 @@ contract InitializeL1BridgeContracts is Script { ); ScrollChain(L1_SCROLL_CHAIN_PROXY_ADDR).initialize( - L1_MESSAGE_QUEUE_PROXY_ADDR, + L1_MESSAGE_QUEUE_V1_PROXY_ADDR, // not used L1_MULTIPLE_VERSION_ROLLUP_VERIFIER_ADDR, MAX_TX_IN_CHUNK ); + ScrollChain(L1_SCROLL_CHAIN_PROXY_ADDR).initializeV2(); + ScrollChain(L1_SCROLL_CHAIN_PROXY_ADDR).addSequencer(L1_COMMIT_SENDER_ADDRESS); ScrollChain(L1_SCROLL_CHAIN_PROXY_ADDR).addProver(L1_FINALIZE_SENDER_ADDRESS); @@ -107,11 +138,11 @@ contract InitializeL1BridgeContracts is Script { // initialize L1MessageQueueV1WithGasPriceOracle proxyAdmin.upgrade( - ITransparentUpgradeableProxy(L1_MESSAGE_QUEUE_PROXY_ADDR), - L1_MESSAGE_QUEUE_IMPLEMENTATION_ADDR + ITransparentUpgradeableProxy(L1_MESSAGE_QUEUE_V1_PROXY_ADDR), + L1_MESSAGE_QUEUE_V1_IMPLEMENTATION_ADDR ); - L1MessageQueueV1WithGasPriceOracle(L1_MESSAGE_QUEUE_PROXY_ADDR).initialize( + L1MessageQueueV1WithGasPriceOracle(L1_MESSAGE_QUEUE_V1_PROXY_ADDR).initialize( L1_SCROLL_MESSENGER_PROXY_ADDR, L1_SCROLL_CHAIN_PROXY_ADDR, L1_ENFORCED_TX_GATEWAY_PROXY_ADDR, @@ -119,7 +150,13 @@ contract InitializeL1BridgeContracts is Script { MAX_L1_MESSAGE_GAS_LIMIT ); - L1MessageQueueV1WithGasPriceOracle(L1_MESSAGE_QUEUE_PROXY_ADDR).initializeV2(); + // initialize L1MessageQueueV2 + proxyAdmin.upgrade( + ITransparentUpgradeableProxy(L1_MESSAGE_QUEUE_V2_PROXY_ADDR), + L1_MESSAGE_QUEUE_V2_IMPLEMENTATION_ADDR + ); + + L1MessageQueueV2(L1_MESSAGE_QUEUE_V2_PROXY_ADDR).initialize(); // initialize L1ScrollMessenger proxyAdmin.upgrade( @@ -131,12 +168,12 @@ contract InitializeL1BridgeContracts is Script { L2_SCROLL_MESSENGER_PROXY_ADDR, L1_FEE_VAULT_ADDR, L1_SCROLL_CHAIN_PROXY_ADDR, - L1_MESSAGE_QUEUE_PROXY_ADDR + L1_MESSAGE_QUEUE_V1_PROXY_ADDR // not used anymore ); // initialize EnforcedTxGateway EnforcedTxGateway(payable(L1_ENFORCED_TX_GATEWAY_PROXY_ADDR)).initialize( - L1_MESSAGE_QUEUE_PROXY_ADDR, + L1_MESSAGE_QUEUE_V2_PROXY_ADDR, L1_FEE_VAULT_ADDR ); diff --git a/scripts/foundry/InitializeL1ScrollOwner.s.sol b/scripts/foundry/InitializeL1ScrollOwner.s.sol index e726c297..9a4b2bc3 100644 --- a/scripts/foundry/InitializeL1ScrollOwner.s.sol +++ b/scripts/foundry/InitializeL1ScrollOwner.s.sol @@ -18,6 +18,7 @@ import {ScrollMessengerBase} from "../../src/libraries/ScrollMessengerBase.sol"; import {L2GasPriceOracle} from "../../src/L1/rollup/L2GasPriceOracle.sol"; import {MultipleVersionRollupVerifier} from "../../src/L1/rollup/MultipleVersionRollupVerifier.sol"; import {ScrollChain} from "../../src/L1/rollup/ScrollChain.sol"; +import {SystemConfig} from "../../src/L1/system-contract/SystemConfig.sol"; import {ScrollOwner} from "../../src/misc/ScrollOwner.sol"; import {Whitelist} from "../../src/L2/predeploys/Whitelist.sol"; @@ -44,9 +45,11 @@ contract InitializeL1ScrollOwner is Script { address L1_7D_TIMELOCK_ADDR = vm.envAddress("L1_7D_TIMELOCK_ADDR"); address L1_14D_TIMELOCK_ADDR = vm.envAddress("L1_14D_TIMELOCK_ADDR"); + address L1_SYSTEM_CONFIG_PROXY_ADDR = vm.envAddress("L1_SYSTEM_CONFIG_PROXY_ADDR"); address L1_PROXY_ADMIN_ADDR = vm.envAddress("L1_PROXY_ADMIN_ADDR"); address L1_SCROLL_CHAIN_PROXY_ADDR = vm.envAddress("L1_SCROLL_CHAIN_PROXY_ADDR"); - address L1_MESSAGE_QUEUE_PROXY_ADDR = vm.envAddress("L1_MESSAGE_QUEUE_PROXY_ADDR"); + address L1_MESSAGE_QUEUE_V1_PROXY_ADDR = vm.envAddress("L1_MESSAGE_QUEUE_V1_PROXY_ADDR"); + address L1_MESSAGE_QUEUE_V2_PROXY_ADDR = vm.envAddress("L1_MESSAGE_QUEUE_V2_PROXY_ADDR"); address L2_GAS_PRICE_ORACLE_PROXY_ADDR = vm.envAddress("L2_GAS_PRICE_ORACLE_PROXY_ADDR"); address L1_SCROLL_MESSENGER_PROXY_ADDR = vm.envAddress("L1_SCROLL_MESSENGER_PROXY_ADDR"); address L1_GATEWAY_ROUTER_PROXY_ADDR = vm.envAddress("L1_GATEWAY_ROUTER_PROXY_ADDR"); @@ -74,6 +77,7 @@ contract InitializeL1ScrollOwner is Script { // @note we don't config 14D access, since the default admin is a 14D timelock which can access all methods. configProxyAdmin(); + configSystemConfig(); configScrollChain(); configL1MessageQueue(); configL1ScrollMessenger(); @@ -96,8 +100,10 @@ contract InitializeL1ScrollOwner is Script { function transferOwnership() internal { Ownable(L1_PROXY_ADMIN_ADDR).transferOwnership(address(owner)); + Ownable(L1_SYSTEM_CONFIG_PROXY_ADDR).transferOwnership(address(owner)); Ownable(L1_SCROLL_CHAIN_PROXY_ADDR).transferOwnership(address(owner)); - Ownable(L1_MESSAGE_QUEUE_PROXY_ADDR).transferOwnership(address(owner)); + Ownable(L1_MESSAGE_QUEUE_V1_PROXY_ADDR).transferOwnership(address(owner)); + Ownable(L1_MESSAGE_QUEUE_V2_PROXY_ADDR).transferOwnership(address(owner)); Ownable(L1_SCROLL_MESSENGER_PROXY_ADDR).transferOwnership(address(owner)); Ownable(L1_ENFORCED_TX_GATEWAY_PROXY_ADDR).transferOwnership(address(owner)); Ownable(L2_GAS_PRICE_ORACLE_PROXY_ADDR).transferOwnership(address(owner)); @@ -136,12 +142,33 @@ contract InitializeL1ScrollOwner is Script { owner.updateAccess(L1_PROXY_ADMIN_ADDR, _selectors, SECURITY_COUNCIL_NO_DELAY_ROLE, true); } + function configSystemConfig() internal { + bytes4[] memory _selectors; + + // no delay, security council + _selectors = new bytes4[](1); + _selectors[0] = SystemConfig.updateEnforcedBatchParameters.selector; + owner.updateAccess(L1_SYSTEM_CONFIG_PROXY_ADDR, _selectors, SECURITY_COUNCIL_NO_DELAY_ROLE, true); + + // no delay, Scroll multisig + _selectors = new bytes4[](2); + _selectors[0] = SystemConfig.updateMessageQueueParameters.selector; + _selectors[1] = SystemConfig.updateSigner.selector; + owner.updateAccess(L1_SYSTEM_CONFIG_PROXY_ADDR, _selectors, SCROLL_MULTISIG_NO_DELAY_ROLE, true); + } + function configScrollChain() internal { bytes4[] memory _selectors; + // no delay, security council + _selectors = new bytes4[](1); + _selectors[0] = ScrollChain.disableEnforcedBatch.selector; + // note: finalizeEuclidInitialBatch is removed in phase-2 + owner.updateAccess(L1_SYSTEM_CONFIG_PROXY_ADDR, _selectors, SECURITY_COUNCIL_NO_DELAY_ROLE, true); + // no delay, scroll multisig and emergency multisig _selectors = new bytes4[](4); - _selectors[0] = ScrollChain.revertBatch.selector; + _selectors[0] = ScrollChain.revertBatch.selector; // new selector! _selectors[1] = ScrollChain.removeSequencer.selector; _selectors[2] = ScrollChain.removeProver.selector; _selectors[3] = ScrollChain.setPause.selector; @@ -167,7 +194,9 @@ contract InitializeL1ScrollOwner is Script { _selectors = new bytes4[](2); _selectors[0] = L1MessageQueueV1.updateGasOracle.selector; _selectors[1] = L1MessageQueueV1.updateMaxGasLimit.selector; - owner.updateAccess(L1_MESSAGE_QUEUE_PROXY_ADDR, _selectors, TIMELOCK_1DAY_DELAY_ROLE, true); + owner.updateAccess(L1_MESSAGE_QUEUE_V1_PROXY_ADDR, _selectors, TIMELOCK_1DAY_DELAY_ROLE, true); + + // no owner methods for V2 } function configL1ScrollMessenger() internal { diff --git a/scripts/foundry/InitializeL1SystemConfig.sol b/scripts/foundry/InitializeL1SystemConfig.sol deleted file mode 100644 index 3b34f1b4..00000000 --- a/scripts/foundry/InitializeL1SystemConfig.sol +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity =0.8.24; - -import {Script} from "forge-std/Script.sol"; -import {SystemConfig} from "../../src/L1/system-contract/SystemConfig.sol"; -import {ScrollOwner} from "../../src/misc/ScrollOwner.sol"; // Adjust this path as needed - -/** - * @title InitializeL1SystemConfig - * @notice Configures the deployed SystemConfig contract. - * This script grants the Security Council (as defined by L1_SECURITY_COUNCIL_ADDR) - * access to call updateSigner() on the SystemConfig contract with no delay. - */ -contract InitializeL1SystemConfig is Script { - function run() external { - // Retrieve required environment variables. - uint256 deployerKey = vm.envUint("L1_DEPLOYER_PRIVATE_KEY"); - address systemConfigAddr = vm.envAddress("SYSTEM_CONTRACT_ADDR"); - address securityCouncilAddr = vm.envAddress("L1_SECURITY_COUNCIL_ADDR"); - address scrollOwnerAddr = vm.envAddress("L1_SCROLL_OWNER_ADDR"); - - // Compute the role hash for the Security Council with no delay. - bytes32 SECURITY_COUNCIL_NO_DELAY_ROLE = keccak256("SECURITY_COUNCIL_NO_DELAY_ROLE"); - - vm.startBroadcast(deployerKey); - - // Instantiate the ScrollOwner contract instance which manages access control. - ScrollOwner owner = ScrollOwner(payable(scrollOwnerAddr)); - // Instantiate the already-deployed SystemConfig contract. - SystemConfig sys = SystemConfig(systemConfigAddr); - - // Prepare a single-element array containing the function selector for updateSigner. - bytes4[] memory selectors = new bytes4[](1); - selectors[0] = sys.updateSigner.selector; - - // Grant the SECURITY_COUNCIL_NO_DELAY_ROLE permission on SystemConfig, - // so that the Security Council address can call updateSigner() with no delay. - owner.updateAccess( - systemConfigAddr, // Address of the SystemConfig contract. - selectors, // The function selectors (only updateSigner here). - SECURITY_COUNCIL_NO_DELAY_ROLE, - true // Grant access. - ); - - vm.stopBroadcast(); - } -} diff --git a/src/L1/rollup/L1MessageQueueV2.sol b/src/L1/rollup/L1MessageQueueV2.sol index 199d682d..7ad7232f 100644 --- a/src/L1/rollup/L1MessageQueueV2.sol +++ b/src/L1/rollup/L1MessageQueueV2.sol @@ -163,7 +163,7 @@ contract L1MessageQueueV2 is OwnableUpgradeable, IL1MessageQueueV2 { /// @inheritdoc IL1MessageQueueV2 function estimatedL2BaseFee() public view returns (uint256) { (, uint256 overhead, uint256 scalar) = SystemConfig(systemConfig).messageQueueParameters(); - // this is unlikely to happen, use unchecked here. It is because the type of `overhead` and `scalar` + // this is unlikely to overflow, use unchecked here. It is because the type of `overhead` and `scalar` // is `uint112` and `block.basefee` usually won't exceed `uint112`. unchecked { return (block.basefee * scalar) / PRECISION + overhead;