Skip to content

Commit 075095d

Browse files
committed
feat(solana): prepare mainnet MCM deployment
1 parent d09cdd0 commit 075095d

File tree

4 files changed

+233
-0
lines changed

4 files changed

+233
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
SOLANA_VERSION=1.17.25
2+
ANCHOR_VERSION=0.29.0
3+
4+
# Variables for cloning the MCM repo
5+
MCM_REPO=https://github.com/base/chainlink-ccip/
6+
MCM_COMMIT=efe0405f3e2fa6789a57ec510e101828040a384b
7+
ID_PATCH=patches/id.patch
8+
9+
# Variables for deploying and sending transactions
10+
CLUSTER=mainnet
11+
AUTHORITY=~/.config/solana/id.json
12+
MCM_KEYPAIR=./mcm-keypair.json
13+
14+
# Signature of the deployWithMaxDataLen tx (used to generate the deployment artifacts)
15+
MCM_DEPLOY_SIGNATURE=
16+
17+
# General variables for MCM
18+
MCM_PROGRAM_ID=Ea5qsVs2kwQXi7LMAh3Qg5YKpuPQbW7oqvYaPXUwBwoX # Same as devnet
19+
MCM_MULTISIG_ID_0=0x0000000000000000000000000000000000000000000000000000000000000000
20+
MCM_MULTISIG_ID_1=0x0000000000000000000000000000000000000000000000000000000000000001
21+
MCM_CHAIN_ID=0
22+
MCM_AUTHORITY_0=
23+
MCM_AUTHORITY_1=
24+
MCM_MULTISIG_INIT_ARTIFACT_0=artifacts/mcm-multisig-init-0.json
25+
MCM_MULTISIG_INIT_ARTIFACT_1=artifacts/mcm-multisig-init-1.json
26+
27+
# Variables for configuring signers for multisig 0 and 1.
28+
# Note: Both multisigs are deployed with the same signers configuration to ease deployment.
29+
# After deployment, the signers configuration for both multisigs MUST be updated to the correct configuration.
30+
MCM_SIGNER_COUNT=1
31+
MCM_SIGNERS=0xb2d9a52e76841279EF0372c534C539a4f68f8C0B
32+
MCM_SIGNER_GROUPS=0
33+
MCM_GROUP_QUORUMS=1
34+
MCM_GROUP_PARENTS=0
35+
MCM_SIGNERS_INIT_ARTIFACT_0=artifacts/mcm-signers-init-0.json
36+
MCM_SIGNERS_INIT_ARTIFACT_1=artifacts/mcm-signers-init-1.json
37+
MCM_SIGNERS_APPEND_ARTIFACT_0=artifacts/mcm-signers-append-0.json
38+
MCM_SIGNERS_APPEND_ARTIFACT_1=artifacts/mcm-signers-append-1.json
39+
MCM_SIGNERS_FINALIZE_ARTIFACT_0=artifacts/mcm-signers-finalize-0.json
40+
MCM_SIGNERS_FINALIZE_ARTIFACT_1=artifacts/mcm-signers-finalize-1.json
41+
MCM_SIGNERS_SET_CONFIG_ARTIFACT_0=artifacts/mcm-signers-set-config-0.json
42+
MCM_SIGNERS_SET_CONFIG_ARTIFACT_1=artifacts/mcm-signers-set-config-1.json
43+
44+
# Variables for transfering multisig 0 ownership to its own authority
45+
MCM_VALID_UNTIL=
46+
MCM_OVERRIDE_PREVIOUS_ROOT=false
47+
MCM_SIGNATURES_COUNT=1
48+
MCM_SIGNATURES_0=
49+
MCM_SIGNATURES_1=
50+
MCM_PROPOSAL_OUTPUT_0=accept_ownership_proposal_0.json
51+
MCM_PROPOSAL_OUTPUT_1=accept_ownership_proposal_1.json
52+
MCM_OWNERSHIP_TRANSFER_ARTIFACT_0=artifacts/mcm-ownership-transfer-0.json
53+
MCM_OWNERSHIP_TRANSFER_ARTIFACT_1=artifacts/mcm-ownership-transfer-1.json
54+
MCM_SIGNATURES_INIT_ARTIFACT_0=artifacts/mcm-signatures-init-0.json
55+
MCM_SIGNATURES_INIT_ARTIFACT_1=artifacts/mcm-signatures-init-1.json
56+
MCM_SIGNATURES_APPEND_ARTIFACT_0=artifacts/mcm-signatures-append-0.json
57+
MCM_SIGNATURES_APPEND_ARTIFACT_1=artifacts/mcm-signatures-append-1.json
58+
MCM_SIGNATURES_FINALIZE_ARTIFACT_0=artifacts/mcm-signatures-finalize-0.json
59+
MCM_SIGNATURES_FINALIZE_ARTIFACT_1=artifacts/mcm-signatures-finalize-1.json
60+
MCM_PROPOSAL_SET_ROOT_ARTIFACT_0=artifacts/mcm-proposal-set-root-0.json
61+
MCM_PROPOSAL_SET_ROOT_ARTIFACT_1=artifacts/mcm-proposal-set-root-1.json
62+
MCM_PROPOSAL_EXECUTE_ARTIFACT_0=artifacts/mcm-proposal-execute-0.json
63+
MCM_PROPOSAL_EXECUTE_ARTIFACT_1=artifacts/mcm-proposal-execute-1.json
64+
65+
# Variables for transferring MCM upgrade authority
66+
SOL_PROGRAM_ID=$(MCM_PROGRAM_ID)
67+
NEW_UPGRADE_AUTHORITY=$(MCM_AUTHORITY_0)
68+
69+
# Signature of the set-upgrade-authority tx (used to generate the set-upgrade-authority artifacts)
70+
SET_UPGRADE_AUTHORITY_SIGNATURE=
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
chainlink-ccip/
2+
*keypair.json
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
include ../.env
2+
include .env
3+
4+
include ../../Makefile
5+
6+
##
7+
# Project Setup
8+
##
9+
10+
.PHONY: install-rust
11+
install-rust:
12+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
13+
14+
.PHONY: install-solana-cli
15+
install-solana-cli:
16+
curl -sSfL https://release.anza.xyz/v$(SOLANA_VERSION)/install | sh
17+
18+
.PHONY: install-anchor
19+
install-anchor:
20+
cargo install --git https://github.com/coral-xyz/anchor --tag v$(ANCHOR_VERSION) anchor-cli --force
21+
22+
.PHONY: setup-deps
23+
setup-deps: install-rust install-solana-cli install-anchor
24+
25+
##
26+
# Deployment Workflow
27+
##
28+
29+
# Step 1: Clone and patch the MCM program
30+
.PHONY: step1-clone-and-patch
31+
step1-clone-and-patch:
32+
@echo "==> Step 1: Cloning and patching the MCM program..."
33+
rm -rf chainlink-ccip
34+
git clone --filter=blob:none $(MCM_REPO) chainlink-ccip
35+
cd chainlink-ccip && \
36+
git checkout $(MCM_COMMIT) && \
37+
git apply ../$(ID_PATCH)
38+
39+
# Step 2: Build and deploy the MCM program
40+
.PHONY: step2-build-and-deploy
41+
step2-build-and-deploy:
42+
@echo "==> Step 2: Building and deploying the MCM program..."
43+
mkdir -p chainlink-ccip/chains/solana/contracts/target/deploy/ && \
44+
cp $(MCM_KEYPAIR) chainlink-ccip/chains/solana/contracts/target/deploy/mcm-keypair.json
45+
cd chainlink-ccip/chains/solana/contracts && \
46+
anchor build -p mcm && \
47+
anchor deploy --provider.cluster $(CLUSTER) --provider.wallet $(AUTHORITY) -p mcm
48+
49+
# Step 3: Generate deploy artifacts (use solana explorer to get the signature of the deployWithMaxDataLen tx)
50+
.PHONY: step3-generate-deploy-artifacts
51+
step3-generate-deploy-artifacts:
52+
@echo "==> Step 3: Generating MCM deploy artifacts..."
53+
make sol-confirm SIG=$(MCM_DEPLOY_SIGNATURE) output=artifacts/mcm-deploy-artifacts.json
54+
55+
# Step 4: Initialize the multisigs(inherited from parent)
56+
.PHONY: step4-init-multisigs
57+
step4-init-multisigs:
58+
@echo "==> Step 4: Initializing MCM multisigs..."
59+
make mcm-multisig-init \
60+
MCM_MULTISIG_ID=$(MCM_MULTISIG_ID_0) \
61+
MCM_MULTISIG_INIT_ARTIFACT=$(MCM_MULTISIG_INIT_ARTIFACT_0)
62+
make mcm-multisig-init \
63+
MCM_MULTISIG_ID=$(MCM_MULTISIG_ID_1) \
64+
MCM_MULTISIG_INIT_ARTIFACT=$(MCM_MULTISIG_INIT_ARTIFACT_1)
65+
@echo "==> MCM multisig authority for multisig 0..."
66+
make mcm-multisig-print-authority \
67+
MCM_MULTISIG_ID=$(MCM_MULTISIG_ID_0)
68+
@echo "==> MCM multisig authority for multisig 1..."
69+
make mcm-multisig-print-authority \
70+
MCM_MULTISIG_ID=$(MCM_MULTISIG_ID_1)
71+
72+
# Step 5: Initialize the signers for multisigs(inherited from parent)
73+
.PHONY: step5-init-signers
74+
step5-init-signers:
75+
@echo "==> Step 5: Initializing MCM signers for multisigs..."
76+
make mcm-signers-all \
77+
MCM_MULTISIG_ID=$(MCM_MULTISIG_ID_0) \
78+
MCM_SIGNERS_INIT_ARTIFACT=$(MCM_SIGNERS_INIT_ARTIFACT_0) \
79+
MCM_SIGNERS_APPEND_ARTIFACT=$(MCM_SIGNERS_APPEND_ARTIFACT_0) \
80+
MCM_SIGNERS_FINALIZE_ARTIFACT=$(MCM_SIGNERS_FINALIZE_ARTIFACT_0) \
81+
MCM_SIGNERS_SET_CONFIG_ARTIFACT=$(MCM_SIGNERS_SET_CONFIG_ARTIFACT_0)
82+
make mcm-signers-all \
83+
MCM_MULTISIG_ID=$(MCM_MULTISIG_ID_1) \
84+
MCM_SIGNERS_INIT_ARTIFACT=$(MCM_SIGNERS_INIT_ARTIFACT_1) \
85+
MCM_SIGNERS_APPEND_ARTIFACT=$(MCM_SIGNERS_APPEND_ARTIFACT_1) \
86+
MCM_SIGNERS_FINALIZE_ARTIFACT=$(MCM_SIGNERS_FINALIZE_ARTIFACT_1) \
87+
MCM_SIGNERS_SET_CONFIG_ARTIFACT=$(MCM_SIGNERS_SET_CONFIG_ARTIFACT_1)
88+
89+
# Step 6: Create accept-ownership proposals (inherited from parent)
90+
.PHONY: step6-create-accept-ownership-proposals
91+
step6-create-accept-ownership-proposals:
92+
@echo "==> Step 6: Creating MCM accept-ownership proposals..."
93+
make mcm-proposal-accept-ownership \
94+
MCM_MULTISIG_ID=$(MCM_MULTISIG_ID_0) \
95+
MCM_PROPOSAL_OUTPUT=$(MCM_PROPOSAL_OUTPUT_0)
96+
make mcm-proposal-accept-ownership \
97+
MCM_MULTISIG_ID=$(MCM_MULTISIG_ID_1) \
98+
MCM_PROPOSAL_OUTPUT=$(MCM_PROPOSAL_OUTPUT_1)
99+
100+
# Step 7: Sign the proposals (inherited from parent)
101+
.PHONY: step7-sign-proposals
102+
step7-sign-proposals:
103+
@echo "==> Step 7: Signing MCM proposals..."
104+
make mcm-sign \
105+
MCM_PROPOSAL_OUTPUT=$(MCM_PROPOSAL_OUTPUT_0)
106+
make mcm-sign \
107+
MCM_PROPOSAL_OUTPUT=$(MCM_PROPOSAL_OUTPUT_1)
108+
109+
# Step 8: Execute ownership transfers (inherited from parent)
110+
.PHONY: step8-execute-ownership-transfers
111+
step8-execute-ownership-transfers:
112+
@echo "==> Step 8: Executing MCM ownership transfers..."
113+
make mcm-ownership-transfer \
114+
MCM_MULTISIG_ID=$(MCM_MULTISIG_ID_0) \
115+
MCM_PROPOSED_OWNER=$(MCM_AUTHORITY_0) \
116+
MCM_OWNERSHIP_TRANSFER_ARTIFACT=$(MCM_OWNERSHIP_TRANSFER_ARTIFACT_0)
117+
make mcm-all \
118+
MCM_PROPOSAL_OUTPUT=$(MCM_PROPOSAL_OUTPUT_0) \
119+
MCM_SIGNATURES=$(MCM_SIGNATURES_0) \
120+
MCM_SIGNATURES_INIT_ARTIFACT=$(MCM_SIGNATURES_INIT_ARTIFACT_0) \
121+
MCM_SIGNATURES_APPEND_ARTIFACT=$(MCM_SIGNATURES_APPEND_ARTIFACT_0) \
122+
MCM_SIGNATURES_FINALIZE_ARTIFACT=$(MCM_SIGNATURES_FINALIZE_ARTIFACT_0) \
123+
MCM_PROPOSAL_SET_ROOT_ARTIFACT=$(MCM_PROPOSAL_SET_ROOT_ARTIFACT_0) \
124+
MCM_PROPOSAL_EXECUTE_ARTIFACT=$(MCM_PROPOSAL_EXECUTE_ARTIFACT_0)
125+
make mcm-ownership-transfer \
126+
MCM_MULTISIG_ID=$(MCM_MULTISIG_ID_1) \
127+
MCM_PROPOSED_OWNER=$(MCM_AUTHORITY_1) \
128+
MCM_OWNERSHIP_TRANSFER_ARTIFACT=$(MCM_OWNERSHIP_TRANSFER_ARTIFACT_1)
129+
make mcm-all \
130+
MCM_PROPOSAL_OUTPUT=$(MCM_PROPOSAL_OUTPUT_1) \
131+
MCM_SIGNATURES=$(MCM_SIGNATURES_1) \
132+
MCM_SIGNATURES_INIT_ARTIFACT=$(MCM_SIGNATURES_INIT_ARTIFACT_1) \
133+
MCM_SIGNATURES_APPEND_ARTIFACT=$(MCM_SIGNATURES_APPEND_ARTIFACT_1) \
134+
MCM_SIGNATURES_FINALIZE_ARTIFACT=$(MCM_SIGNATURES_FINALIZE_ARTIFACT_1) \
135+
MCM_PROPOSAL_SET_ROOT_ARTIFACT=$(MCM_PROPOSAL_SET_ROOT_ARTIFACT_1) \
136+
MCM_PROPOSAL_EXECUTE_ARTIFACT=$(MCM_PROPOSAL_EXECUTE_ARTIFACT_1)
137+
138+
# Step 9: Transfer upgrade authority (inherited from parent)
139+
.PHONY: step9-transfer-upgrade-authority
140+
step9-transfer-upgrade-authority:
141+
@echo "==> Step 9: Transferring MCM upgrade authority..."
142+
make sol-program-set-upgrade-authority
143+
make sol-program-show
144+
145+
# Step 10: Generate set-upgrade-authority artifacts (use solana explorer to get the signature of the set-upgrade-authority tx)
146+
.PHONY: step10-generate-set-upgrade-authority-artifacts
147+
step10-generate-set-upgrade-authority-artifacts:
148+
@echo "==> Step 10: Generating MCM set-upgrade-authority artifacts..."
149+
make sol-confirm SIG=$(SET_UPGRADE_AUTHORITY_SIGNATURE) output=artifacts/set-upgrade-authority-artifacts.json
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/chains/solana/contracts/programs/mcm/src/lib.rs b/chains/solana/contracts/programs/mcm/src/lib.rs
2+
index a2e1d0b3..f2420a45 100644
3+
--- a/chains/solana/contracts/programs/mcm/src/lib.rs
4+
+++ b/chains/solana/contracts/programs/mcm/src/lib.rs
5+
@@ -1,6 +1,6 @@
6+
use anchor_lang::prelude::*;
7+
8+
-declare_id!("5vNJx78mz7KVMjhuipyr9jKBKcMrKYGdjGkgE4LUmjKk");
9+
+declare_id!("Ea5qsVs2kwQXi7LMAh3Qg5YKpuPQbW7oqvYaPXUwBwoX");
10+
11+
use program::Mcm;
12+

0 commit comments

Comments
 (0)