Skip to content

Commit 88b65a9

Browse files
authored
Merge branch 'main' into martinh/multigov-upgrade-sol
2 parents 3fb1f1a + 913a206 commit 88b65a9

File tree

7 files changed

+565
-55
lines changed

7 files changed

+565
-55
lines changed
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
title: MultiGov
22
nav:
33
- index.md
4-
- 'Deployment': 'deployment.md'
4+
- 'Deploy to EVM': 'deploy-to-evm.md'
5+
- 'Deploy to Solana': 'deploy-to-solana.md'
56
- 'Upgrade Contracts on EVM': 'upgrade-evm.md'
67
- 'Upgrade Contracts on Solana': 'upgrade-solana.md'
78
- 'Technical FAQs': 'faq.md'

build/contract-integrations/multigov/deployment.md build/contract-integrations/multigov/deploy-to-evm.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
title: MultiGov Deployment
3-
description: Set up and deploy MultiGov locally with step-by-step instructions for configuring, compiling, and deploying smart contracts across chains.
2+
title: MultiGov Deployment to EVM
3+
description: Set up and deploy MultiGov to EVM locally with step-by-step instructions for configuring, compiling, and deploying smart contracts across chains.
44
---
55

6-
# Deployment
6+
# Deploy MultiGov on EVM
77

8-
This guide provodes instructions to set up and deploy the MultiGov governance system locally. Before diving into the technical deployment, ensure that MultiGov is the right fit for your projects governance needs by following the steps for the [integration process](/docs/build/contract-integrations/multigov/){target=\_blank}.
8+
This guide provides instructions on how to set up and deploy the MultiGov governance system locally. Before diving into the technical deployment, ensure that MultiGov is the right fit for your project's governance needs by following the steps for the [integration process](/docs/build/contract-integrations/multigov/){target=\_blank}.
99

1010
Once your project is approved through the intake process and you’ve collaborated with the Tally team to tailor MultiGov to your requirements, use this guide to configure, compile, and deploy the necessary smart contracts across your desired blockchain networks. This deployment will enable decentralized governance across your hub and spoke chains.
1111

