diff --git a/contracts/.env.example b/contracts/.env.example index c3ed4e0d2..5d9038354 100644 --- a/contracts/.env.example +++ b/contracts/.env.example @@ -8,6 +8,9 @@ # Bootstrap Safe that becomes vault admin (accepts via vault.acceptAdmin()). # Changeable later via transferAdmin; handed to the Timelock at phase 5. +# Create the Safe on this chain first: the script refuses an address that is +# not a Safe (no code, an EIP-7702 delegated EOA) and a Safe whose threshold +# (getThreshold()) is below 2. ADMIN_SAFE= # Fast pause guardian (small-threshold Safe). Can pause but NOT unpause, so a # compromised guardian can only halt, never release. Its signers must hold no @@ -21,7 +24,8 @@ ATTESTOR_2= ATTESTOR_3= ATTESTOR_4= -# PERMANENT. Max issuance in 18-decimal units. Decision D3: 150M PEN. +# PERMANENT. Max issuance in 18-decimal units. Decision D3: 150M PEN. The +# script refuses any other value (Deploy.s.sol EXPECTED_MAX_ISSUANCE). MAX_ISSUANCE=150000000000000000000000000 # Caps in 18-decimal units. Set equal to each other on purpose: a release @@ -37,10 +41,12 @@ MAX_ISSUANCE=150000000000000000000000000 PER_RELEASE_CAP=1000000000000000000000000 DAILY_CAP=1000000000000000000000000 -# PERMANENT. Unix timestamp before which the remainder CANNOT be swept. This is -# a floor on the earliest a sweep could happen, not a deadline for holders: -# closing the window is a separate governance decision and can be deferred -# indefinitely. +# PERMANENT. Unix timestamp in SECONDS before which the remainder CANNOT be +# swept; the script refuses a value less than 30 days after the deploy block +# (2027-03-01 below passes for any deploy up to 2027-01-30) or more than two +# years ahead (a milliseconds value lands far beyond that). This is a floor on +# the earliest a sweep could happen, not a deadline for holders: closing the +# window is a separate governance decision and can be deferred indefinitely. # # Deliberately set beyond the ~3-month window we intend to advertise: a later # floor costs nothing operationally (the remainder simply waits in the vault, @@ -53,22 +59,42 @@ DAILY_CAP=1000000000000000000000000 # 1803859200 = 2027-03-01 00:00 UTC EARLIEST_SWEEP_TS=1803859200 +# Testnet drills and local runs only: TEST_DEPLOY=true admits an ADMIN_SAFE +# that is not a Safe and an EARLIEST_SWEEP_TS less than 30 days ahead. Refused +# on Base mainnet; leave it unset for production. +# TEST_DEPLOY= + # --- DeployGovernance.s.sol (phase 5) --- -PEN_TOKEN= -TIMELOCK_DELAY=172800 # 48h (PRD V5) -VOTING_DELAY=86400 # 1 day, seconds (timestamp clock) -VOTING_PERIOD=432000 # 5 days -PROPOSAL_THRESHOLD= # token units required to propose +# The script checks every value below before broadcasting. +PEN_TOKEN= # must be the token of VAULT_ADDRESS +VAULT_ADDRESS= # the MigrationVault deployed above +TIMELOCK_DELAY=172800 # 48h (PRD V5); seconds, 48h to 30 days +VOTING_DELAY=86400 # 1 day, seconds (timestamp clock), 1h to 30 days +VOTING_PERIOD=432000 # 5 days, seconds, 1 to 30 days +# 18-decimal token units required to propose, NOT whole PEN: the script +# refuses anything below 1 PEN (1e18) or above the total supply. +PROPOSAL_THRESHOLD= # Percent of CIRCULATING supply (total minus the vault's unmigrated balance, # which setToken parks at the vote sink), counting For+Abstain -# votes actually cast. Bounded below by QUORUM_FLOOR. +# votes actually cast. Bounded below by QUORUM_FLOOR. 1 to 100; the script +# refuses 0, which would leave quorum at the floor for good. QUORUM_FRACTION=2 -# Absolute quorum floor, 18-decimal token units. Decide this before phase 5 — -# there is no safe default and the script refuses to run without it. Size it -# so quorum is reachable soon after launch, or no proposal (an unpause -# included) can pass. +# PERMANENT (immutable in the governor). Absolute quorum floor, 18-decimal +# token units, NOT whole PEN: the script refuses anything below 1 PEN (1e18) +# or above the total supply. Decide this before phase 5 — there is no safe +# default and the script refuses to run without it. Size it so quorum is +# reachable soon after launch, or no proposal (an unpause included) can pass. QUORUM_FLOOR= -# Strongly recommended: a multisig granted CANCELLER_ROLE on the timelock, so a -# queued operation can still be vetoed during the 48h delay (OZ Governor alone -# lets only the proposer cancel, and only before voting starts). +# Required: a dedicated canceller Safe, separate from the guardian, granted +# CANCELLER_ROLE on the timelock so a queued operation can still be vetoed +# during the 48h delay (OZ Governor alone lets only the proposer cancel, and +# only before voting starts). Create the Safe on this chain first: the script +# refuses to run without it, with an address that is not a Safe, with a Safe +# whose threshold (getThreshold()) is below 2, or with the deployer, +# PEN_TOKEN, VAULT_ADDRESS or the vault's guardian. TIMELOCK_CANCELLER= +# Testnet drills only: TEST_DEPLOY=true admits a shorter TIMELOCK_DELAY, +# VOTING_DELAY and VOTING_PERIOD, a TIMELOCK_CANCELLER that is not a Safe or +# is the guardian, QUORUM_FRACTION=0 and QUORUM_FLOOR=0. Refused on Base +# mainnet; leave it unset for production. +# TEST_DEPLOY= diff --git a/contracts/script/Deploy.s.sol b/contracts/script/Deploy.s.sol index 27a9a2034..f48db21be 100644 --- a/contracts/script/Deploy.s.sol +++ b/contracts/script/Deploy.s.sol @@ -5,6 +5,7 @@ import {Script, console} from "forge-std/Script.sol"; import {PEN} from "../src/PEN.sol"; import {MigrationVault} from "../src/MigrationVault.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {requireMultisigSafe} from "./SafeCheck.sol"; /// @notice Deploys the migration stack on Base (PRD rollout phase 3): /// 1. MigrationVault with the deployer as interim admin @@ -14,25 +15,59 @@ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /// must call acceptAdmin() to complete) /// /// Environment: -/// ADMIN_SAFE bootstrap Safe that becomes vault admin +/// ADMIN_SAFE bootstrap Safe that becomes vault admin; must be a +/// Safe on this chain with a threshold of at least 2 +/// (getThreshold(); no EIP-7702 delegated EOA) /// GUARDIAN_SAFE fast pause guardian /// ATTESTOR_1..4 attestor transaction-sender addresses (D4: 3-of-4) -/// MAX_ISSUANCE max issuance in 18-decimal units (decision D3) +/// MAX_ISSUANCE max issuance in 18-decimal units (decision D3); +/// must equal EXPECTED_MAX_ISSUANCE /// PER_RELEASE_CAP initial per-release cap, 18-decimal units /// DAILY_CAP initial daily cap, 18-decimal units -/// EARLIEST_SWEEP_TS unix timestamp before which no remainder sweep (D5) +/// EARLIEST_SWEEP_TS unix timestamp in SECONDS before which no remainder +/// sweep (D5); at least MIN_SWEEP_FLOOR_AHEAD after +/// the deploy block and at most MAX_SWEEP_FLOOR_AHEAD +/// TEST_DEPLOY optional, testnet drills and local runs only: allows +/// an ADMIN_SAFE that is not a Safe and an +/// EARLIEST_SWEEP_TS any time in the future. Refused +/// on Base mainnet. contract Deploy is Script { + uint256 internal constant BASE_MAINNET = 8453; // 12-decimal pallet amounts -> 18-decimal token amounts (decision D2). uint256 internal constant CONVERSION_FACTOR = 1e6; uint256 internal constant THRESHOLD = 3; + // MAX_ISSUANCE and EARLIEST_SWEEP_TS are permanent once deployed, so the + // script checks them instead of trusting the environment. + // Decision D3: 150M PEN. + uint256 internal constant EXPECTED_MAX_ISSUANCE = 150_000_000e18; + // A sweep floor further out than this is a units slip (milliseconds land + // ~1000x further) or a typo, not a decision. + uint256 internal constant MAX_SWEEP_FLOOR_AHEAD = 2 * 365 days; + // A sweep floor closer than this is a drill value, not a migration window. + uint256 internal constant MIN_SWEEP_FLOOR_AHEAD = 30 days; - function run() external { + function run() external returns (PEN pen, MigrationVault vault) { + bool testDeploy = vm.envOr("TEST_DEPLOY", false); + require(!testDeploy || block.chainid != BASE_MAINNET, "TEST_DEPLOY is refused on Base mainnet"); + + // The bootstrap admin holds every vault setting until governance takes + // over, so it must be a Safe, not a single key. address adminSafe = vm.envAddress("ADMIN_SAFE"); + if (!testDeploy) requireMultisigSafe(adminSafe, "ADMIN_SAFE"); address guardianSafe = vm.envAddress("GUARDIAN_SAFE"); uint256 maxIssuance = vm.envUint("MAX_ISSUANCE"); uint256 perReleaseCap = vm.envUint("PER_RELEASE_CAP"); uint256 dailyCap = vm.envUint("DAILY_CAP"); uint256 earliestSweepTs = vm.envUint("EARLIEST_SWEEP_TS"); + require(maxIssuance == EXPECTED_MAX_ISSUANCE, "MAX_ISSUANCE must be 150M PEN in 18-decimal units"); + require( + earliestSweepTs > block.timestamp && earliestSweepTs <= block.timestamp + MAX_SWEEP_FLOOR_AHEAD, + "EARLIEST_SWEEP_TS must be a future unix time in seconds, at most two years ahead" + ); + require( + earliestSweepTs >= block.timestamp + MIN_SWEEP_FLOOR_AHEAD || testDeploy, + "EARLIEST_SWEEP_TS is less than 30 days after the deploy block" + ); address[] memory attestors = new address[](4); attestors[0] = vm.envAddress("ATTESTOR_1"); @@ -40,9 +75,11 @@ contract Deploy is Script { attestors[2] = vm.envAddress("ATTESTOR_3"); attestors[3] = vm.envAddress("ATTESTOR_4"); - vm.startBroadcast(); + // Broadcast as msg.sender (forge sets it to --sender or the single + // signer), the address the interim admin role below is given to. + vm.startBroadcast(msg.sender); - MigrationVault vault = new MigrationVault( + vault = new MigrationVault( msg.sender, // interim admin for setToken; handed over below guardianSafe, attestors, @@ -52,7 +89,7 @@ contract Deploy is Script { dailyCap, earliestSweepTs ); - PEN pen = new PEN(address(vault), maxIssuance); + pen = new PEN(address(vault), maxIssuance); vault.setToken(IERC20(address(pen))); vault.transferAdmin(adminSafe); diff --git a/contracts/script/DeployGovernance.s.sol b/contracts/script/DeployGovernance.s.sol index 6e88e23bd..8e93792d1 100644 --- a/contracts/script/DeployGovernance.s.sol +++ b/contracts/script/DeployGovernance.s.sol @@ -5,6 +5,9 @@ import {Script, console} from "forge-std/Script.sol"; import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.sol"; import {PENGovernor} from "../src/PENGovernor.sol"; import {IVotes} from "@openzeppelin/contracts/governance/utils/IVotes.sol"; +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {MigrationVault} from "../src/MigrationVault.sol"; +import {requireMultisigSafe} from "./SafeCheck.sol"; /// @notice Deploys the on-chain governance stack (PRD rollout phase 5): /// TimelockController + PENGovernor, wired so that only the Governor @@ -16,54 +19,124 @@ import {IVotes} from "@openzeppelin/contracts/governance/utils/IVotes.sol"; /// (bootstrap Safe calls vault.transferAdmin(timelock), then a /// governance proposal calls vault.acceptAdmin()). /// -/// Environment: -/// PEN_TOKEN deployed PEN address -/// TIMELOCK_DELAY seconds (PRD V5: >= 48h = 172800) -/// VOTING_DELAY seconds before voting starts (timestamp clock) -/// VOTING_PERIOD seconds of voting -/// PROPOSAL_THRESHOLD token units needed to propose +/// Environment (each value is checked before anything is broadcast: most are +/// fixed at deploy or changeable only by a proposal through this governor, so +/// a wrong one could not be corrected afterwards): +/// PEN_TOKEN deployed PEN address; must be VAULT_ADDRESS's token +/// VAULT_ADDRESS deployed MigrationVault (its setToken verified that +/// PEN_TOKEN minted the whole supply into it) +/// TIMELOCK_DELAY seconds, 48h (172800) to 30 days (PRD V5) +/// VOTING_DELAY seconds before voting starts (timestamp clock), +/// 1 hour to 30 days +/// VOTING_PERIOD seconds of voting, 1 day to 30 days +/// PROPOSAL_THRESHOLD 18-decimal token units needed to propose, 1 PEN +/// (1e18) to total supply; a whole-PEN figure such as +/// 50000 is refused /// QUORUM_FRACTION percent of CIRCULATING supply (total minus the /// vault's unmigrated balance parked at the vote -/// sink, see PRD G1 as revised in review round 8) +/// sink, see PRD G1), 1 to 100 /// QUORUM_FLOOR absolute quorum lower bound, 18-decimal token -/// units; keeps early proposals from being trivially -/// cheap while circulating supply is still small -/// TIMELOCK_CANCELLER optional: an address (the guardian/council Safe) -/// that can cancel a QUEUED operation during the -/// timelock delay. Without it only the Governor holds -/// CANCELLER_ROLE, and OZ Governor lets only the -/// proposer cancel, only before voting starts — so a -/// hostile proposal that passed could not be stopped -/// during the 48h delay by anyone (review round 9) +/// units, 1 PEN (1e18) to total supply; PERMANENT. +/// Keeps early proposals from being trivially cheap +/// while circulating supply is still small +/// TIMELOCK_CANCELLER required: a dedicated canceller Safe, separate +/// from the guardian, that can cancel a QUEUED +/// operation during the timelock delay. Without it +/// only the Governor holds CANCELLER_ROLE, and OZ +/// Governor lets only the proposer cancel, only before +/// voting starts, so a hostile proposal that passed +/// could not be stopped during the delay by anyone. +/// Once the delay has passed anyone may execute, so +/// the script refuses to deploy without it. It must +/// be a Safe on this chain with a threshold of at +/// least 2 (getThreshold(); no EIP-7702 delegated EOA) +/// and must not be the deployer, PEN_TOKEN, +/// VAULT_ADDRESS or the vault's guardian. +/// TEST_DEPLOY optional, testnet drills only: allows a shorter +/// TIMELOCK_DELAY, VOTING_DELAY and VOTING_PERIOD, a +/// TIMELOCK_CANCELLER that is not a Safe or is the +/// guardian, QUORUM_FRACTION=0 and QUORUM_FLOOR=0. +/// Refused on Base mainnet. contract DeployGovernance is Script { - function run() external { + uint256 internal constant BASE_MAINNET = 8453; + uint256 internal constant MIN_TIMELOCK_DELAY = 2 days; + // Shorter windows are a units slip (days entered as seconds), and a vote + // too short for holders to take part in could not be undone by one. + uint256 internal constant MIN_VOTING_DELAY = 1 hours; + uint256 internal constant MIN_VOTING_PERIOD = 1 days; + // Longer periods are a units slip (milliseconds land ~1000x further), and + // a governor whose votes never end could not vote to shorten them. + uint256 internal constant MAX_PERIOD = 30 days; + + function run() external returns (TimelockController timelock, PENGovernor governor) { + bool testDeploy = vm.envOr("TEST_DEPLOY", false); + require(!testDeploy || block.chainid != BASE_MAINNET, "TEST_DEPLOY is refused on Base mainnet"); + address token = vm.envAddress("PEN_TOKEN"); + MigrationVault vault = MigrationVault(vm.envAddress("VAULT_ADDRESS")); + require(address(vault.token()) == token, "PEN_TOKEN is not the migration vault's token"); + uint256 supply = IERC20(token).totalSupply(); + uint256 timelockDelay = vm.envUint("TIMELOCK_DELAY"); - uint48 votingDelay = uint48(vm.envUint("VOTING_DELAY")); - uint32 votingPeriod = uint32(vm.envUint("VOTING_PERIOD")); + require(timelockDelay >= MIN_TIMELOCK_DELAY || testDeploy, "TIMELOCK_DELAY is below 48h"); + require(timelockDelay <= MAX_PERIOD, "TIMELOCK_DELAY is above 30 days (seconds expected)"); + uint256 votingDelay = vm.envUint("VOTING_DELAY"); + require(votingDelay >= MIN_VOTING_DELAY || testDeploy, "VOTING_DELAY is below 1h (seconds expected)"); + require(votingDelay <= MAX_PERIOD, "VOTING_DELAY is above 30 days (seconds expected)"); + uint256 votingPeriod = vm.envUint("VOTING_PERIOD"); + require(votingPeriod >= MIN_VOTING_PERIOD || testDeploy, "VOTING_PERIOD is below 1 day (seconds expected)"); + require(votingPeriod <= MAX_PERIOD, "VOTING_PERIOD is above 30 days (seconds expected)"); + + // 18-decimal units: below one PEN is a whole-PEN figure entered as + // wei, above the supply could never be met. uint256 proposalThreshold = vm.envUint("PROPOSAL_THRESHOLD"); + require( + proposalThreshold >= 1e18 && proposalThreshold <= supply, + "PROPOSAL_THRESHOLD must be 18-decimal units, 1 PEN to total supply" + ); + // Zero leaves quorum at the permanent floor however much PEN + // circulates. uint256 quorumFraction = vm.envUint("QUORUM_FRACTION"); + require(quorumFraction > 0 || testDeploy, "QUORUM_FRACTION must be above 0"); uint256 quorumFloor = vm.envUint("QUORUM_FLOOR"); + require( + (quorumFloor >= 1e18 || (testDeploy && quorumFloor == 0)) && quorumFloor <= supply, + "QUORUM_FLOOR must be 18-decimal units, 1 PEN to total supply" + ); + address canceller = vm.envOr("TIMELOCK_CANCELLER", address(0)); + require(canceller != address(0), "TIMELOCK_CANCELLER is required: no veto during the timelock delay otherwise"); + require(canceller != msg.sender, "TIMELOCK_CANCELLER must not be the deployer"); + require(canceller != token && canceller != address(vault), "TIMELOCK_CANCELLER must not be PEN or the vault"); + require(canceller != vault.guardian() || testDeploy, "TIMELOCK_CANCELLER must be separate from the guardian"); + // A 1-of-n canceller is a single key holding a veto over every proposal. + if (!testDeploy) requireMultisigSafe(canceller, "TIMELOCK_CANCELLER"); - vm.startBroadcast(); + // Broadcast as msg.sender (forge sets it to --sender or the single + // signer), the deployer that is temporary admin so the roles below + // can be wired. + vm.startBroadcast(msg.sender); - // Deployer is temporary admin so the roles below can be wired. address[] memory empty = new address[](0); - TimelockController timelock = - new TimelockController(timelockDelay, empty, empty, msg.sender); + timelock = new TimelockController(timelockDelay, empty, empty, msg.sender); - PENGovernor governor = new PENGovernor( - IVotes(token), timelock, votingDelay, votingPeriod, proposalThreshold, quorumFraction, quorumFloor + governor = new PENGovernor( + IVotes(token), + timelock, + uint48(votingDelay), // bounded by MAX_PERIOD above + uint32(votingPeriod), + proposalThreshold, + quorumFraction, + quorumFloor ); // Only the Governor proposes; anyone may execute after the delay. The - // Governor cancels its own operations, and an optional human canceller - // can veto a queued operation during the delay — the reaction window - // the timelock exists to provide. + // Governor cancels its own operations, and the human canceller can + // veto a queued operation during the delay — the reaction window the + // timelock exists to provide. timelock.grantRole(timelock.PROPOSER_ROLE(), address(governor)); timelock.grantRole(timelock.CANCELLER_ROLE(), address(governor)); - if (canceller != address(0)) timelock.grantRole(timelock.CANCELLER_ROLE(), canceller); + timelock.grantRole(timelock.CANCELLER_ROLE(), canceller); timelock.grantRole(timelock.EXECUTOR_ROLE(), address(0)); // Leave the timelock self-administered: changes require a proposal. timelock.renounceRole(timelock.DEFAULT_ADMIN_ROLE(), msg.sender); diff --git a/contracts/script/SafeCheck.sol b/contracts/script/SafeCheck.sol new file mode 100644 index 000000000..f10ce8cff --- /dev/null +++ b/contracts/script/SafeCheck.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-3.0-only +pragma solidity 0.8.26; + +// A 1-of-n Safe is a single key. +uint256 constant MIN_SAFE_THRESHOLD = 2; + +/// @notice Refuses `account`, named `name` in the messages, unless it is a +/// Safe on this chain with a threshold of at least MIN_SAFE_THRESHOLD. +/// A Safe answers getThreshold() with its non-zero threshold. An +/// EIP-7702 delegated EOA stays a single key whatever it delegates to. +function requireMultisigSafe(address account, string memory name) view { + require(account.code.length > 0, string.concat(name, " has no code on this chain (create the Safe first)")); + require(bytes3(account.code) != 0xef0100, string.concat(name, " is an EIP-7702 delegated EOA, not a Safe")); + (bool ok, bytes memory threshold) = account.staticcall(abi.encodeWithSignature("getThreshold()")); + require(ok && threshold.length == 32, string.concat(name, " is not a Safe (getThreshold() failed)")); + uint256 value = abi.decode(threshold, (uint256)); + require(value > 0, string.concat(name, " Safe has threshold 0 (not set up)")); + require(value >= MIN_SAFE_THRESHOLD, string.concat(name, " Safe threshold is below 2")); +} diff --git a/contracts/src/MigrationVault.sol b/contracts/src/MigrationVault.sol index 9d055ff00..afc5deb3d 100644 --- a/contracts/src/MigrationVault.sol +++ b/contracts/src/MigrationVault.sol @@ -434,7 +434,7 @@ contract MigrationVault { // A decrease can retroactively qualify a sub-threshold payload without // routing through approve() (which maintains pendingApprovedAmount); // gate sweeps for a settling period so it can be detected and released - // first (round-4 finding). + // first. if (threshold_ < threshold) thresholdReducedAt = block.timestamp; threshold = threshold_; emit ThresholdUpdated(threshold_); diff --git a/contracts/src/PENGovernor.sol b/contracts/src/PENGovernor.sol index c0c5b4fe7..697eb92ec 100644 --- a/contracts/src/PENGovernor.sol +++ b/contracts/src/PENGovernor.sol @@ -18,7 +18,7 @@ import {IVotes} from "@openzeppelin/contracts/governance/utils/IVotes.sol"; /// bootstrap phase. PEN uses the EIP-6372 timestamp clock, so all /// Governor periods below are in seconds. /// -/// Quorum (PRD G1, revised in review round 8): quorum is a fraction of +/// Quorum (PRD G1): quorum is a fraction of /// the CIRCULATING supply — total supply minus the unmigrated balance /// parked at `QUORUM_SINK` by the MigrationVault — bounded below by an /// absolute `quorumFloor`. A full-supply denominator could deadlock diff --git a/contracts/test/DeployScripts.t.sol b/contracts/test/DeployScripts.t.sol new file mode 100644 index 000000000..470cba46b --- /dev/null +++ b/contracts/test/DeployScripts.t.sol @@ -0,0 +1,289 @@ +// SPDX-License-Identifier: GPL-3.0-only +pragma solidity 0.8.26; + +import {Test} from "forge-std/Test.sol"; +import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.sol"; +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {PEN} from "../src/PEN.sol"; +import {MigrationVault} from "../src/MigrationVault.sol"; +import {PENGovernor} from "../src/PENGovernor.sol"; +import {Deploy} from "../script/Deploy.s.sol"; +import {DeployGovernance} from "../script/DeployGovernance.s.sol"; + +// These run the real scripts against their environment. The environment is +// process-wide, forge runs test functions in parallel and both scripts read +// TEST_DEPLOY, so all cases share one test function instead of racing on the +// same variables. The scripts broadcast as their caller, so this test +// contract is the deployer. + +// Answers getThreshold() like a Safe. Immutable, so an account delegating to +// it answers the same. +contract SafeStub { + uint256 internal immutable threshold; + + constructor(uint256 threshold_) { + threshold = threshold_; + } + + function getThreshold() external view returns (uint256) { + return threshold; + } +} + +// Answers every call with the given raw bytes. +contract RawAnswerStub { + bytes internal answer; + + constructor(bytes memory answer_) { + answer = answer_; + } + + fallback(bytes calldata) external returns (bytes memory) { + return answer; + } +} + +contract DeployScriptsTest is Test { + uint256 internal constant SWEEP_FLOOR = 1803859200; // 2027-03-01 00:00 UTC + uint256 internal constant DEPLOY_TIME = 1792000000; // October 2026 + uint256 internal constant SUPPLY = 150_000_000e18; + + Deploy internal deployScript; + address internal adminSafe = address(new SafeStub(2)); + + DeployGovernance internal governanceScript; + PEN internal pen; + MigrationVault internal vault; + // The dedicated canceller Safe, separate from the vault's guardian Safe, + // at the lowest threshold the script accepts. + address internal canceller = address(new SafeStub(2)); + address internal guardian = address(new SafeStub(2)); + + function setUp() public { + vm.warp(DEPLOY_TIME); + deployScript = new Deploy(); + governanceScript = new DeployGovernance(); + address[] memory attestors = new address[](3); + attestors[0] = makeAddr("a0"); + attestors[1] = makeAddr("a1"); + attestors[2] = makeAddr("a2"); + vault = new MigrationVault(address(this), guardian, attestors, 2, 1e6, 1e24, 1e24, block.timestamp + 365 days); + pen = new PEN(address(vault), SUPPLY); + vault.setToken(IERC20(address(pen))); + } + + function test_RunScriptsRefuseBadValuesAndDeploy() public { + _runDeployCases(); + _runGovernanceCases(); + } + + function _setValidDeployEnv() internal { + vm.setEnv("TEST_DEPLOY", "false"); + vm.setEnv("ADMIN_SAFE", vm.toString(adminSafe)); + vm.setEnv("GUARDIAN_SAFE", vm.toString(makeAddr("guardianSafe"))); + vm.setEnv("ATTESTOR_1", vm.toString(makeAddr("attestor1"))); + vm.setEnv("ATTESTOR_2", vm.toString(makeAddr("attestor2"))); + vm.setEnv("ATTESTOR_3", vm.toString(makeAddr("attestor3"))); + vm.setEnv("ATTESTOR_4", vm.toString(makeAddr("attestor4"))); + vm.setEnv("MAX_ISSUANCE", "150000000000000000000000000"); + vm.setEnv("PER_RELEASE_CAP", "1000000000000000000000000"); + vm.setEnv("DAILY_CAP", "1000000000000000000000000"); + vm.setEnv("EARLIEST_SWEEP_TS", vm.toString(SWEEP_FLOOR)); + } + + function _expectDeployRefused(string memory key, string memory value, string memory reason) internal { + _setValidDeployEnv(); + vm.setEnv(key, value); + vm.expectRevert(bytes(reason)); + deployScript.run(); + } + + function _runDeployCases() internal { + string memory issuance = "MAX_ISSUANCE must be 150M PEN in 18-decimal units"; + _expectDeployRefused("MAX_ISSUANCE", "15000000000000000000000000", issuance); // one zero short + _expectDeployRefused("MAX_ISSUANCE", "150000000", issuance); // whole PEN + + string memory sweep = "EARLIEST_SWEEP_TS must be a future unix time in seconds, at most two years ahead"; + _expectDeployRefused("EARLIEST_SWEEP_TS", vm.toString(SWEEP_FLOOR * 1000), sweep); // milliseconds + _expectDeployRefused("EARLIEST_SWEEP_TS", vm.toString(block.timestamp), sweep); + string memory sweepSoon = "EARLIEST_SWEEP_TS is less than 30 days after the deploy block"; + _expectDeployRefused("EARLIEST_SWEEP_TS", vm.toString(block.timestamp + 2 hours), sweepSoon); + _expectDeployRefused("EARLIEST_SWEEP_TS", vm.toString(block.timestamp + 30 days - 1), sweepSoon); + // The decided floor still passes for a deploy up to 30 days before it. + vm.warp(SWEEP_FLOOR - 30 days + 1); + _expectDeployRefused("EARLIEST_SWEEP_TS", vm.toString(SWEEP_FLOOR), sweepSoon); + vm.warp(SWEEP_FLOOR - 30 days); // 2027-01-30 00:00 UTC + _setValidDeployEnv(); + deployScript.run(); + vm.warp(DEPLOY_TIME); + + address adminEoa = makeAddr("adminEoa"); + _expectDeployRefused( + "ADMIN_SAFE", vm.toString(adminEoa), "ADMIN_SAFE has no code on this chain (create the Safe first)" + ); + address delegated = makeAddr("delegatedAdmin"); + vm.etch(delegated, abi.encodePacked(hex"ef0100", adminSafe)); // EIP-7702 delegation to a Safe + _expectDeployRefused( + "ADMIN_SAFE", vm.toString(delegated), "ADMIN_SAFE is an EIP-7702 delegated EOA, not a Safe" + ); + _expectDeployRefused( + "ADMIN_SAFE", + vm.toString(address(new PEN(makeAddr("other"), SUPPLY))), + "ADMIN_SAFE is not a Safe (getThreshold() failed)" + ); + // A 1-of-n Safe, the Safe singleton's own threshold included. + _expectDeployRefused( + "ADMIN_SAFE", vm.toString(address(new SafeStub(1))), "ADMIN_SAFE Safe threshold is below 2" + ); + + // A production deploy on Base mainnet. + vm.chainId(8453); + _expectDeployRefused("TEST_DEPLOY", "true", "TEST_DEPLOY is refused on Base mainnet"); + _setValidDeployEnv(); + (PEN newPen, MigrationVault newVault) = deployScript.run(); + vm.chainId(31337); + assertEq(address(newVault.token()), address(newPen)); + assertEq(newPen.totalSupply(), 150_000_000e18); + assertEq(newPen.balanceOf(address(newVault)), 150_000_000e18); + assertEq(newVault.earliestSweepTimestamp(), SWEEP_FLOOR); + assertEq(newVault.admin(), address(this), "interim admin until the Safe accepts"); + assertEq(newVault.pendingAdmin(), adminSafe); + + // Testnet drills and local runs: an EOA as admin and a sweep floor an + // hour ahead. + _setValidDeployEnv(); + vm.setEnv("TEST_DEPLOY", "true"); + vm.setEnv("ADMIN_SAFE", vm.toString(adminEoa)); + vm.setEnv("EARLIEST_SWEEP_TS", vm.toString(block.timestamp + 1 hours)); + (, newVault) = deployScript.run(); + assertEq(newVault.pendingAdmin(), adminEoa); + assertEq(newVault.earliestSweepTimestamp(), block.timestamp + 1 hours); + } + + function _setValidGovernanceEnv() internal { + vm.setEnv("TEST_DEPLOY", "false"); + vm.setEnv("PEN_TOKEN", vm.toString(address(pen))); + vm.setEnv("VAULT_ADDRESS", vm.toString(address(vault))); + vm.setEnv("TIMELOCK_DELAY", "172800"); + vm.setEnv("VOTING_DELAY", "86400"); + vm.setEnv("VOTING_PERIOD", "432000"); + vm.setEnv("PROPOSAL_THRESHOLD", "1000000000000000000000"); // 1,000 PEN + vm.setEnv("QUORUM_FRACTION", "2"); + vm.setEnv("QUORUM_FLOOR", "100000000000000000000000"); // 100,000 PEN + vm.setEnv("TIMELOCK_CANCELLER", vm.toString(canceller)); + } + + function _expectGovernanceRefused(string memory key, string memory value, string memory reason) internal { + _setValidGovernanceEnv(); + vm.setEnv(key, value); + vm.expectRevert(bytes(reason)); + governanceScript.run(); + } + + function _runGovernanceCases() internal { + string memory notToken = "PEN_TOKEN is not the migration vault's token"; + _expectGovernanceRefused("PEN_TOKEN", vm.toString(address(vault)), notToken); + _expectGovernanceRefused("PEN_TOKEN", vm.toString(address(new PEN(makeAddr("other"), SUPPLY))), notToken); + + _expectGovernanceRefused("TIMELOCK_DELAY", "0", "TIMELOCK_DELAY is below 48h"); + _expectGovernanceRefused("TIMELOCK_DELAY", "172799", "TIMELOCK_DELAY is below 48h"); + _expectGovernanceRefused("TIMELOCK_DELAY", "172800000", "TIMELOCK_DELAY is above 30 days (seconds expected)"); + _expectGovernanceRefused("VOTING_DELAY", "1", "VOTING_DELAY is below 1h (seconds expected)"); // days + _expectGovernanceRefused("VOTING_DELAY", "3599", "VOTING_DELAY is below 1h (seconds expected)"); + _expectGovernanceRefused("VOTING_DELAY", "86400000", "VOTING_DELAY is above 30 days (seconds expected)"); + _expectGovernanceRefused("VOTING_PERIOD", "5", "VOTING_PERIOD is below 1 day (seconds expected)"); // days + _expectGovernanceRefused("VOTING_PERIOD", "86399", "VOTING_PERIOD is below 1 day (seconds expected)"); + // Would have been narrowed to 432000 by a bare uint32 cast. + _expectGovernanceRefused("VOTING_PERIOD", "4295399296", "VOTING_PERIOD is above 30 days (seconds expected)"); + + string memory threshold = "PROPOSAL_THRESHOLD must be 18-decimal units, 1 PEN to total supply"; + _expectGovernanceRefused("PROPOSAL_THRESHOLD", "1000", threshold); // whole PEN + _expectGovernanceRefused("PROPOSAL_THRESHOLD", vm.toString(SUPPLY + 1), threshold); + _expectGovernanceRefused("QUORUM_FRACTION", "0", "QUORUM_FRACTION must be above 0"); + string memory floor = "QUORUM_FLOOR must be 18-decimal units, 1 PEN to total supply"; + _expectGovernanceRefused("QUORUM_FLOOR", "100000", floor); // whole PEN + _expectGovernanceRefused("QUORUM_FLOOR", "0", floor); + _expectGovernanceRefused("QUORUM_FLOOR", vm.toString(SUPPLY + 1), floor); + + _expectGovernanceRefused( + "TIMELOCK_CANCELLER", "", "TIMELOCK_CANCELLER is required: no veto during the timelock delay otherwise" + ); + _expectGovernanceRefused( + "TIMELOCK_CANCELLER", vm.toString(address(this)), "TIMELOCK_CANCELLER must not be the deployer" + ); + string memory notPenOrVault = "TIMELOCK_CANCELLER must not be PEN or the vault"; + _expectGovernanceRefused("TIMELOCK_CANCELLER", vm.toString(address(pen)), notPenOrVault); + _expectGovernanceRefused("TIMELOCK_CANCELLER", vm.toString(address(vault)), notPenOrVault); + _expectGovernanceRefused( + "TIMELOCK_CANCELLER", vm.toString(guardian), "TIMELOCK_CANCELLER must be separate from the guardian" + ); + _expectGovernanceRefused( + "TIMELOCK_CANCELLER", + vm.toString(makeAddr("codeless")), + "TIMELOCK_CANCELLER has no code on this chain (create the Safe first)" + ); + address delegated = makeAddr("delegatedEoa"); + vm.etch(delegated, abi.encodePacked(hex"ef0100", canceller)); // EIP-7702 delegation to a Safe + _expectGovernanceRefused( + "TIMELOCK_CANCELLER", vm.toString(delegated), "TIMELOCK_CANCELLER is an EIP-7702 delegated EOA, not a Safe" + ); + string memory notSafe = "TIMELOCK_CANCELLER is not a Safe (getThreshold() failed)"; + _expectGovernanceRefused( + "TIMELOCK_CANCELLER", vm.toString(address(new PEN(makeAddr("other"), SUPPLY))), notSafe + ); + // Answers that are not exactly one word, whatever their first bytes say. + _expectGovernanceRefused("TIMELOCK_CANCELLER", vm.toString(address(new RawAnswerStub(hex"03"))), notSafe); + bytes memory twoWords = abi.encode(uint256(3), uint256(3)); + _expectGovernanceRefused("TIMELOCK_CANCELLER", vm.toString(address(new RawAnswerStub(twoWords))), notSafe); + _expectGovernanceRefused( + "TIMELOCK_CANCELLER", + vm.toString(address(new SafeStub(0))), + "TIMELOCK_CANCELLER Safe has threshold 0 (not set up)" + ); + _expectGovernanceRefused( + "TIMELOCK_CANCELLER", vm.toString(address(new SafeStub(1))), "TIMELOCK_CANCELLER Safe threshold is below 2" + ); + + // A production deploy on Base mainnet. + vm.chainId(8453); + _expectGovernanceRefused("TEST_DEPLOY", "true", "TEST_DEPLOY is refused on Base mainnet"); + _setValidGovernanceEnv(); + (TimelockController timelock, PENGovernor governor) = governanceScript.run(); + vm.chainId(31337); + bytes32[4] memory roles = [ + timelock.DEFAULT_ADMIN_ROLE(), timelock.PROPOSER_ROLE(), timelock.CANCELLER_ROLE(), timelock.EXECUTOR_ROLE() + ]; + for (uint256 i = 0; i < roles.length; i++) { + assertFalse(timelock.hasRole(roles[i], address(this)), "deployer keeps no timelock role"); + } + assertTrue(timelock.hasRole(timelock.CANCELLER_ROLE(), canceller)); + assertTrue(timelock.hasRole(timelock.CANCELLER_ROLE(), address(governor))); + assertTrue(timelock.hasRole(timelock.PROPOSER_ROLE(), address(governor))); + assertTrue(timelock.hasRole(timelock.EXECUTOR_ROLE(), address(0))); + assertTrue(timelock.hasRole(timelock.DEFAULT_ADMIN_ROLE(), address(timelock))); + assertEq(timelock.getMinDelay(), 2 days); + assertEq(address(governor.token()), address(pen)); + assertEq(governor.votingDelay(), 1 days); + assertEq(governor.votingPeriod(), 5 days); + assertEq(governor.proposalThreshold(), 1_000e18); + assertEq(governor.quorumNumerator(), 2); + assertEq(governor.quorumFloor(), 100_000e18); + + // Testnet drills: short delays and voting, no quorum fraction or floor + // and the guardian key, not a Safe, as canceller. + address guardianKey = makeAddr("guardianKey"); + vault.setGuardian(guardianKey); + _setValidGovernanceEnv(); + vm.setEnv("TEST_DEPLOY", "true"); + vm.setEnv("TIMELOCK_DELAY", "180"); + vm.setEnv("VOTING_DELAY", "60"); + vm.setEnv("VOTING_PERIOD", "240"); + vm.setEnv("QUORUM_FRACTION", "0"); + vm.setEnv("QUORUM_FLOOR", "0"); + vm.setEnv("TIMELOCK_CANCELLER", vm.toString(guardianKey)); + (timelock, governor) = governanceScript.run(); + assertEq(timelock.getMinDelay(), 180); + assertEq(governor.votingPeriod(), 240); + assertTrue(timelock.hasRole(timelock.CANCELLER_ROLE(), guardianKey)); + } +} diff --git a/contracts/test/PENGovernor.t.sol b/contracts/test/PENGovernor.t.sol index f939c9ccc..5fbfadbfb 100644 --- a/contracts/test/PENGovernor.t.sol +++ b/contracts/test/PENGovernor.t.sol @@ -24,6 +24,7 @@ contract PENGovernorTest is Test { address internal alice = makeAddr("alice"); address internal guardian = makeAddr("guardian"); + address internal canceller = makeAddr("canceller"); function setUp() public { // Token held by alice directly so she has voting power without going @@ -40,8 +41,9 @@ contract PENGovernorTest is Test { timelock.grantRole(timelock.PROPOSER_ROLE(), address(governor)); timelock.grantRole(timelock.CANCELLER_ROLE(), address(governor)); // The human veto during the timelock delay (DeployGovernance's - // optional TIMELOCK_CANCELLER): the guardian Safe. - timelock.grantRole(timelock.CANCELLER_ROLE(), guardian); + // required TIMELOCK_CANCELLER): a dedicated canceller Safe, separate + // from the guardian. + timelock.grantRole(timelock.CANCELLER_ROLE(), canceller); timelock.grantRole(timelock.EXECUTOR_ROLE(), address(0)); timelock.renounceRole(timelock.DEFAULT_ADMIN_ROLE(), address(this)); @@ -121,7 +123,7 @@ contract PENGovernorTest is Test { // GovernorTimelockControl salts the operation with the governor address. bytes32 salt = bytes20(address(governor)) ^ descriptionHash; bytes32 operationId = timelock.hashOperationBatch(targets, values, calldatas, 0, salt); - vm.prank(guardian); + vm.prank(canceller); timelock.cancel(operationId); assertEq(uint256(governor.state(proposalId)), uint256(IGovernor.ProposalState.Canceled)); diff --git a/docs/pen-migration-local-test-plan.md b/docs/pen-migration-local-test-plan.md index 40e052243..9ee528188 100644 --- a/docs/pen-migration-local-test-plan.md +++ b/docs/pen-migration-local-test-plan.md @@ -57,7 +57,8 @@ script works with realistic parameters. anvil --port 8545 --slots-in-an-epoch 0 # terminal 1 cd contracts cp .env.example .env # fill in: 4 attestor addrs, Safes, caps, MAX_ISSUANCE, EARLIEST_SWEEP_TS -forge script script/Deploy.s.sol --rpc-url http://localhost:8545 --broadcast +# TEST_DEPLOY admits plain Anvil accounts as the Safes, as phase1-base.mjs does +TEST_DEPLOY=true forge script script/Deploy.s.sol --rpc-url http://localhost:8545 --broadcast ``` Automated by `testing/src/phase1-base.mjs` (`node testing/src/phase1-base.mjs`), diff --git a/testing/.env.rehearsal.example b/testing/.env.rehearsal.example index 5cb78e569..582678760 100644 --- a/testing/.env.rehearsal.example +++ b/testing/.env.rehearsal.example @@ -34,8 +34,8 @@ RELEASER_PRIVATE_KEY= # release drain by itself inside one session. Production values are validated # separately on Anvil in phase 1, where time can be warped. REHEARSAL_DAILY_CAP_PEN=28800 -# Must not exceed the daily cap: the vault enforces perReleaseCap <= dailyCap -# (round 9), since anything in between could never fit the daily allowance. +# Must not exceed the daily cap: the vault enforces perReleaseCap <= dailyCap, +# since anything in between could never fit the daily allowance. REHEARSAL_PER_RELEASE_CAP_PEN=28800 # How far ahead the immutable sweep floor sits. Short so the sweep path is @@ -52,6 +52,6 @@ GOV_VOTING_DELAY=60 GOV_VOTING_PERIOD=240 GOV_PROPOSAL_THRESHOLD_PEN=1000 GOV_QUORUM_FRACTION=0 -# Absolute quorum floor in whole PEN (round 8: quorum is a fraction of +# Absolute quorum floor in whole PEN (quorum is a fraction of # CIRCULATING supply bounded below by this floor; 0 keeps the drill trivial). GOV_QUORUM_FLOOR_PEN=0 diff --git a/testing/src/deploy.mjs b/testing/src/deploy.mjs index 848f00b02..b29a489bf 100644 --- a/testing/src/deploy.mjs +++ b/testing/src/deploy.mjs @@ -25,6 +25,8 @@ export function deployStack({ earliestSweepOffsetSeconds = 365 * 24 * 3600 } = { const [deployer, attA, attB, attC, attD, guardian, admin] = accounts; const env = { ...process.env, + // The roles are plain Anvil accounts, not Safes. + TEST_DEPLOY: "true", PRIVATE_KEY: keys[0], ADMIN_SAFE: admin.address, GUARDIAN_SAFE: guardian.address, diff --git a/testing/src/phase3-e2e.mjs b/testing/src/phase3-e2e.mjs index ed25769c0..fc49a9cd8 100644 --- a/testing/src/phase3-e2e.mjs +++ b/testing/src/phase3-e2e.mjs @@ -156,7 +156,7 @@ section("Cap deferral and the releaser"); await check("a cap-deferred release is drained by the releaser, unattended", async () => { // Squeeze the daily budget so the next migration cannot release immediately. // Both caps equal one minimum-sized migration: the vault rejects - // perReleaseCap > dailyCap (round 9), and a MIN migration still fits the + // perReleaseCap > dailyCap, and a MIN migration still fits the // per-release cap exactly while the second one must wait for the refill. const tiny = MIN * CF; // one minimum-sized migration's worth await send(admin, { ...V, functionName: "setCaps", args: [tiny, tiny] }); diff --git a/testing/src/phase5b-governance.mjs b/testing/src/phase5b-governance.mjs index 790b8f024..22b8e227c 100644 --- a/testing/src/phase5b-governance.mjs +++ b/testing/src/phase5b-governance.mjs @@ -123,7 +123,9 @@ async function main() { // --- governance deployment ---------------------------------------------- section("Governance deployment (first execution of DeployGovernance.s.sol)"); - const { timelock, governor, params } = deployGovernanceToSepolia({ env, pen, log }); + // The drill reuses the guardian key as canceller; production uses a + // dedicated canceller Safe, separate from the guardian. + const { timelock, governor, params } = deployGovernanceToSepolia({ env, pen, vault, canceller: ctx.roles.guardian.address, log }); log(`timelock ${timelock}\n governor ${governor}`); const G = { address: governor, abi: governorAbi }; const T = { address: timelock, abi: timelockAbi }; @@ -138,6 +140,7 @@ async function main() { await eventually(async () => { assertEq(await read(T, "hasRole", [proposerRole, governor]), true, "governor is proposer"); assertEq(await read(T, "hasRole", [cancellerRole, governor]), true, "governor is canceller"); + assertEq(await read(T, "hasRole", [cancellerRole, ctx.roles.guardian.address]), true, "guardian is canceller"); assertEq(await read(T, "hasRole", [executorRole, "0x0000000000000000000000000000000000000000"]), true, "execution open to anyone"); assertEq(await read(T, "hasRole", [adminRole, ctx.roles.deployer.address]), false, "deployer admin renounced"); assertEq(await read(T, "hasRole", [adminRole, timelock]), true, "timelock self-administered"); @@ -302,7 +305,7 @@ async function main() { commit: execSync("git rev-parse HEAD", { cwd: ROOT, encoding: "utf8" }).trim(), contracts: { vault, pen, timelock, governor }, voter: voter.address, - params: { ...params, proposalThreshold: params.proposalThreshold.toString() }, + params: { ...params, proposalThreshold: params.proposalThreshold.toString(), quorumFloor: params.quorumFloor.toString() }, proposals: { handover: handoverProposal?.toString(), capsRaise: capsProposal?.toString(), diff --git a/testing/src/rehearsal-deploy.mjs b/testing/src/rehearsal-deploy.mjs index 1fc0bd822..5e9d6a227 100644 --- a/testing/src/rehearsal-deploy.mjs +++ b/testing/src/rehearsal-deploy.mjs @@ -19,8 +19,8 @@ const CONTRACTS = path.join(ROOT, "contracts"); export function rehearsalParams(env) { const dailyCapPen = BigInt(env.REHEARSAL_DAILY_CAP_PEN ?? "28800"); - // Equal to the daily cap: the vault rejects perReleaseCap > dailyCap since - // round 9 (that band could never release). + // Equal to the daily cap: the vault rejects perReleaseCap > dailyCap (that + // band could never release). const perReleaseCapPen = BigInt(env.REHEARSAL_PER_RELEASE_CAP_PEN ?? "28800"); return { maxIssuance: 150_000_000n * PEN_18, @@ -37,6 +37,8 @@ export function deployToSepolia({ env, roles, log }) { const sweepTs = Math.floor(Date.now() / 1000) + params.sweepOffsetSeconds; const scriptEnv = { ...process.env, + // The admin is a throwaway key, not a Safe. + TEST_DEPLOY: "true", PRIVATE_KEY: env.DEPLOYER_PRIVATE_KEY, ADMIN_SAFE: roles.admin.address, GUARDIAN_SAFE: roles.guardian.address, @@ -90,18 +92,24 @@ export function governanceDrillParams(env) { }; } -/** Runs the real DeployGovernance.s.sol — its first execution anywhere. */ -export function deployGovernanceToSepolia({ env, pen, log }) { +/** Runs the real DeployGovernance.s.sol — its first execution anywhere. + * TEST_DEPLOY admits the drill-scale delay and voting, the zero quorum + * fraction and floor and the guardian EOA as canceller, which the script + * refuses for a production deploy. */ +export function deployGovernanceToSepolia({ env, pen, vault, canceller, log }) { const params = governanceDrillParams(env); const scriptEnv = { ...process.env, + TEST_DEPLOY: "true", PEN_TOKEN: pen, + VAULT_ADDRESS: vault, TIMELOCK_DELAY: String(params.timelockDelay), VOTING_DELAY: String(params.votingDelay), VOTING_PERIOD: String(params.votingPeriod), PROPOSAL_THRESHOLD: params.proposalThreshold.toString(), QUORUM_FRACTION: String(params.quorumFraction), QUORUM_FLOOR: params.quorumFloor.toString(), + TIMELOCK_CANCELLER: canceller, }; log(`deploying governance (timelock ${params.timelockDelay}s, voting ${params.votingDelay}s+${params.votingPeriod}s, quorum ${params.quorumFraction}% of circulating, floor ${params.quorumFloor / PEN_18} PEN) ...`); execFileSync(