Skip to content

Commit

Permalink
ctb: Deploy separate foundation ops and upgrade safes (#10647)
Browse files Browse the repository at this point in the history
  • Loading branch information
maurelian authored May 24, 2024
1 parent 388bd0b commit 2a805a9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 13 deletions.
25 changes: 18 additions & 7 deletions packages/contracts-bedrock/scripts/DeployOwnership.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ contract DeployOwnership is Deploy {
// The SuperchainConfig is needed as a constructor argument to the Deputy Guardian Module
deploySuperchainConfig();

deployFoundationSafe();
deployFoundationOperationsSafe();
deployFoundationUpgradeSafe();
deploySecurityCouncilSafe();
deployGuardianSafe();
configureGuardianSafe();
Expand All @@ -87,7 +88,7 @@ contract DeployOwnership is Deploy {
guardianConfig_ = GuardianConfig({
safeConfig: SafeConfig({ threshold: 1, owners: exampleGuardianOwners }),
deputyGuardianModuleConfig: DeputyGuardianModuleConfig({
deputyGuardian: mustGetAddress("FoundationSafe"),
deputyGuardian: mustGetAddress("FoundationOperationsSafe"),
superchainConfig: SuperchainConfig(mustGetAddress("SuperchainConfig"))
})
});
Expand All @@ -103,24 +104,34 @@ contract DeployOwnership is Deploy {
councilConfig_ = SecurityCouncilConfig({
safeConfig: safeConfig,
livenessModuleConfig: LivenessModuleConfig({
livenessInterval: 24 weeks,
livenessInterval: 14 weeks,
thresholdPercentage: 75,
minOwners: 8,
fallbackOwner: mustGetAddress("FoundationSafe")
fallbackOwner: mustGetAddress("FoundationUpgradeSafe")
})
});
}

/// @notice Deploys a Safe with a configuration similar to that of the Foundation Safe on Mainnet.
function deployFoundationSafe() public broadcast returns (address addr_) {
function deployFoundationOperationsSafe() public broadcast returns (address addr_) {
SafeConfig memory exampleFoundationConfig = _getExampleFoundationConfig();
addr_ = deploySafe({
_name: "FoundationSafe",
_name: "FoundationOperationsSafe",
_owners: exampleFoundationConfig.owners,
_threshold: exampleFoundationConfig.threshold,
_keepDeployer: false
});
}

/// @notice Deploys a Safe with a configuration similar to that of the Foundation Safe on Mainnet.
function deployFoundationUpgradeSafe() public broadcast returns (address addr_) {
SafeConfig memory exampleFoundationConfig = _getExampleFoundationConfig();
addr_ = deploySafe({
_name: "FoundationUpgradeSafe",
_owners: exampleFoundationConfig.owners,
_threshold: exampleFoundationConfig.threshold,
_keepDeployer: false
});
console.log("Deployed and configured the Foundation Safe!");
}

/// @notice Deploy a LivenessGuard for use on the Security Council Safe.
Expand Down
19 changes: 13 additions & 6 deletions packages/contracts-bedrock/test/Safe/DeployOwnership.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,20 @@ contract DeployOwnershipTest is Test, DeployOwnership {
}
}

/// @dev Test the example Foundation Safe configuration.
function test_exampleFoundationSafe() public {
Safe foundationSafe = Safe(payable(mustGetAddress("FoundationSafe")));
/// @dev Test the example Foundation Safe configurations, against the expected configuration, and
/// check that they both have the same configuration.
function test_exampleFoundationSafes() public {
Safe upgradeSafe = Safe(payable(mustGetAddress("FoundationUpgradeSafe")));
Safe operationsSafe = Safe(payable(mustGetAddress("FoundationOperationsSafe")));
SafeConfig memory exampleFoundationConfig = _getExampleFoundationConfig();

_checkSafeConfig(exampleFoundationConfig, foundationSafe);
// Ensure the safes both match the example configuration
_checkSafeConfig(exampleFoundationConfig, upgradeSafe);
_checkSafeConfig(exampleFoundationConfig, operationsSafe);

// Sanity check to ensure the safes match each other's configuration
assertEq(upgradeSafe.getThreshold(), operationsSafe.getThreshold());
assertEq(upgradeSafe.getOwners().length, operationsSafe.getOwners().length);
}

/// @dev Test the example Security Council Safe configuration.
Expand All @@ -72,7 +80,6 @@ contract DeployOwnershipTest is Test, DeployOwnership {

// Module Checks
address livenessModule = mustGetAddress("LivenessModule");
address deputyGuardianModule = mustGetAddress("DeputyGuardianModule");
(address[] memory modules, address nextModule) =
ModuleManager(securityCouncilSafe).getModulesPaginated(SENTINEL_MODULES, 2);
assertEq(modules.length, 1);
Expand All @@ -91,7 +98,7 @@ contract DeployOwnershipTest is Test, DeployOwnership {
}

/// @dev Test the example Guardian Safe configuration.
function test_exampleGuardianSafe() public {
function test_exampleGuardianSafe() public view {
Safe guardianSafe = Safe(payable(mustGetAddress("GuardianSafe")));
address[] memory owners = new address[](1);
owners[0] = mustGetAddress("SecurityCouncilSafe");
Expand Down

0 comments on commit 2a805a9

Please sign in to comment.