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
7ce3e4dc
Unverified
Commit
7ce3e4dc
authored
Oct 24, 2023
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(ctb): Only emit a single address from SignerRecorded
parent
927bcaaa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
15 deletions
+12
-15
LivenessGuard.sol
packages/contracts-bedrock/src/Safe/LivenessGuard.sol
+5
-7
LivenessGuard.t.sol
packages/contracts-bedrock/test/LivenessGuard.t.sol
+7
-8
No files found.
packages/contracts-bedrock/src/Safe/LivenessGuard.sol
View file @
7ce3e4dc
...
...
@@ -21,9 +21,9 @@ import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableS
contract LivenessGuard is ISemver, BaseGuard {
using EnumerableSet for EnumerableSet.AddressSet;
/// @notice Emitted when a
new set of signers
is recorded.
/// @param signer
s An arrary of signer addresse
s.
event Signer
sRecorded(bytes32 indexed txHash, address[] signers
);
/// @notice Emitted when a
signer
is recorded.
/// @param signer
The signer's addres
s.
event Signer
Recorded(bytes32 indexed txHash, address signer
);
/// @notice Semantic version.
/// @custom:semver 1.0.0
...
...
@@ -95,8 +95,8 @@ contract LivenessGuard is ISemver, BaseGuard {
for (uint256 i = 0; i < signers.length; i++) {
lastLive[signers[i]] = block.timestamp;
emit SignerRecorded(txHash, signers[i]);
}
emit SignersRecorded(txHash, signers);
}
/// @notice Update the lastLive mapping according to the set of owners before and after execution.
...
...
@@ -134,10 +134,8 @@ contract LivenessGuard is ISemver, BaseGuard {
function showLiveness() external {
require(SAFE.isOwner(msg.sender), "LivenessGuard: only Safe owners may demontstrate liveness");
lastLive[msg.sender] = block.timestamp;
address[] memory signers = new address[](1);
signers[0] = msg.sender;
emit Signer
sRecorded(0x0, signers
);
emit Signer
Recorded(0x0, msg.sender
);
}
/// @notice Getter function for the Safe contract instance
...
...
packages/contracts-bedrock/test/LivenessGuard.t.sol
View file @
7ce3e4dc
...
...
@@ -21,7 +21,7 @@ import { LivenessGuard } from "src/Safe/LivenessGuard.sol";
contract LivenessGuard_TestInit is Test, SafeTestTools {
using SafeTestLib for SafeInstance;
event Signer
sRecorded(bytes32 indexed txHash, address[] signers
);
event Signer
Recorded(bytes32 indexed txHash, address signer
);
LivenessGuard livenessGuard;
SafeInstance safeInstance;
...
...
@@ -69,9 +69,11 @@ contract LivenessGuard_CheckTx_Test is LivenessGuard_TestInit {
signers[0] = safeInstance.owners[0];
signers[1] = safeInstance.owners[1];
// Don't check topic1 so that we can avoid the ugly txHash calculation.
vm.expectEmit(false, true, true, true, address(livenessGuard));
emit SignersRecorded(0x0, signers);
for (uint256 i; i < signers.length; i++) {
// Don't check topic1 so that we can avoid the ugly txHash calculation.
vm.expectEmit(false, true, true, true, address(livenessGuard));
emit SignerRecorded(0x0, signers[i]);
}
vm.expectCall(address(safeInstance.safe), abi.encodeWithSignature("nonce()"));
vm.expectCall(address(safeInstance.safe), abi.encodeCall(OwnerManager.getThreshold, ()));
safeInstance.execTransaction({ to: address(1111), value: 0, data: hex"abba" });
...
...
@@ -96,11 +98,8 @@ contract LivenessGuard_ShowLiveness_Test is LivenessGuard_TestInit {
// Cache the caller
address caller = safeInstance.owners[0];
// Construct a signers array with just the caller to identify the expected event.
address[] memory signers = new address[](1);
signers[0] = caller;
vm.expectEmit(address(livenessGuard));
emit Signer
sRecorded(0x0, signers
);
emit Signer
Recorded(0x0, caller
);
vm.prank(caller);
livenessGuard.showLiveness();
...
...
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