Skip to content

Commit 1e531d5

Browse files
authored
feat: Add OP content (#54)
Implementing actual content of the old repository https://github.com/defi-wonderland/op-handbook Issue https://linear.app/defi-wonderland/issue/CHA-345/content-migration
1 parent 04433fb commit 1e531d5

56 files changed

Lines changed: 2829 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "Governance",
3+
"position": 4,
4+
"link": {
5+
"type": "doc",
6+
"id": "governance/governance-overview"
7+
}
8+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
id: bye
3+
title: Wrapping up
4+
sidebar_label: Wrapping up
5+
---
6+
7+
# Wrapping Up
8+
9+
To wrap up, where the OP Stack defines *how the system runs*, governance defines *how it changes*. It encodes: who can propose, who can vote, and who can veto. And because governance must evolve with the Collective, it’s designed to be both programmable and flexible—via modules, managers, and community experimentation.
10+
11+
As you’ve seen, governance isn’t just about casting votes. It’s about trust minimization, fault tolerance, consent, and credible neutrality. The system must balance legitimacy with execution, and decentralization with security.
12+
13+
Now that you’ve studied the full structure, we encourage you to sit with some deeper technical questions:
14+
15+
## 🧠 Questions to think about
16+
17+
<details>
18+
<summary>Why separate the Governor from the Proposal Validator?</summary>
19+
20+
The Validator acts as a permissioned gatekeeper, enforcing off-chain rules (like delegate approval) in an on-chain format. It allows us to evolve the proposal logic independently from the core voting and execution engine. What trade-offs are we making in doing so?
21+
</details>
22+
23+
<details>
24+
<summary>What could go wrong if the ProposalTypesConfigurator is centralized?</summary>
25+
26+
Since quorum and approval thresholds depend on proposal type IDs, a compromised Configurator could lower requirements to push malicious proposals through. How would you design a decentralized alternative?
27+
</details>
28+
29+
<details>
30+
<summary>How would you detect a subdelegation abuse via Alligator?</summary>
31+
32+
If voting power is subdelegated to multiple downstream voters, how do we ensure no over-delegation occurs? What data structures or interfaces would help us prevent double-spending of votes?
33+
</details>
34+
35+
<details>
36+
<summary>Can we remove the Manager role entirely?</summary>
37+
38+
What would need to change in the system to remove the Manager's power to submit proposals, configure thresholds, or change voting deadlines? Could this be replaced with a DAO-controlled policy engine?
39+
</details>
40+
41+
<details>
42+
<summary>What does 'forkability' look like in governance?</summary>
43+
44+
If a delegate or group of citizens disagrees with the direction of governance, can they fork the system? What technical mechanisms or social affordances (e.g. reproducible config, open contracts) enable this?
45+
</details>
46+
47+
### Keep Building
48+
49+
Governance is never done. If you're working on tooling, researching modules, or helping design the next iteration of participation, it shapes the protocol!
50+
51+
You can follow ongoing governance upgrades in:
52+
- [vote.optimism.io](https://vote.optimism.io/)
53+
- [gov.optimism.io](https://gov.optimism.io/)
54+
- [github.com/voteagora](https://github.com/voteagora)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
id: governance-overview
3+
title: Governance Overview
4+
sidebar_label: Overview
5+
pagination_next: governance/intro-to-governance
6+
---
7+
8+
# Governance: What You Should Know
9+
10+
This section introduces how governance works in the Optimism Collective: how proposals are created, who gets to vote, what infrastructure runs the system, and how that infrastructure is evolving toward greater decentralization and permissionlessness.
11+
12+
We’ll start from the basics, what governance means in crypto, what proposals look like under the hood, and the vocabulary you’ll need to reason about things like quorums, thresholds, or veto rights.
13+
14+
Then we’ll walk through the **OP Governor** smart contracts and the modular architecture surrounding them: `Alligator`, `ProposalTypesConfigurator`, `VotableSupplyOracle`, and the emerging validator logic for permissionless proposals. If you're wondering *who proposes what, and how proposals actually work*, this section is for you.
15+
16+
We’ll also look at the **Operating Manual**, the dual-house structure (Token House & Citizens’ House), and how protocol upgrades, Retro Funding, and Missions are routed through this governance system.
17+
18+
Finally, we’ll end with a breakdown of our current work to open up Optimism governance to more direct participation, removing bottlenecks, making rule enforcement on-chain, and enabling a path to *trust-minimized proposal submission*.
19+
20+
By the end of this section, you should be able to answer:
21+
22+
- What’s the difference between an approval and a vote on Optimism?
23+
- Who can propose? Who can vote? What powers are delegated?
24+
- How do proposals move through states like Pending → Active → Executed?
25+
- How is quorum calculated, and what makes a proposal “pass”?
26+
- What is Alligator, and why is delegation logic so complicated?
27+
- What happens if a delegate tries to push a proposal that violates cycle rules?
28+
- What is permissionless governance, and what tradeoffs does it introduce?
29+
30+
Let’s dive into the design to understand who gets to change the rules.
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
id: governor-walkthrough
3+
title: Governor Walkthrough
4+
sidebar_label: Governor Walkthrough
5+
---
6+
7+
# The Optimism Governor Walkthrough
8+
9+
The Optimism Governor is based on the OpenZeppelin’s Governor, customized to support Optimism’s governance needs: signaling proposals, customizable voting rules, subdelegations, and so on.
10+
11+
In the long run anyone should be able to propose changes, but safeguards like delegate approvals, quorum thresholds, and timelocks are required to ensure quality and protect against manipulation.
12+
13+
Some useful resources:
14+
15+
- [Governor GitHub Repo (voteagora)](https://github.com/voteagora/optimism-governor)
16+
- [vote.optimism.io](https://vote.optimism.io/): front-end interface for participation
17+
18+
## Architecture and Deployment
19+
20+
The [`OptimismGovernor`](https://github.com/voteagora/optimism-governor/blob/main/src/OptimismGovernor.sol) contract is upgradeable, following a proxy pattern:
21+
22+
- `Governor Proxy`: `0xcDF27F107725988f2261Ce2256bDfCdE8B382B10`
23+
- `Alligator` (subdelegations): `0x7f08F3095530B67CdF8466B7a923607944136Df0`
24+
- `ProposalTypesConfigurator`: `0xCE52b7cc490523B3e81C3076D5ae5Cca9a3e2D6F`
25+
- `VotableSupplyOracle`: `0x1b7CA7437748375302bAA8954A2447fC3FBE44CC`
26+
27+
While proposals today are signaling-only for most types (i.e., they do not trigger automatic onchain execution), the system enforces the full governance lifecycle: `Pending → Active → Succeeded → Queued → Executed`. The key exceptions are Governance Fund (Missions) proposals and certain Security Council proposals, which do cause onchain token transfers, for example, transferring OP to fund a Mission or allocating ETH from the treasury.
28+
29+
## Core Roles
30+
31+
- **`admin`**: Owns the proxy and controls upgrades. Does not vote or propose.
32+
- **`manager`**: Can create proposals, execute them, or update system parameters.
33+
- **`voters`**: Any address with delegated OP — either directly or through Alligator.
34+
35+
## Inheritance
36+
37+
```solidity
38+
contract OptimismGovernor is
39+
Initializable,
40+
GovernorUpgradeableV2,
41+
GovernorCountingSimpleUpgradeableV2,
42+
GovernorVotesUpgradeableV2,
43+
GovernorVotesQuorumFractionUpgradeableV2,
44+
GovernorSettingsUpgradeableV2
45+
```
46+
47+
Each inherited contract contributes:
48+
- `GovernorUpgradeableV2`: Core lifecycle logic, proposal state machine
49+
- `GovernorCountingSimpleUpgradeableV2`: Vote tallying (for/against/abstain)
50+
- `GovernorVotesUpgradeableV2`: Gets historical voting power at a given block
51+
- `GovernorVotesQuorumFractionUpgradeableV2`: Legacy support for % quorum
52+
- `GovernorSettingsUpgradeableV2`: Configurable parameters (e.g. voting period)
53+
54+
:::warning
55+
The Optimism Governor overrides some of these base contracts, notably quorum and proposal thresholds, using a `ProposalTypesConfigurator` and `VotableSupplyOracle`
56+
:::
57+
58+
## Proposal Flow
59+
60+
The Governor supports two proposal paths:
61+
62+
```solidity
63+
propose(...): // Standard proposal
64+
proposeWithModule(...): // Proposal with custom voting module
65+
```
66+
67+
Only the `manager` or `timelock()` can call propose. Each proposal is assigned a `proposalType`, which maps to specific quorum/approval thresholds in the `ProposalTypesConfigurator`.
68+
69+
Voting is handled via:
70+
- `castVote()`: standard token-based voting
71+
- `castVoteFromAlligator()`: partial delegation via the Alligator contract
72+
- `VoteCastWithParams`: supports modules that require additional input (e.g., ranked or approval voting)
73+
74+
Proposals are executed via the Timelock contract, using `execute()` or `executeWithModule()`.
75+
76+
## The key Modules
77+
78+
### Alligator - Subdelegations
79+
80+
The Alligator enables partial delegation, a user can split their voting power across multiple delegates using absolute or relative rules. These delegations can be chained (A → B → C) and validated onchain using authority[] arrays.
81+
82+
The key structures are:
83+
- `subdelegations[from][to]`: maps delegations
84+
- `SubdelegationRules`: define allowance, `maxRedelegations`, timing, and custom logic
85+
- Supports batched voting with `castVoteWithReasonAndParamsBatched(...)`
86+
87+
The contract validates that:
88+
1. Each delegation is valid and within limits
89+
2. The final sender is authorized
90+
3. No overuse or double-voting has occurred
91+
92+
It then forwards votes to `castVoteFromAlligator()` on the Governor.
93+
94+
## ProposalTypesConfigurator
95+
96+
Proposals can have different voting requirements depending on their type. This configurator allows each `proposalType` to define:
97+
- quorum (e.g. 5100 = 51%)
98+
- approvalThreshold (e.g. 7600 = 76%)
99+
- name, description, module (if any)
100+
101+
Proposal thresholds are stored with 1e4 scaling (10000 = 100%). The Governor calls `proposalTypesConfigurator.proposalTypes(proposalTypeId)` during voting and quorum checks.
102+
103+
## Votable Supply Oracle
104+
105+
Instead of total token supply, quorum is based on votable supply — the total OP that has been delegated. This is retrieved at proposal creation block and used to calculate thresholds dynamically.
106+
107+
- **Fallback**: if `votableSupply()` returns zero, the Governor falls back to total token supply.
108+
109+
## Functions Summary
110+
111+
**Proposal Management**
112+
- `propose()` / `proposeWithModule()`
113+
- `setVotingDelay()`, `setVotingPeriod()`, `setProposalThreshold()`
114+
- `setProposalDeadline()`: update deadline during voting
115+
- `cancel()`, `cancelWithModule()`
116+
117+
**Voting**
118+
- `castVote()`
119+
- `castVoteFromAlligator(...)`
120+
- `increaseWeightCast(...)`: internal weight accounting for partial votes
121+
122+
**Execution**
123+
- `queue()`, `queueWithModule()`
124+
- `execute()`, `executeWithModule()`
125+
126+
## Future Extensions
127+
128+
We are working on an upgrade that is evolving toward permissionless proposals, enforced via `DelegatesProposalValidator` contract, it gates access to `propose()` based on delegate approvals and submission windows, allowing any qualifying participant to propose, while still preserving cycle alignment.
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
id: intro-to-governance
3+
title: Governance in a nutshell
4+
sidebar_label: Governance in a nutshell
5+
---
6+
7+
# Governance in a nutshell
8+
9+
Before we get into Optimism-specific contracts, let’s zoom out.
10+
11+
On-chain governance is a mechanism for managing shared infrastructure using verifiable rules. In practice, governance contracts behave similar to multisigs, but with vote weights distributed across token holders rather than multisig signers.
12+
13+
At its core, governance is about managing change. A **proposal** is just a transaction (or set of transactions): a list of target addresses, call data, and sometimes ETH values. Token holders vote to approve or reject the proposal. If the vote passes and quorum is met, the transaction can be executed onchain. If it fails, it’s simply discarded.
14+
15+
Voting power is usually determined by the number of tokens an address holds at a specific snapshot block. Most systems also allow **delegation**, meaning you can assign your voting power to another address to vote on your behalf.
16+
17+
Some proposals affect onchain systems directly (e.g. upgrading a contract). Others are **signaling-only** (e.g. changing a community guideline or legal structure). In those cases, proposals still follow the same governance flow, but their “execution” happens through offchain coordination or manual implementation.
18+
19+
## Common Terms
20+
21+
These are the core terms used across most governance systems, including Optimism:
22+
23+
- **Proposal**: A governance action defined by a set of addresses and calldata. Often restricted to users with a minimum token balance.
24+
- **Vote**: A signal (usually onchain) cast by a token holder. Can be FOR, AGAINST, or ABSTAIN.
25+
- **Voting Power**: The influence a voter has, usually based on token holdings at a snapshot block. Voting power can be delegated.
26+
- **Voting Period**: A fixed duration during which votes can be submitted. If quorum isn’t reached, the proposal fails.
27+
- **Quorum**: The minimum percentage of voting power that must participate for a proposal to be valid.
28+
- **Timelock**: A delay between passing a proposal and executing it. Gives time for reactions before changes take effect.
29+
- **Queued / Execution**: Proposals are queued in a timelock contract after passing, and only then executed.
30+
31+
## The Proposal Lifecycle
32+
33+
While implementations vary, the lifecycle of a proposal usually looks like this:
34+
35+
```nasm
36+
Pending ⭢ Active ⭢ Defeated ⭢ Canceled
37+
⮑ Succeeded ⭢ Queued ⭢ Executed
38+
⮑----------⮑-------⮑ Expired
39+
```
40+
- **Pending**: Proposal exists, but voting hasn’t started (waiting for delay).
41+
- **Active**: Voting is open.
42+
- **Succeeded**: Quorum was reached and a majority voted FOR.
43+
- **Queued**: Added to timelock. Awaiting delay before execution.
44+
- **Executed**: Transactions have been run.
45+
- **Defeated / Canceled / Expired**: Proposal did not pass or was invalidated.
46+
47+
:::info Reference
48+
When in doubt about how a transition works, [just read the contract.](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.8/contracts/governance)
49+
:::
50+
51+
## Compound’s Bravo + OpenZeppelin’s Governor
52+
53+
The most influential governance systems today trace back to [Compound’s Governor Bravo](https://docs.compound.finance/v2/governance/). It introduced:
54+
55+
- Support for explicit ABSTAIN votes
56+
- Upgradeable architecture
57+
- Reason strings on vote calls (`castVoteWithReason`)
58+
59+
OpenZeppelin later extended Bravo to create a fully composable [Governor](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.8/contracts/governance/Governor.sol) base contract, which defines the lifecycle (propose → vote → queue → execute), and lets developers plug in extensions for voting, quorum logic, timelocks, and more.
60+
61+
In particular, the [`GovernorCompatibilityBravo`](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.8/contracts/governance/compatibility/GovernorCompatibilityBravo.sol) contract matches the Bravo API, enabling drop-in compatibility with Compound-style frontends.
62+
63+
## Function Primer
64+
65+
### Proposal Management
66+
67+
| Function | Description |
68+
|----------|-------------|
69+
| `propose()` | Create a new proposal (must meet threshold) |
70+
| `queue()` | Queue a passed proposal for timelock |
71+
| `execute()` | Execute proposal after delay |
72+
| `cancel()` | Cancel a proposal if conditions change |
73+
74+
### Voting
75+
76+
| Function | Description |
77+
|----------|-------------|
78+
| `castVote()` | Submit a vote (FOR/AGAINST/ABSTAIN) |
79+
| `castVoteWithReason()` | Submit a vote with an explanation |
80+
| `getReceipt()` | View voting record for an address |
81+
82+
### Querying
83+
84+
| Function | Description |
85+
|----------|-------------|
86+
| `state()` | Get current proposal state (Pending, Active, etc.) |
87+
| `getActions()` | See what the proposal will execute |
88+
| `quorumVotes()` | Check quorum required for proposal to pass |
89+
90+
## Design Patterns in Governance
91+
92+
Most governance systems in Ethereum share the same building blocks:
93+
- A voting mechanism that calculates token-weighted power at a specific block (snapshot).
94+
- A registry of proposals with metadata like start/end blocks, vote tallies, and actions.
95+
- A timelock controller that enforces a minimum delay before execution.
96+
- A quorum and approval threshold to ensure decisions are legitimate.
97+
98+
On top of this, each protocol adds its own mechanics: delegation systems, role-based permissions, modular thresholds, and custom voting logic.
99+
100+
Some proposals are executable, others are advisory. Some are submitted by anyone, others require approvals. Governance is always opinionated, the trick is making those opinions legible and upgradeable.
101+
102+
## Limitations and Responsibilities
103+
104+
Governance systems can encode process, but not intention. They can enforce thresholds, track votes, and trigger transactions, but they can’t make communities healthy or decisions wise.
105+
106+
As you move deeper into OP governance, keep in mind:
107+
- Power structures can be encoded, but legitimacy is earned.
108+
- Permissionless doesn’t mean consequence-free.
109+
- The goal is alignment.
110+
111+
Governance is still an evolving experiment. And in the next section, we’ll look at how its infrastructure reflects that approach.
380 KB
Loading
148 KB
Loading
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
id: overview
3+
title: Our Work
4+
sidebar_label: Our Work
5+
---
6+
7+
This section documents active governance-related development initiatives led by or contributed to Wonderland. While the previous sections described how the governance system functions today, this space focuses on improvements in progress—features that are being designed, discussed, or implemented. Some initiatives are in early stages; others are already live onchain.
8+
9+
## Why it matters
10+
11+
The governance is designed to evolve. Improvements often arise from practical bottlenecks observed by delegates, contributors, and protocol developers. This section records how those pain points are being addressed—through new contracts, improved interfaces, or procedural upgrades.
12+
13+
Each entry aims to explain:
14+
15+
- The motivation for the change
16+
- How the proposed solution works
17+
- Key trade-offs or risks involved
18+
- Links to contracts, proposals, or diagrams
19+
20+
## Included so far
21+
22+
- [Permissionless Proposals](./permissionless-proposals.md): Automating the proposal submission process to remove reliance on gatekeeping, while preserving collective approval via delegate sign-offs.
23+
24+
As the governance system grows, this section will expand to include changes to proposal types, validator flows, delegate tooling, and so on.

0 commit comments

Comments
 (0)