Skip to content

Commit

Permalink
Merge pull request #45 from aragon/f/timelock-setting
Browse files Browse the repository at this point in the history
Turning the timelock into a setting
  • Loading branch information
brickpop authored Nov 29, 2024
2 parents 8240322 + 86a4ce9 commit 10709bf
Show file tree
Hide file tree
Showing 13 changed files with 239 additions and 103 deletions.
7 changes: 4 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ MULTISIG_MEMBERS_JSON_FILE_NAME="/script/multisig-members.json"

# GOVERNANCE PARAMETERS
MIN_VETO_RATIO="300000" # 30% (base 1_000_000)
TIME_LOCK_PERIOD="604800" # in seconds (7 days)
L2_INACTIVITY_PERIOD="600" # in seconds (10 minutes)
L2_AGGREGATION_GRACE_PERIOD="172800" # in seconds (2 days)
SKIP_L2=true # Determines whether vote aggregation from the L2 will be disabled
MIN_STD_PROPOSAL_DURATION="864000" # in seconds (10 days)
MIN_STD_APPROVALS="5" # How many multisig approvals are required
MIN_EMERGENCY_APPROVALS="10" # How many emergency multisig approvals are required
MIN_STD_PROPOSAL_DURATION="1209600" # in seconds (14 days)
MIN_STD_APPROVALS="3" # How many multisig approvals are required
MIN_EMERGENCY_APPROVALS="6" # How many emergency multisig approvals are required
MULTISIG_PROPOSAL_EXPIRATION_PERIOD="864000" # How long until a pending proposal expires (10 days)

# TAIKO's PARAMETERS
Expand Down
36 changes: 36 additions & 0 deletions DEPLOYMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,42 @@

## Holesly

### November 28th 2024

Deployment for internal testing:
- Exit window of 7 days (parameterizable)
- L2 disabled
- Using a pre-release voting token

```
Deploying from: 0x424797Ed6d902E17b9180BFcEF452658e148e0Ab
Chain ID: 17000
Using test token settings
Minting test tokens for the multisig members and the bridge
Factory: 0x7b9B81258d4b52Fb6D4Fb3C597bCeD2652F00bc8
DAO: 0x9Fe7b040cfD4CA67BB44714aa9c9D2F5234780BE
Voting token: 0x690b92470Aa1500CFc64af5adAb4A9D4c0a0a5f0
Taiko Bridge: 0x0000000000000000000000000000001234567890
Plugins
- Multisig plugin: 0xEAfaB9a95dC75C51d94b2cad2D675296914fA8a6
- Emergency multisig plugin: 0xF0847b600eebe43da7FD6bA1C9E325EC8408cB4F
- Optimistic token voting plugin: 0x892d99d271844A7C39757adcD177fbE2EFD3adbb
Helpers
- Signer list 0x08e2003Aab54d8C981A3bc5c48bB121B9eb57467
- Encryption registry 0x5Ec236003Cf8493cF2621E5daCAbD60f0a7A31Ae
- Delegation wall 0xe2e3b8a20048F699d40c1d4394BE62B30560fa6f
Plugin repositories
- Multisig plugin repository: 0xe797aFeABf9Cf5a0e86EA2B5D3a5F20397A98514
- Emergency multisig plugin repository: 0x87322002988a7AD7864cF89233b43D7CAE9289DA
- Optimistic token voting plugin repository: 0x2a0fa7CBB75444DA374169e9dd6Fee3330082B99
```

### November 18th 2024

