-
Notifications
You must be signed in to change notification settings - Fork 319
feat(solana): prepare Bridge deploy task on Solana mainnet #485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| RUST_TOOLCHAIN=1.87.0 | ||
| SOLANA_VERSION=2.1.21 | ||
| ANCHOR_VERSION=0.31.0 | ||
|
|
||
| # Variables for cloning Bridge repo | ||
| BRIDGE_REPO=https://github.com/base/bridge.git | ||
| BRIDGE_COMMIT=d6ea31a5a1f86f4e1e444dd37558325bb4bdbd0c | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Waiting for base/bridge#162 to be merged |
||
|
|
||
| # Variables for deploying and sending transactions | ||
| DEPLOY_ENV=mainnet | ||
| DEPLOYER_KP=~/.config/solana/id.json | ||
| BRIDGE_KEYPAIR=./bridge-keypair.json | ||
| BASE_RELAYER_KEYPAIR=./base_relayer-keypair.json | ||
|
|
||
| GAS_FEE_RECEIVER=4m2jaKbJ4pDZw177BmLPMLsztPF5eVFo2fvxPgajdBNz | ||
|
|
||
| # Variables for initializing the Bridge Solana program | ||
| BRIDGE_PROGRAM_ID=7c6mteAcTXaQ1MFBCrnuzoZVTTAEfZwa6wgy4bqX3KXC # Same as devnet | ||
| GUARDIAN=HBHoWnK5876Sqy3f9jmUuaevat62ZA4dqStqwbEN7Zpe # MCM 1 Authority | ||
| SOL_REMOTE_TOKEN= | ||
| BRIDGE_EIP1559_TARGET=5_000_000 | ||
| BRIDGE_EIP1559_DENOMINATOR=2 | ||
| BRIDGE_EIP1559_WINDOW_DURATION_SECONDS=1 | ||
| BRIDGE_EIP1559_MINIMUM_BASE_FEE=1 | ||
| BRIDGE_GAS_PER_CALL=125_000 | ||
| BRIDGE_GAS_COST_SCALER=1_000_000 | ||
| BRIDGE_GAS_COST_SCALER_DP=1_000_000 | ||
| BRIDGE_GAS_FEE_RECEIVER=$(GAS_FEE_RECEIVER) | ||
| BRIDGE_PROTOCOL_BLOCK_INTERVAL_REQUIREMENT=300 | ||
| BRIDGE_BUFFER_MAX_CALL_BUFFER_SIZE=8192 # 8KB | ||
| BRIDGE_BASE_ORACLE_THRESHOLD=2 | ||
| BRIDGE_BASE_ORACLE_SIGNER_COUNT=2 | ||
| BRIDGE_BASE_ORACLE_SIGNERS=0x68fb9f14256fb52944c65f4afd207c2153ec18f1,0x9B1494C2d4c0dedbd8DA203054ee7de08c138836 | ||
| BRIDGE_PARTNER_ORACLE_REQUIRED_THRESHOLD=0 | ||
|
|
||
| # Variables for initializing the Base Relayer Solana program | ||
| BASE_RELAYER_PROGRAM_ID=56MBBEYAtQAdjT4e1NzHD8XaoyRSTvfgbSVVcEcHj51H # Same as devnet | ||
| GUARDIAN=HBHoWnK5876Sqy3f9jmUuaevat62ZA4dqStqwbEN7Zpe # MCM 1 Authority | ||
| BASE_RELAYER_EIP1559_TARGET=5_000_000 | ||
| BASE_RELAYER_EIP1559_DENOMINATOR=2 | ||
| BASE_RELAYER_EIP1559_WINDOW_DURATION_SECONDS=1 | ||
| BASE_RELAYER_EIP1559_MINIMUM_BASE_FEE=1 | ||
| BASE_RELAYER_MIN_GAS_LIMIT_PER_MESSAGE=100_000 | ||
| BASE_RELAYER_MAX_GAS_LIMIT_PER_MESSAGE=5_000_000 | ||
| BASE_RELAYER_GAS_COST_SCALER=1_000_000 | ||
| BASE_RELAYER_GAS_COST_SCALER_DP=1_000_000 | ||
| BASE_RELAYER_GAS_FEE_RECEIVER=$(GAS_FEE_RECEIVER) | ||
|
|
||
| # Variables for transferring upgrade authorities | ||
| UPGRADE_AUTHORITY=2N9nKVFPHsBVazniiYNxECB2nPLcwjk3dHAJH9tkr2xQ # MCM 0 Authority | ||
|
|
||
| # Variables for funding the SOL vault and the gas fee receiver | ||
| AUTHORITY=$(DEPLOYER_KP) | ||
| SOL_VAULT=4LS6xgoSn5Ed1UcJKJbwNSsyBQY2NX7H6nJcdt979c1A # Same as devnet | ||
| SOL_AMOUNT=0.1 | ||
|
|
||
| # Signatures of the set-upgrade-authority txs (used to generate the set-upgrade-authority artifacts) | ||
| SET_BRIDGE_UPGRADE_AUTHORITY_SIGNATURE= | ||
| SET_BASE_RELAYER_UPGRADE_AUTHORITY_SIGNATURE= | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| bridge/ | ||
| *keypair.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,164 @@ | ||
| include ../.env | ||
| include .env | ||
|
|
||
| include ../../Makefile | ||
|
|
||
| .PHONY: install-rust | ||
| install-rust: | ||
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
| rustup toolchain install $(RUST_TOOLCHAIN) && \ | ||
| rustup default $(RUST_TOOLCHAIN) | ||
|
|
||
| .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: install-bun | ||
| install-bun: | ||
| curl -fsSL https://bun.sh/install | bash | ||
|
|
||
| .PHONY: setup-deps | ||
| setup-deps: install-rust install-solana-cli install-anchor install-bun | ||
|
|
||
| ## | ||
| # Deployment Workflow | ||
| ## | ||
|
|
||
| # Step 1: Clone and build bridge programs | ||
| .PHONY: step1-clone-bridge | ||
| step1-clone-bridge: | ||
| @echo "==> Step 1: Cloning and building bridge programs..." | ||
| rm -rf bridge | ||
| git clone --filter=blob:none $(BRIDGE_REPO) bridge | ||
| cd bridge && \ | ||
| git checkout $(BRIDGE_COMMIT) | ||
| cd bridge/clients/ts && \ | ||
| bun install && \ | ||
| bun run build | ||
| cd bridge/scripts && \ | ||
| bun install | ||
|
|
||
| # Step 2: Build programs | ||
| .PHONY: step2-build-programs | ||
| step2-build-programs: | ||
| @echo "==> Step 2: Building bridge programs..." | ||
| mkdir -p bridge/solana/target/deploy && \ | ||
| cp $(BRIDGE_KEYPAIR) bridge/solana/target/deploy/bridge-keypair.json && \ | ||
| cp $(BASE_RELAYER_KEYPAIR) bridge/solana/target/deploy/base_relayer-keypair.json && \ | ||
| cd bridge/solana && \ | ||
| anchor keys sync | ||
| cd bridge/scripts && \ | ||
| bun cli sol build \ | ||
| --deploy-env $(DEPLOY_ENV) \ | ||
| --bridge-program-kp ../../$(BRIDGE_KEYPAIR) \ | ||
| --base-relayer-program-kp ../../$(BASE_RELAYER_KEYPAIR) | ||
|
|
||
| # Step 3: Deploy programs | ||
| .PHONY: step3-deploy-programs | ||
| step3-deploy-programs: | ||
| @echo "==> Step 3: Deploying programs..." | ||
| make sol-confirm-cmd \ | ||
| cmd="cd bridge/scripts && \ | ||
| bun cli sol deploy \ | ||
| --deploy-env $(DEPLOY_ENV) \ | ||
| --program bridge \ | ||
| --program-kp ../../$(BRIDGE_KEYPAIR) \ | ||
| --deployer-kp $(DEPLOYER_KP)" \ | ||
| output=artifacts/bridge-deploy-artifacts.json | ||
| make sol-confirm-cmd \ | ||
| cmd="cd bridge/scripts && \ | ||
| bun cli sol deploy \ | ||
| --deploy-env $(DEPLOY_ENV) \ | ||
| --program base-relayer \ | ||
| --program-kp ../../$(BASE_RELAYER_KEYPAIR) \ | ||
| --deployer-kp $(DEPLOYER_KP)" \ | ||
| output=artifacts/base-relayer-deploy-artifacts.json | ||
|
|
||
| # Step 4: Initialize programs | ||
| .PHONY: step4-init-programs | ||
| step4-init-programs: | ||
| @echo "==> Step 4: Initializing programs..." | ||
| make sol-confirm-cmd \ | ||
| cmd="cd bridge/scripts && \ | ||
| bun cli sol bridge initialize \ | ||
| --program-id $(BRIDGE_PROGRAM_ID) \ | ||
| --rpc-url $(SOL_RPC_URL) \ | ||
| --payer-kp $(DEPLOYER_KP) \ | ||
| --guardian $(GUARDIAN) \ | ||
| --remote-sol-address $(SOL_REMOTE_TOKEN) \ | ||
| --eip1559-target $(BRIDGE_EIP1559_TARGET) \ | ||
| --eip1559-denominator $(BRIDGE_EIP1559_DENOMINATOR) \ | ||
| --eip1559-window-duration-seconds $(BRIDGE_EIP1559_WINDOW_DURATION_SECONDS) \ | ||
| --eip1559-minimum-base-fee $(BRIDGE_EIP1559_MINIMUM_BASE_FEE) \ | ||
| --gas-per-call $(BRIDGE_GAS_PER_CALL) \ | ||
| --gas-cost-scaler $(BRIDGE_GAS_COST_SCALER) \ | ||
| --gas-cost-scaler-dp $(BRIDGE_GAS_COST_SCALER_DP) \ | ||
| --gas-fee-receiver $(BRIDGE_GAS_FEE_RECEIVER) \ | ||
| --protocol-block-interval-requirement $(BRIDGE_PROTOCOL_BLOCK_INTERVAL_REQUIREMENT) \ | ||
| --buffer-max-call-buffer-size $(BRIDGE_BUFFER_MAX_CALL_BUFFER_SIZE) \ | ||
| --base-oracle-threshold $(BRIDGE_BASE_ORACLE_THRESHOLD) \ | ||
| --base-oracle-signer-count $(BRIDGE_BASE_ORACLE_SIGNER_COUNT) \ | ||
| --base-oracle-signers $(BRIDGE_BASE_ORACLE_SIGNERS) \ | ||
| --partner-oracle-required-threshold $(BRIDGE_PARTNER_ORACLE_REQUIRED_THRESHOLD)" \ | ||
| output=artifacts/init-bridge.json | ||
| make sol-confirm-cmd \ | ||
| cmd="cd bridge/scripts && \ | ||
| bun cli sol base-relayer initialize \ | ||
| --program-id $(BASE_RELAYER_PROGRAM_ID) \ | ||
| --rpc-url $(SOL_RPC_URL) \ | ||
| --payer-kp $(DEPLOYER_KP) \ | ||
| --guardian $(GUARDIAN) \ | ||
| --eip1559-target $(BASE_RELAYER_EIP1559_TARGET) \ | ||
| --eip1559-denominator $(BASE_RELAYER_EIP1559_DENOMINATOR) \ | ||
| --eip1559-window-duration-seconds $(BASE_RELAYER_EIP1559_WINDOW_DURATION_SECONDS) \ | ||
| --eip1559-minimum-base-fee $(BASE_RELAYER_EIP1559_MINIMUM_BASE_FEE) \ | ||
| --min-gas-limit-per-message $(BASE_RELAYER_MIN_GAS_LIMIT_PER_MESSAGE) \ | ||
| --max-gas-limit-per-message $(BASE_RELAYER_MAX_GAS_LIMIT_PER_MESSAGE) \ | ||
| --gas-cost-scaler $(BASE_RELAYER_GAS_COST_SCALER) \ | ||
| --gas-cost-scaler-dp $(BASE_RELAYER_GAS_COST_SCALER_DP) \ | ||
| --gas-fee-receiver $(BASE_RELAYER_GAS_FEE_RECEIVER)" \ | ||
| output=artifacts/init-base-relayer.json | ||
|
|
||
| # Step 5: Print SOL vault | ||
| .PHONY: step5-print-sol-vault | ||
| step5-print-sol-vault: | ||
| @echo "==> Step 5: Printing SOL vault..." | ||
| cd bridge/scripts && \ | ||
| bun cli sol bridge sol-vault \ | ||
| --bridge-program $(BRIDGE_PROGRAM_ID) | ||
|
|
||
| # Step 6: Fund SOL vault | ||
| .PHONY: step6-fund-sol-vault | ||
| step6-fund-sol-vault: | ||
| @echo "==> Step 6: Funding SOL vault..." | ||
| make sol-transfer SOL_RECIPIENT=$(SOL_VAULT) output=artifacts/fund-sol-vault.json | ||
|
|
||
| # Step 7: Fund the gas fee receiver | ||
| .PHONY: step7-fund-gas-fee-receiver | ||
| step7-fund-gas-fee-receiver: | ||
| @echo "==> Step 7: Funding gas fee receiver..." | ||
| make sol-transfer SOL_RECIPIENT=$(GAS_FEE_RECEIVER) output=artifacts/fund-gas-fee-receiver.json | ||
|
|
||
| # Step 8: Transfer upgrade authorities of the bridge and base relayer programs | ||
| .PHONY: step8-transfer-upgrade-authorities | ||
| step8-transfer-upgrade-authorities: | ||
| @echo "==> Step 8: Transferring upgrade authorities of the bridge and base relayer programs..." | ||
| make sol-program-set-upgrade-authority \ | ||
| SOL_PROGRAM_ID=$(BRIDGE_PROGRAM_ID) \ | ||
| NEW_UPGRADE_AUTHORITY=$(UPGRADE_AUTHORITY) | ||
| make sol-program-show SOL_PROGRAM_ID=$(BRIDGE_PROGRAM_ID) | ||
| make sol-program-set-upgrade-authority \ | ||
| SOL_PROGRAM_ID=$(BASE_RELAYER_PROGRAM_ID) \ | ||
| NEW_UPGRADE_AUTHORITY=$(UPGRADE_AUTHORITY) | ||
| make sol-program-show SOL_PROGRAM_ID=$(BASE_RELAYER_PROGRAM_ID) | ||
|
|
||
| # Step 9: Generate set-upgrade-authority artifacts (use solana explorer to get the signature of the set-upgrade-authority tx) | ||
| .PHONY: step9-generate-set-upgrade-authorities-artifacts | ||
| step9-generate-set-upgrade-authorities-artifacts: | ||
| @echo "==> Step 8: Generating set-upgrade-authorities artifacts..." | ||
| make sol-confirm SIG=$(SET_BRIDGE_UPGRADE_AUTHORITY_SIGNATURE) output=artifacts/set-bridge-upgrade-authority-artifacts.json | ||
| make sol-confirm SIG=$(SET_BASE_RELAYER_UPGRADE_AUTHORITY_SIGNATURE) output=artifacts/set-base-relayer-upgrade-authority-artifacts.json |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix typo in previous devnet deployment