From 29a103fbeb128dd3b087cd53a0f5672da6690337 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Norswap\" Laurent" Date: Tue, 26 Sep 2023 19:46:58 +0200 Subject: [PATCH] deploy slowly --- config.py | 14 +++++++++++--- l2.py | 4 ++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/config.py b/config.py index 4515dd9..e7dea68 100644 --- a/config.py +++ b/config.py @@ -1,6 +1,7 @@ import os.path from paths import OPPaths +import libroll as lib # Summary on default port mapping: # @@ -45,7 +46,6 @@ class Config: def __init__(self, paths: OPPaths = None): - # ========================================================================================== # Paths (General) @@ -188,6 +188,15 @@ def __init__(self, paths: OPPaths = None): default, which is the Foundry default). """ + self.deploy_slowly = lib.args.preset == "prod" + """ + Whether to deploy contracts "slowly", i.e. wait for each transaction to succeed before + submitting the next one. This is recommended for production deployments, since RPC nodes + can be capricious and don't react kindly to getting 30+ transactions at once. + + Defaults to True when the `--preset=prod` is passed, False otherwise. + """ + # ========================================================================================== # Governance @@ -736,7 +745,7 @@ def l2_engine_chaindata_dir(self): """Directory storing chain data for the L2 engine.""" return os.path.join(self.l2_engine_data_dir, "geth", "chaindata") -# ============================================================================================== + # ============================================================================================== def validate(self): """ @@ -903,5 +912,4 @@ def production_config(paths: OPPaths): config.use_production_config() return config - #################################################################################################### diff --git a/l2.py b/l2.py index f857d4d..8a205ff 100644 --- a/l2.py +++ b/l2.py @@ -219,11 +219,12 @@ def deploy_l1_contracts(config: Config): log_file = "logs/deploy_l1_contracts.log" print(f"Deploying contracts to L1. Logging to {log_file}") + slow = "--slow" if config.deploy_slowly else "" lib.run_roll_log( "deploy contracts", f"forge script {deploy_script} --private-key {config.contract_deployer_key} " f"--gas-estimate-multiplier {config.l1_deployment_gas_multiplier} " - f"--rpc-url {config.l1_rpc} --broadcast", + f"--rpc-url {config.l1_rpc} --broadcast {slow}", cwd=config.paths.contracts_dir, env=env, log_file=log_file) @@ -335,5 +336,4 @@ def clean(config: Config): shutil.rmtree(config.deployments_dir, ignore_errors=True) - ####################################################################################################