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
c7d5b2b9
Unverified
Commit
c7d5b2b9
authored
Oct 24, 2023
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(ctb): Clean up in LivenessGuard
parent
6368229c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
21 deletions
+19
-21
LivenessGuard.sol
packages/contracts-bedrock/src/Safe/LivenessGuard.sol
+19
-21
No files found.
packages/contracts-bedrock/src/Safe/LivenessGuard.sol
View file @
c7d5b2b9
...
@@ -47,20 +47,21 @@ contract LivenessGuard is ISemver, BaseGuard {
...
@@ -47,20 +47,21 @@ contract LivenessGuard is ISemver, BaseGuard {
address[] memory ownersAfter = safe.getOwners();
address[] memory ownersAfter = safe.getOwners();
// Iterate over the current owners, and remove one at a time from the ownersBefore set.
// Iterate over the current owners, and remove one at a time from the ownersBefore set.
for (uint256 i = 0; i < ownersAfter.length; i++) {
uint256 ownersAfterLength = ownersAfter.length;
for (uint256 i = 0; i < ownersAfterLength; i++) {
// If the value was present, remove() returns true.
// If the value was present, remove() returns true.
if (ownersBefore.remove(ownersAfter[i]) == false) {
address ownerAfter = ownersAfter[i];
if (ownersBefore.remove(ownerAfter) == false) {
// This address was not already an owner, add it to the lastSigned mapping
// This address was not already an owner, add it to the lastSigned mapping
lastLive[owner
sAfter[i]
] = block.timestamp;
lastLive[owner
After
] = block.timestamp;
}
}
}
}
// Now iterate over the remaining ownersBefore entries. Any remaining addresses are no longer an owner, so we
// Now iterate over the remaining ownersBefore entries. Any remaining addresses are no longer an owner, so we
// delete them from the lastSigned mapping.
// delete them from the lastSigned mapping.
for (uint256 j = 0; j < ownersBefore.length(); j++) {
for (uint256 j = 0; j < ownersBefore.length(); j++) {
address owner = ownersBefore.at(j);
address owner
Before
= ownersBefore.at(j);
delete lastLive[owner];
delete lastLive[owner
Before
];
}
}
return;
}
}
/// @notice Records the most recent time which any owner has signed a transaction.
/// @notice Records the most recent time which any owner has signed a transaction.
...
@@ -92,21 +93,18 @@ contract LivenessGuard is ISemver, BaseGuard {
...
@@ -92,21 +93,18 @@ contract LivenessGuard is ISemver, BaseGuard {
// This call will reenter to the Safe which is calling it. This is OK because it is only reading the
// This call will reenter to the Safe which is calling it. This is OK because it is only reading the
// nonce, and using the getTransactionHash() method.
// nonce, and using the getTransactionHash() method.
bytes32 txHash = Safe(payable(msg.sender)).getTransactionHash(
bytes32 txHash = Safe(payable(msg.sender)).getTransactionHash({
// Transaction info
to: to,
to,
value: value,
value,
data: data,
data,
operation: operation,
operation,
safeTxGas: safeTxGas,
safeTxGas,
baseGas: baseGas,
// Payment info
gasPrice: gasPrice,
baseGas,
gasToken: gasToken,
gasPrice,
refundReceiver: refundReceiver,
gasToken,
_nonce: Safe(payable(msg.sender)).nonce() - 1
refundReceiver,
});
// Signature info
Safe(payable(msg.sender)).nonce() - 1
);
uint256 threshold = safe.getThreshold();
uint256 threshold = safe.getThreshold();
address[] memory signers =
address[] memory signers =
...
...
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