Skip to content

Commit

Permalink
feat(solana): auto deploy programs
Browse files Browse the repository at this point in the history
By using `--upgradeable-program` , we can auto deploy programs detected in the mounted path `/programs`, this reduces the need for consumer of this library to have to deploy the programs themselves, especially with go sdk where deploying a program is not straightforward and involves a decent amount of code, the alternative is to ssh into the docker container and run `solana deploy ...` but this involves an extra step.

Inspired from https://github.com/smartcontractkit/chainlink-ccip/blob/609f7b0c9734b3cfc1d1a1aea0fd1ddf4c90bd0c/chains/solana/contracts/tests/testutils/anchor.go#L72-L72

JIRA: https://smartcontract-it.atlassian.net/browse/DPA-1458
  • Loading branch information
graham-chainlink committed Dec 30, 2024
1 parent 4fd8d9a commit 85388d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions book/src/framework/components/blockchains/solana.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ arm64 f4hrenh9it/solana:latest - used locally
# optional, in case you need some custom image
# image = "solanalabs/solana:v1.18.26"

# optional, in case you need to deploy some programs
# this example assumes there is a mcm.so in the mounted contracts_dir directory
# value is the program id to set for the deployed program instead of auto generating
# useful for deterministic testing
# optional
# To deploy a solana program, we can provide a mapping of program name to program id.
# The program name has to match the name of the .so file in the contracts_dir directory.
# This example assumes there is a mcm.so in the mounted contracts_dir directory
# value is the program_id to set for the deployed program, any valid public key can be used here.
# this allows lookup via program_id during testing.
# Alternative, we can use `solana deploy` instead of this field to deploy a program, but
# program_id will be auto generated.
[blockchain_a.solana_programs]
mcm = "6UmMZr5MEqiKWD5jqTJd1WCR5kT8oZuFYBLJFi1o6GQX"

Expand Down
1 change: 1 addition & 0 deletions framework/components/blockchain/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type Input struct {
ContractsDir string `toml:"contracts_dir"`
// programs to deploy on solana-test-validator start
// a map of program name to program id
// there needs to be a matching .so file in contracts_dir
SolanaPrograms map[string]string `toml:"solana_programs"`
}

Expand Down

0 comments on commit 85388d4

Please sign in to comment.