-
Notifications
You must be signed in to change notification settings - Fork 196
LivenessModule #751
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
Closed
Closed
LivenessModule #751
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a256392
initial draft
35dd6c4
Merge branch 'main' into ac/liveness-module
alcueca d6d605f
Addressed non-format comments
355293c
Formatted the assumptions and invariants
52a5e9a
Blaine's review
1033b49
Added another invariant
d9e9261
No restrictions on enabling.
3dc41e0
Fix toc
7d4c4a3
lint
dd496f6
Wording
998db32
better invariants, matching function spec to implementation lessons
alcueca a846fa9
More explicit specs about when to cancel a challenge
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
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,121 @@ | ||
| # Governor | ||
|
|
||
| <!-- START doctoc generated TOC please keep comment here to allow auto update --> | ||
| <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
| **Table of Contents** | ||
|
|
||
| - [Overview](#overview) | ||
| - [Definitions](#definitions) | ||
| - [Successful challenge](#successful-challenge) | ||
JosepBove marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - [Unsuccessful challenge](#unsuccessful-challenge) | ||
| - [Assumptions](#assumptions) | ||
| - [Invariants](#invariants) | ||
| - [Function Specification](#function-specification) | ||
| - [constructor](#constructor) | ||
| - [`enableModule`](#enablemodule) | ||
| - [`disableModule`](#disablemodule) | ||
| - [`setLivenessChallengePeriod`](#setlivenesschallengeperiod) | ||
| - [`setFallbackOwner`](#setfallbackowner) | ||
| - [`livenessChallengePeriod`](#livenesschallengeperiod) | ||
| - [`fallbackOwner`](#fallbackowner) | ||
| - [`isChallenged`](#ischallenged) | ||
| - [`startChallenge`](#startchallenge) | ||
| - [`cancelChallenge`](#cancelchallenge) | ||
| - [`changeOwnershipToFallback`](#changeownershiptofallback) | ||
|
|
||
| <!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
|
|
||
| ## Overview | ||
|
|
||
| The `Governor` contract implements the core governance logic for creating, voting, and executing proposals. | ||
alcueca marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| This contract uses the `GovernanceToken` contract for voting power snapshots, and the `ProposalTypesConfigurator` | ||
| for proposal types. | ||
|
|
||
| ## Definitions | ||
|
|
||
| ### Successful challenge | ||
| A challenge with a `challenge_start_time` more than `liveness_challenge_period` in the past. | ||
|
|
||
| ### Unsuccessful challenge | ||
alcueca marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| A challenge for which `cancelChallenge` was called earlier than `challenge_start_time + liveness_challenge_period`. | ||
| TODO: Make sure the two definitions are a perfect partition. | ||
|
|
||
| ## Assumptions | ||
|
|
||
| ## Invariants | ||
alcueca marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - For an enabled `safe`, there can't be more than one concurrent challenge. | ||
|
|
||
| ## Function Specification | ||
|
|
||
| ### constructor | ||
| - MUST not set any values. | ||
|
|
||
| ### `enableModule` | ||
| Enables the module by the multisig to be challenged. | ||
|
|
||
| - MUST set the caller as a `safe`. | ||
| - MUST take as parameters `liveness_challenge_period` and `fallback_owner` and store them as related to the `safe`. | ||
| - MUST accept an arbitrary number of independent `safe` contracts to enable the module. | ||
alcueca marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| TODO: Should we require the `fallback_owner` to execute a second transaction to confirm? | ||
alcueca marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| TODO: Should we hardcode some lower and higher bounds to `liveness_challenge_period`? | ||
|
|
||
| ### `disableModule` | ||
| Disables the module by the multisig to be challenged. | ||
|
|
||
| - MUST only be executable an enabled `safe`. | ||
| - MUST revert if there is an ongoing challenge for the calling `safe`. | ||
alcueca marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - MUST erase the existing `liveness_challenge_period` and `fallback_owner` data related to the calling `safe`. | ||
alcueca marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ### `setLivenessChallengePeriod` | ||
| Changes the `liveness_challenge_period` for a given `safe` | ||
|
|
||
| - MUST only be executable an enabled `safe`. | ||
| - MUST revert if there is a challenge for the calling `safe`. | ||
|
|
||
| ### `setFallbackOwner` | ||
alcueca marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Changes the `fallback_owner` for a given `safe` | ||
|
|
||
| - MUST only be executable an enabled `safe`. | ||
| - MUST revert if there is a challenge for the calling `safe`. | ||
|
|
||
| ### `livenessChallengePeriod` | ||
alcueca marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Returns `livenessChallengePeriod`. | ||
|
|
||
| - MUST never revert. | ||
|
|
||
| ### `fallbackOwner` | ||
| Returns `fallbackOwner`. | ||
|
|
||
| - MUST never revert. | ||
|
|
||
| ### `isChallenged` | ||
| Returns `challenge_start_time + liveness_challenge_period` if there is a challenge for the given `safe`, or 0 if not. | ||
|
|
||
| - MUST never revert. | ||
|
|
||
| ### `startChallenge` | ||
alcueca marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Challenges a enabled `safe`. | ||
alcueca marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - MUST only be executable by `fallback` owner of the challenged `safe`. | ||
| - MUST revert if there is a challenge for the `safe`. | ||
| - MUST set `challenge_start_time` to the current block time. | ||
| - MUST emit the `ChallengeStarted` event. | ||
|
|
||
| ### `cancelChallenge` | ||
alcueca marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Cancels a challenge for a enabled `safe`. | ||
alcueca marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - MUST only be executable by a enabled `safe`. | ||
alcueca marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - MUST revert if there isn't a challenge for the calling `safe`. | ||
| - MUST revert if there is a challenge for the calling `safe` but the challenge is successful. | ||
alcueca marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - MUST emit the `ChallengeCancelled` event. | ||
|
|
||
| ### `changeOwnershipToFallback` | ||
|
|
||
| With a successful challenge, removes all current owners from a enabled `safe`, appoints `fallback` as its sole owner, and sets its quorum to 1. | ||
alcueca marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
alcueca marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - MUST be executable by anyone. | ||
| - MUST revert if the given `safe` hasn't enabled the module. | ||
| - MUST revert if there isn't a successful challenge for the given `safe`. | ||
| - MUST enable the module to start a new challenge. | ||
| - MUST emit the `ChallengeExecuted` event. | ||
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.