@@ -34,7 +34,7 @@ For developers looking to set up a local MultiGov environment:
3434
```bash
3535
cp .env.example .env
3636
```
37-
Edit `.env` with your specific [configuration](/docs/build/contract-integrations/multigov/deployment/#configuration){target=\_blank}
37+
Edit `.env` with your specific [configuration](/docs/build/contract-integrations/multigov/deploy-to-evm/#configuration)
3838

3939
3. Compile contracts:
4040
```bash
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
---
2+
title: MultiGov Deployment to Solana
3+
description: Learn how to deploy the MultiGov Staking Program on Solana, including setup, funding, deployment, and configuration steps.
4+
---
5+
6+
# Deploy MultiGov on Solana
7+
8+
This guide provides instructions on how to set up and deploy the **MultiGov Staking Program** on Solana. Before proceeding with the deployment, ensure that MultiGov aligns with your project's governance needs by reviewing the system [architecture](/docs/learn/governance/architecture/){target=\_blank}.
9+
10+
Once your project setup is complete, follow this guide to configure, compile, and deploy the necessary Solana programs and supporting accounts. This deployment enables decentralized governance participation on Solana as a spoke chain within the MultiGov system.
11+
12+
## Prerequisites
13+
14+
To deploy MultiGov on Solana, ensure you have the following installed:
15+
16+
- Install [Git](https://git-scm.com/downloads){target=\_blank}
17+
- Install [Node.js](https://nodejs.org/){target=\_blank} **`v20.10.0`**
18+
- Install [Solana CLI](https://docs.anza.xyz/cli/install/){target=\_blank} **`v1.18.20`**
19+
- Install [Anchor](https://www.anchor-lang.com/docs/installation){target=\_blank} **`v0.30.1`**
20+
- Install [Rust](https://www.rust-lang.org/tools/install){target=\_blank} **`v1.80.1`**
21+
- Install [Docker](https://www.docker.com/get-started/){target=\_blank}
22+
- Clone the repository:
23+
```bash
24+
git clone https://github.com/wormhole-foundation/multigov.git
25+
cd multigov/solana/
26+
```
27+
28+
## Build the Project
29+
30+
To create a verifiable build of the MultiGov Staking Program, run the following command:
31+
32+
```bash
33+
./scripts/build_verifiable_staking_program.sh
34+
```
35+
36+
Once the build is complete, the compiled artifacts will be available in the `target` folder.
37+
38+
## Set Up the Deployer Account
39+
40+
For a successful deployment, you need a funded deployer account on Solana. This account will store the program and execute deployment transactions.
41+
42+
In this section, you will create a new keypair, check the account balance, and ensure it has enough SOL tokens to cover deployment costs. If needed, you can fund the account using different methods before deploying.
43+
44+
### Generate a New Keypair
45+
46+
To create a new keypair and save it to a file, run the following command:
47+
48+
```bash
49+
solana-keygen new --outfile ./app/keypairs/deployer.json
50+
```
51+
52+
### Check the Deployer Account Address
53+
54+
To retrieve the public address of the newly created keypair, run the following command:
55+
56+
```bash
57+
solana address -k ./app/keypairs/deployer.json
58+
```
59+
60+
### Check the Deployer Account Balance
61+
62+
To verify the current balance of the deployer account, run the following command:
63+
64+
```bash
65+
solana balance -k ./app/keypairs/deployer.json
66+
```
67+
68+
!!! important
69+
When deploying the MultiGov Staking Program, the deployer account must have enough SOL to cover deployment costs and transaction fees.
70+
71+
- 7.60219224 SOL for deployment costs
72+
- 0.00542 SOL for transaction fees
73+
74+
### Fund the Deployer Account
75+
76+
If the account does not have enough SOL, use one of the following methods to add funds.
77+
78+
- **Transfer SOL from another account** - if you already have SOL in another account, transfer it using a wallet (Phantom, Solflare, etc.) or in the terminal
79+
80+
```bash
81+
solana transfer <deployer_account_address> <amount> --from /path/to/funder.json
82+
```
83+
84+
- **Request an airdrop (devnet only)** - if deploying to devnet, you can request free SOL
85+
86+
```bash
87+
solana airdrop 2 -k ./app/keypairs/deployer.json
88+
```
89+
90+
- **Use a Solana faucet (devnet only)** - you can use online faucets to receive 10 free SOL
91+
92+
- [Solana Faucet](https://faucet.solana.com/){target=\_blank}
93+
94+
## Deploy the MultiGov Staking Program
95+
96+
With the deployer account set up and funded, you can deploy the MultiGov Staking Program to the Solana blockchain. This step involves deploying the program, verifying the deployment, and ensuring the necessary storage and metadata are correctly configured. Once the IDL is initialized, the program will be ready for further setup and interaction.
97+
98+
### Deploy the Program
99+
100+
Deploy the MultiGov Staking Program using **Anchor**:
101+
102+
```bash
103+
anchor deploy --provider.cluster https://api.devnet.solana.com --provider.wallet ./app/keypairs/deployer.json
104+
```
105+
106+
### Verify the Deployment
107+
108+
After deployment, check if the program is successfully deployed by running the following command:
109+
110+
```bash
111+
solana program show INSERT_PROGRAM_ID
112+
```
113+
114+
### Extend Program Storage
115+
116+
If the deployed program requires additional storage space for updates or functionality, extend the program storage using the following command:
117+
118+
```bash
119+
solana program extend INSERT_PROGRAM_ID 800000
120+
```
121+
122+
### Initialize the IDL
123+
124+
To associate an IDL file with the deployed program, run the following command:
125+
126+
```bash
127+
anchor idl init --provider.cluster https://api.devnet.solana.com --filepath ./target/idl/staking.json INSERT_PROGRAM_ID
128+
```
129+
130+
## Configure the Staking Program
131+
132+
The final step after deploying the MultiGov Staking Program is configuring it for proper operation. This includes running a series of deployment scripts to initialize key components and set important governance parameters. These steps ensure that staking, governance, and cross-chain communication function as expected.
133+
134+
### Run Deployment Scripts
135+
136+
After deploying the program and initializing the IDL, execute the following scripts **in order** to set up the staking environment and necessary accounts.
137+
138+
1. Initialize the MultiGov Staking Program with default settings:
139+
140+
```bash
141+
npx ts-node app/deploy/01_init_staking.ts
142+
```
143+
144+
2. Create an Account Lookup Table (ALT) to optimize transaction processing:
145+
146+
```bash
147+
npx ts-node app/deploy/02_create_account_lookup_table.ts
148+
```
149+
150+
3. Set up airlock accounts:
151+
152+
```bash
153+
npx ts-node app/deploy/03_create_airlock.ts
154+
```
155+
156+
4. Deploy a metadata collector:
157+
158+
```bash
159+
npx ts-node app/deploy/04_create_spoke_metadata_collector.ts
160+
```
161+
162+
5. Configure vote weight window lengths:
163+
164+
```bash
165+
npx ts-node app/deploy/05_initializeVoteWeightWindowLengths.ts
166+
```
167+
168+
6. Deploy the message executor for handling governance messages:
169+
170+
```bash
171+
npx ts-node app/deploy/06_create_message_executor.ts
172+
```
173+
174+
### Set MultiGov Staking Program Key Parameters
175+
176+
When deploying MultiGov on Solana, several key parameters need to be set. Here are the most important configuration points:
177+
178+
- `maxCheckpointsAccountLimit` ++"u64"++ - the maximum number of checkpoints an account can have. For example, `654998` is used in production, while `15` might be used for testing
179+
- `hubChainId` `u16` - the chain ID of the hub network where proposals are primarily managed. For example, `10002` for Sepolia testnet
180+
- `hubProposalMetadata` ++"[u8; 20]"++ - an array of bytes representing the address of the Hub Proposal Metadata contract on Ethereum. This is used to identify proposals from the hub
181+
- `voteWeightWindowLength` ++"u64"++ - specifies the length of the checkpoint window in seconds in which the minimum voting weight is taken. The window ends at the vote start for a proposal and begins at the vote start minus the vote weight window. The vote weight window helps solve problems such as manipulating votes in a chain
182+
- `votingTokenMint` ++"Pubkey"++ - the mint address of the token used for voting
183+
- `governanceAuthority` ++"Pubkey"++ - the account's public key with the authority to govern the staking system. The `governanceAuthority` should not be the default Pubkey, as this would indicate an uninitialized or incorrectly configured setup
184+
- `vestingAdmin` ++"Pubkey"++ - the account's public key for managing vesting operations. The `vestingAdmin` should not be the default Pubkey, as this would indicate an uninitialized or incorrectly configured setup
185+
- `hubDispatcher` ++"Pubkey"++ - the Solana public key derived from an Ethereum address on the hub chain that dispatches messages to the spoke chains. This is crucial for ensuring that only authorized messages from the hub are executed on the spoke

build/contract-integrations/multigov/index.md

+11-3
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,21 @@ Take the following steps to get started with a MultiGov integration:
1818

1919
<div class="grid cards" markdown>
2020

21-
- :octicons-rocket-16:{ .lg .middle } **Deployment**
21+
- :octicons-rocket-16:{ .lg .middle } **Deploy to EVM**
2222

2323
---
2424

25-
Set up and deploy MultiGov locally with step-by-step instructions for configuring, compiling, and deploying smart contracts across chains.
25+
Set up and deploy MultiGov on EVM with step-by-step instructions for configuring, compiling, and deploying smart contracts across chains.
2626

27-
[:custom-arrow: Discover how to deploy MultiGov](/docs/build/contract-integrations/multigov/deployment/)
27+
[:custom-arrow: Discover how to deploy MultiGov](/docs/build/contract-integrations/multigov/deploy-to-evm/)
28+
29+
- :octicons-rocket-16:{ .lg .middle } **Deploy to Solana**
30+
31+
---
32+
33+
Set up and deploy the MultiGov Staking Program on Solana with step-by-step instructions for configuring, funding, deploying, and initializing the program.
34+
35+
[:custom-arrow: Discover how to deploy MultiGov on Solana](/docs/build/contract-integrations/multigov/deploy-to-solana/)
2836

2937
- :octicons-file-code-16:{ .lg .middle } **Upgrade MultiGov on EVM**
3038

learn/governance/architecture.md

+76-17
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,87 @@ Spoke chains handle local voting, forward votes to the hub, and execute approved
2727
- **`SpokeVoteAggregator`** - collects votes on the spoke chain and forwards them to the hub
2828
- **`SpokeMessageExecutor`** - receives and executes approved proposals from the hub
2929
- **`SpokeMetadataCollector`** - fetches proposal metadata from the hub for spoke chain voters
30-
- **`SpokeAirlock`** - acts as governance's "admin" on the spoke, has permissions and its treasury
30+
- **`SpokeAirlock`** - acts as governance's "admin" on the spoke, has permissions, and its treasury
31+
32+
### Spoke Solana Staking Program
33+
34+
The Spoke Solana Staking Program handles local voting from users who have staked W tokens or are vested in the program, forwards votes to the hub, and executes approved proposals from the hub for decentralized governance.
35+
36+
The program implements its functionality through instructions, using specialized PDA accounts where data is stored. Below are the key accounts in the program:
37+
38+
- **`GlobalConfig`** - global program configuration
39+
- **`StakeAccountMetadata`** - stores user's staking information
40+
- **`CustodyAuthority`** - PDA account managing custody and overseeing token operations related to stake accounts
41+
- **`StakeAccountCustody`** - token account associated with a stake account for securely storing staked tokens
42+
- **`CheckpointData`** - tracks delegation history
43+
- **`SpokeMetadataCollector`** - collects and updates proposal metadata from the hub chain
44+
- **`GuardianSignatures`** - stores guardian signatures for message verification
45+
- **`ProposalData`** - stores data about a specific proposal, including votes and start time
46+
- **`ProposalVotersWeightCast`** - tracks individual voter's weight for a proposal
47+
- **`SpokeMessageExecutor`** - processes messages from a spoke chain via the Wormhole protocol
48+
- **`SpokeAirlock`** - manages PDA signing and seed validation for secure instruction execution
49+
- **`VestingBalance`** - stores total vesting balance and related staking information of a vester
50+
- **`VestingConfig`** - defines vesting configuration, including mint and admin details
51+
- **`Vesting`** - represents individual vesting allocations with maturation data
52+
- **`VoteWeightWindowLengths`** - tracks lengths of vote weight windows
53+
54+
Each account is implemented as a Solana PDA (Program Derived Address) and utilizes Anchor's account framework for serialization and management.
3155

3256
## System Workflow
3357

34-
The MultiGov system workflow details the step-by-step process for creating, voting on and executing governance proposals across connected chains, from proposal creation to final cross-chain execution.
58+
The MultiGov system workflow details the step-by-step process for creating, voting on, and executing governance proposals across connected chains, from proposal creation to final cross-chain execution.
59+
60+
### EVM Governance Workflow
61+
62+
The EVM-based MultiGov workflow follows these steps:
63+
64+
1. **Proposal creation**:
65+
1. A user creates a proposal through the `HubEvmSpokeAggregateProposer`, which checks eligibility across chains, or directly on the `HubGovernor` via the `propose` method
66+
2. The proposal is submitted to the `HubGovernor` if the user meets the proposal threshold
67+
2. **Proposal metadata distribution**:
68+
1. `HubProposalMetadata` creates a custom view method to be queried for use in the `SpokeMetadataCollector`
69+
2. `SpokeMetadataCollector` on each spoke chain queries `HubProposalMetadata` for proposal details
70+
3. **Voting process**:
71+
1. Users on spoke chains vote through their respective `SpokeVoteAggregators`
72+
2. `SpokeVoteAggregators` send aggregated votes to the `HubVotePool` via Wormhole
73+
3. `HubVotePool` submits the aggregated votes to the `HubGovernor`
74+
4. **Vote tallying and proposal execution**:
75+
1. `HubGovernor` tallies votes from all chains
76+
2. If a quorum is reached and there are more for votes than against votes, the vote passes and is queued for execution
77+
3. After the timelock delay, the proposal can be executed on the hub chain
78+
4. For cross-chain actions, a proposal should call the `dispatch` method in the `HubMessageDispatcher`, which sends execution messages to the relevant spoke chains
79+
5. `SpokeMessageExecutors` on each spoke chain receive and execute the approved actions through their respective `SpokeAirlocks`
80+
81+
### Solana Governance Workflow
82+
83+
The Solana-based MultiGov workflow follows these steps:
3584

3685
1. **Proposal creation**:
37-
- A user creates a proposal through the `HubEvmSpokeAggregateProposer`, which checks eligibility across chains, or directly on the `HubGovernor` via the `propose` method
38-
- The proposal is submitted to the `HubGovernor` if the user meets the proposal threshold
39-
1. **Proposal metadata distribution**:
40-
- `HubProposalMetadata` creates a custom view method to be queried for use in the `SpokeMetadataCollector`
41-
- `SpokeMetadataCollector` on each spoke chain queries `HubProposalMetadata` for proposal details
42-
1. **Voting process**:
43-
- Users on spoke chains vote through their respective `SpokeVoteAggregators`
44-
- `SpokeVoteAggregators` send aggregated votes to the `HubVotePool` via Wormhole
45-
- `HubVotePool` submits the aggregated votes to the `HubGovernor`
46-
1. **Vote tallying and proposal execution**:
47-
- `HubGovernor` tallies votes from all chains
48-
- If a quorum is reached and there are more for votes than against votes, the vote passes and is queued for execution
49-
- After the timelock delay, the proposal can be executed on the hub chain
50-
- For cross-chain actions, a proposal should call the `dispatch` method in the `HubMessageDispatcher`, which sends execution messages to the relevant spoke chains
51-
- `SpokeMessageExecutors` on each spoke chain receive and execute the approved actions through their respective `SpokeAirlocks`
86+
1. A user creates a proposal on `HubGovernor` by calling the `propose` method, provided they meet the proposal threshold
87+
2. For the proposal to be executed on the Solana blockchain, a `SolanaPayload` must be generated and included in the `calldata` parameter of the `propose` function
88+
3. The `SolanaPayload` contains encoded details specifying which instructions will be executed and which Solana program is responsible for execution
89+
90+
2. **Proposal metadata distribution**:
91+
1. A user queries `getProposalMetadata` from `HubProposalMetadata` via the Wormhole query system to create a proposal on the **Spoke Solana Chain Staking Program**
92+
2. The retrieved metadata is used in the `AddProposal` instruction in the Solana program
93+
3. The proposal data is verified to ensure it matches the expected format
94+
4. Guardian signatures are posted using the `PostSignatures` instruction
95+
5. Once validated, the proposal is stored on-chain
96+
97+
3. **Voting process**:
98+
1. Users vote on proposals stored in the `ProposalData` account on Solana
99+
2. The `CastVote` instruction records their choice (`for_votes`, `against_votes`, or `abstain_votes`)
100+
3. Eligibility and vote weight are verified using historical voter checkpoint data
101+
4. A **Query Wormhole** request retrieves vote data from a Solana PDA
102+
5. The signed response from Wormhole guardians is submitted to the `HubVotePool` on Ethereum for verification
103+
6. The `crossChainVote` function in `HubVotePool` processes the validated response and forwards the aggregated vote data to the `HubGovernor` to finalize the decision
104+
105+
4. **Vote tallying and proposal execution**:
106+
1. `HubGovernor` tallies votes from all chains
107+
2. If a quorum is reached with more **for votes** than **against votes**, the proposal passes and is queued for execution
108+
3. After the timelock delay, the proposal can be executed either on the hub chain or another chain
109+
4. For cross-chain execution involving Solana, the proposal calls the `dispatch` method in `HubSolanaMessageDispatcher`, which sends execution messages to Solana
110+
5. On Solana, the `ReceiveMessage` instruction processes the approved message, and the `SpokeAirlock` executes the corresponding instructions
52111

53112
## Cross-Chain Communication
54113

learn/governance/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Discover everything you need to know about MultiGov, Wormhole's cross-chain gove
2323

2424
---
2525

26-
Discover an overview of MultiGov's hub-and-spoke architecture, including how it enables cross-chain governance by coordinating decision-making across blockchain.
26+
Discover MultiGov's hub-and-spoke architecture, enabling EVM and Solana cross-chain governance through coordinated decision-making.
2727

2828
[:custom-arrow: Learn about MultiGov architecture](/docs/learn/governance/architecture/)
2929

0 commit comments

Comments
 (0)