From 65059087afedfec9a91a349592344f466708f5a3 Mon Sep 17 00:00:00 2001 From: r4bbit <445106+0x-r4bbit@users.noreply.github.com> Date: Fri, 22 Sep 2023 08:21:19 +0200 Subject: [PATCH] refactor: don't revert deployment on non-existant configs At this point, the contracts that need to be deployed do not require chain specific configurations. The ones provided for local test nodes are used in tests that don't represent the production deployment. Hence, there's little point in reverting the deployment if there's no config for a specific chain. This commit also moves the `deployer` assignment to the beginning of the constructor, ensuring that it's set when configs are created. --- script/DeploymentConfig.s.sol | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/script/DeploymentConfig.s.sol b/script/DeploymentConfig.s.sol index ef0e1dc..fc7f85d 100644 --- a/script/DeploymentConfig.s.sol +++ b/script/DeploymentConfig.s.sol @@ -20,13 +20,11 @@ contract DeploymentConfig is Script { address public immutable deployer; constructor(address _broadcaster) { - if (block.chainid == 31_337) { - (ownerTokenConfig, masterTokenConfig) = getOrCreateAnvilEthConfig(); - } else { - revert("no network config for this chain"); - } if (_broadcaster == address(0)) revert DeploymentConfig_InvalidDeployerAddress(); deployer = _broadcaster; + if (block.chainid == 31_337) { + (ownerTokenConfig, masterTokenConfig) = getOrCreateAnvilEthConfig(); + } } function getOrCreateAnvilEthConfig() public pure returns (TokenConfig memory, TokenConfig memory) {