Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions solana/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ setup-mcm-set-pause-bridge:
rm -rf $(TEMPLATE_SET_PAUSE_BRIDGE)/cache $(TEMPLATE_SET_PAUSE_BRIDGE)/lib $(TEMPLATE_SET_PAUSE_BRIDGE)/out
cp -r $(TEMPLATE_SET_PAUSE_BRIDGE) $(SET_PAUSE_BRIDGE_DIR)

# Run `make setup-mcm-set-partner-threshold-bridge network=<network>`
setup-mcm-set-partner-threshold-bridge:
rm -rf $(TEMPLATE_SET_PARTNER_THRESHOLD_BRIDGE)/cache $(TEMPLATE_SET_PARTNER_THRESHOLD_BRIDGE)/lib $(TEMPLATE_SET_PARTNER_THRESHOLD_BRIDGE)/out
cp -r $(TEMPLATE_SET_PARTNER_THRESHOLD_BRIDGE) $(SET_PARTNER_THRESHOLD_BRIDGE_DIR)

##
# Dependencies
##
Expand Down
65 changes: 65 additions & 0 deletions solana/devnet/2025-10-24-mcm-program-upgrade/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
SOLANA_VERSION=1.17.25
ANCHOR_VERSION=0.29.0

# Variables for cloning the MCM repo
MCM_REPO=https://github.com/base/chainlink-ccip/
MCM_COMMIT=efe0405f3e2fa6789a57ec510e101828040a384b
ID_PATCH=patches/id.patch

##
# Common MCM Proposal Variables
##

# MCM program ID (base58 encoded)
MCM_PROGRAM_ID=Ea5qsVs2kwQXi7LMAh3Qg5YKpuPQbW7oqvYaPXUwBwoX

# MCM multisig ID (32 bytes hex with 0x prefix)
MCM_MULTISIG_ID=0x0000000000000000000000000000000000000000000000000000000000000000

# MCM authority address (derived PDA, base58 encoded)
MCM_AUTHORITY=2N9nKVFPHsBVazniiYNxECB2nPLcwjk3dHAJH9tkr2xQ

# Timestamp until which the proposal is valid and can be executed
MCM_VALID_UNTIL=1761404616 # Sat Oct 25 2025 15:03:36 GMT+0000

# Set to true if you want to override the previous root when registering the proposal
# If set to true, it allows to override the (proposal) root even if there are outstanding operations left to execute in the previous proposal
MCM_OVERRIDE_PREVIOUS_ROOT=false

# Total number of signatures required to execute the proposal
MCM_SIGNATURES_COUNT=3

# MCM proposal signatures
MCM_SIGNATURES=0xe11f80eb03f50906f6e193d5c2189629e62864b3a2489e14937470e411fe39376617ee2aff7f68fb5aa4e7b1f0da762f77467a91bbaeb3e4cf45c2f006148d8e1b,0xb46e5ddd0a44360538bdb47f9284072c9b33c1db21b97741db95f53abf6448e717614b5590b6bd6bdf16b4bedd9e7719c10417709bc88ab0ac563b764ea3266b1b,0xc4a3dbe200d2c4af18230cf2daa6ca2ce4530d0fae4b2a9817e226a18cdefbf07a2b3bea214b88d9c9ceadaece35d21cc215b5ad0a15a3f2912b7d193c1a22931b

# Output file for the MCM proposal
MCM_PROPOSAL_OUTPUT=proposal.json

# Authority account that will sign and submit MCM transactions
AUTHORITY=~/.config/solana/id.json

##
# MCM Proposal Variables Specific to Program Upgrade
##

# Program address to upgrade
PROGRAM=$(MCM_PROGRAM_ID)

# Buffer address containing the new program data (obtained from 'make write-buffer')
BUFFER=BqBKeo3AuEwbuXKn6z8VCuUhdXtW1Hre19kNigryayid

# Spill account address to receive refunded lamports
SPILL= AFs1LCbodhvwpgX3u3URLsud6R1XMSaMiQ5LtXw4GKYT # Gas fee receiver

##
# Variables for managing the temporary buffer
##

# Path to the compiled program binary (.so file)
PROGRAM_BINARY=./chainlink-ccip/chains/solana/contracts/target/deploy/mcm.so

# New buffer authority (MCM authority)
NEW_BUFFER_AUTHORITY=$(MCM_AUTHORITY)

