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
d52cc302
Unverified
Commit
d52cc302
authored
Oct 26, 2023
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(ctb): Add Guard owner management tests
parent
f7ecd62b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
2 deletions
+36
-2
LivenessGuard.t.sol
packages/contracts-bedrock/test/LivenessGuard.t.sol
+36
-2
No files found.
packages/contracts-bedrock/test/LivenessGuard.t.sol
View file @
d52cc302
...
...
@@ -101,8 +101,6 @@ contract LivenessGuard_CheckAfterExecution_TestFails is LivenessGuard_TestInit {
}
}
contract LivenessGuard_CheckAfterExecution_Test is LivenessGuard_TestInit { }
contract LivenessGuard_ShowLiveness_TestFail is LivenessGuard_TestInit {
/// @dev Tests that the showLiveness function reverts if the caller is not an owner
function test_showLiveness_callIsNotSafeOwner_reverts() external {
...
...
@@ -126,3 +124,39 @@ contract LivenessGuard_ShowLiveness_Test is LivenessGuard_TestInit {
assertEq(livenessGuard.lastLive(caller), block.timestamp);
}
}
contract LivenessGuard_OwnerManagement_Test is LivenessGuard_TestInit {
using SafeTestLib for SafeInstance;
/// @dev Tests that the guard correctly deletes the owner from the lastLive mapping when it is removed
function test_removeOwner_succeeds() external {
address ownerToRemove = safeInstance.owners[0];
assertGe(livenessGuard.lastLive(ownerToRemove), 0);
assertTrue(safeInstance.safe.isOwner(ownerToRemove));
safeInstance.execTransaction({
to: address(safeInstance.safe),
value: 0,
data: abi.encodeWithSelector(OwnerManager.removeOwner.selector, SENTINEL_OWNERS, ownerToRemove, 1)
});
assertFalse(safeInstance.safe.isOwner(ownerToRemove));
assertEq(livenessGuard.lastLive(ownerToRemove), 0);
}
/// @dev Tests that the guard correctly adds an owner to the lastLive mapping when it is added
function test_addOwner_succeeds() external {
address ownerToAdd = makeAddr("new owner");
assertEq(livenessGuard.lastLive(ownerToAdd), 0);
assertFalse(safeInstance.safe.isOwner(ownerToAdd));
safeInstance.execTransaction({
to: address(safeInstance.safe),
value: 0,
data: abi.encodeWithSelector(OwnerManager.addOwnerWithThreshold.selector, ownerToAdd, 1)
});
assertTrue(safeInstance.safe.isOwner(ownerToAdd));
assertEq(livenessGuard.lastLive(ownerToAdd), block.timestamp);
}
}
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