Commit 7d974663 authored by Maurelian's avatar Maurelian

feat(ctb): Naming improvements

Standardizing on the term owner rather than signer except in and around calls to _getNSigners.
parent fbc6aded
...@@ -21,9 +21,9 @@ import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableS ...@@ -21,9 +21,9 @@ import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableS
contract LivenessGuard is ISemver, BaseGuard { contract LivenessGuard is ISemver, BaseGuard {
using EnumerableSet for EnumerableSet.AddressSet; using EnumerableSet for EnumerableSet.AddressSet;
/// @notice Emitted when a signer is recorded. /// @notice Emitted when an owner is recorded.
/// @param signer The signer's address. /// @param owner The owner's address.
event SignerRecorded(bytes32 indexed txHash, address signer); event OwnerRecorded(bytes32 indexed txHash, address owner);
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 1.0.0 /// @custom:semver 1.0.0
...@@ -95,7 +95,7 @@ contract LivenessGuard is ISemver, BaseGuard { ...@@ -95,7 +95,7 @@ contract LivenessGuard is ISemver, BaseGuard {
for (uint256 i = 0; i < signers.length; i++) { for (uint256 i = 0; i < signers.length; i++) {
lastLive[signers[i]] = block.timestamp; lastLive[signers[i]] = block.timestamp;
emit SignerRecorded(txHash, signers[i]); emit OwnerRecorded(txHash, signers[i]);
} }
} }
...@@ -135,7 +135,7 @@ contract LivenessGuard is ISemver, BaseGuard { ...@@ -135,7 +135,7 @@ contract LivenessGuard is ISemver, BaseGuard {
require(SAFE.isOwner(msg.sender), "LivenessGuard: only Safe owners may demontstrate liveness"); require(SAFE.isOwner(msg.sender), "LivenessGuard: only Safe owners may demontstrate liveness");
lastLive[msg.sender] = block.timestamp; lastLive[msg.sender] = block.timestamp;
emit SignerRecorded(0x0, msg.sender); emit OwnerRecorded(0x0, msg.sender);
} }
/// @notice Getter function for the Safe contract instance /// @notice Getter function for the Safe contract instance
......
...@@ -147,11 +147,11 @@ contract LivenessModule is ISemver { ...@@ -147,11 +147,11 @@ contract LivenessModule is ISemver {
); );
// Check that the guard has not been changed. // Check that the guard has not been changed.
_verifyGuard(); _requireCorrectGuard();
} }
/// @notice Reverts if the guard address does not match the expected value. /// @notice Reverts if the guard address does not match the expected value.
function _verifyGuard() internal view { function _requireCorrectGuard() internal view {
require( require(
address(LIVENESS_GUARD) == address(uint160(uint256(bytes32(SAFE.getStorageAt(GUARD_STORAGE_SLOT, 1))))), address(LIVENESS_GUARD) == address(uint160(uint256(bytes32(SAFE.getStorageAt(GUARD_STORAGE_SLOT, 1))))),
"LivenessModule: guard has been changed" "LivenessModule: guard has been changed"
......
...@@ -21,7 +21,7 @@ import { LivenessGuard } from "src/Safe/LivenessGuard.sol"; ...@@ -21,7 +21,7 @@ import { LivenessGuard } from "src/Safe/LivenessGuard.sol";
contract LivenessGuard_TestInit is Test, SafeTestTools { contract LivenessGuard_TestInit is Test, SafeTestTools {
using SafeTestLib for SafeInstance; using SafeTestLib for SafeInstance;
event SignerRecorded(bytes32 indexed txHash, address signer); event OwnerRecorded(bytes32 indexed txHash, address signer);
LivenessGuard livenessGuard; LivenessGuard livenessGuard;
SafeInstance safeInstance; SafeInstance safeInstance;
...@@ -72,7 +72,7 @@ contract LivenessGuard_CheckTx_Test is LivenessGuard_TestInit { ...@@ -72,7 +72,7 @@ contract LivenessGuard_CheckTx_Test is LivenessGuard_TestInit {
for (uint256 i; i < signers.length; i++) { for (uint256 i; i < signers.length; i++) {
// Don't check topic1 so that we can avoid the ugly txHash calculation. // Don't check topic1 so that we can avoid the ugly txHash calculation.
vm.expectEmit(false, true, true, true, address(livenessGuard)); vm.expectEmit(false, true, true, true, address(livenessGuard));
emit SignerRecorded(0x0, signers[i]); emit OwnerRecorded(0x0, signers[i]);
} }
vm.expectCall(address(safeInstance.safe), abi.encodeWithSignature("nonce()")); vm.expectCall(address(safeInstance.safe), abi.encodeWithSignature("nonce()"));
vm.expectCall(address(safeInstance.safe), abi.encodeCall(OwnerManager.getThreshold, ())); vm.expectCall(address(safeInstance.safe), abi.encodeCall(OwnerManager.getThreshold, ()));
...@@ -99,7 +99,7 @@ contract LivenessGuard_ShowLiveness_Test is LivenessGuard_TestInit { ...@@ -99,7 +99,7 @@ contract LivenessGuard_ShowLiveness_Test is LivenessGuard_TestInit {
address caller = safeInstance.owners[0]; address caller = safeInstance.owners[0];
vm.expectEmit(address(livenessGuard)); vm.expectEmit(address(livenessGuard));
emit SignerRecorded(0x0, caller); emit OwnerRecorded(0x0, caller);
vm.prank(caller); vm.prank(caller);
livenessGuard.showLiveness(); livenessGuard.showLiveness();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment