Skip to content

Governance lifecycle test suite: propose → vote → queue → execute for every governable parameter #693

Closed

Description

@thiras

Summary

DecdnGovernor.t.sol is explicit in its header (L17-18) that it skips the full propose → vote → queue → execute dance and only exercises vote-weight snapshot semantics. The 11 tests there are read-only views or direct setter-bounds called under vm.prank(governance). We have no end-to-end coverage that the production governance path — proposal threshold check, voting window, quorum, Timelock queue, Timelock delay, execute, parameter actually changes on the target contract — works for any of our governable parameters.

This means a regression in Governor wiring (wrong vote source, wrong quorum denominator, missing _executor() override, wrong Timelock binding) could ship undetected.

Why prod-blocking

Mainnet/Sepolia readiness requires confidence the on-chain governance loop actually closes. Bounds checks alone don't catch:

  • Governor reading vote weight from the wrong source at the wrong timepoint.
  • _executor() returning the wrong address (proposals execute from Governor, not Timelock).
  • proposalNeedsQueuing / state() transitions misbehaving with the served-bytes weight source.
  • Cross-contract GOVERNANCE_ROLE not actually held by Timelock at deploy.

Scope

One new contracts/test/GovernanceLifecycle.t.sol with table-driven cases covering every governable setter listed in ADR 016 §Governance-Controlled Parameters:

FeeRouter (5): setShares, setSafetyReserve, setBuybackBurner, setTreasury, setWindowEpochs
CapacityBond (5): setAlpha, setK, setMaxCapacityPerOperator, setAgeRampMonths, setUnbondingPeriod
DecdnGovernor self-params (2): setVoteCapBps, setAgeRampMonths
ContentBlacklist (5): addHash, removeHash, addOrigin, removeOrigin, registerRegionalBody
SafetyReserve (1): setMaxAppealRestitution
PublisherRegistry (2): setMaxNamespacesPerPublisher, setNamespaceTransferTimelock

For each parameter, two test paths:

  • Happy path: seed FeeRouter.bytesPerEpoch so a test proposer crosses the 0.1% threshold; propose() → fast-forward past VOTING_DELAY → castVote(For) from accounts whose summed weight crosses 4% quorum → fast-forward past VOTING_PERIOD → queue() → fast-forward past Timelock 48h delay → execute() → assert new value on target.
  • Out-of-bounds revert path: same flow with a value outside the ADR-bounded range; assert execute() reverts with ParamOutOfBounds (or contract-specific error) and target state is unchanged.

Acceptance

  • New GovernanceLifecycle.t.sol exercises propose → vote → queue → execute against every parameter above.
  • Each parameter has both a happy-path test (new value lands on target) and an out-of-bounds revert test.
  • GOVERNANCE_ROLE on each target is held by Timelock in test setup, mirroring production deploy ordering (this anticipates issue Production DeployProtocol.s.sol with atomic deployer→Timelock role handoff #694 but can be set up manually for now).
  • forge coverage for DecdnGovernor.sol and each target's setter functions reaches 100% line + branch coverage on the lifecycle paths.

Out of scope

  • Emergency-multisig fast-track lifecycle (separate flow; tested in SafetyReserve.t.sol and can stay there).
  • Governance UI / off-chain proposal indexers.
  • Vote-source unit tests — DecdnGovernor.t.sol already covers those.

Related

Activity

  1. added
    kind:feature
    kind:test
    on May 28, 2026
  2. self-assigned this
    on May 28, 2026
  3. github-actions commented on May 28, 2026

    @github-actions

    🎯 Triage report

    This issue requests a new GovernanceLifecycle.t.sol Foundry test suite that covers the full propose → vote → queue → execute flow for all 20 governable parameters across FeeRouter, CapacityBond, DecdnGovernor, ContentBlacklist, SafetyReserve, and PublisherRegistry. Existing DecdnGovernor.t.sol explicitly skips this lifecycle, leaving wiring regressions (wrong vote source, bad _executor(), Timelock misrouting) undetectable. Marked prod-blocking as this directly gates Mainnet/Sepolia readiness.

    📊 Assessment

    Dimension Value Reasoning
    Type Task Pure test-writing work with fully enumerated scope; no design decisions outstanding
    Labels enhancement, technical, testing, prod-blocking (already applied) All four existing labels are accurate; high priority label would also fit given explicit prod-blocking status
    Coding agent Suitable Requirements are completely specified: exact file path, exact list of 20 setters, exact two test paths per setter with precise setup steps, and measurable acceptance criteria (100% line+branch coverage). Self-contained to contracts/test/.

    🔗 Similar issues

    💡 Notes and suggestions

    Key implementation risks to address:

    1. _executor() wiring — DecdnGovernor must override _executor() to return the Governor itself (not Timelock) for GovernorTimelockControl. A bug here causes execute() to revert silently or execute from the wrong address. The test should assert governor.timelock() == address(timelockController) and that execute() succeeds only when called by the Governor.

    2. Vote weight snapshot timing — ADR 036 uses FeeRouter.bytesPerEpoch as the vote-weight source. The test must call vm.roll() or equivalent to advance past the VOTING_DELAY snapshot point after seeding bytesPerEpoch, or proposals will see zero weight. Use governor.proposalSnapshot(id) to confirm the correct block.

    3. Quorum denominator — GovernorVotesQuorumFraction uses token.getPastTotalSupply(snapshot) as denominator. If the test fixture doesn't mint enough tokens to a voting account, the 4% quorum will never be met. Seed multiple voter accounts totalling > 4% of total supply.

    4. Timelock role setup — Each target contract's GOVERNANCE_ROLE must be granted to address(timelockController) in setUp(), not to address(governor). This mirrors the production deploy ordering described in ADR 016 §2 and is the exact prerequisite Production DeployProtocol.s.sol with atomic deployer→Timelock role handoff #694 formalizes.

    5. Out-of-bounds revert path — When execute() triggers a reverting call, the Governor will catch and bubble the revert. Assert with vm.expectRevert(abi.encodeWithSelector(ParamOutOfBounds.selector, ...)) before calling execute(), not before the inner setter.

    Suggested sub-task checklist:

    • Shared _proposeVoteQueueExecute(address target, bytes calldata callData) helper to avoid 40× duplicated boilerplate
    • setUp() — deploy full stack (Token, FeeRouter, CapacityBond, Governor, Timelock, SafetyReserve, ContentBlacklist, PublisherRegistry), grant roles, seed bytesPerEpoch
    • FeeRouter (5 setters × 2 paths = 10 tests)
    • CapacityBond (5 × 2 = 10 tests)
    • DecdnGovernor self-params (2 × 2 = 4 tests)
    • ContentBlacklist (5 × 2 = 10 tests)
    • SafetyReserve (1 × 2 = 2 tests)
    • PublisherRegistry (2 × 2 = 4 tests)
    • forge coverage gate — confirm 100% line+branch on lifecycle paths

    Dependency note: #694 (deploy script with Timelock role-handoff) is a soft dependency. The issue says roles can be set up manually in setUp() for now, so #693 is not blocked.

    Generated by Agentic Triage for issue #693 · ● 1.2M · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
  4. added a commit that references this issue on May 28, 2026
    9822c05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:featurekind:testprio:high

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions