Skip to content

Commit 50f6bd5

Browse files
authored
feat(solana): prepare MCM deploy task on Solana mainnet (#480)
* feat(solana): prepare mainnet MCM deployment * chore(solana): use chain_id 1 for mainnet * chore(solana): add funding step to fund MCM authorities * chore(solana): simplify deployment to same address
1 parent d09cdd0 commit 50f6bd5

File tree

3 files changed

+230
-0
lines changed

3 files changed

+230
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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+
8+
# Variables for deploying and sending transactions
9+
CLUSTER=mainnet
10+
AUTHORITY=~/.config/solana/id.json
11+
MCM_KEYPAIR=./mcm-keypair.json
12+
13+
# Signature of the deployWithMaxDataLen tx (used to generate the deployment artifacts)
14+
MCM_DEPLOY_SIGNATURE=
15+
16+
# General variables for MCM
17+
MCM_PROGRAM_ID=Ea5qsVs2kwQXi7LMAh3Qg5YKpuPQbW7oqvYaPXUwBwoX # Same as devnet
18+
MCM_MULTISIG_ID_0=0x0000000000000000000000000000000000000000000000000000000000000000
19+
MCM_MULTISIG_ID_1=0x0000000000000000000000000000000000000000000000000000000000000001
20+
MCM_CHAIN_ID=1
21+
MCM_AUTHORITY_0=
22+
MCM_AUTHORITY_1=
23+
MCM_MULTISIG_INIT_ARTIFACT_0=artifacts/mcm-multisig-init-0.json
24+
MCM_MULTISIG_INIT_ARTIFACT_1=artifacts/mcm-multisig-init-1.json
25+
26+
# Variables for configuring signers for multisig 0 and 1.
27+
# Note: Both multisigs are deployed with the same signers configuration to ease deployment.
28+
# After deployment, the signers configuration for both multisigs MUST be updated to the correct configuration.
29+
MCM_SIGNER_COUNT=1
30+
MCM_SIGNERS=0xb2d9a52e76841279EF0372c534C539a4f68f8C0B
31+
MCM_SIGNER_GROUPS=0
32+
MCM_GROUP_QUORUMS=1
33+
MCM_GROUP_PARENTS=0
34+
MCM_SIGNERS_INIT_ARTIFACT_0=artifacts/mcm-signers-init-0.json
35+
MCM_SIGNERS_INIT_ARTIFACT_1=artifacts/mcm-signers-init-1.json
36+
MCM_SIGNERS_APPEND_ARTIFACT_0=artifacts/mcm-signers-append-0.json
37+
MCM_SIGNERS_APPEND_ARTIFACT_1=artifacts/mcm-signers-append-1.json
38+
MCM_SIGNERS_FINALIZE_ARTIFACT_0=artifacts/mcm-signers-finalize-0.json
39+
MCM_SIGNERS_FINALIZE_ARTIFACT_1=artifacts/mcm-signers-finalize-1.json
40+
MCM_SIGNERS_SET_CONFIG_ARTIFACT_0=artifacts/mcm-signers-set-config-0.json
41+
MCM_SIGNERS_SET_CONFIG_ARTIFACT_1=artifacts/mcm-signers-set-config-1.json
42+
43+
# Variables for transfering multisig 0 ownership to its own authority
44+
MCM_VALID_UNTIL=
45+
MCM_OVERRIDE_PREVIOUS_ROOT=false
46+
MCM_SIGNATURES_COUNT=1
47+
MCM_SIGNATURES_0=
48+
MCM_SIGNATURES_1=
49+
MCM_PROPOSAL_OUTPUT_0=accept_ownership_proposal_0.json
50+
MCM_PROPOSAL_OUTPUT_1=accept_ownership_proposal_1.json
51+
MCM_OWNERSHIP_TRANSFER_ARTIFACT_0=artifacts/mcm-ownership-transfer-0.json
52+
MCM_OWNERSHIP_TRANSFER_ARTIFACT_1=artifacts/mcm-ownership-transfer-1.json
53+
MCM_SIGNATURES_INIT_ARTIFACT_0=artifacts/mcm-signatures-init-0.json
54+
MCM_SIGNATURES_INIT_ARTIFACT_1=artifacts/mcm-signatures-init-1.json
55+
MCM_SIGNATURES_APPEND_ARTIFACT_0=artifacts/mcm-signatures-append-0.json
56+
MCM_SIGNATURES_APPEND_ARTIFACT_1=artifacts/mcm-signatures-append-1.json
57+
MCM_SIGNATURES_FINALIZE_ARTIFACT_0=artifacts/mcm-signatures-finalize-0.json
58+
MCM_SIGNATURES_FINALIZE_ARTIFACT_1=artifacts/mcm-signatures-finalize-1.json
59+
MCM_PROPOSAL_SET_ROOT_ARTIFACT_0=artifacts/mcm-proposal-set-root-0.json
60+
MCM_PROPOSAL_SET_ROOT_ARTIFACT_1=artifacts/mcm-proposal-set-root-1.json
61+
MCM_PROPOSAL_EXECUTE_ARTIFACT_0=artifacts/mcm-proposal-execute-0.json
62+
MCM_PROPOSAL_EXECUTE_ARTIFACT_1=artifacts/mcm-proposal-execute-1.json
63+
64+
# Variables for transferring MCM upgrade authority
65+
SOL_PROGRAM_ID=$(MCM_PROGRAM_ID)
66+
NEW_UPGRADE_AUTHORITY=$(MCM_AUTHORITY_0)
67+
68+
# Signature of the set-upgrade-authority tx (used to generate the set-upgrade-authority artifacts)
69+
SET_UPGRADE_AUTHORITY_SIGNATURE=
70+
71+
# Variables for funding MCM authorities
72+
SOL_AMOUNT=0.5
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: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
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+
38+
# Step 2: Build and deploy the MCM program
39+
.PHONY: step2-build-and-deploy
40+
step2-build-and-deploy:
41+
@echo "==> Step 2: Building and deploying the MCM program..."
42+
mkdir -p chainlink-ccip/chains/solana/contracts/target/deploy/ && \
43+
cp $(MCM_KEYPAIR) chainlink-ccip/chains/solana/contracts/target/deploy/mcm-keypair.json
44+
cd chainlink-ccip/chains/solana/contracts && \
45+
anchor keys sync && \
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
150+
151+
# Step 11: Fund MCM authorities (inherited from parent)
152+
.PHONY: step11-fund-mcm-authorities
153+
step11-fund-mcm-authorities:
154+
@echo "==> Step 11: Funding MCM authorities..."
155+
make sol-transfer SOL_RECIPIENT=$(MCM_AUTHORITY_0) output=artifacts/fund-mcm-authority-0.json
156+
make sol-transfer SOL_RECIPIENT=$(MCM_AUTHORITY_1) output=artifacts/fund-mcm-authority-1.json

0 commit comments

Comments
 (0)