# Signature of the set-buffer-authority transaction
SET_BUFFER_AUTHORITY_SIGNATURE=3ULQf5AQaEyBzwMREibauZ3j8vnFBBsFNR8Py9qqM5qA66VfZTFmNNQMc9MyUMEZLtp2ytWHcdjS3NtbwQdZ74wr
1 change: 1 addition & 0 deletions solana/devnet/2025-10-24-mcm-program-upgrade/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chainlink-ccip/
156 changes: 156 additions & 0 deletions solana/devnet/2025-10-24-mcm-program-upgrade/FACILITATORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Facilitator Instructions: MCM Program Upgrade

## Overview

As a Facilitator, you are responsible for:
1. Preparing the program buffer
2. Creating the MCM proposal
3. Committing and pushing the proposal to the repo
4. Coordinating with Signers
5. Collecting signatures
6. Executing the proposal on-chain

## Prerequisites

```bash
cd contract-deployments
git pull
cd solana/devnet/2025-10-22-mcm-upgrade
make deps
```

Ensure you have:
- Solana CLI installed and configured
- `mcmctl` installed (via `make deps`)
- `eip712sign` installed (via `make deps`)
- A funded Solana wallet configured
- The compiled program binary (`.so` file) ready

## Phase 1: Prepare the Program Buffer

### 1.1. Obtain the compiled program

Get the compiled program binary (`.so` file) that contains the new version of the program.

### 1.2. Update .env for buffer upload

Set the following in `.env`:

```bash
PROGRAM=<program-address>
PROGRAM_BINARY=<path-to-.so-file>
```

### 1.3. Write buffer

```bash
make write-buffer
```

This will output a buffer address. Copy it.

### 1.4. Update .env and transfer buffer authority

Set the following in `.env`:

```bash
BUFFER=<buffer-address-from-write-buffer>
MCM_AUTHORITY=<mcm-authority-pda>
SPILL=<your-wallet-address>
```

Then transfer buffer authority to MCM:

```bash
make transfer-buffer
```

The buffer is now controlled by the MCM authority.

## Phase 2: Create and Commit MCM Proposal

### 2.1. Update .env for proposal generation

Set the following in `.env`:

```bash
MCM_PROGRAM_ID=<mcm-program-id>
MCM_MULTISIG_ID=<multisig-id>
MCM_VALID_UNTIL=<unix-timestamp>
MCM_OVERRIDE_PREVIOUS_ROOT=false # or true if needed
MCM_PROPOSAL_OUTPUT=proposal.json
```

### 2.2. Generate proposal

```bash
make mcm-proposal
```

This creates the proposal file (default `proposal.json` or whatever is set in `MCM_PROPOSAL_OUTPUT`).

### 2.3. Review proposal

Open and review the generated proposal file to verify:
- Program address matches `PROGRAM`
- Buffer address matches `BUFFER`
- Spill address is correct
- Valid until timestamp is appropriate
- All instructions are correct

### 2.4. Commit and push

```bash
git add .
git commit -m "Add MCM program upgrade proposal for <program-name>"
git push
```

## Phase 3: Coordinate with Signers and Collect Signatures

Coordinate with Signers to collect their signatures. Each Signer will run `make mcm-sign` and provide their signature.

Concatenate all signatures in the format: `0xSIG1,0xSIG2,0xSIG3`

Once you have all required signatures, update `.env`:

```bash
MCM_SIGNATURES_COUNT=<number-of-signatures>
MCM_SIGNATURES=0xSIG1,0xSIG2,0xSIG3
```

## Phase 4: Execute Proposal

```bash
make mcm-all
```

This command executes all the necessary steps:
- Initialize signatures account
- Append signatures
- Finalize signatures
- Set root
- Execute proposal

## Phase 5: Verification

### 5.1. Verify program on Solana Explorer

Visit the Solana Explorer for your network:
- Mainnet: https://explorer.solana.com/
- Devnet: https://explorer.solana.com/?cluster=devnet

Search for the program address (`$PROGRAM`) and verify:
- The "Last Deployed Slot" is recent
- The upgrade authority is still `MCM_AUTHORITY`
- The execution transaction is visible in history

### 5.2. Update README

Update the Status line in README.md to:

```markdown
Status: [EXECUTED](https://explorer.solana.com/tx/<transaction-signature>?cluster=<network>)
```

Replace `<transaction-signature>` with the execution transaction signature and `<network>` with the appropriate cluster (devnet, mainnet-beta, etc.).
76 changes: 76 additions & 0 deletions solana/devnet/2025-10-24-mcm-program-upgrade/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
include ../.env
include .env

include ../../Makefile

##
# Project Setup
##

