-
Notifications
You must be signed in to change notification settings - Fork 3.9k
LivenessModule2 implementation #17272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
9d13224
start
JosepBove 8102495
DeployOwnership scripts update
JosepBove dd75f3e
cleanup
JosepBove 5f934f7
reset challangeStartTime when re-enabling the module
JosepBove ec5b31a
remove duplicated comment
JosepBove 59cae4d
test cleanup
JosepBove e93c34f
fmt
JosepBove ee88fb3
semverlock
JosepBove dc1887d
add livenessmodule2 to checkfrozenfiles
JosepBove 989ae74
address alcueca's feedback
JosepBove d3bf748
change ownershiptransfer logic
JosepBove 34419fe
pre-pr
JosepBove 548fcf4
LivenessModule - Slightly simplified code (#17277)
alcueca 874836d
address smartcontract's feedback
JosepBove 37ae803
alcueca's feedback
JosepBove 93494c7
smartcontract's feedback
JosepBove f5fb1d3
add extra checks suggested by alcueca
JosepBove ee4de98
fix clear error
JosepBove e971a46
update snapshots
JosepBove 9c0f85c
conflicts
JosepBove 53efa74
Merge branch 'develop' into jb/liveness-module
JosepBove 6a29e0d
name nitpicks and coverage at 100%
JosepBove 39f603c
fix tests
JosepBove f0abb54
remove interface extra lines
JosepBove 6545424
fix event on test
JosepBove c670f52
rename isChallenged function to getChallengePeriodEnd
JosepBove 737affc
update snapshots
JosepBove d42b2b7
Merge branch 'develop' into jb/liveness-module
JosepBove f671313
update implementation from specs
JosepBove 669f2e1
sentinel owner and interface fix
JosepBove e4669ac
DRYness comments
JosepBove 405ae9c
move getter at the top
JosepBove 7b7923f
update comment
JosepBove dc3d59f
rename event
JosepBove d0dc8a5
add _assertModuleConfigured
JosepBove 60a11a4
add _assertModuleEnabled
JosepBove a93ac08
assert module enable fixes
JosepBove 1c27cb6
_cancelChallenge internal function
JosepBove 44c3ada
fix comments
JosepBove 3fb2639
more comments
JosepBove e177a22
split configure errors
JosepBove a8a54cd
owner transfer invariant
JosepBove e03a5d7
address comments
JosepBove 01eade2
address kelvin's feedback
JosepBove 5818472
lint
JosepBove e8f4b89
more comments
JosepBove 5f77577
Merge branch 'develop' into jb/liveness-module
JosepBove 5be1c2d
alcueca's comments
JosepBove d071478
Merge branch 'develop' into jb/liveness-module
JosepBove File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
packages/contracts-bedrock/interfaces/safe/ILivenessModule2.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import { ISemver } from "interfaces/universal/ISemver.sol"; | ||
|
|
||
| /// @title ILivenessModule2 | ||
| /// @notice Interface for LivenessModule2, a singleton module for challenge-based ownership transfer | ||
| interface ILivenessModule2 is ISemver { | ||
|
|
||
| /// @notice Error for when module is not enabled for the Safe | ||
| error LivenessModule2_ModuleNotEnabled(); | ||
|
|
||
| /// @notice Error for when a challenge already exists | ||
| error LivenessModule2_ChallengeAlreadyExists(); | ||
|
|
||
| /// @notice Error for when no challenge exists | ||
| error LivenessModule2_ChallengeDoesNotExist(); | ||
|
|
||
| /// @notice Error for when challenge is not successful | ||
| error LivenessModule2_ChallengeNotSuccessful(); | ||
|
|
||
| /// @notice Error for when caller is not authorized | ||
| error LivenessModule2_UnauthorizedCaller(); | ||
|
|
||
| /// @notice Error for invalid parameters | ||
| error LivenessModule2_InvalidParameters(); | ||
|
|
||
| /// @notice Error for when an owner is not found in the Safe's owner list | ||
| error LivenessModule2_OwnerNotFound(); | ||
|
|
||
| /// @notice Emitted when a Safe enables the module | ||
| event ModuleEnabled(address indexed safe, uint256 livenessChallengePeriod, address fallbackOwner); | ||
|
|
||
| /// @notice Emitted when a Safe disables the module | ||
| event ModuleDisabled(address indexed safe); | ||
|
|
||
| /// @notice Emitted when a challenge is started | ||
| event ChallengeStarted(address indexed safe, uint256 challengeStartTime); | ||
|
|
||
| /// @notice Emitted when a challenge is cancelled | ||
| event ChallengeCancelled(address indexed safe); | ||
|
|
||
| /// @notice Emitted when ownership is transferred to the fallback owner | ||
| event ChallengeExecuted(address indexed safe, address fallbackOwner); | ||
|
|
||
| /// @notice Returns the configuration for a Safe | ||
| /// @return livenessChallengePeriod The challenge period | ||
| /// @return fallbackOwner The fallback owner address | ||
| /// @return challengeStartTime The challenge start time (0 if no challenge) | ||
| function safeConfigs(address) external view returns (uint256 livenessChallengePeriod, address fallbackOwner, uint256 challengeStartTime); | ||
|
|
||
| /// @notice Semantic version | ||
| /// @return version The contract version | ||
| function version() external view returns (string memory); | ||
|
|
||
| /// @notice Enables the module by the multisig to be challenged | ||
| /// @param _livenessChallengePeriod The period in seconds for a liveness challenge | ||
| /// @param _fallbackOwner The address that will become owner if challenge succeeds | ||
| function enableModule(uint256 _livenessChallengePeriod, address _fallbackOwner) external; | ||
|
|
||
| /// @notice Disables the module by an enabled safe | ||
| function disableModule() external; | ||
|
|
||
JosepBove marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// @notice Returns the liveness_challenge_period and fallback_owner for a given safe | ||
| /// @param _safe The Safe address to query | ||
| /// @return livenessChallengePeriod The challenge period | ||
| /// @return fallbackOwner The fallback owner address | ||
| function viewConfiguration(address _safe) external view returns (uint256, address); | ||
|
|
||
| /// @notice Returns challenge_start_time + liveness_challenge_period if there is a challenge, or 0 if not | ||
| /// @param _safe The Safe address to query | ||
| /// @return The challenge end timestamp, or 0 if no challenge | ||
| function isChallenged(address _safe) external view returns (uint256); | ||
JosepBove marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /// @notice Challenges an enabled safe | ||
| /// @param _safe The Safe to challenge | ||
| function startChallenge(address _safe) external; | ||
|
|
||
| /// @notice Cancels a challenge for an enabled safe | ||
| function cancelChallenge() external; | ||
|
|
||
| /// @notice Removes all current owners from an enabled safe and appoints fallback as sole owner | ||
| /// @param _safe The Safe to transfer ownership of | ||
| function changeOwnershipToFallback(address _safe) external; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.