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
2 changes: 1 addition & 1 deletion solana/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ sol-write-buffer:
sol-set-buffer-authority:
solana program set-buffer-authority $(BUFFER) \
--new-buffer-authority $(NEW_BUFFER_AUTHORITY) \
--url $(SOL_RPC_URL)"
--url $(SOL_RPC_URL)
2 changes: 1 addition & 1 deletion solana/devnet-alpha/2025-10-20-deploy-bridge/.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ANCHOR_VERSION=0.31.0

# Variables for cloning Bridge repo
BRIDGE_REPO=https://github.com/base/bridge.git
BRIDGE_AUDITED_COMMIT=e9b5fe27280a
BRIDGE_COMMIT=e9b5fe27280ad2345d823d42668810432b0651aa

# Variables for deploying and sending transactions
DEPLOY_ENV=testnet-alpha
Expand Down
2 changes: 1 addition & 1 deletion solana/devnet-alpha/2025-10-20-deploy-bridge/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ step1-clone-bridge:
rm -rf bridge
git clone --filter=blob:none $(BRIDGE_REPO) bridge
cd bridge && \
git checkout $(BRIDGE_AUDITED_COMMIT)
git checkout $(BRIDGE_COMMIT)
cd bridge/clients/ts && \
bun install && \
bun run build
Expand Down
5 changes: 3 additions & 2 deletions solana/devnet/2025-10-20-deploy-mcm/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ ANCHOR_VERSION=0.29.0

# Variables for cloning the MCM repo
MCM_REPO=https://github.com/smartcontractkit/chainlink-ccip.git
MCM_AUDITED_COMMIT=0ee732e80586
MCM_PROGRAM_PATCH=patch/cb.patch
MCM_AUDITED_COMMIT=0ee732e80586c2e9df5e9b0c3b5e9a19ee66b3a1
INVOKE_SIGNED_PATCH=patches/invoke_signed.patch
EIP712_PATCH=patches/eip712.patch

# Variables for deploying and sending transactions
CLUSTER=devnet
Expand Down
7 changes: 4 additions & 3 deletions solana/devnet/2025-10-20-deploy-mcm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ install-solana-cli:
install-anchor:
cargo install --git https://github.com/coral-xyz/anchor --tag v$(ANCHOR_VERSION) anchor-cli --force

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

##
# Deployment Workflow
Expand All @@ -34,7 +34,8 @@ step1-clone-and-patch:
git clone --filter=blob:none $(MCM_REPO) chainlink-ccip
cd chainlink-ccip && \
git checkout $(MCM_AUDITED_COMMIT) && \
git apply ../$(MCM_PROGRAM_PATCH)
git apply ../$(INVOKE_SIGNED_PATCH) && \
git apply ../$(EIP712_PATCH)

# Step 2: Build and deploy the MCM program
.PHONY: step2-build-and-deploy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,24 +349,6 @@ index 7b030cda..eaf3b666 100644

mod test_hash_leaf {
use super::*;
diff --git a/chains/solana/contracts/programs/mcm/src/instructions/execute.rs b/chains/solana/contracts/programs/mcm/src/instructions/execute.rs
index 155b1a71..b550e7fe 100644
--- a/chains/solana/contracts/programs/mcm/src/instructions/execute.rs
+++ b/chains/solana/contracts/programs/mcm/src/instructions/execute.rs
@@ -93,6 +93,13 @@ pub fn execute<'info>(

invoke_signed(&instruction, acc_infos, signer)?;

+ // If the CPI modified any typed accounts present in this outer context
+ // (e.g., calling `accept_ownership` which updates `multisig_config`),
+ // reload them to avoid Anchor writing back the stale outer copy on exit.
+ ctx.accounts.multisig_config.reload()?;
+ ctx.accounts.root_metadata.reload()?;
+ ctx.accounts.expiring_root_and_op_count.reload()?;
+
emit!(OpExecuted {
nonce,
to: instruction.program_id,
diff --git a/chains/solana/contracts/programs/mcm/src/instructions/set_root.rs b/chains/solana/contracts/programs/mcm/src/instructions/set_root.rs
index 5d5167d4..8cbce01c 100644
--- a/chains/solana/contracts/programs/mcm/src/instructions/set_root.rs
Expand Down
18 changes: 18 additions & 0 deletions solana/devnet/2025-10-20-deploy-mcm/patches/invoke_signed.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/chains/solana/contracts/programs/mcm/src/instructions/execute.rs b/chains/solana/contracts/programs/mcm/src/instructions/execute.rs
index 155b1a71..b550e7fe 100644
--- a/chains/solana/contracts/programs/mcm/src/instructions/execute.rs
+++ b/chains/solana/contracts/programs/mcm/src/instructions/execute.rs
@@ -93,6 +93,13 @@ pub fn execute<'info>(

invoke_signed(&instruction, acc_infos, signer)?;

+ // If the CPI modified any typed accounts present in this outer context
+ // (e.g., calling `accept_ownership` which updates `multisig_config`),
+ // reload them to avoid Anchor writing back the stale outer copy on exit.
+ ctx.accounts.multisig_config.reload()?;
+ ctx.accounts.root_metadata.reload()?;
+ ctx.accounts.expiring_root_and_op_count.reload()?;
+
emit!(OpExecuted {
nonce,
to: instruction.program_id,
68 changes: 68 additions & 0 deletions solana/devnet/2025-10-22-mcm-upgrade/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
SOLANA_VERSION=1.17.25
ANCHOR_VERSION=0.29.0

# Variables for cloning the MCM repo
MCM_REPO=https://github.com/smartcontractkit/chainlink-ccip.git
MCM_AUDITED_COMMIT=0ee732e80586c2e9df5e9b0c3b5e9a19ee66b3a1
INVOKE_SIGNED_PATCH=patches/invoke_signed.patch
EIP712_PATCH=patches/eip712.patch
SIMPLIFY_EIP712_PATCH=patches/simplify_eip712.patch
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=1761205094 # Thu Oct 23 2025 07:38:14 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=

# 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=C4XSxK5zGw2ANbWQSURn6Cx4HaFiCxpmD6Nbb4T6szNu

# Spill account address to receive refunded lamports
SPILL=2aWsUTRfJu2hPNUYHaYJjm6C3SVPqXjtoxu2VgBXsd72 # Payer address

##
# 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=5MH2pXrEmvoUepzVNfqWzJ5mVXyJn4T9b81yqFaK8T8QzW8quRAXoaATWqtaaaVXJ7hzmywaHFDwcAHj7EQ5EFEs
1 change: 1 addition & 0 deletions solana/devnet/2025-10-22-mcm-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-22-mcm-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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we pre-set these also?

```

### 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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't many of these already exist? (I mean from the .env file that's defined above.)

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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MCM_SIGNATURES_COUNT=<number-of-signatures>
MCM_SIGNATURES_COUNT=3

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.).
Loading