Sub topic 7
From proposal to execution: voting, quorum, and timelocks
This chapter assumes you know what a governance token is and that a Governor-style contract reads voting power from a token that supports delegation. The next chapter covers how delegation and checkpoints work in code. Here the question is what happens between "someone has an idea" and "the protocol changes."
The lifecycle at a glance
An on-chain proposal is a list of function calls (targets, values, and calldata) that the protocol will run if token holders approve. The proposal moves through fixed states, and each state is a safeguard.
Proposing
Most governors require the proposer to hold a minimum amount of voting power, called the proposal threshold. It limits spam, since every proposal asks the community to spend attention. A threshold of zero is allowed, but then anyone can flood the system.
The proposal is identified by a hash of its actions and description. If you change one byte of calldata or the description, you get a different proposal ID. The actions run together in one transaction, so if one call reverts, none of them take effect.
Voting delay, snapshot, and voting period
Two time parameters shape every vote. Both are usually measured in blocks or timestamps.
- Voting delay: the gap between creating the proposal and the start of voting.
- Voting period: how long voting stays open.
Voting power is read at a snapshot, normally the moment voting starts. Tokens bought after the snapshot do not count for that proposal, and neither does a delegation made after it. The delay gives holders time to delegate or to vote against a proposal they dislike. It also stops someone from buying tokens only after seeing a proposal.
For example, OpenZeppelin's Wizard defaults to roughly a one-day delay and a one-week period. Other protocols choose differently, and short periods favor attentive insiders.
Counting votes
OpenZeppelin's GovernorCountingSimple offers three choices: for, against, and abstain. A voter's whole weight goes to one choice, and each address votes once per proposal.
A proposal succeeds only if both of these hold:
- Quorum is reached.
- For-votes are strictly greater than against-votes.
A tie fails. Abstain votes do not help or hurt the majority test, but in this module they count toward quorum. Other designs differ, so always check how a given protocol counts abstentions.
Quorum
Quorum is the minimum participation needed for a result to be valid. Without it, a handful of voters could pass a change while everyone else was asleep.
| Approach | How it works | Main trade-off |
|---|---|---|
| Fixed number | A set token amount, such as 400,000 | Becomes wrong as supply changes |
| Fraction of supply | A percentage (such as 4%) of total supply at the snapshot | Simple, but locked or treasury tokens inflate the denominator |
| Dynamic or tiered | Quorum depends on the proposal type or on prior turnout | More flexible, harder to reason about and audit |
The denominator matters. If 30% of supply sits in a treasury or in unclaimed vesting contracts and never votes, a 4% quorum is effectively higher than it sounds. Because the quorum is also read at the snapshot, a mint or burn after that moment does not move the target.
Timelocks
After a proposal succeeds, it is queued in a timelock contract, which holds the approved actions for a minimum delay before they can be executed. Typically the timelock is the owner of the protocol's contracts, and the governor is the only account allowed to schedule operations on it. So a change can reach the protocol only by passing a vote and then waiting.
The delay serves several purposes:
- Users who dislike the change have time to withdraw funds.
- Watchers can inspect the calldata and raise an alarm about a malicious or buggy proposal.
- A guardian role, if one exists, has a window to cancel a dangerous proposal.
Typical delays run from about a day to a week or more, depending on how much is at stake. The tension is real. A long delay protects users but slows emergency fixes, so some protocols keep a separate, more centralized emergency path. That path becomes a trust assumption you should note when evaluating the system.
A runnable simulation
This Python model keeps only the logic from the sections above. It uses plain integers for time, and voting power is fixed at the snapshot. It needs Python 3.8 or later.
class Governor:
def __init__(self, power, delay=10, period=50, quorum_pct=4, timelock=20):
self.power = dict(power) # voting power frozen at the snapshot
self.total = sum(power.values())
self.delay, self.period = delay, period
self.quorum_pct, self.timelock = quorum_pct, timelock
self.start = self.end = self.queued_at = None
self.tally = {"for": 0, "against": 0, "abstain": 0}
self.voted = set()
self.executed = False
def propose(self, now):
self.start = now + self.delay
self.end = self.start + self.period
def quorum(self):
return self.total * self.quorum_pct // 100
def state(self, now):
if self.executed:
return "Executed"
if now < self.start:
return "Pending"
if now <= self.end:
return "Active"
participated = self.tally["for"] + self.tally["abstain"]
if participated < self.quorum() or self.tally["for"] <= self.tally["against"]:
return "Defeated"
return "Succeeded" if self.queued_at is None else "Queued"
def vote(self, now, who, choice):
if self.state(now) != "Active":
raise ValueError("voting is not open")
if who in self.voted:
raise ValueError("already voted")
self.voted.add(who)
self.tally[choice] += self.power.get(who, 0)
def queue(self, now):
if self.state(now) != "Succeeded":
raise ValueError("proposal has not succeeded")
self.queued_at = now
def execute(self, now):
if self.state(now) != "Queued":
raise ValueError("proposal is not queued")
if now < self.queued_at + self.timelock:
raise ValueError("timelock has not expired")
self.executed = True
power = {"whale": 300_000, "fund": 150_000, "alice": 10_000, "others": 540_000}
g = Governor(power)
g.propose(now=100) # voting opens at 110 and closes at 160
print(g.state(100)) # Pending
print(g.state(115)) # Active
g.vote(115, "whale", "for")
g.vote(120, "fund", "against")
g.vote(130, "alice", "abstain")
print(g.state(161)) # Succeeded
g.queue(161)
print(g.state(165)) # Queued
try:
g.execute(170)
except ValueError as err:
print(err) # timelock has not expired
g.execute(181)
print(g.state(181)) # ExecutedThe output is Pending, Active, Succeeded, Queued, timelock has not expired, and Executed, one per line. Quorum here is 40,000 votes (4% of 1,000,000). Participation was 310,000 including the abstention, and the 540,000 held by non-voters never mattered.
Edge cases and common errors
- Delegating too late. A holder who delegates after the snapshot has zero weight on that proposal. This is the most common reason a user's vote "didn't work."
- Ties fail. For-votes must strictly exceed against-votes.
- Quorum denominator. Check what counts as total supply. Locked or treasury tokens can make quorum hard to reach, which lets a determined minority block everything by staying silent.
- Low turnout, low quorum. If quorum is tiny compared to the tokens held by a few large wallets, one holder can pass proposals alone. As the simulation shows, the whale cleared quorum by itself.
- Expiry. Some systems let a queued operation expire if nobody executes it within a grace period. Others, such as the OpenZeppelin timelock, let it wait indefinitely. Know which applies.
- Proposal contents. Voters approve calldata, not intentions. A description can say one thing while the encoded call does another, so tools that decode calldata are part of safe voting.
- Bypass paths. Multisig admin keys, guardian cancel rights, and emergency roles can override the vote. A system with a timelock but an unrestricted admin key is not really governed by its token holders.
Exercise
A protocol has 2,000,000 tokens in total supply at the snapshot, a 5% quorum, and counts for and abstain votes toward quorum. A proposal gets 60,000 for, 55,000 against, and 30,000 abstain. Does it pass? What changes if the for-votes were 55,000 instead?
Show answer
Quorum is 5% of 2,000,000 = 100,000. Participation is 60,000 + 30,000 = 90,000 (against votes do not count toward quorum in this module), which is below 100,000, so the proposal is defeated despite having more for-votes than against-votes. If the for-votes were 55,000, participation would be 85,000, quorum would still be missed, and for would equal against, so it would also fail the majority test on the tie rule.