From 89358e9aa3ce11b86b6d824895423787232bac73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Garamv=C3=B6lgyi?= Date: Thu, 11 Sep 2025 14:07:29 +0200 Subject: [PATCH 1/4] feat: better configuration management for deterministic deployment --- scripts/deterministic/Configuration.sol | 172 ++---------------- scripts/deterministic/DeployScroll.s.sol | 12 +- .../deterministic/DeterministicDeployment.sol | 13 +- scripts/deterministic/GenerateConfigs.s.sol | 10 +- scripts/deterministic/GenerateGenesis.s.sol | 2 +- scripts/deterministic/ScrollConfiguration.sol | 171 +++++++++++++++++ 6 files changed, 208 insertions(+), 172 deletions(-) create mode 100644 scripts/deterministic/ScrollConfiguration.sol diff --git a/scripts/deterministic/Configuration.sol b/scripts/deterministic/Configuration.sol index 95ba45d7..c2c0b55e 100644 --- a/scripts/deterministic/Configuration.sol +++ b/scripts/deterministic/Configuration.sol @@ -5,9 +5,6 @@ import {Script} from "forge-std/Script.sol"; import {VmSafe} from "forge-std/Vm.sol"; import {stdToml} from "forge-std/StdToml.sol"; -import {CONFIG_PATH, CONFIG_CONTRACTS_PATH, CONFIG_CONTRACTS_TEMPLATE_PATH} from "./Constants.sol"; - -/// @notice Configuration allows inheriting contracts to read the TOML configuration file. abstract contract Configuration is Script { using stdToml for string; @@ -18,135 +15,28 @@ abstract contract Configuration is Script { string internal cfg; string internal contractsCfg; - /**************************** - * Configuration parameters * - ****************************/ - - // general - string internal L1_RPC_ENDPOINT; - string internal L2_RPC_ENDPOINT; - - string internal CHAIN_NAME_L1; - string internal CHAIN_NAME_L2; - uint64 internal CHAIN_ID_L1; - uint64 internal CHAIN_ID_L2; - - uint256 internal MAX_TX_IN_CHUNK; - uint256 internal MAX_BLOCK_IN_CHUNK; - uint256 internal MAX_BATCH_IN_BUNDLE; - uint256 internal MAX_L1_MESSAGE_GAS_LIMIT; - uint256 internal FINALIZE_BATCH_DEADLINE_SEC; - uint256 internal RELAY_MESSAGE_DEADLINE_SEC; - - uint256 internal L1_CONTRACT_DEPLOYMENT_BLOCK; - - bool internal TEST_ENV_MOCK_FINALIZE_ENABLED; - uint256 internal TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC; - - // accounts - uint256 internal DEPLOYER_PRIVATE_KEY; - uint256 internal L1_COMMIT_SENDER_PRIVATE_KEY; - uint256 internal L1_FINALIZE_SENDER_PRIVATE_KEY; - uint256 internal L1_GAS_ORACLE_SENDER_PRIVATE_KEY; - uint256 internal L2_GAS_ORACLE_SENDER_PRIVATE_KEY; - - address internal DEPLOYER_ADDR; - address internal L1_COMMIT_SENDER_ADDR; - address internal L1_FINALIZE_SENDER_ADDR; - address internal L1_GAS_ORACLE_SENDER_ADDR; - address internal L2_GAS_ORACLE_SENDER_ADDR; - - address internal OWNER_ADDR; - - address internal L2GETH_SIGNER_ADDRESS; - - // db - string internal ROLLUP_EXPLORER_BACKEND_DB_CONNECTION_STRING; - - // genesis - uint256 internal L2_MAX_ETH_SUPPLY; - uint256 internal L2_DEPLOYER_INITIAL_BALANCE; - uint256 internal L2_SCROLL_MESSENGER_INITIAL_BALANCE; - - // contracts - string internal DEPLOYMENT_SALT; - - address internal L1_FEE_VAULT_ADDR; - - // coordinator - string internal CHUNK_COLLECTION_TIME_SEC; - string internal BATCH_COLLECTION_TIME_SEC; - string internal BUNDLE_COLLECTION_TIME_SEC; - string internal COORDINATOR_JWT_SECRET_KEY; - - // frontend - string internal EXTERNAL_RPC_URI_L1; - string internal EXTERNAL_RPC_URI_L2; - string internal BRIDGE_API_URI; - string internal ROLLUPSCAN_API_URI; - string internal EXTERNAL_EXPLORER_URI_L1; - string internal EXTERNAL_EXPLORER_URI_L2; - string internal ADMIN_SYSTEM_DASHBOARD_URI; - string internal GRAFANA_URI; - /********************** * Internal interface * **********************/ - function readConfig() internal { - if (!vm.exists(CONFIG_CONTRACTS_PATH)) { - string memory template = vm.readFile(CONFIG_CONTRACTS_TEMPLATE_PATH); - vm.writeFile(CONFIG_CONTRACTS_PATH, template); - } - - cfg = vm.readFile(CONFIG_PATH); - contractsCfg = vm.readFile(CONFIG_CONTRACTS_PATH); - - CHAIN_ID_L1 = uint64(cfg.readUint(".general.CHAIN_ID_L1")); - CHAIN_ID_L2 = uint64(cfg.readUint(".general.CHAIN_ID_L2")); - - MAX_TX_IN_CHUNK = cfg.readUint(".rollup.MAX_TX_IN_CHUNK"); - MAX_BLOCK_IN_CHUNK = cfg.readUint(".rollup.MAX_BLOCK_IN_CHUNK"); - MAX_BATCH_IN_BUNDLE = cfg.readUint(".rollup.MAX_BATCH_IN_BUNDLE"); - MAX_L1_MESSAGE_GAS_LIMIT = cfg.readUint(".rollup.MAX_L1_MESSAGE_GAS_LIMIT"); - FINALIZE_BATCH_DEADLINE_SEC = cfg.readUint(".rollup.FINALIZE_BATCH_DEADLINE_SEC"); - RELAY_MESSAGE_DEADLINE_SEC = cfg.readUint(".rollup.RELAY_MESSAGE_DEADLINE_SEC"); - - L1_CONTRACT_DEPLOYMENT_BLOCK = cfg.readUint(".general.L1_CONTRACT_DEPLOYMENT_BLOCK"); - - TEST_ENV_MOCK_FINALIZE_ENABLED = cfg.readBool(".rollup.TEST_ENV_MOCK_FINALIZE_ENABLED"); - TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC = cfg.readUint(".rollup.TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC"); - - DEPLOYER_PRIVATE_KEY = cfg.readUint(".accounts.DEPLOYER_PRIVATE_KEY"); - L1_COMMIT_SENDER_PRIVATE_KEY = cfg.readUint(".accounts.L1_COMMIT_SENDER_PRIVATE_KEY"); - L1_FINALIZE_SENDER_PRIVATE_KEY = cfg.readUint(".accounts.L1_FINALIZE_SENDER_PRIVATE_KEY"); - L1_GAS_ORACLE_SENDER_PRIVATE_KEY = cfg.readUint(".accounts.L1_GAS_ORACLE_SENDER_PRIVATE_KEY"); - L2_GAS_ORACLE_SENDER_PRIVATE_KEY = cfg.readUint(".accounts.L2_GAS_ORACLE_SENDER_PRIVATE_KEY"); - - DEPLOYER_ADDR = cfg.readAddress(".accounts.DEPLOYER_ADDR"); - L1_COMMIT_SENDER_ADDR = cfg.readAddress(".accounts.L1_COMMIT_SENDER_ADDR"); - L1_FINALIZE_SENDER_ADDR = cfg.readAddress(".accounts.L1_FINALIZE_SENDER_ADDR"); - L1_GAS_ORACLE_SENDER_ADDR = cfg.readAddress(".accounts.L1_GAS_ORACLE_SENDER_ADDR"); - L2_GAS_ORACLE_SENDER_ADDR = cfg.readAddress(".accounts.L2_GAS_ORACLE_SENDER_ADDR"); - - OWNER_ADDR = cfg.readAddress(".accounts.OWNER_ADDR"); - - L2GETH_SIGNER_ADDRESS = cfg.readAddress(".sequencer.L2GETH_SIGNER_ADDRESS"); + function initialize(string memory workdir) internal { + string memory cfgPath = string(abi.encodePacked(workdir, "/config.toml")); + cfg = vm.readFile(cfgPath); - L2_MAX_ETH_SUPPLY = cfg.readUint(".genesis.L2_MAX_ETH_SUPPLY"); - L2_DEPLOYER_INITIAL_BALANCE = cfg.readUint(".genesis.L2_DEPLOYER_INITIAL_BALANCE"); - L2_SCROLL_MESSENGER_INITIAL_BALANCE = L2_MAX_ETH_SUPPLY - L2_DEPLOYER_INITIAL_BALANCE; - - DEPLOYMENT_SALT = cfg.readString(".contracts.DEPLOYMENT_SALT"); + string memory contractsCfgPath = string(abi.encodePacked(workdir, "/config-contracts.toml")); + contractsCfg = vm.readFile(contractsCfgPath); + } - L1_FEE_VAULT_ADDR = cfg.readAddress(".contracts.L1_FEE_VAULT_ADDR"); + function readUint(string memory key) internal view returns (uint256) { + return cfg.readUint(key); + } - CHUNK_COLLECTION_TIME_SEC = cfg.readString(".coordinator.CHUNK_COLLECTION_TIME_SEC"); - BATCH_COLLECTION_TIME_SEC = cfg.readString(".coordinator.BATCH_COLLECTION_TIME_SEC"); - BUNDLE_COLLECTION_TIME_SEC = cfg.readString(".coordinator.BUNDLE_COLLECTION_TIME_SEC"); - COORDINATOR_JWT_SECRET_KEY = cfg.readString(".coordinator.COORDINATOR_JWT_SECRET_KEY"); + function readAddress(string memory key) internal view returns (address) { + return cfg.readAddress(key); + } - runSanityCheck(); + function readString(string memory key) internal view returns (string memory) { + return cfg.readString(key); } /// @dev Ensure that `addr` is not the zero address. @@ -193,38 +83,4 @@ abstract contract Configuration is Script { return addr; } - - /********************* - * Private functions * - *********************/ - - function runSanityCheck() private view { - verifyAccount("DEPLOYER", DEPLOYER_PRIVATE_KEY, DEPLOYER_ADDR); - verifyAccount("L1_COMMIT_SENDER", L1_COMMIT_SENDER_PRIVATE_KEY, L1_COMMIT_SENDER_ADDR); - verifyAccount("L1_FINALIZE_SENDER", L1_FINALIZE_SENDER_PRIVATE_KEY, L1_FINALIZE_SENDER_ADDR); - verifyAccount("L1_GAS_ORACLE_SENDER", L1_GAS_ORACLE_SENDER_PRIVATE_KEY, L1_GAS_ORACLE_SENDER_ADDR); - verifyAccount("L2_GAS_ORACLE_SENDER", L2_GAS_ORACLE_SENDER_PRIVATE_KEY, L2_GAS_ORACLE_SENDER_ADDR); - } - - function verifyAccount( - string memory name, - uint256 privateKey, - address addr - ) private pure { - if (vm.addr(privateKey) != addr) { - revert( - string( - abi.encodePacked( - "[ERROR] ", - name, - "_ADDR (", - vm.toString(addr), - ") does not match ", - name, - "_PRIVATE_KEY" - ) - ) - ); - } - } } diff --git a/scripts/deterministic/DeployScroll.s.sol b/scripts/deterministic/DeployScroll.s.sol index 394d4725..cae98923 100644 --- a/scripts/deterministic/DeployScroll.s.sol +++ b/scripts/deterministic/DeployScroll.s.sol @@ -43,13 +43,13 @@ import {ScrollStandardERC20FactorySetOwner} from "./contracts/ScrollStandardERC2 import {ScrollChainMockFinalize} from "../../src/mocks/ScrollChainMockFinalize.sol"; import "./Constants.sol"; -import "./Configuration.sol"; +import {ScrollConfiguration} from "./ScrollConfiguration.sol"; import "./DeterministicDeployment.sol"; /// @dev The minimum deployer account balance. uint256 constant MINIMUM_DEPLOYER_BALANCE = 0.1 ether; -contract DeployScroll is DeterministicDeployment { +contract DeployScroll is DeterministicDeployment, ScrollConfiguration { using stdToml for string; /********* @@ -178,11 +178,15 @@ contract DeployScroll is DeterministicDeployment { * Entry point * ***************/ - function run(string memory layer, string memory scriptMode) public { + function run( + string memory workdir, + string memory layer, + string memory scriptMode + ) public { broadcastLayer = parseLayer(layer); ScriptMode mode = parseScriptMode(scriptMode); - DeterministicDeployment.initialize(mode); + DeterministicDeployment.initialize(mode, workdir); checkDeployerBalance(); deployAllContracts(); diff --git a/scripts/deterministic/DeterministicDeployment.sol b/scripts/deterministic/DeterministicDeployment.sol index 98390508..e303a7b4 100644 --- a/scripts/deterministic/DeterministicDeployment.sol +++ b/scripts/deterministic/DeterministicDeployment.sol @@ -8,7 +8,7 @@ import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.s import {ITransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import {ERC1967Upgrade} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol"; -import {CONFIG_CONTRACTS_PATH, DEFAULT_DEPLOYMENT_SALT, DETERMINISTIC_DEPLOYMENT_PROXY_ADDR} from "./Constants.sol"; +import {DEFAULT_DEPLOYMENT_SALT, DETERMINISTIC_DEPLOYMENT_PROXY_ADDR} from "./Constants.sol"; import {Configuration} from "./Configuration.sol"; /// @notice DeterministicDeployment provides utilities for deterministic contract deployments. @@ -35,19 +35,24 @@ abstract contract DeterministicDeployment is Configuration { string private saltPrefix; bool private skipDeploy; + string private cfgContractsPath; + /********************** * Internal interface * **********************/ - function initialize(ScriptMode _mode) internal { + function initialize(ScriptMode _mode, string memory workdir) internal { mode = _mode; skipDeploy = false; + cfgContractsPath = string(abi.encodePacked(workdir, "/config-contracts.toml")); + if (mode != ScriptMode.EmptyConfig) { - readConfig(); + super.initialize(workdir); } // salt prefix used for deterministic deployments + string memory DEPLOYMENT_SALT = readString(".contracts.DEPLOYMENT_SALT"); if (bytes(DEPLOYMENT_SALT).length != 0) { saltPrefix = DEPLOYMENT_SALT; } else { @@ -203,7 +208,7 @@ abstract contract DeterministicDeployment is Configuration { string memory tomlPath = string(abi.encodePacked(".", name, "_ADDR")); if (mode == ScriptMode.WriteConfig) { - vm.writeToml(vm.toString(addr), CONFIG_CONTRACTS_PATH, tomlPath); + vm.writeToml(vm.toString(addr), cfgContractsPath, tomlPath); // TODO: move to helpers return; } diff --git a/scripts/deterministic/GenerateConfigs.s.sol b/scripts/deterministic/GenerateConfigs.s.sol index cc3485f4..4215a876 100644 --- a/scripts/deterministic/GenerateConfigs.s.sol +++ b/scripts/deterministic/GenerateConfigs.s.sol @@ -15,7 +15,7 @@ contract GenerateRollupConfig is DeployScroll { ***************/ function run() public { - DeterministicDeployment.initialize(ScriptMode.VerifyConfig); + DeterministicDeployment.initialize(ScriptMode.VerifyConfig, ""); // TODO predictAllContracts(); generateRollupConfig(ROLLUP_CONFIG_PATH); @@ -59,7 +59,7 @@ contract GenerateCoordinatorConfig is DeployScroll { ***************/ function run() public { - DeterministicDeployment.initialize(ScriptMode.VerifyConfig); + DeterministicDeployment.initialize(ScriptMode.VerifyConfig, ""); // TODO predictAllContracts(); generateCoordinatorConfig(COORDINATOR_API_CONFIG_PATH); @@ -101,7 +101,7 @@ contract GenerateChainMonitorConfig is DeployScroll { ***************/ function run() public { - DeterministicDeployment.initialize(ScriptMode.VerifyConfig); + DeterministicDeployment.initialize(ScriptMode.VerifyConfig, ""); // TODO predictAllContracts(); generateChainMonitorConfig(CHAIN_MONITOR_CONFIG_PATH); @@ -154,7 +154,7 @@ contract GenerateBridgeHistoryConfig is DeployScroll { ***************/ function run() public { - DeterministicDeployment.initialize(ScriptMode.VerifyConfig); + DeterministicDeployment.initialize(ScriptMode.VerifyConfig, ""); // TODO predictAllContracts(); generateBridgeHistoryConfig(BRIDGE_HISTORY_API_CONFIG_PATH); @@ -210,7 +210,7 @@ contract GenerateBalanceCheckerConfig is DeployScroll { ***************/ function run() public { - DeterministicDeployment.initialize(ScriptMode.VerifyConfig); + DeterministicDeployment.initialize(ScriptMode.VerifyConfig, ""); // TODO predictAllContracts(); generateBalanceCheckerConfig(BALANCE_CHECKER_CONFIG_PATH); diff --git a/scripts/deterministic/GenerateGenesis.s.sol b/scripts/deterministic/GenerateGenesis.s.sol index d36ed5c6..5d03327e 100644 --- a/scripts/deterministic/GenerateGenesis.s.sol +++ b/scripts/deterministic/GenerateGenesis.s.sol @@ -17,7 +17,7 @@ contract GenerateGenesis is DeployScroll { ***************/ function run() public { - DeterministicDeployment.initialize(ScriptMode.VerifyConfig); + DeterministicDeployment.initialize(ScriptMode.VerifyConfig, ""); // TODO predictAllContracts(); generateGenesisAlloc(); diff --git a/scripts/deterministic/ScrollConfiguration.sol b/scripts/deterministic/ScrollConfiguration.sol new file mode 100644 index 00000000..9eb2195a --- /dev/null +++ b/scripts/deterministic/ScrollConfiguration.sol @@ -0,0 +1,171 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity =0.8.24; + +import {Script} from "forge-std/Script.sol"; +import {stdToml} from "forge-std/StdToml.sol"; + +import {Configuration} from "./Configuration.sol"; + +/// @notice ScrollConfiguration allows inheriting contracts to read the TOML configuration file. +abstract contract ScrollConfiguration is Script, Configuration { + using stdToml for string; + + /**************************** + * Configuration parameters * + ****************************/ + + // general + string internal L1_RPC_ENDPOINT; + string internal L2_RPC_ENDPOINT; + + string internal CHAIN_NAME_L1; + string internal CHAIN_NAME_L2; + uint64 internal CHAIN_ID_L1; + uint64 internal CHAIN_ID_L2; + + uint256 internal MAX_TX_IN_CHUNK; + uint256 internal MAX_BLOCK_IN_CHUNK; + uint256 internal MAX_BATCH_IN_BUNDLE; + uint256 internal MAX_L1_MESSAGE_GAS_LIMIT; + uint256 internal FINALIZE_BATCH_DEADLINE_SEC; + uint256 internal RELAY_MESSAGE_DEADLINE_SEC; + + uint256 internal L1_CONTRACT_DEPLOYMENT_BLOCK; + + bool internal TEST_ENV_MOCK_FINALIZE_ENABLED; + uint256 internal TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC; + + // accounts + uint256 internal DEPLOYER_PRIVATE_KEY; + uint256 internal L1_COMMIT_SENDER_PRIVATE_KEY; + uint256 internal L1_FINALIZE_SENDER_PRIVATE_KEY; + uint256 internal L1_GAS_ORACLE_SENDER_PRIVATE_KEY; + uint256 internal L2_GAS_ORACLE_SENDER_PRIVATE_KEY; + + address internal DEPLOYER_ADDR; + address internal L1_COMMIT_SENDER_ADDR; + address internal L1_FINALIZE_SENDER_ADDR; + address internal L1_GAS_ORACLE_SENDER_ADDR; + address internal L2_GAS_ORACLE_SENDER_ADDR; + + address internal OWNER_ADDR; + + address internal L2GETH_SIGNER_ADDRESS; + + // db + string internal ROLLUP_EXPLORER_BACKEND_DB_CONNECTION_STRING; + + // genesis + uint256 internal L2_MAX_ETH_SUPPLY; + uint256 internal L2_DEPLOYER_INITIAL_BALANCE; + uint256 internal L2_SCROLL_MESSENGER_INITIAL_BALANCE; + + // contracts + string internal DEPLOYMENT_SALT; + + address internal L1_FEE_VAULT_ADDR; + + // coordinator + string internal CHUNK_COLLECTION_TIME_SEC; + string internal BATCH_COLLECTION_TIME_SEC; + string internal BUNDLE_COLLECTION_TIME_SEC; + string internal COORDINATOR_JWT_SECRET_KEY; + + // frontend + string internal EXTERNAL_RPC_URI_L1; + string internal EXTERNAL_RPC_URI_L2; + string internal BRIDGE_API_URI; + string internal ROLLUPSCAN_API_URI; + string internal EXTERNAL_EXPLORER_URI_L1; + string internal EXTERNAL_EXPLORER_URI_L2; + string internal ADMIN_SYSTEM_DASHBOARD_URI; + string internal GRAFANA_URI; + + /********************** + * Internal interface * + **********************/ + + function readConfig(string memory workdir) internal { + super.initialize(workdir); + + CHAIN_ID_L1 = uint64(cfg.readUint(".general.CHAIN_ID_L1")); + CHAIN_ID_L2 = uint64(cfg.readUint(".general.CHAIN_ID_L2")); + + MAX_TX_IN_CHUNK = cfg.readUint(".rollup.MAX_TX_IN_CHUNK"); + MAX_BLOCK_IN_CHUNK = cfg.readUint(".rollup.MAX_BLOCK_IN_CHUNK"); + MAX_BATCH_IN_BUNDLE = cfg.readUint(".rollup.MAX_BATCH_IN_BUNDLE"); + MAX_L1_MESSAGE_GAS_LIMIT = cfg.readUint(".rollup.MAX_L1_MESSAGE_GAS_LIMIT"); + FINALIZE_BATCH_DEADLINE_SEC = cfg.readUint(".rollup.FINALIZE_BATCH_DEADLINE_SEC"); + RELAY_MESSAGE_DEADLINE_SEC = cfg.readUint(".rollup.RELAY_MESSAGE_DEADLINE_SEC"); + + L1_CONTRACT_DEPLOYMENT_BLOCK = cfg.readUint(".general.L1_CONTRACT_DEPLOYMENT_BLOCK"); + + TEST_ENV_MOCK_FINALIZE_ENABLED = cfg.readBool(".rollup.TEST_ENV_MOCK_FINALIZE_ENABLED"); + TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC = cfg.readUint(".rollup.TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC"); + + DEPLOYER_PRIVATE_KEY = cfg.readUint(".accounts.DEPLOYER_PRIVATE_KEY"); + L1_COMMIT_SENDER_PRIVATE_KEY = cfg.readUint(".accounts.L1_COMMIT_SENDER_PRIVATE_KEY"); + L1_FINALIZE_SENDER_PRIVATE_KEY = cfg.readUint(".accounts.L1_FINALIZE_SENDER_PRIVATE_KEY"); + L1_GAS_ORACLE_SENDER_PRIVATE_KEY = cfg.readUint(".accounts.L1_GAS_ORACLE_SENDER_PRIVATE_KEY"); + L2_GAS_ORACLE_SENDER_PRIVATE_KEY = cfg.readUint(".accounts.L2_GAS_ORACLE_SENDER_PRIVATE_KEY"); + + DEPLOYER_ADDR = cfg.readAddress(".accounts.DEPLOYER_ADDR"); + L1_COMMIT_SENDER_ADDR = cfg.readAddress(".accounts.L1_COMMIT_SENDER_ADDR"); + L1_FINALIZE_SENDER_ADDR = cfg.readAddress(".accounts.L1_FINALIZE_SENDER_ADDR"); + L1_GAS_ORACLE_SENDER_ADDR = cfg.readAddress(".accounts.L1_GAS_ORACLE_SENDER_ADDR"); + L2_GAS_ORACLE_SENDER_ADDR = cfg.readAddress(".accounts.L2_GAS_ORACLE_SENDER_ADDR"); + + OWNER_ADDR = cfg.readAddress(".accounts.OWNER_ADDR"); + + L2GETH_SIGNER_ADDRESS = cfg.readAddress(".sequencer.L2GETH_SIGNER_ADDRESS"); + + L2_MAX_ETH_SUPPLY = cfg.readUint(".genesis.L2_MAX_ETH_SUPPLY"); + L2_DEPLOYER_INITIAL_BALANCE = cfg.readUint(".genesis.L2_DEPLOYER_INITIAL_BALANCE"); + L2_SCROLL_MESSENGER_INITIAL_BALANCE = L2_MAX_ETH_SUPPLY - L2_DEPLOYER_INITIAL_BALANCE; + + DEPLOYMENT_SALT = cfg.readString(".contracts.DEPLOYMENT_SALT"); + + L1_FEE_VAULT_ADDR = cfg.readAddress(".contracts.L1_FEE_VAULT_ADDR"); + + CHUNK_COLLECTION_TIME_SEC = cfg.readString(".coordinator.CHUNK_COLLECTION_TIME_SEC"); + BATCH_COLLECTION_TIME_SEC = cfg.readString(".coordinator.BATCH_COLLECTION_TIME_SEC"); + BUNDLE_COLLECTION_TIME_SEC = cfg.readString(".coordinator.BUNDLE_COLLECTION_TIME_SEC"); + COORDINATOR_JWT_SECRET_KEY = cfg.readString(".coordinator.COORDINATOR_JWT_SECRET_KEY"); + + runSanityCheck(); + } + + /********************* + * Private functions * + *********************/ + + function runSanityCheck() private view { + verifyAccount("DEPLOYER", DEPLOYER_PRIVATE_KEY, DEPLOYER_ADDR); + verifyAccount("L1_COMMIT_SENDER", L1_COMMIT_SENDER_PRIVATE_KEY, L1_COMMIT_SENDER_ADDR); + verifyAccount("L1_FINALIZE_SENDER", L1_FINALIZE_SENDER_PRIVATE_KEY, L1_FINALIZE_SENDER_ADDR); + verifyAccount("L1_GAS_ORACLE_SENDER", L1_GAS_ORACLE_SENDER_PRIVATE_KEY, L1_GAS_ORACLE_SENDER_ADDR); + verifyAccount("L2_GAS_ORACLE_SENDER", L2_GAS_ORACLE_SENDER_PRIVATE_KEY, L2_GAS_ORACLE_SENDER_ADDR); + } + + function verifyAccount( + string memory name, + uint256 privateKey, + address addr + ) private pure { + if (vm.addr(privateKey) != addr) { + revert( + string( + abi.encodePacked( + "[ERROR] ", + name, + "_ADDR (", + vm.toString(addr), + ") does not match ", + name, + "_PRIVATE_KEY" + ) + ) + ); + } + } +} From 4e8ba55d1dc42382741c0937ff014a60625d83ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Garamv=C3=B6lgyi?= Date: Thu, 11 Sep 2025 14:13:22 +0200 Subject: [PATCH 2/4] move things around --- .../deterministic/DeterministicDeployment.sol | 7 +- .../deterministic/{ => scroll}/Constants.sol | 7 -- .../{ => scroll}/DeployScroll.s.sol | 75 ++++++++++--------- .../{ => scroll}/GenerateConfigs.s.sol | 2 +- .../{ => scroll}/GenerateGenesis.s.sol | 14 ++-- .../{ => scroll}/ScrollConfiguration.sol | 2 +- .../{ => scroll}/config/config-contracts.toml | 0 .../config/config-contracts.toml.template | 0 .../{ => scroll}/config/config.toml | 0 .../{ => scroll}/shell/deploy.sh | 0 .../{ => scroll}/shell/update-configs.sh | 0 11 files changed, 52 insertions(+), 55 deletions(-) rename scripts/deterministic/{ => scroll}/Constants.sol (99%) rename scripts/deterministic/{ => scroll}/DeployScroll.s.sol (94%) rename scripts/deterministic/{ => scroll}/GenerateConfigs.s.sol (99%) rename scripts/deterministic/{ => scroll}/GenerateGenesis.s.sol (93%) rename scripts/deterministic/{ => scroll}/ScrollConfiguration.sol (99%) rename scripts/deterministic/{ => scroll}/config/config-contracts.toml (100%) rename scripts/deterministic/{ => scroll}/config/config-contracts.toml.template (100%) rename scripts/deterministic/{ => scroll}/config/config.toml (100%) rename scripts/deterministic/{ => scroll}/shell/deploy.sh (100%) rename scripts/deterministic/{ => scroll}/shell/update-configs.sh (100%) diff --git a/scripts/deterministic/DeterministicDeployment.sol b/scripts/deterministic/DeterministicDeployment.sol index e303a7b4..cc1658c5 100644 --- a/scripts/deterministic/DeterministicDeployment.sol +++ b/scripts/deterministic/DeterministicDeployment.sol @@ -8,9 +8,12 @@ import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.s import {ITransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import {ERC1967Upgrade} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol"; -import {DEFAULT_DEPLOYMENT_SALT, DETERMINISTIC_DEPLOYMENT_PROXY_ADDR} from "./Constants.sol"; import {Configuration} from "./Configuration.sol"; +/// @dev The address of DeterministicDeploymentProxy. +/// See https://github.com/Arachnid/deterministic-deployment-proxy. +address constant DETERMINISTIC_DEPLOYMENT_PROXY_ADDR = 0x4e59b44847b379578588920cA78FbF26c0B4956C; + /// @notice DeterministicDeployment provides utilities for deterministic contract deployments. abstract contract DeterministicDeployment is Configuration { using stdToml for string; @@ -56,7 +59,7 @@ abstract contract DeterministicDeployment is Configuration { if (bytes(DEPLOYMENT_SALT).length != 0) { saltPrefix = DEPLOYMENT_SALT; } else { - saltPrefix = DEFAULT_DEPLOYMENT_SALT; + revert("Missing deployment salt"); } // sanity check: make sure DeterministicDeploymentProxy exists diff --git a/scripts/deterministic/Constants.sol b/scripts/deterministic/scroll/Constants.sol similarity index 99% rename from scripts/deterministic/Constants.sol rename to scripts/deterministic/scroll/Constants.sol index fb6781df..54c17070 100644 --- a/scripts/deterministic/Constants.sol +++ b/scripts/deterministic/scroll/Constants.sol @@ -1,13 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity =0.8.24; -/// @dev The default deterministic deployment salt prefix. -string constant DEFAULT_DEPLOYMENT_SALT = "ScrollStack"; - -/// @dev The address of DeterministicDeploymentProxy. -/// See https://github.com/Arachnid/deterministic-deployment-proxy. -address constant DETERMINISTIC_DEPLOYMENT_PROXY_ADDR = 0x4e59b44847b379578588920cA78FbF26c0B4956C; - /// @dev The default minimum withdraw amount configured on L2TxFeeVault. uint256 constant FEE_VAULT_MIN_WITHDRAW_AMOUNT = 1 ether; diff --git a/scripts/deterministic/DeployScroll.s.sol b/scripts/deterministic/scroll/DeployScroll.s.sol similarity index 94% rename from scripts/deterministic/DeployScroll.s.sol rename to scripts/deterministic/scroll/DeployScroll.s.sol index cae98923..c1dec5aa 100644 --- a/scripts/deterministic/DeployScroll.s.sol +++ b/scripts/deterministic/scroll/DeployScroll.s.sol @@ -2,49 +2,50 @@ pragma solidity =0.8.24; import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; -import {ProxyAdminSetOwner} from "./contracts/ProxyAdminSetOwner.sol"; +import {ProxyAdminSetOwner} from "../contracts/ProxyAdminSetOwner.sol"; import {TransparentUpgradeableProxy, ITransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; -import {EmptyContract} from "../../src/misc/EmptyContract.sol"; - -import {EnforcedTxGateway} from "../../src/L1/gateways/EnforcedTxGateway.sol"; -import {L1CustomERC20Gateway} from "../../src/L1/gateways/L1CustomERC20Gateway.sol"; -import {L1ERC1155Gateway} from "../../src/L1/gateways/L1ERC1155Gateway.sol"; -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"; -import {L2GasPriceOracle} from "../../src/L1/rollup/L2GasPriceOracle.sol"; -import {MultipleVersionRollupVerifierSetOwner} from "./contracts/MultipleVersionRollupVerifierSetOwner.sol"; -import {ScrollChain} from "../../src/L1/rollup/ScrollChain.sol"; -import {ZkEvmVerifierV2} from "../../src/libraries/verifier/ZkEvmVerifierV2.sol"; -import {L2CustomERC20Gateway} from "../../src/L2/gateways/L2CustomERC20Gateway.sol"; -import {L2ERC1155Gateway} from "../../src/L2/gateways/L2ERC1155Gateway.sol"; -import {L2ERC721Gateway} from "../../src/L2/gateways/L2ERC721Gateway.sol"; -import {L2ETHGateway} from "../../src/L2/gateways/L2ETHGateway.sol"; -import {L2GatewayRouter} from "../../src/L2/gateways/L2GatewayRouter.sol"; -import {L2ScrollMessenger} from "../../src/L2/L2ScrollMessenger.sol"; -import {L2StandardERC20Gateway} from "../../src/L2/gateways/L2StandardERC20Gateway.sol"; -import {L2WETHGateway} from "../../src/L2/gateways/L2WETHGateway.sol"; -import {L1GasPriceOracle} from "../../src/L2/predeploys/L1GasPriceOracle.sol"; -import {L2MessageQueue} from "../../src/L2/predeploys/L2MessageQueue.sol"; -import {L2TxFeeVault} from "../../src/L2/predeploys/L2TxFeeVault.sol"; -import {Whitelist} from "../../src/L2/predeploys/Whitelist.sol"; -import {WrappedEther} from "../../src/L2/predeploys/WrappedEther.sol"; -import {ScrollStandardERC20} from "../../src/libraries/token/ScrollStandardERC20.sol"; -import {ScrollStandardERC20FactorySetOwner} from "./contracts/ScrollStandardERC20FactorySetOwner.sol"; - -import {ScrollChainMockFinalize} from "../../src/mocks/ScrollChainMockFinalize.sol"; +import {EmptyContract} from "../../../src/misc/EmptyContract.sol"; + +import {EnforcedTxGateway} from "../../../src/L1/gateways/EnforcedTxGateway.sol"; +import {L1CustomERC20Gateway} from "../../../src/L1/gateways/L1CustomERC20Gateway.sol"; +import {L1ERC1155Gateway} from "../../../src/L1/gateways/L1ERC1155Gateway.sol"; +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"; +import {L2GasPriceOracle} from "../../../src/L1/rollup/L2GasPriceOracle.sol"; +import {ScrollChain} from "../../../src/L1/rollup/ScrollChain.sol"; +import {ZkEvmVerifierV2} from "../../../src/libraries/verifier/ZkEvmVerifierV2.sol"; +import {L2CustomERC20Gateway} from "../../../src/L2/gateways/L2CustomERC20Gateway.sol"; +import {L2ERC1155Gateway} from "../../../src/L2/gateways/L2ERC1155Gateway.sol"; +import {L2ERC721Gateway} from "../../../src/L2/gateways/L2ERC721Gateway.sol"; +import {L2ETHGateway} from "../../../src/L2/gateways/L2ETHGateway.sol"; +import {L2GatewayRouter} from "../../../src/L2/gateways/L2GatewayRouter.sol"; +import {L2ScrollMessenger} from "../../../src/L2/L2ScrollMessenger.sol"; +import {L2StandardERC20Gateway} from "../../../src/L2/gateways/L2StandardERC20Gateway.sol"; +import {L2WETHGateway} from "../../../src/L2/gateways/L2WETHGateway.sol"; +import {L1GasPriceOracle} from "../../../src/L2/predeploys/L1GasPriceOracle.sol"; +import {L2MessageQueue} from "../../../src/L2/predeploys/L2MessageQueue.sol"; +import {L2TxFeeVault} from "../../../src/L2/predeploys/L2TxFeeVault.sol"; +import {Whitelist} from "../../../src/L2/predeploys/Whitelist.sol"; +import {WrappedEther} from "../../../src/L2/predeploys/WrappedEther.sol"; +import {ScrollStandardERC20} from "../../../src/libraries/token/ScrollStandardERC20.sol"; + +import {MultipleVersionRollupVerifierSetOwner} from "../contracts/MultipleVersionRollupVerifierSetOwner.sol"; +import {ScrollStandardERC20FactorySetOwner} from "../contracts/ScrollStandardERC20FactorySetOwner.sol"; + +import {ScrollChainMockFinalize} from "../../../src/mocks/ScrollChainMockFinalize.sol"; import "./Constants.sol"; import {ScrollConfiguration} from "./ScrollConfiguration.sol"; -import "./DeterministicDeployment.sol"; +import "../DeterministicDeployment.sol"; /// @dev The minimum deployer account balance. uint256 constant MINIMUM_DEPLOYER_BALANCE = 0.1 ether; diff --git a/scripts/deterministic/GenerateConfigs.s.sol b/scripts/deterministic/scroll/GenerateConfigs.s.sol similarity index 99% rename from scripts/deterministic/GenerateConfigs.s.sol rename to scripts/deterministic/scroll/GenerateConfigs.s.sol index 4215a876..8c7653fb 100644 --- a/scripts/deterministic/GenerateConfigs.s.sol +++ b/scripts/deterministic/scroll/GenerateConfigs.s.sol @@ -5,7 +5,7 @@ import {stdToml} from "forge-std/StdToml.sol"; import {ADMIN_SYSTEM_BACKEND_CONFIG_PATH, ADMIN_SYSTEM_CRON_CONFIG_PATH, BALANCE_CHECKER_CONFIG_PATH, BALANCE_CHECKER_CONFIG_TEMPLATE_PATH, BRIDGE_HISTORY_API_CONFIG_PATH, BRIDGE_HISTORY_CONFIG_TEMPLATE_PATH, BRIDGE_HISTORY_FETCHER_CONFIG_PATH, CHAIN_MONITOR_CONFIG_PATH, CHAIN_MONITOR_CONFIG_TEMPLATE_PATH, COORDINATOR_API_CONFIG_PATH, COORDINATOR_CONFIG_TEMPLATE_PATH, COORDINATOR_CRON_CONFIG_PATH, GAS_ORACLE_CONFIG_PATH, GENESIS_ALLOC_JSON_PATH, GENESIS_JSON_PATH, ROLLUP_CONFIG_PATH, ROLLUP_CONFIG_TEMPLATE_PATH, ROLLUP_EXPLORER_BACKEND_CONFIG_PATH} from "./Constants.sol"; import {DeployScroll} from "./DeployScroll.s.sol"; -import {DeterministicDeployment} from "./DeterministicDeployment.sol"; +import {DeterministicDeployment} from "../DeterministicDeployment.sol"; contract GenerateRollupConfig is DeployScroll { using stdToml for string; diff --git a/scripts/deterministic/GenerateGenesis.s.sol b/scripts/deterministic/scroll/GenerateGenesis.s.sol similarity index 93% rename from scripts/deterministic/GenerateGenesis.s.sol rename to scripts/deterministic/scroll/GenerateGenesis.s.sol index 5d03327e..0ccdff2d 100644 --- a/scripts/deterministic/GenerateGenesis.s.sol +++ b/scripts/deterministic/scroll/GenerateGenesis.s.sol @@ -1,15 +1,15 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity =0.8.24; -import {L1GasPriceOracle} from "../../src/L2/predeploys/L1GasPriceOracle.sol"; -import {L2MessageQueue} from "../../src/L2/predeploys/L2MessageQueue.sol"; -import {L2TxFeeVault} from "../../src/L2/predeploys/L2TxFeeVault.sol"; -import {Whitelist} from "../../src/L2/predeploys/Whitelist.sol"; -import {WrappedEther} from "../../src/L2/predeploys/WrappedEther.sol"; +import {L1GasPriceOracle} from "../../../src/L2/predeploys/L1GasPriceOracle.sol"; +import {L2MessageQueue} from "../../../src/L2/predeploys/L2MessageQueue.sol"; +import {L2TxFeeVault} from "../../../src/L2/predeploys/L2TxFeeVault.sol"; +import {Whitelist} from "../../../src/L2/predeploys/Whitelist.sol"; +import {WrappedEther} from "../../../src/L2/predeploys/WrappedEther.sol"; -import {DETERMINISTIC_DEPLOYMENT_PROXY_ADDR, FEE_VAULT_MIN_WITHDRAW_AMOUNT, GENESIS_ALLOC_JSON_PATH, GENESIS_JSON_PATH, GENESIS_JSON_TEMPLATE_PATH} from "./Constants.sol"; +import {FEE_VAULT_MIN_WITHDRAW_AMOUNT, GENESIS_ALLOC_JSON_PATH, GENESIS_JSON_PATH, GENESIS_JSON_TEMPLATE_PATH} from "./Constants.sol"; import {DeployScroll} from "./DeployScroll.s.sol"; -import {DeterministicDeployment} from "./DeterministicDeployment.sol"; +import {DeterministicDeployment, DETERMINISTIC_DEPLOYMENT_PROXY_ADDR} from "../DeterministicDeployment.sol"; contract GenerateGenesis is DeployScroll { /*************** diff --git a/scripts/deterministic/ScrollConfiguration.sol b/scripts/deterministic/scroll/ScrollConfiguration.sol similarity index 99% rename from scripts/deterministic/ScrollConfiguration.sol rename to scripts/deterministic/scroll/ScrollConfiguration.sol index 9eb2195a..f94e7bb2 100644 --- a/scripts/deterministic/ScrollConfiguration.sol +++ b/scripts/deterministic/scroll/ScrollConfiguration.sol @@ -4,7 +4,7 @@ pragma solidity =0.8.24; import {Script} from "forge-std/Script.sol"; import {stdToml} from "forge-std/StdToml.sol"; -import {Configuration} from "./Configuration.sol"; +import {Configuration} from "../Configuration.sol"; /// @notice ScrollConfiguration allows inheriting contracts to read the TOML configuration file. abstract contract ScrollConfiguration is Script, Configuration { diff --git a/scripts/deterministic/config/config-contracts.toml b/scripts/deterministic/scroll/config/config-contracts.toml similarity index 100% rename from scripts/deterministic/config/config-contracts.toml rename to scripts/deterministic/scroll/config/config-contracts.toml diff --git a/scripts/deterministic/config/config-contracts.toml.template b/scripts/deterministic/scroll/config/config-contracts.toml.template similarity index 100% rename from scripts/deterministic/config/config-contracts.toml.template rename to scripts/deterministic/scroll/config/config-contracts.toml.template diff --git a/scripts/deterministic/config/config.toml b/scripts/deterministic/scroll/config/config.toml similarity index 100% rename from scripts/deterministic/config/config.toml rename to scripts/deterministic/scroll/config/config.toml diff --git a/scripts/deterministic/shell/deploy.sh b/scripts/deterministic/scroll/shell/deploy.sh similarity index 100% rename from scripts/deterministic/shell/deploy.sh rename to scripts/deterministic/scroll/shell/deploy.sh diff --git a/scripts/deterministic/shell/update-configs.sh b/scripts/deterministic/scroll/shell/update-configs.sh similarity index 100% rename from scripts/deterministic/shell/update-configs.sh rename to scripts/deterministic/scroll/shell/update-configs.sh From 29b8be195afd272f8a50df786413dbfe150ed435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Garamv=C3=B6lgyi?= Date: Thu, 11 Sep 2025 14:21:56 +0200 Subject: [PATCH 3/4] fix todos --- scripts/deterministic/Configuration.sol | 4 ++++ .../deterministic/DeterministicDeployment.sol | 6 +----- .../scroll/GenerateConfigs.s.sol | 20 +++++++++---------- .../scroll/GenerateGenesis.s.sol | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/scripts/deterministic/Configuration.sol b/scripts/deterministic/Configuration.sol index c2c0b55e..89535fa6 100644 --- a/scripts/deterministic/Configuration.sol +++ b/scripts/deterministic/Configuration.sol @@ -39,6 +39,10 @@ abstract contract Configuration is Script { return cfg.readString(key); } + function writeToml(address addr, string memory tomlPath) internal { + vm.writeToml(vm.toString(addr), cfg, tomlPath); + } + /// @dev Ensure that `addr` is not the zero address. /// This helps catch bugs arising from incorrect deployment order. function notnull(address addr) internal pure returns (address) { diff --git a/scripts/deterministic/DeterministicDeployment.sol b/scripts/deterministic/DeterministicDeployment.sol index cc1658c5..01f5821d 100644 --- a/scripts/deterministic/DeterministicDeployment.sol +++ b/scripts/deterministic/DeterministicDeployment.sol @@ -38,8 +38,6 @@ abstract contract DeterministicDeployment is Configuration { string private saltPrefix; bool private skipDeploy; - string private cfgContractsPath; - /********************** * Internal interface * **********************/ @@ -48,8 +46,6 @@ abstract contract DeterministicDeployment is Configuration { mode = _mode; skipDeploy = false; - cfgContractsPath = string(abi.encodePacked(workdir, "/config-contracts.toml")); - if (mode != ScriptMode.EmptyConfig) { super.initialize(workdir); } @@ -211,7 +207,7 @@ abstract contract DeterministicDeployment is Configuration { string memory tomlPath = string(abi.encodePacked(".", name, "_ADDR")); if (mode == ScriptMode.WriteConfig) { - vm.writeToml(vm.toString(addr), cfgContractsPath, tomlPath); // TODO: move to helpers + writeToml(addr, tomlPath); return; } diff --git a/scripts/deterministic/scroll/GenerateConfigs.s.sol b/scripts/deterministic/scroll/GenerateConfigs.s.sol index 8c7653fb..49aefedf 100644 --- a/scripts/deterministic/scroll/GenerateConfigs.s.sol +++ b/scripts/deterministic/scroll/GenerateConfigs.s.sol @@ -14,8 +14,8 @@ contract GenerateRollupConfig is DeployScroll { * Entry point * ***************/ - function run() public { - DeterministicDeployment.initialize(ScriptMode.VerifyConfig, ""); // TODO + function run(string memory workdir) public { + DeterministicDeployment.initialize(ScriptMode.VerifyConfig, workdir); predictAllContracts(); generateRollupConfig(ROLLUP_CONFIG_PATH); @@ -58,8 +58,8 @@ contract GenerateCoordinatorConfig is DeployScroll { * Entry point * ***************/ - function run() public { - DeterministicDeployment.initialize(ScriptMode.VerifyConfig, ""); // TODO + function run(string memory workdir) public { + DeterministicDeployment.initialize(ScriptMode.VerifyConfig, workdir); predictAllContracts(); generateCoordinatorConfig(COORDINATOR_API_CONFIG_PATH); @@ -100,8 +100,8 @@ contract GenerateChainMonitorConfig is DeployScroll { * Entry point * ***************/ - function run() public { - DeterministicDeployment.initialize(ScriptMode.VerifyConfig, ""); // TODO + function run(string memory workdir) public { + DeterministicDeployment.initialize(ScriptMode.VerifyConfig, workdir); predictAllContracts(); generateChainMonitorConfig(CHAIN_MONITOR_CONFIG_PATH); @@ -153,8 +153,8 @@ contract GenerateBridgeHistoryConfig is DeployScroll { * Entry point * ***************/ - function run() public { - DeterministicDeployment.initialize(ScriptMode.VerifyConfig, ""); // TODO + function run(string memory workdir) public { + DeterministicDeployment.initialize(ScriptMode.VerifyConfig, workdir); predictAllContracts(); generateBridgeHistoryConfig(BRIDGE_HISTORY_API_CONFIG_PATH); @@ -209,8 +209,8 @@ contract GenerateBalanceCheckerConfig is DeployScroll { * Entry point * ***************/ - function run() public { - DeterministicDeployment.initialize(ScriptMode.VerifyConfig, ""); // TODO + function run(string memory workdir) public { + DeterministicDeployment.initialize(ScriptMode.VerifyConfig, workdir); predictAllContracts(); generateBalanceCheckerConfig(BALANCE_CHECKER_CONFIG_PATH); diff --git a/scripts/deterministic/scroll/GenerateGenesis.s.sol b/scripts/deterministic/scroll/GenerateGenesis.s.sol index 0ccdff2d..f86348b0 100644 --- a/scripts/deterministic/scroll/GenerateGenesis.s.sol +++ b/scripts/deterministic/scroll/GenerateGenesis.s.sol @@ -16,8 +16,8 @@ contract GenerateGenesis is DeployScroll { * Entry point * ***************/ - function run() public { - DeterministicDeployment.initialize(ScriptMode.VerifyConfig, ""); // TODO + function run(string memory workdir) public { + DeterministicDeployment.initialize(ScriptMode.VerifyConfig, workdir); predictAllContracts(); generateGenesisAlloc(); From 42816d844a5f0caf85d76074afdbf5b52141808d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Garamv=C3=B6lgyi?= Date: Thu, 11 Sep 2025 14:27:56 +0200 Subject: [PATCH 4/4] foundry.toml --- foundry.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foundry.toml b/foundry.toml index 5d7e99bf..3ebf29b5 100644 --- a/foundry.toml +++ b/foundry.toml @@ -35,6 +35,6 @@ bytecode_hash = 'none' ffi = true fs_permissions = [ - { access='read-write', path='./scripts/deterministic/config' }, + { access='read-write', path='./scripts/deterministic/scroll/config' }, { access='read-write', path='../../config' }, ] \ No newline at end of file