wormhole/solana
Jeff Schroeder b175dd43c8
docs: quit the spelling spam typo fix PRs with cspell magic (#3845)
* Add cspell configuration and custom dictionary

The goal is to cut down on both incoming tyops, and well meaning but
spammy tyop fix PRs.

To run cspell locally install it and run:

    cspell '**/*.md' \
        --config cspell.config.yaml \
        --words-only \
        --unique \
        --quiet | sort --ignore-case

* docs: cspell updates

* wormchain: cspell updates

* aptos: cspell updates

* node: cspell updates

* algorand: cspell updates

* whitepapers: cspell updates

* near: cspell updates

* solana: cspell updates

* terra: cspell updates

* cosmwasm: cspell updates

* ethereum: cspell updates

* clients: cspell updates

* cspell updates for DEVELOP document

* github: run cspell github action

* sdk: cspell updates

* github: only run cspell on markdown files

* algorand: EMMITTER --> EMITTER

Suggested-by: @evan-gray

* cspell: removed from dictionary

Suggested-by: @evan-gray

* aptos and node: cspell updates

Suggested-by: @evan-gray

* cosmowasm: doc updates for terra2

Suggested-by: @evan-gray

* algorand: cspell updates

Suggested-by: @evan-gray

* algorand: cspell updates

Suggested-by: @evan-gray

* cspell: updated custom word dictionary

This resorts the dictionary and adds a few new words from the
algorand/MEMORY.md document around varints and integers.

* cspell: sort the dictionary how vscode does it

On macOS the sorting is locale dependent. To do this on macOS, you have
to invert the case, do a character insensitive sort, and then invert the
case again:

    LC_COLLATE="en_US.UTF-8" cspell '**/*.md' --config cspell.config.yaml \
        --words-only \
        --unique \
        --no-progress \
        --quiet \
    | tr 'a-zA-Z' 'A-Za-z' \
    | sort --ignore-case \
    | tr 'a-zA-Z' 'A-Za-z'

This requires the `LC_COLLATE` variable to be set to `en_US.UTF-8`, or it
will not do the right thing.

* docs: grammar clean up

---------

Co-authored-by: Evan Gray <battledingo@gmail.com>
2024-03-20 15:40:02 -04:00
..
bridge ci: Fix flaky solana tests and improve CI time (#2148) 2022-12-21 14:24:50 +01:00
external solana: fix token metadata program interaction (#2913) 2023-05-15 20:55:03 +01:00
idl sdk/js: Remove Solana WASM Dependencies (#1375) 2022-10-26 10:28:46 -04:00
keys fixed solana devnet key 2 typo 2023-02-10 12:35:34 -05:00
migration tob-worm-4-panics: using options rather than unwrap & tob-worm-9: cosmwasm test build (#1672) 2022-10-26 12:39:31 -04:00
modules solana: complete token transfer payload docs (#2550) 2023-06-13 13:58:04 -04:00
solitaire tob-worm-4-panics: using options rather than unwrap & tob-worm-9: cosmwasm test build (#1672) 2022-10-26 12:39:31 -04:00
.dockerignore Optimise solana dockerfiles (#1334) 2022-07-14 12:29:33 -05:00
Cargo.lock solana: fix token metadata program interaction (#2913) 2023-05-15 20:55:03 +01:00
Cargo.toml solitaire: remove unused client code 2022-06-24 13:51:50 +02:00
DOCKER.md certusone -> wormhole-foundation 2022-08-26 12:48:14 -04:00
Dockerfile tilt: remove additional root CA support 2023-12-12 14:22:05 -06:00
Dockerfile.base solana: bump: Rust nightly-2022-07-12, SOL SDK v1.10.31, rust container 1.60 2022-08-17 15:30:01 +01:00
Dockerfile.client dockerfile: update nodesource installer (#3487) 2023-11-01 15:32:19 -04:00
Dockerfile.wasm tilt: remove additional root CA support 2023-12-12 14:22:05 -06:00
Makefile solana: Add fmt, check, clippy, and test targets to Makefile 2022-09-20 23:00:47 +09:00
README.md docs: quit the spelling spam typo fix PRs with cspell magic (#3845) 2024-03-20 15:40:02 -04:00
UPGRADE.md solana: Add solana sdk upgrade instructions 2022-08-17 15:30:01 +01:00
devnet_setup.sh docker: build CLI in shared image 2023-06-01 15:33:07 +01:00
rust-toolchain solana: bump: Rust nightly-2022-07-12, SOL SDK v1.10.31, rust container 1.60 2022-08-17 15:30:01 +01:00
rustfmt.toml Fix Governance Headers 2021-07-20 17:37:08 +00:00
verify solana: Fix verify script (#1356) 2022-07-14 17:11:42 -05:00

README.md

Solana Wormhole Contract Deployment

This readme describes the steps for building, verifying, and deploying Solana smart contracts for Wormhole.

WARNING: This process is only Linux host compatible at this time.

Verify Tilt

Before building Solana contracts, ensure that the specific commit you will be building from passes in tilt. This ensures the basic functionality of the Solana smart contracts that you are about to build and deploy.

Build Contracts

The following command can be used to build contracts for Solana contracts via Docker.

Build Target Options: [mainnet|testnet|devnet]

These network names correspond to the naming convention used by wormhole elsewhere. This means that mainnet corresponds to Solana mainnet-beta, testnet corresponds to Solana devnet, and devnet is Solana localhost.

wormhole/solana $ make NETWORK=BUILD_TARGET artifacts

Example: make NETWORK=testnet artifacts

Upon completion, the compiled bytecode for the Solana contracts will be placed into an artifacts directory with a convention of artifacts-BUILD_TARGET (eg. artifacts-testnet)

The contract addresses are compiled into the binaries, which is why these build outputs are kept separate. The deploy script below makes sure that only the right binaries can be deployed to each network.

You may set the build target in the NETWORK environment variable, and then omit it from all of the subsequent commands. Example:

export NETWORK=testnet
make artifacts

Verify Checksums

Now that you have built the Solana Contracts, you should ask a peer to build using the same process and compare the equivalent checksums.txt files to make sure the contract bytecode(s) are deterministic.

Verify Target Options: [mainnet|testnet|devnet]

wormhole/solana $ cat artifacts-VERIFY_TARGET/checksums.txt

Example: cat artifacts-testnet/checksums.txt

Once you have verified the Solana contracts are deterministic with a peer, you can now move to the deploy step.

Deploy Contracts

Now that you have built and verified checksums, you can now deploy one or more relevant contracts to the Solana blockchain.

Deploy Target Options: [mainnet|testnet|devnet]

You will need to define a payer-DEPLOY_TARGET.json for the relevant deploy target (eg. payer-testnet.json). This will contain the relevant wallet private key that you will be using to deploy the contracts.

wormhole/solana $ make NETWORK=DEPLOY_TARGET deploy/bridge
wormhole/solana $ make NETWORK=DEPLOY_TARGET deploy/token_bridge
wormhole/solana $ make NETWORK=DEPLOY_TARGET deploy/nft_bridge

Example: make NETWORK=testnet deploy/bridge

For each deployed contract, you will get an account address for that relevant account address for the deployment, make note of these so you can use them in the next step for on-chain verification.

Verify On-Chain

Now that you have deployed one or more contracts on-chain, you can verify the onchain bytecode and make sure it matches the same checksums you identified above.

For each contract you wish to verify on-chain, you will need the following elements:

  • Path to the contracts bytecode (eg. artifacts-testnet/bridge.so)
  • Solana account address for the relevant contract (eg. 9GRbmSbdrWGNf9z27YrhPbWnL7zZ3doeQAq2LrkmCB4Y)
  • A network to verify on (mainnet, testnet, or devnet)

Below is how to verify all three contracts on testnet:

wormhole/solana $ verify -n testnet artifacts-testnet/bridge.so NEW_BRIDGE_ACCOUNT_ADDRESS
wormhole/solana $ verify -n testnet artifacts-testnet/token_bridge.so NEW_TOKEN_BRIDGE_ACCOUNT_ADDRESS
wormhole/solana $ verify -n testnet artifacts-testnet/nft_bridge.so NEW_NFT_BRIDGE_ACCOUNT_ADDRESS

Example: verify -n testnet artifacts-testnet/bridge.so 9GRbmSbdrWGNf9z27YrhPbWnL7zZ3doeQAq2LrkmCB4Y

Again, if you have the NETWORK environment variable set, then the -n flag is optional:

verify artifacts-testnet/bridge.so 9GRbmSbdrWGNf9z27YrhPbWnL7zZ3doeQAq2LrkmCB4Y

For each contract, you should expect a Successfully verified output message. If all contracts can be successfully verified, you can engage in Wormhole protocol governance to obtain an authorized VAA for the contract upgrade(s).

A verification failure should never happen, and is a sign of some error in the deployment process.

If you instead get Failed to verify for any contract, you can debug the differences between the compiled and on-chain byte code using hashdump and vimdiff. The verify script temporarily caches bytecode in /tmp/account.dump, so you can run the verify command for a contract that doesn't verify and then debug as needed.

Below is an example of the commands you'd need to hexdump and vimdiff the differences in contract bytecode:

wormhole/solana $ hexdump -C /tmp/account.dump > deployed.bin
wormhole/solana $ hexdump -C artifacts-testnet/bridge.so > compiled.bin
wormhole/solana $ vimdiff compiled.bin deployed.bin

Do not proceed with governance until you can verify the on-chain bytecode with the locally compiled bytecode.