Deployment for internal testing:
Expand Down
18 changes: 10 additions & 8 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ contract Deploy is Script {
tokenAddress: IVotesUpgradeable(vm.envAddress("TOKEN_ADDRESS")),
taikoL1ContractAddress: vm.envAddress("TAIKO_L1_ADDRESS"),
taikoBridgeAddress: vm.envAddress("TAIKO_BRIDGE_ADDRESS"),
l2InactivityPeriod: uint64(vm.envUint("L2_INACTIVITY_PERIOD")),
l2AggregationGracePeriod: uint64(vm.envUint("L2_AGGREGATION_GRACE_PERIOD")),
timelockPeriod: uint32(vm.envUint("TIME_LOCK_PERIOD")),
l2InactivityPeriod: uint32(vm.envUint("L2_INACTIVITY_PERIOD")),
l2AggregationGracePeriod: uint32(vm.envUint("L2_AGGREGATION_GRACE_PERIOD")),
skipL2: bool(vm.envBool("SKIP_L2")),
// Voting settings
minVetoRatio: uint32(vm.envUint("MIN_VETO_RATIO")),
minStdProposalDuration: uint64(vm.envUint("MIN_STD_PROPOSAL_DURATION")),
minStdProposalDuration: uint32(vm.envUint("MIN_STD_PROPOSAL_DURATION")),
minStdApprovals: uint16(vm.envUint("MIN_STD_APPROVALS")),
minEmergencyApprovals: uint16(vm.envUint("MIN_EMERGENCY_APPROVALS")),
// OSx contracts
Expand All @@ -92,7 +93,7 @@ contract Deploy is Script {
optimisticTokenVotingPluginSetup: OptimisticTokenVotingPluginSetup(optimisticTokenVotingPluginSetup),
// Multisig members
multisigMembers: readMultisigMembers(),
multisigExpirationPeriod: uint64(vm.envUint("MULTISIG_PROPOSAL_EXPIRATION_PERIOD")),
multisigExpirationPeriod: uint32(vm.envUint("MULTISIG_PROPOSAL_EXPIRATION_PERIOD")),
// ENS
stdMultisigEnsDomain: vm.envString("STD_MULTISIG_ENS_DOMAIN"),
emergencyMultisigEnsDomain: vm.envString("EMERGENCY_MULTISIG_ENS_DOMAIN"),
Expand All @@ -112,12 +113,13 @@ contract Deploy is Script {
tokenAddress: IVotesUpgradeable(votingToken),
taikoL1ContractAddress: address(new TaikoL1Mock()),
taikoBridgeAddress: taikoBridgeAddress,
l2InactivityPeriod: uint64(vm.envUint("L2_INACTIVITY_PERIOD")),
l2AggregationGracePeriod: uint64(vm.envUint("L2_AGGREGATION_GRACE_PERIOD")),
timelockPeriod: uint32(vm.envUint("TIME_LOCK_PERIOD")),
l2InactivityPeriod: uint32(vm.envUint("L2_INACTIVITY_PERIOD")),
l2AggregationGracePeriod: uint32(vm.envUint("L2_AGGREGATION_GRACE_PERIOD")),
skipL2: bool(vm.envBool("SKIP_L2")),
// Voting settings
minVetoRatio: uint32(vm.envUint("MIN_VETO_RATIO")),
minStdProposalDuration: uint64(vm.envUint("MIN_STD_PROPOSAL_DURATION")),
minStdProposalDuration: uint32(vm.envUint("MIN_STD_PROPOSAL_DURATION")),
minStdApprovals: uint16(vm.envUint("MIN_STD_APPROVALS")),
minEmergencyApprovals: uint16(vm.envUint("MIN_EMERGENCY_APPROVALS")),
// OSx contracts
Expand All @@ -130,7 +132,7 @@ contract Deploy is Script {
optimisticTokenVotingPluginSetup: OptimisticTokenVotingPluginSetup(optimisticTokenVotingPluginSetup),
// Multisig members
multisigMembers: multisigMembers,
multisigExpirationPeriod: uint64(vm.envUint("MULTISIG_PROPOSAL_EXPIRATION_PERIOD")),
multisigExpirationPeriod: uint32(vm.envUint("MULTISIG_PROPOSAL_EXPIRATION_PERIOD")),
// ENS
stdMultisigEnsDomain: vm.envString("STD_MULTISIG_ENS_DOMAIN"),
emergencyMultisigEnsDomain: vm.envString("EMERGENCY_MULTISIG_ENS_DOMAIN"),
Expand Down
4 changes: 2 additions & 2 deletions src/EmergencyMultisig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ contract EmergencyMultisig is IEmergencyMultisig, PluginUUPSUpgradeable, Proposa
bool onlyListed;
uint16 minApprovals;
SignerList signerList;
uint64 proposalExpirationPeriod;
uint32 proposalExpirationPeriod; // uint32 is enough, not a timestamp
}

/// @notice The ID of the permission required to call the `addAddresses` and `removeAddresses` functions.
Expand Down Expand Up @@ -128,7 +128,7 @@ contract EmergencyMultisig is IEmergencyMultisig, PluginUUPSUpgradeable, Proposa
/// @param signerList The contract defining who is a member and/or who is appointed as a decryption wallet
/// @param proposalExpirationPeriod The amount of seconds after which a non executed proposal expires.
event MultisigSettingsUpdated(
bool onlyListed, uint16 indexed minApprovals, SignerList signerList, uint64 proposalExpirationPeriod
bool onlyListed, uint16 indexed minApprovals, SignerList signerList, uint32 proposalExpirationPeriod
);

/// @notice Initializes Release 1, Build 1.
Expand Down
8 changes: 4 additions & 4 deletions src/Multisig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ contract Multisig is IMultisig, PluginUUPSUpgradeable, ProposalUpgradeable {
struct MultisigSettings {
bool onlyListed;
uint16 minApprovals;
uint64 destinationProposalDuration;
uint32 destinationProposalDuration; // uint32 is enough, not a timestamp
SignerList signerList;
uint64 proposalExpirationPeriod;
uint32 proposalExpirationPeriod; // uint32 is enough, not a timestamp
}

/// @notice The ID of the permission required to call the `addAddresses` and `removeAddresses` functions.
Expand Down Expand Up @@ -124,9 +124,9 @@ contract Multisig is IMultisig, PluginUUPSUpgradeable, ProposalUpgradeable {
event MultisigSettingsUpdated(
bool onlyListed,
uint16 indexed minApprovals,
uint64 destinationProposalDuration,
uint32 destinationProposalDuration,
SignerList signerList,
uint64 proposalExpirationPeriod
uint32 proposalExpirationPeriod
);

/// @notice Initializes Release 1, Build 1.
Expand Down
13 changes: 6 additions & 7 deletions src/OptimisticTokenVotingPlugin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ contract OptimisticTokenVotingPlugin is
/// @notice A container for the optimistic majority settings that will be applied as parameters on proposal creation.
/// @param minVetoRatio The support threshold value. Its value has to be in the interval [0, 10^6] defined by `RATIO_BASE = 10**6`.
/// @param minDuration The minimum duration of the proposal vote in seconds.
/// @param timelockPeriod The time in seconds between a proposal passing and execution being unlocked
/// @param l2InactivityPeriod The age in seconds of the latest block, after which the L2 is considered unavailable.
/// @param l2AggregationGracePeriod The amount of extra seconds to allow for L2 veto bridging after `vetoEndDate` is reached.
/// @param skipL2 Defines wether the plugin should ignore the voting power bridged to the L2, in terms of the token supply and L2 votes accepted. NOTE: Ongoing proposals will keep the value of the setting at the time of creation.
struct OptimisticGovernanceSettings {
uint32 minVetoRatio;
uint64 minDuration;
uint64 l2InactivityPeriod;
uint64 l2AggregationGracePeriod;
uint32 minDuration;
uint32 timelockPeriod;
uint32 l2InactivityPeriod;
uint32 l2AggregationGracePeriod;
bool skipL2;
}

Expand Down Expand Up @@ -84,9 +86,6 @@ contract OptimisticTokenVotingPlugin is
bytes32 public constant UPDATE_OPTIMISTIC_GOVERNANCE_SETTINGS_PERMISSION_ID =
keccak256("UPDATE_OPTIMISTIC_GOVERNANCE_SETTINGS_PERMISSION");

/// @notice The time gap between a proposal passing and execution being unlocked
uint64 public constant EXIT_WINDOW = 7 days;

/// @notice An [OpenZeppelin `Votes`](https://docs.openzeppelin.com/contracts/4.x/api/governance#Votes) compatible contract referencing the token being used for voting.
IVotesUpgradeable public votingToken;

Expand Down Expand Up @@ -580,7 +579,7 @@ contract OptimisticTokenVotingPlugin is
/// @param proposal_ The proposal struct.
/// @return True if the proposal cannot be executed because the exit window hasn't elapsed yet
function _proposalInExitWindow(Proposal storage proposal_) internal view virtual returns (bool) {
uint64 exitWindowTimestamp = proposal_.parameters.vetoEndDate + EXIT_WINDOW;
uint64 exitWindowTimestamp = proposal_.parameters.vetoEndDate + governanceSettings.timelockPeriod;

if (!proposal_.parameters.unavailableL2) {
exitWindowTimestamp += governanceSettings.l2AggregationGracePeriod;
Expand Down
10 changes: 6 additions & 4 deletions src/factory/TaikoDaoFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ contract TaikoDaoFactory {
IVotesUpgradeable tokenAddress;
address taikoL1ContractAddress;
address taikoBridgeAddress;
uint64 l2InactivityPeriod;
uint64 l2AggregationGracePeriod;
uint32 timelockPeriod;
uint32 l2InactivityPeriod;
uint32 l2AggregationGracePeriod;
bool skipL2;
// Voting settings
uint32 minVetoRatio;
uint64 minStdProposalDuration;
uint32 minStdProposalDuration;
uint16 minStdApprovals;
uint16 minEmergencyApprovals;
// OSx contracts
Expand All @@ -69,7 +70,7 @@ contract TaikoDaoFactory {
OptimisticTokenVotingPluginSetup optimisticTokenVotingPluginSetup;
// Multisig
address[] multisigMembers;
uint64 multisigExpirationPeriod;
uint32 multisigExpirationPeriod;
// ENS
string stdMultisigEnsDomain;
string emergencyMultisigEnsDomain;
Expand Down Expand Up @@ -291,6 +292,7 @@ contract TaikoDaoFactory {
.OptimisticGovernanceSettings(
settings.minVetoRatio,
0, // minDuration (the condition contract will enforce it)
settings.timelockPeriod,
settings.l2InactivityPeriod,
settings.l2AggregationGracePeriod,
settings.skipL2
Expand Down
4 changes: 2 additions & 2 deletions test/EmergencyMultisig.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {IProposal} from "@aragon/osx/core/plugin/proposal/IProposal.sol";
import {IPlugin} from "@aragon/osx/core/plugin/IPlugin.sol";
import {IEmergencyMultisig} from "../src/interfaces/IEmergencyMultisig.sol";

uint64 constant EMERGENCY_MULTISIG_PROPOSAL_EXPIRATION_PERIOD = 10 days;
uint32 constant EMERGENCY_MULTISIG_PROPOSAL_EXPIRATION_PERIOD = 10 days;

contract EmergencyMultisigTest is AragonTest {
DaoBuilder builder;
Expand All @@ -38,7 +38,7 @@ contract EmergencyMultisigTest is AragonTest {
error InvalidActions(uint256 proposalId);

event MultisigSettingsUpdated(
bool onlyListed, uint16 indexed minApprovals, SignerList signerList, uint64 proposalExpirationPeriod
bool onlyListed, uint16 indexed minApprovals, SignerList signerList, uint32 proposalExpirationPeriod
);

event EmergencyProposalCreated(uint256 indexed proposalId, address indexed creator, bytes encryptedPayloadURI);
Expand Down
6 changes: 3 additions & 3 deletions test/Multisig.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {IProposal} from "@aragon/osx/core/plugin/proposal/IProposal.sol";
import {IPlugin} from "@aragon/osx/core/plugin/IPlugin.sol";
import {IMultisig} from "../src/interfaces/IMultisig.sol";

uint64 constant MULTISIG_PROPOSAL_EXPIRATION_PERIOD = 10 days;
uint32 constant MULTISIG_PROPOSAL_EXPIRATION_PERIOD = 10 days;
uint32 constant DESTINATION_PROPOSAL_DURATION = 9 days;

contract MultisigTest is AragonTest {
Expand All @@ -41,9 +41,9 @@ contract MultisigTest is AragonTest {
event MultisigSettingsUpdated(
bool onlyListed,
uint16 indexed minApprovals,
uint64 destinationProposalDuration,
uint32 destinationProposalDuration,
SignerList signerList,
uint64 proposalExpirationPeriod
uint32 proposalExpirationPeriod
);
// Multisig and OptimisticTokenVotingPlugin's event
event ProposalCreated(
Expand Down
Loading

0 comments on commit 10709bf

Please sign in to comment.