Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
a51e82f3
Unverified
Commit
a51e82f3
authored
Oct 26, 2023
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ctb): Add constructor check on threshold
parent
7fe44b99
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
LivenessModule.sol
packages/contracts-bedrock/src/Safe/LivenessModule.sol
+5
-2
LivenessModule.t.sol
packages/contracts-bedrock/test/LivenessModule.t.sol
+3
-3
No files found.
packages/contracts-bedrock/src/Safe/LivenessModule.sol
View file @
a51e82f3
...
...
@@ -54,8 +54,11 @@ contract LivenessModule is ISemver {
LIVENESS_INTERVAL = _livenessInterval;
FALLBACK_OWNER = _fallbackOwner;
MIN_OWNERS = _minOwners;
address[] memory owners = _safe.getOwners();
require(_minOwners < owners.length, "LivenessModule: minOwners must be less than the number of owners");
require(
_minOwners < _safe.getOwners().length, "LivenessModule: minOwners must be less than the number of owners"
_safe.getThreshold() == get75PercentThreshold(owners.length),
"LivenessModule: Safe must have a threshold of 75% of the number of owners"
);
}
...
...
@@ -161,7 +164,7 @@ contract LivenessModule is ISemver {
uint256 threshold = SAFE.getThreshold();
require(
threshold == get75PercentThreshold(numOwners),
"LivenessModule:
threshold must be
75% of the number of owners"
"LivenessModule:
Safe must have a threshold of
75% of the number of owners"
);
// Check that the guard has not been changed
...
...
packages/contracts-bedrock/test/LivenessModule.t.sol
View file @
a51e82f3
...
...
@@ -219,7 +219,7 @@ contract LivenessModule_RemoveOwners_TestFail is LivenessModule_TestInit {
ownersToRemove[0] = safeInstance.owners[0];
prevOwners[0] = ownersToRemove[0]; // incorrect.
vm.warp(block.timestamp + livenessInterval);
vm.warp(block.timestamp + livenessInterval
+ 1
);
vm.expectRevert("LivenessModule: failed to remove owner");
livenessModule.removeOwners(prevOwners, ownersToRemove);
}
...
...
@@ -237,7 +237,7 @@ contract LivenessModule_RemoveOwners_TestFail is LivenessModule_TestInit {
// Incorrectly set the final owner to address(0)
ownersToRemove[ownersToRemove.length - 1] = address(0);
vm.warp(block.timestamp + livenessInterval);
vm.warp(block.timestamp + livenessInterval
+ 1
);
vm.expectRevert("LivenessModule: failed to swap to fallback owner");
livenessModule.removeOwners(prevOwners, ownersToRemove);
}
...
...
@@ -253,7 +253,7 @@ contract LivenessModule_RemoveOwners_TestFail is LivenessModule_TestInit {
}
address[] memory prevOwners = _getPrevOwners(ownersToRemove);
vm.warp(block.timestamp + livenessInterval);
vm.warp(block.timestamp + livenessInterval
+ 1
);
vm.expectRevert(
"LivenessModule: Safe must have the minimum number of owners or be owned solely by the fallback owner"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment