Skip to content

Commit 85388d4

Browse files
feat(solana): auto deploy programs
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
1 parent 4fd8d9a commit 85388d4

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

book/src/framework/components/blockchains/solana.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ arm64 f4hrenh9it/solana:latest - used locally
1717
# optional, in case you need some custom image
1818
# image = "solanalabs/solana:v1.18.26"
1919

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

framework/components/blockchain/blockchain.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type Input struct {
2323
ContractsDir string `toml:"contracts_dir"`
2424
// programs to deploy on solana-test-validator start
2525
// a map of program name to program id
26+
// there needs to be a matching .so file in contracts_dir
2627
SolanaPrograms map[string]string `toml:"solana_programs"`
2728
}
2829

0 commit comments

Comments
 (0)