Repository navigation
Description
Motivation
ADR 009 § Delegation specifies a Governor Bravo delegate(address) pattern over ve-balance: a ve-locker may assign their (non-transferable) voting weight to another address for casting votes. DecdnGovernor currently ships without delegation — each voter votes their own ve-balance, read directly from VotingEscrow.balanceOfAt (see DecdnGovernor._getVotes). This issue tracks adding delegation.
This is not blocking governance: voting works today with self-weight. Delegation is a participation/UX enhancement, deferred to post-PoC.
Why it was deferred (the hard part)
Delegation here is materially harder than OpenZeppelin ERC20Votes/IVotes delegation. ERC20Votes checkpoints a static voting-unit count per delegate. ve-weight decays continuously (amount × remaining_lock / maxLock), so a delegate's weight at a snapshot is the time-varying sum of its delegators' decaying balances — not a static number. Correctly supporting getPastVotes(delegate, ts) therefore requires per-delegate bias/slope checkpointing inside VotingEscrow (aggregate a delegate's inbound delegations as a piecewise-linear curve, analogous to the existing global supply checkpoint with scheduled slope changes at lock expiries), plus moving a delegator's bias/slope between delegates on delegate() / re-delegation / lock changes.
Scope
VotingEscrowdelegation machinery:delegate(address),delegateBySig(...)(EIP-712),delegates(address)views.- Per-delegate inbound aggregate checkpoints (bias, slope, scheduled slope changes) so
delegatedBalanceOfAt(delegate, ts)returns the decayed sum of inbound delegations + the delegate's own undelegated ve-balance. - Move a delegator's bias/slope on
delegate(), re-delegation,increaseAmount,increaseUnlockTime, andwithdraw. - Events:
DelegateChanged,DelegateVotesChanged(or ve-appropriate equivalents).
DecdnGovernorrewire:_getVotesreads the delegated weight instead ofbalanceOfAt;quorum/proposalThresholdcontinue to use total ve-supply. Decide whether to adopt OZIVotes/GovernorVotes(if the VE delegation surface is made IERC-5805-conformant) or keep the thin custom override. The Governor's external interface should be unaffected.
Acceptance criteria
- ve-lockers can delegate/redelegate/revoke; effective at the next snapshot (ADR 009 § Delegation).
- Delegated weight decays correctly over time (differential tests vs. summing
balanceOfAt(delegator, ts)across delegators at multiple timestamps). - Lock mutations (increase amount / extend / withdraw) correctly update the delegate's aggregate.
-
DecdnGovernorcounts delegated weight; quorum/threshold unchanged; no Governor interface change. - ADR 009 § Delegation and ADR 026 governance table flipped back from "Deferred" to "Supported".
References
contracts/src/DecdnGovernor.sol(current self-weight_getVotes)contracts/src/VotingEscrow.sol(checkpoint/slope machinery to extend)- ADR 009 § Delegation; ADR 026 § Voting weight = ve-balance
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
github-actions commentedon May 22, 2026
🎯 Triage report
This issue tracks adding Governor Bravo-style
delegate(address)support toVotingEscrowand wiringDecdnGovernor._getVotesto use delegated weight instead of rawbalanceOfAt. The hard part — already well-articulated — is that ve-weight decays continuously, so per-delegate checkpointing must track bias/slope curves (not static counts likeERC20Votes). Explicitly deferred to post-PoC; governance works today with self-weight only.📊 Assessment
enhancement,technical,prod-blocking(already applied)IERC-5805/IVotesconformance inVotingEscrowand switchDecdnGovernorto OZGovernorVotes, or keep the thin custom_getVotesoverride. This choice affects the full delegation API surface and should be settled before implementation begins.💡 Notes and suggestions
Key design decision to resolve first:
IVotes/IERC-5805conformance vs. custom thin wrapper. The tradeoff:GovernorVotesdrop-in, tooling/wallet compatibility (eth_call getPastVotes), butgetPastVotes(delegate, ts)must return auint256representing the decayed aggregate — semantically unusual compared to static-token delegates.DecdnGovernor._getVotescalls a newdelegatedBalanceOfAt(delegate, ts)directly; no interface baggage; easier to audit. Probably the right default given the non-standard decay semantics.Implementation sub-tasks (suggested order):
VotingEscrowdata structures: addmapping(address => address) public delegatesand per-delegatePointcheckpoint arrays + scheduled slope changes (mirror the global supply structure)._moveDelegates(from, to, bias, slope, endTs): internal helper that removes inbound bias/slope fromfrom's aggregate and applies it toto; used by all mutation paths.delegate(address newDelegate)+delegateBySig(EIP-712 typed data): call_moveDelegatesafter updating the mapping.createLock,increaseAmount,increaseUnlockTime, andwithdrawto call_moveDelegateswhen the caller has a non-self delegate.delegatedBalanceOfAt(address delegate, uint256 ts): binary-search the per-delegate checkpoint array and evaluate the piecewise-linear curve atts(same algorithm asbalanceOfAtbut over the aggregate slope).DecdnGovernor._getVotes: swapVotingEscrow.balanceOfAt(account, ts)→VotingEscrow.delegatedBalanceOfAt(account, ts).delegatedBalanceOfAt(delegate, ts) == Σ balanceOfAt(delegatori, ts)across all delegators.Potential pitfalls:
_moveDelegatescall.withdrawmust zero out the delegator's bias/slope from the delegate aggregate before unlocking tokens.SSTOREs perdelegate()/lock-mutation; acceptable but worth noting in the PR.Reference art:
VotingEscrow.vydoes not support delegation (by design); Frax'sveFXSand Ribbon'sveRBNboth added delegation on top — their slope-bookkeeping patches are worth reviewing.ERC20Votessource is a useful structural template even if the static-checkpoint model doesn't apply directly.Add this agentic workflows to your repo
To install this agentic workflow, run