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
2f3965fc
Unverified
Commit
2f3965fc
authored
Oct 26, 2023
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(ctb): Refactor tests to use owner management lib utils
parent
e3ac8519
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
10 deletions
+21
-10
LivenessGuard.t.sol
packages/contracts-bedrock/test/LivenessGuard.t.sol
+21
-10
No files found.
packages/contracts-bedrock/test/LivenessGuard.t.sol
View file @
2f3965fc
...
...
@@ -134,11 +134,7 @@ contract LivenessGuard_OwnerManagement_Test is LivenessGuard_TestInit {
assertGe(livenessGuard.lastLive(ownerToRemove), 0);
assertTrue(safeInstance.safe.isOwner(ownerToRemove));
safeInstance.execTransaction({
to: address(safeInstance.safe),
value: 0,
data: abi.encodeWithSelector(OwnerManager.removeOwner.selector, SafeTestLib.SENTINEL_OWNERS, ownerToRemove, 1)
});
safeInstance.removeOwner({ prevOwner: address(0), owner: ownerToRemove, threshold: 1 });
assertFalse(safeInstance.safe.isOwner(ownerToRemove));
assertEq(livenessGuard.lastLive(ownerToRemove), 0);
...
...
@@ -150,11 +146,26 @@ contract LivenessGuard_OwnerManagement_Test is LivenessGuard_TestInit {
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)
});
safeInstance.addOwnerWithThreshold({ owner: ownerToAdd, threshold: 1 });
assertTrue(safeInstance.safe.isOwner(ownerToAdd));
assertEq(livenessGuard.lastLive(ownerToAdd), block.timestamp);
}
/// @dev Tests that the guard correctly adds an owner to the lastLive mapping when it is added
function test_swapOwner_succeeds() external {
address ownerToRemove = safeInstance.owners[0];
assertGe(livenessGuard.lastLive(ownerToRemove), 0);
assertTrue(safeInstance.safe.isOwner(ownerToRemove));
address ownerToAdd = makeAddr("new owner");
assertEq(livenessGuard.lastLive(ownerToAdd), 0);
assertFalse(safeInstance.safe.isOwner(ownerToAdd));
safeInstance.swapOwner({ prevOwner: address(0), oldOwner: ownerToRemove, newOwner: ownerToAdd });
assertFalse(safeInstance.safe.isOwner(ownerToRemove));
assertEq(livenessGuard.lastLive(ownerToRemove), 0);
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