From f78571be9445df5d990680d552e002c01ec15ddd Mon Sep 17 00:00:00 2001 From: Jon C Date: Wed, 27 Nov 2024 11:54:48 +0100 Subject: [PATCH] CI: Fix downstream anchor projects (#3805) #### Problem The downstream anchor jobs were disabled because of breaking changes between the monorepo and SPL. #### Summary of changes Now that the v2.1 crates are released, and SPL is using them, re-enable the job! The biggest change is the crate patching, which will hopefully be easier to maintain with this change. The patching functions were essentially copied to mirror the patching scripts in SPL. --- .../workflows/downstream-project-anchor.yml | 2 +- scripts/build-downstream-anchor-projects.sh | 1 - scripts/patch-crates.sh | 292 ++++++++++++++++-- 3 files changed, 263 insertions(+), 32 deletions(-) diff --git a/.github/workflows/downstream-project-anchor.yml b/.github/workflows/downstream-project-anchor.yml index 9e6b1591b6c23e..da5e3e160052db 100644 --- a/.github/workflows/downstream-project-anchor.yml +++ b/.github/workflows/downstream-project-anchor.yml @@ -38,11 +38,11 @@ env: jobs: test: + if: github.repository == 'anza-xyz/agave' runs-on: ubuntu-latest strategy: matrix: version: ["master"] - if: false # Re-enable once new major versions for spl-token-2022 and spl-pod are out steps: - uses: actions/checkout@v4 diff --git a/scripts/build-downstream-anchor-projects.sh b/scripts/build-downstream-anchor-projects.sh index fe2f5e813ee613..e282a446c7c79a 100755 --- a/scripts/build-downstream-anchor-projects.sh +++ b/scripts/build-downstream-anchor-projects.sh @@ -69,7 +69,6 @@ anchor() { patch_crates_io_solana Cargo.toml "$solana_dir" patch_spl_crates . Cargo.toml "$spl_dir" - sed -i '/\[patch.crates-io\]/a curve25519-dalek = { git = "https://github.com/anza-xyz/curve25519-dalek.git", rev = "b500cdc2a920cd5bff9e2dd974d7b97349d61464" }' ./Cargo.toml $cargo test # serum_dex and mpl-token-metadata are using caret versions of solana and SPL dependencies # rather pull and patch those as well, ignore for now diff --git a/scripts/patch-crates.sh b/scripts/patch-crates.sh index 771dcddbd02fa4..45a2d67caf7f9b 100644 --- a/scripts/patch-crates.sh +++ b/scripts/patch-crates.sh @@ -6,24 +6,128 @@ update_solana_dependencies() { declare tomls=() while IFS='' read -r line; do tomls+=("$line"); done < <(find "$project_root" -name Cargo.toml) - sed -i -e "s#\(solana-program = \"\)[^\"]*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? - sed -i -e "s#\(solana-program = { version = \"\)[^\"]*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? - sed -i -e "s#\(solana-program-test = \"\)[^\"]*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? - sed -i -e "s#\(solana-program-test = { version = \"\)[^\"]*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? - sed -i -e "s#\(solana-sdk = \"\).*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? - sed -i -e "s#\(solana-sdk = { version = \"\)[^\"]*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? - sed -i -e "s#\(solana-client = \"\)[^\"]*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? - sed -i -e "s#\(solana-client = { version = \"\)[^\"]*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? - sed -i -e "s#\(solana-cli-config = \"\)[^\"]*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? - sed -i -e "s#\(solana-cli-config = { version = \"\)[^\"]*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? - sed -i -e "s#\(solana-clap-utils = \"\)[^\"]*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? - sed -i -e "s#\(solana-clap-utils = { version = \"\)[^\"]*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? - sed -i -e "s#\(solana-account-decoder = \"\)[^\"]*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? - sed -i -e "s#\(solana-account-decoder = { version = \"\)[^\"]*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? - sed -i -e "s#\(solana-faucet = \"\)[^\"]*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? - sed -i -e "s#\(solana-faucet = { version = \"\)[^\"]*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? - sed -i -e "s#\(solana-zk-token-sdk = \"\)[^\"]*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? - sed -i -e "s#\(solana-zk-token-sdk = { version = \"\)[^\"]*\(\"\)#\1=$solana_ver\2#g" "${tomls[@]}" || return $? + crates=( + solana-account-decoder + solana-account-decoder-client-types + solana-banks-client + solana-banks-interface + solana-banks-server + solana-bloom + solana-bucket-map + solana-builtins-default-costs + solana-clap-utils + solana-clap-v3-utils + solana-cli-config + solana-cli-output + solana-client + solana-compute-budget + solana-connection-cache + solana-core + solana-entry + solana-faucet + solana-fee + solana-frozen-abi + solana-frozen-abi-macro + agave-geyser-plugin-interface + solana-geyser-plugin-manager + solana-gossip + solana-lattice-hash + solana-ledger + solana-log-collector + solana-logger + solana-measure + solana-merkle-tree + solana-metrics + solana-net-utils + solana-perf + solana-poh + solana-program-runtime + solana-program-test + solana-address-lookup-table-program + solana-bpf-loader-program + solana-compute-budget-program + solana-config-program + solana-stake-program + solana-system-program + solana-vote-program + solana-zk-elgamal-proof-program + solana-zk-token-proof-program + solana-pubsub-client + solana-quic-client + solana-rayon-threadlimit + solana-remote-wallet + solana-rpc + solana-rpc-client + solana-rpc-client-api + solana-rpc-client-nonce-utils + solana-runtime + solana-runtime-transaction + solana-sdk + solana-sdk-macro + solana-program + solana-send-transaction-service + solana-storage-bigtable + solana-storage-proto + solana-streamer + solana-svm-rent-collector + solana-svm-transaction + solana-test-validator + solana-thin-client + solana-tpu-client + solana-transaction-status + solana-transaction-status-client-types + solana-udp-client + solana-version + solana-zk-token-sdk + solana-zk-sdk + solana-bn254 + solana-curve25519 + solana-secp256k1-recover + solana-account + solana-account-info + solana-atomic-u64 + solana-bincode + solana-borsh + solana-clock + solana-cpi + solana-decode-error + solana-define-syscall + solana-derivation-path + solana-epoch-schedule + solana-feature-set + solana-fee-calculator + solana-hash + solana-inflation + solana-instruction + solana-last-restart-slot + solana-msg + solana-native-token + solana-packet + solana-precompile-error + solana-program-entrypoint + solana-program-error + solana-program-memory + solana-program-option + solana-program-pack + solana-pubkey + solana-rent + solana-sanitize + solana-serde-varint + solana-serialize-utils + solana-sha256-hasher + solana-short-vec + solana-signature + solana-slot-hashes + solana-stable-layout + solana-timings + solana-transaction-error + ) + + set -x + for crate in "${crates[@]}"; do + sed -E -i'' -e "s:(${crate} = \")([=<>]*)[0-9.]+([^\"]*)\".*:\1\2${solana_ver}\3\":" "${tomls[@]}" + sed -E -i'' -e "s:(${crate} = \{ version = \")([=<>]*)[0-9.]+([^\"]*)(\".*):\1\2${solana_ver}\3\4:" "${tomls[@]}" + done } patch_crates_io_solana() { @@ -32,21 +136,149 @@ patch_crates_io_solana() { cat >> "$Cargo_toml" <> "$Cargo_toml" <> "$Cargo_toml" + fi + cat >> "$Cargo_toml" <