.PHONY: install-rust
install-rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

.PHONY: install-solana-cli
install-solana-cli:
curl -sSfL https://release.anza.xyz/v$(SOLANA_VERSION)/install | sh

.PHONY: install-anchor
install-anchor:
cargo install --git https://github.com/coral-xyz/anchor --tag v$(ANCHOR_VERSION) anchor-cli --force

.PHONY: setup-deps
setup-deps: install-rust install-solana-cli install-anchor

##
# MCM Program Upgrade Workflow
##

# Step 1: Clone and patch the MCM program
.PHONY: step1-clone-patch-and-build
step1-clone-patch-and-build:
@echo "==> Step 1: Cloning and patching the MCM program..."
rm -rf chainlink-ccip
git clone --filter=blob:none $(MCM_REPO) chainlink-ccip
cd chainlink-ccip && \
git checkout $(MCM_COMMIT) && \
git apply ../$(ID_PATCH)
cd chainlink-ccip/chains/solana/contracts && \
anchor build -p mcm

# Step 2: Write program buffer
.PHONY: step2-write-buffer
step2-write-buffer:
@echo "==> Step 2: Writing program buffer..."
make sol-write-buffer

# Step 3: Transfer buffer authority to MCM
.PHONY: step3-transfer-buffer
step3-transfer-buffer:
@echo "==> Step 2: Transferring buffer authority to MCM..."
make sol-set-buffer-authority

# Step 3.5: Generate set-buffer-authority artifacts (use solana explorer to get the signature of the set-buffer-authority tx)
.PHONY: step3.5-generate-set-buffer-authority-artifacts
step3.5-generate-set-buffer-authority-artifacts:
@echo "==> Step 3.5: Generating MCM set-buffer-authority artifacts..."
make sol-confirm SIG=$(SET_BUFFER_AUTHORITY_SIGNATURE) output=artifacts/set-buffer-authority-artifacts.json

# Step 4: Create upgrade proposal
.PHONY: step4-create-proposal
step4-create-proposal:
@echo "==> Step 4: Creating MCM upgrade proposal..."
make mcm-proposal-loader-v3-upgrade

# Step 5: Sign proposal
.PHONY: sign
sign:
@echo "==> Step 5: Signing proposal..."
make mcm-sign

# Step 6: Execute proposal (signatures + set-root + execute)
.PHONY: step6-execute-proposal
step6-execute-proposal:
@echo "==> Step 6: Executing MCM proposal..."
make mcm-signatures-all
make mcm-proposal-all
61 changes: 61 additions & 0 deletions solana/devnet/2025-10-24-mcm-program-upgrade/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# MCM Program Upgrade via Multi-Chain Multisig

Status: [EXECUTED](https://solscan.io/tx/5tR6S66cJri7xyCBaw6UxS1hVtyyb49McHJ5aoUxvzKA3jqMUA71e8f83MCHaLo9CXDBLrwA7vD16QqNWSte51VU?cluster=devnet)

## Description

This task upgrades a Solana program using the Multi-Chain Multisig (MCM) governance system. The upgrade is performed by uploading a new program buffer and creating an MCM proposal that, once signed and executed, will upgrade the program to the new version.

## Procedure for Signers

### 1. Update repo

```bash
cd contract-deployments
git pull
cd solana/devnet/2025-10-22-mcm-upgrade
make deps
```

### 2. Setup Ledger

Your Ledger needs to be connected and unlocked. The **Ethereum application** needs to be opened on Ledger with the message "Application is ready".

### 3. Review the proposal

The Facilitator will provide you with the proposal details. Review:
- Program being upgraded: `PROGRAM`
- Buffer address: `BUFFER`
- MCM Program ID: `MCM_PROGRAM_ID`
- Valid until timestamp: `MCM_VALID_UNTIL`

These values are in the `.env` file and the generated `proposal.json`.

### 4. Sign the proposal

```bash
make sign
```

This command will:
1. Display the proposal hash
2. Prompt you to sign on your Ledger
3. Output your signature

**Verify on your Ledger**: Check that the data you're signing matches the proposal hash displayed in the terminal.

After signing, you will see output like:

```
Signature: 1234567890abcdef...
```

### 5. Send signature to Facilitator

Copy the **entire signature** and send it to the Facilitator via your secure communication channel.

**That's it!** The Facilitator will collect all signatures and execute the proposal.

## For Facilitators

See [FACILITATORS.md](./FACILITATORS.md) for complete instructions on preparing, executing, and verifying this task.
Loading