Commit d759e6ff authored by Maurelian's avatar Maurelian

fix(ctb): Module constructor allows higher than minimum threshold in Safe

Loosening this requirement should provide added flexibility when setting
up the liveness system
parent d1f965f9
......@@ -57,8 +57,8 @@ contract LivenessModule is ISemver {
address[] memory owners = _safe.getOwners();
require(_minOwners <= owners.length, "LivenessModule: minOwners must be less than the number of owners");
require(
_safe.getThreshold() == get75PercentThreshold(owners.length),
"LivenessModule: Safe must have a threshold of 75% of the number of owners"
_safe.getThreshold() >= get75PercentThreshold(owners.length),
"LivenessModule: Safe must have a threshold of at least 75% of the number of owners"
);
}
......
......@@ -64,7 +64,7 @@ contract LivenessModule_TestInit is Test, SafeTestTools {
}
}
contract LivenessModule_Constructor_Test is LivenessModule_TestInit {
contract LivenessModule_Constructor_TestFail is LivenessModule_TestInit {
/// @dev Tests that the constructor fails if the minOwners is greater than the number of owners
function test_constructor_minOwnersGreaterThanOwners_reverts() external {
vm.expectRevert("LivenessModule: minOwners must be less than the number of owners");
......@@ -79,11 +79,11 @@ contract LivenessModule_Constructor_Test is LivenessModule_TestInit {
/// @dev Tests that the constructor fails if the minOwners is greater than the number of owners
function test_constructor_wrongThreshold_reverts() external {
uint256 wrongThreshold = livenessModule.get75PercentThreshold(safeInstance.owners.length) + 1;
uint256 wrongThreshold = livenessModule.get75PercentThreshold(safeInstance.owners.length) - 1;
vm.mockCall(
address(safeInstance.safe), abi.encodeCall(OwnerManager.getThreshold, ()), abi.encode(wrongThreshold)
);
vm.expectRevert("LivenessModule: Safe must have a threshold of 75% of the number of owners");
vm.expectRevert("LivenessModule: Safe must have a threshold of at least 75% of the number of owners");
new LivenessModule({
_safe: safeInstance.safe,
_livenessGuard: livenessGuard,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment