1+ // SPDX-License-Identifier: UNLICENSED
2+ pragma solidity = 0.8.24 ;
3+
4+ import { Script } from "forge-std/Script.sol " ;
5+ import { SystemConfig } from "../../src/L1/system-contract/SystemConfig.sol " ;
6+ import { ScrollOwner } from "../../src/misc/ScrollOwner.sol " ; // Adjust this path as needed
7+
8+ /**
9+ * @title InitializeL1SystemConfig
10+ * @notice Configures the deployed SystemConfig contract.
11+ * This script grants the Security Council (as defined by L1_SECURITY_COUNCIL_ADDR)
12+ * access to call updateSigner() on the SystemConfig contract with no delay.
13+ */
14+ contract InitializeL1SystemConfig is Script {
15+ function run () external {
16+ // Retrieve required environment variables.
17+ uint256 deployerKey = vm.envUint ("L1_DEPLOYER_PRIVATE_KEY " );
18+ address systemConfigAddr = vm.envAddress ("SYSTEM_CONTRACT_ADDR " );
19+ address securityCouncilAddr = vm.envAddress ("L1_SECURITY_COUNCIL_ADDR " );
20+ address scrollOwnerAddr = vm.envAddress ("L1_SCROLL_OWNER_ADDR " );
21+
22+ // Compute the role hash for the Security Council with no delay.
23+ bytes32 SECURITY_COUNCIL_NO_DELAY_ROLE = keccak256 ("SECURITY_COUNCIL_NO_DELAY_ROLE " );
24+
25+ vm.startBroadcast (deployerKey);
26+
27+ // Instantiate the ScrollOwner contract instance which manages access control.
28+ ScrollOwner owner = ScrollOwner (payable (scrollOwnerAddr));
29+ // Instantiate the already-deployed SystemConfig contract.
30+ SystemConfig sys = SystemConfig (systemConfigAddr);
31+
32+ // Prepare a single-element array containing the function selector for updateSigner.
33+ bytes4 [] memory selectors = new bytes4 [](1 );
34+ selectors[0 ] = sys.updateSigner.selector ;
35+
36+ // Grant the SECURITY_COUNCIL_NO_DELAY_ROLE permission on SystemConfig,
37+ // so that the Security Council address can call updateSigner() with no delay.
38+ owner.updateAccess (
39+ systemConfigAddr, // Address of the SystemConfig contract.
40+ selectors, // The function selectors (only updateSigner here).
41+ SECURITY_COUNCIL_NO_DELAY_ROLE,
42+ true // Grant access.
43+ );
44+
45+ vm.stopBroadcast ();
46+ }
47+ }
0 commit comments