diff --git a/ci/test-stable.sh b/ci/test-stable.sh index 52c2937c50..0e724f41c9 100755 --- a/ci/test-stable.sh +++ b/ci/test-stable.sh @@ -58,6 +58,20 @@ test-stable-sbf) # SBF solana-sdk legacy compile test "$cargo_build_sbf" --manifest-path sdk/Cargo.toml + # Ensure the minimum supported "rust-version" matches platform tools to fail + # quickly if users try to build with an older platform tools install + cargo_toml=sdk/program/Cargo.toml + source "scripts/read-cargo-variable.sh" + crate_rust_version=$(readCargoVariable rust-version $cargo_toml) + platform_tools_rust_version=$("$cargo_build_sbf" --version | grep rustc) + platform_tools_rust_version=$(echo "$platform_tools_rust_version" | cut -d\ -f2) # Remove "rustc " prefix from a string like "rustc 1.68.0-dev" + platform_tools_rust_version=$(echo "$platform_tools_rust_version" | cut -d- -f1) # Remove "-dev" suffix from a string like "1.68.0-dev" + + if [[ $crate_rust_version != "$platform_tools_rust_version" ]]; then + echo "Error: Update 'rust-version' field in '$cargo_toml' from $crate_rust_version to $platform_tools_rust_version" + exit 1 + fi + # SBF C program system tests _ make -C programs/sbf/c tests if need_to_upload_test_result; then diff --git a/sdk/program/Cargo.toml b/sdk/program/Cargo.toml index 10c1be407f..b8fa3dd5e1 100644 --- a/sdk/program/Cargo.toml +++ b/sdk/program/Cargo.toml @@ -9,6 +9,7 @@ repository = { workspace = true } homepage = { workspace = true } license = { workspace = true } edition = { workspace = true } +rust-version = "1.68.0" # solana platform-tools rust version [dependencies] bincode = { workspace = true }