Skip to content

Commit

Permalink
Solana router deploy (D) (#15871)
Browse files Browse the repository at this point in the history
* Adding solchains in NewEnv

* Revert "Adding solchains in NewEnv"

This reverts commit aaab52e.

* adding sol chains to newenv

* newEnv needs to send nil

* adding test env setup

* adding link token deployment and test

* adding nil for crib sol chains

* using switch case

* Adding decimal const

* adding chain selectors commit

* go mod tidy

* adding initial code for solana chain contracts deploy

* linting

* adding solana state

* adding initial code for solana chain contracts deploy

* wip

* chain sel update

* update core/scripts go files

* again

* add changeset

* go imports

* go mod

* go mod

* go mod tidy

* todo

* deploy stuff

* Adding solana router deploy

* Adding

* updates

* adding stuff for tests

* linting

* linting

* changing to ctf

* bug

* Add CI Action to build Solana contracts

* testing stuff

* continue testing

* Update action.yml

* Update action.yml

* Update action.yml

* Update action.yml

* Update action.yml

* Update action.yml

* Update action.yml

* Update action.yml

* deployment: memory: Generate more transmitter key types, expose in JD

* deployment: memory: Configure nodes with solana config too

* Use CTF to spin up the solana validator for in-memory tests

* Use autopatchelf on solana binaries to make them usable on NixOS

* memory: solana: Shut down the container when test terminates

* go mod tidy

* Use latest upstream CTF

* Add missing import

* make modgraph

* Use framework.DefaultNetwork()

* changes

* tidying

* ignoring keypair if not provided

* fix

* Update action.yml

* Update action.yml

* Update action.yml

* Update action.yml

* Update action.yml

* Update action.yml

* test integrating with CI build step

* test fix

* try reading program ids

* Update action.yml

* Update action.yml

* Update action.yml

* Update action.yml

* Update chain.go

* Update action.yml

* last try

* Update action.yml

* Update action.yml

* make script executable

* reverting changes to stabilize the branch

* Create ccip_router.so

* linting

* adding build here

* test different strategy

* another try

* Update action.yml

* yash fixed it!

* Update chain.go

* cleanup

* still linting

* lint

* solana tooling dev

* Revert "solana tooling dev"

This reverts commit 38607aa.

* switch strategy to local build

* clean up test

* cleanning up

* fix

* try fix ci

* Update action.yml

* Update action.yml

* Update action.yml

* get full sha

* :(

* :(

* Update action.yml

* very sad

* fixing

* cleanning up branch

* Update action.yml

* reuse build script in CI

* typo

* welp

cleaning up branch

* Delete .solana_contracts_rev

* fix

* Update action.yml

* fix fetch

* Update action.yml

* Update action.yml

* clean up and add comments

* linting

* Update solana_chain.go

* fix ci checks

* Update ci-core-partial.yml

* test fix

* CI is difficult

* Update flakeguard.yml

* try a purge just for fun

* try bigger image

* revert flakeguard

---------

Co-authored-by: Terry Tata <[email protected]>
Co-authored-by: jlaveracll <[email protected]>
Co-authored-by: Blaž Hrastnik <[email protected]>
  • Loading branch information
4 people authored Jan 23, 2025
1 parent 5e404d2 commit 7791a28
Show file tree
Hide file tree
Showing 18 changed files with 646 additions and 113 deletions.
73 changes: 73 additions & 0 deletions .github/actions/setup-solana/build-contracts/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Solana build contracts
description: Build Solana contracts

runs:
using: composite
steps:
- name: Checkout chainlink-ccip
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
repository: smartcontractkit/chainlink-ccip
path: chainlink-ccip
fetch-depth: 0
- name: Checkout branch based on CCIP Revision
id: get_checkout_ccip_chains_solana_revision
shell: bash
run: |
# get the short revision of the chainlink-ccip solana contracts dependency from the go.mod file
short_revision=$(grep "github.com/smartcontractkit/chainlink-ccip/chains/solana" deployment/go.mod | awk '{print $2}' | cut -d'-' -f3)
# since the github action checkout action doesn't support short revisions, we have to do it manually
cd chainlink-ccip
git checkout $short_revision
echo "CHAINLINK_CCIP_COMMIT_SHORT=${short_revision}" >> $GITHUB_ENV
- name: Get Anchor Version
id: get_anchor_version
shell: bash
run: |
cd chainlink-ccip/chains/solana
anchor=$(make anchor_version)
echo "ANCHOR_VERSION=${anchor}" >> $GITHUB_ENV
- name: cache docker build image
id: cache-image
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
lookup-only: true
path: chains/solana/contracts/docker-build.tar
key: ${{ runner.os }}-solana-build-${{ env.ANCHOR_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo target dir
id: cache-target
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
lookup-only: true
path: chains/solana/contracts/target
key: ${{ runner.os }}-solana-contract-artifacts-${{ hashFiles('**/Cargo.lock') }}
- name: build & save image
if: steps.cache-image.outputs.cache-hit != 'true'
shell: bash
run: |
cd chainlink-ccip/chains/solana/contracts
docker buildx build . -t ccip-solana:build --build-arg ANCHOR_CLI=${{ env.ANCHOR_VERSION }}
docker save -o docker-build.tar ccip-solana
- name: build & save contract compilation artifacts
if: steps.cache-target.outputs.cache-hit != 'true'
shell: bash
run: |
cd chainlink-ccip/chains/solana
docker run -v "$(pwd)/contracts":/solana/contracts ccip-solana:build bash -c "\
set -eoux pipefail &&\
RUSTUP_HOME=\"/root/.rustup\" &&\
FORCE_COLOR=1 &&\
cd /solana/contracts &&\
anchor build &&\
chmod -R 755 ./target"
- name: move built contracts to test folder
shell: bash
run: |
# copy the built contracts so they can be used in the chainlink tests
mkdir -p /home/runner/work/chainlink/chainlink/deployment/ccip/changeset/internal/solana_contracts
cp chainlink-ccip/chains/solana/contracts/target/deploy/*.so /home/runner/work/chainlink/chainlink/deployment/ccip/changeset/internal/solana_contracts
# save the revision of the built chainlink-ccip solana contracts
echo ${{ env.CHAINLINK_CCIP_COMMIT_SHORT }} > /home/runner/work/chainlink/chainlink/deployment/ccip/changeset/internal/solana_contracts/.solana_contracts_rev
9 changes: 9 additions & 0 deletions .github/workflows/ci-core-partial.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ jobs:
- name: Setup Solana
uses: ./.github/actions/setup-solana

- name: Build Solana artifacts
uses: ./.github/actions/setup-solana/build-contracts

- name: Setup wasmd
uses: ./.github/actions/setup-wasmd

Expand Down Expand Up @@ -210,6 +213,9 @@ jobs:
- name: Setup Solana
uses: ./.github/actions/setup-solana

- name: Build Solana artifacts
uses: ./.github/actions/setup-solana/build-contracts

- name: Setup wasmd
uses: ./.github/actions/setup-wasmd

Expand Down Expand Up @@ -256,6 +262,9 @@ jobs:
- name: Setup Solana
uses: ./.github/actions/setup-solana

- name: Build Solana artifacts
uses: ./.github/actions/setup-solana/build-contracts

- name: Setup wasmd
uses: ./.github/actions/setup-wasmd

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ jobs:
if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }}
uses: ./.github/actions/setup-solana

- name: Build Solana artifacts
if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }}
uses: ./.github/actions/setup-solana/build-contracts

- name: Setup wasmd
if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }}
uses: ./.github/actions/setup-wasmd
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/flakeguard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ jobs:
restore-build-cache-only: "true"
- name: Setup Solana
uses: ./.github/actions/setup-solana
- name: Build Solana artifacts
uses: ./.github/actions/setup-solana/build-contracts
- name: Setup wasmd
uses: ./.github/actions/setup-wasmd
- name: Setup Postgres
Expand Down
Loading

0 comments on commit 7791a28

Please sign in to comment.