diff --git a/.github/workflows/downstream-project-anchor.yml b/.github/workflows/downstream-project-anchor.yml index 33ecc632f0b7d5..92ebee20aa217f 100644 --- a/.github/workflows/downstream-project-anchor.yml +++ b/.github/workflows/downstream-project-anchor.yml @@ -41,7 +41,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - version: ["v0.29.0", "v0.30.0"] + version: ["master"] steps: - uses: actions/checkout@v4 diff --git a/Cargo.toml b/Cargo.toml index 9852e973507b70..b5e5aca8fb5cc4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -159,6 +159,15 @@ homepage = "https://anza.xyz/" license = "Apache-2.0" edition = "2021" +[workspace.lints.rust.unexpected_cfgs] +level = "warn" +check-cfg = [ + 'cfg(target_os, values("solana"))', + 'cfg(feature, values("frozen-abi", "no-entrypoint"))', + 'cfg(RUSTC_WITH_SPECIALIZATION)', + 'cfg(RUSTC_WITHOUT_SPECIALIZATION)', +] + [workspace.dependencies] Inflector = "0.11.4" agave-transaction-view = { path = "transaction-view", version = "=2.1.0" } diff --git a/account-decoder/Cargo.toml b/account-decoder/Cargo.toml index 7aee8478b4f126..71674b67ddd23b 100644 --- a/account-decoder/Cargo.toml +++ b/account-decoder/Cargo.toml @@ -34,3 +34,6 @@ spl-pod = { workspace = true } [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/accounts-db/Cargo.toml b/accounts-db/Cargo.toml index 8a6d7e4d32160a..2eb876219da96a 100644 --- a/accounts-db/Cargo.toml +++ b/accounts-db/Cargo.toml @@ -111,3 +111,6 @@ harness = false [[bench]] name = "bench_lock_accounts" harness = false + +[lints] +workspace = true diff --git a/bloom/Cargo.toml b/bloom/Cargo.toml index 5234fb506d90aa..4c9d88893fbacf 100644 --- a/bloom/Cargo.toml +++ b/bloom/Cargo.toml @@ -41,3 +41,6 @@ frozen-abi = [ "dep:solana-frozen-abi-macro", "solana-sdk/frozen-abi", ] + +[lints] +workspace = true diff --git a/builtins-default-costs/Cargo.toml b/builtins-default-costs/Cargo.toml index ddc5f06a6d68ee..f2173aabed588f 100644 --- a/builtins-default-costs/Cargo.toml +++ b/builtins-default-costs/Cargo.toml @@ -44,3 +44,6 @@ frozen-abi = [ "dep:solana-frozen-abi", "solana-vote-program/frozen-abi", ] + +[lints] +workspace = true diff --git a/ci/docker/Dockerfile b/ci/docker/Dockerfile index fa801cf124314f..622b017146f817 100644 --- a/ci/docker/Dockerfile +++ b/ci/docker/Dockerfile @@ -70,11 +70,11 @@ RUN \ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh -s -- --no-modify-path --profile minimal --default-toolchain $RUST_VERSION -y && \ rustup component add rustfmt && \ rustup component add clippy && \ - rustup component add llvm-tools-preview && \ rustup install $RUST_NIGHTLY_VERSION && \ rustup component add clippy --toolchain=$RUST_NIGHTLY_VERSION && \ rustup component add rustfmt --toolchain=$RUST_NIGHTLY_VERSION && \ rustup component add miri --toolchain=$RUST_NIGHTLY_VERSION && \ + rustup component add llvm-tools-preview --toolchain=$RUST_NIGHTLY_VERSION && \ rustup target add wasm32-unknown-unknown && \ cargo install cargo-audit && \ cargo install cargo-hack && \ diff --git a/ci/rust-version.sh b/ci/rust-version.sh index c902153c4fdb4f..c55d5ba4462998 100644 --- a/ci/rust-version.sh +++ b/ci/rust-version.sh @@ -29,7 +29,7 @@ fi if [[ -n $RUST_NIGHTLY_VERSION ]]; then nightly_version="$RUST_NIGHTLY_VERSION" else - nightly_version=2024-05-02 + nightly_version=2024-08-08 fi diff --git a/compute-budget/Cargo.toml b/compute-budget/Cargo.toml index 55229cf808b4f0..bbcaa27b8d57d5 100644 --- a/compute-budget/Cargo.toml +++ b/compute-budget/Cargo.toml @@ -22,3 +22,6 @@ frozen-abi = [ "dep:solana-frozen-abi", "solana-sdk/frozen-abi", ] + +[lints] +workspace = true diff --git a/core/Cargo.toml b/core/Cargo.toml index 8d96a2a1b0d1b8..cf17e92b11f7d8 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -152,3 +152,6 @@ name = "sigverify_stage" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/cost-model/Cargo.toml b/cost-model/Cargo.toml index c33ba7a5415963..9739aef0496937 100644 --- a/cost-model/Cargo.toml +++ b/cost-model/Cargo.toml @@ -53,3 +53,6 @@ frozen-abi = [ [[bench]] name = "cost_tracker" + +[lints] +workspace = true diff --git a/curves/bn254/Cargo.toml b/curves/bn254/Cargo.toml index 7182ff53f95b45..c2cc0fe86764d6 100644 --- a/curves/bn254/Cargo.toml +++ b/curves/bn254/Cargo.toml @@ -25,3 +25,6 @@ array-bytes = { workspace = true } serde = { workspace = true } serde_derive = { workspace = true } serde_json = { workspace = true } + +[lints] +workspace = true diff --git a/curves/curve25519/Cargo.toml b/curves/curve25519/Cargo.toml index ce77b5ddca04db..6d8991623ee0bd 100644 --- a/curves/curve25519/Cargo.toml +++ b/curves/curve25519/Cargo.toml @@ -19,3 +19,6 @@ solana-program = { workspace = true } [target.'cfg(not(target_os = "solana"))'.dependencies] curve25519-dalek = { workspace = true, features = ["serde"] } + +[lints] +workspace = true diff --git a/curves/secp256k1-recover/Cargo.toml b/curves/secp256k1-recover/Cargo.toml index 90208106bb5475..6f983ef6d713c4 100644 --- a/curves/secp256k1-recover/Cargo.toml +++ b/curves/secp256k1-recover/Cargo.toml @@ -37,3 +37,6 @@ frozen-abi = ["dep:rustc_version", "dep:solana-frozen-abi", "dep:solana-frozen-a [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/define-syscall/Cargo.toml b/define-syscall/Cargo.toml index af8ef66d74450e..7f93af8817f3ff 100644 --- a/define-syscall/Cargo.toml +++ b/define-syscall/Cargo.toml @@ -11,3 +11,8 @@ edition = { workspace = true } [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = [ + 'cfg(target_feature, values("static-syscalls"))', +] } diff --git a/frozen-abi/Cargo.toml b/frozen-abi/Cargo.toml index 5c71ec5c2b4596..096662d05956f9 100644 --- a/frozen-abi/Cargo.toml +++ b/frozen-abi/Cargo.toml @@ -36,3 +36,6 @@ rustc_version = { workspace = true } default = ["frozen-abi"] # no reason to deactivate this. It's needed because the build.rs is reused elsewhere frozen-abi = [] + +[lints] +workspace = true diff --git a/frozen-abi/macro/Cargo.toml b/frozen-abi/macro/Cargo.toml index fe3c79d4404cbe..f5cb98c1287e45 100644 --- a/frozen-abi/macro/Cargo.toml +++ b/frozen-abi/macro/Cargo.toml @@ -24,3 +24,6 @@ rustc_version = { workspace = true } default = ["frozen-abi"] # no reason to deactivate this. It's needed because the build.rs is reused elsewhere frozen-abi = [] + +[lints] +workspace = true diff --git a/gossip/Cargo.toml b/gossip/Cargo.toml index 96f54442e7c98d..db46eb8ea1c974 100644 --- a/gossip/Cargo.toml +++ b/gossip/Cargo.toml @@ -94,3 +94,6 @@ path = "src/main.rs" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/ledger/Cargo.toml b/ledger/Cargo.toml index c21f8028bdf95e..255efa9c8358dd 100644 --- a/ledger/Cargo.toml +++ b/ledger/Cargo.toml @@ -112,3 +112,6 @@ name = "blockstore" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/metrics/src/counter.rs b/metrics/src/counter.rs index da7d8f9b1d96b1..0431a3538a108b 100644 --- a/metrics/src/counter.rs +++ b/metrics/src/counter.rs @@ -58,7 +58,10 @@ macro_rules! create_counter { #[macro_export] macro_rules! inc_counter { ($name:expr, $level:expr, $count:expr) => { - unsafe { $name.inc($level, $count) }; + #[allow(clippy::macro_metavars_in_unsafe)] + unsafe { + $name.inc($level, $count) + }; }; } diff --git a/perf/Cargo.toml b/perf/Cargo.toml index 4cf6e49d2f4f72..0e90fd7ccf231a 100644 --- a/perf/Cargo.toml +++ b/perf/Cargo.toml @@ -64,3 +64,12 @@ name = "discard" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints.rust.unexpected_cfgs] +level = "warn" +check-cfg = [ + 'cfg(build_target_feature_avx)', + 'cfg(build_target_feature_avx2)', + 'cfg(RUSTC_WITH_SPECIALIZATION)', + 'cfg(RUSTC_WITHOUT_SPECIALIZATION)', +] diff --git a/poseidon/Cargo.toml b/poseidon/Cargo.toml index 09f40b2ac65ecb..021bf76716d03a 100644 --- a/poseidon/Cargo.toml +++ b/poseidon/Cargo.toml @@ -21,3 +21,6 @@ light-poseidon = { workspace = true } [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/program-runtime/Cargo.toml b/program-runtime/Cargo.toml index 1b6b914835c07f..413f7b7665ba42 100644 --- a/program-runtime/Cargo.toml +++ b/program-runtime/Cargo.toml @@ -59,3 +59,6 @@ frozen-abi = [ "solana-sdk/frozen-abi", ] shuttle-test = ["solana-type-overrides/shuttle-test", "solana_rbpf/shuttle-test"] + +[lints] +workspace = true diff --git a/programs/address-lookup-table/Cargo.toml b/programs/address-lookup-table/Cargo.toml index 1c61a6bdf466d2..3ff68a686a7521 100644 --- a/programs/address-lookup-table/Cargo.toml +++ b/programs/address-lookup-table/Cargo.toml @@ -32,3 +32,6 @@ name = "solana_address_lookup_table_program" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/programs/sbf/Cargo.toml b/programs/sbf/Cargo.toml index 15d1775ab6559b..186d27954b238f 100644 --- a/programs/sbf/Cargo.toml +++ b/programs/sbf/Cargo.toml @@ -7,6 +7,10 @@ homepage = "https://anza.xyz" license = "Apache-2.0" edition = "2021" +[workspace.lints.rust.unexpected_cfgs] +level = "warn" +check-cfg = ['cfg(target_os, values("solana"))'] + [workspace.dependencies] array-bytes = "=1.4.1" bincode = { version = "1.1.4", default-features = false } diff --git a/programs/sbf/rust/custom_heap/Cargo.toml b/programs/sbf/rust/custom_heap/Cargo.toml index d4daadfd4ab423..3386d32547b31f 100644 --- a/programs/sbf/rust/custom_heap/Cargo.toml +++ b/programs/sbf/rust/custom_heap/Cargo.toml @@ -17,3 +17,6 @@ custom-heap = [] [lib] crate-type = ["cdylib"] + +[lints] +workspace = true diff --git a/programs/sbf/rust/deprecated_loader/Cargo.toml b/programs/sbf/rust/deprecated_loader/Cargo.toml index dce97434a03c4b..8a139ba3912199 100644 --- a/programs/sbf/rust/deprecated_loader/Cargo.toml +++ b/programs/sbf/rust/deprecated_loader/Cargo.toml @@ -13,3 +13,6 @@ solana-program = { workspace = true } [lib] crate-type = ["cdylib"] + +[lints] +workspace = true diff --git a/programs/sbf/rust/membuiltins/Cargo.toml b/programs/sbf/rust/membuiltins/Cargo.toml index a2ae21f4c9c37d..405feffd4effb9 100644 --- a/programs/sbf/rust/membuiltins/Cargo.toml +++ b/programs/sbf/rust/membuiltins/Cargo.toml @@ -14,3 +14,6 @@ solana-sbf-rust-mem-dep = { workspace = true } [lib] crate-type = ["cdylib"] + +[lints] +workspace = true diff --git a/programs/sbf/rust/panic/Cargo.toml b/programs/sbf/rust/panic/Cargo.toml index 706bab0c664107..46f99056ac901e 100644 --- a/programs/sbf/rust/panic/Cargo.toml +++ b/programs/sbf/rust/panic/Cargo.toml @@ -17,3 +17,6 @@ custom-panic = [] [lib] crate-type = ["cdylib"] + +[lints] +workspace = true diff --git a/programs/sbf/rust/ro_modify/Cargo.toml b/programs/sbf/rust/ro_modify/Cargo.toml index d71ae82da01b4f..566734108df255 100644 --- a/programs/sbf/rust/ro_modify/Cargo.toml +++ b/programs/sbf/rust/ro_modify/Cargo.toml @@ -13,3 +13,6 @@ solana-program = { workspace = true } [lib] crate-type = ["cdylib"] + +[lints] +workspace = true diff --git a/programs/sbf/rust/sanity/Cargo.toml b/programs/sbf/rust/sanity/Cargo.toml index f01dd7501e6906..d5c47f9deb46b2 100644 --- a/programs/sbf/rust/sanity/Cargo.toml +++ b/programs/sbf/rust/sanity/Cargo.toml @@ -13,3 +13,6 @@ solana-program = { workspace = true } [lib] crate-type = ["cdylib"] + +[lints] +workspace = true diff --git a/programs/stake/Cargo.toml b/programs/stake/Cargo.toml index e14fc532d34bca..16f1e746698e71 100644 --- a/programs/stake/Cargo.toml +++ b/programs/stake/Cargo.toml @@ -35,3 +35,6 @@ name = "solana_stake_program" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/programs/vote/Cargo.toml b/programs/vote/Cargo.toml index 58a21e6fd8443f..2a8462cd178ecf 100644 --- a/programs/vote/Cargo.toml +++ b/programs/vote/Cargo.toml @@ -48,3 +48,6 @@ frozen-abi = [ "solana-program-runtime/frozen-abi", "solana-sdk/frozen-abi", ] + +[lints] +workspace = true diff --git a/runtime-transaction/Cargo.toml b/runtime-transaction/Cargo.toml index 2965564e63d3dc..e9e55116859dc3 100644 --- a/runtime-transaction/Cargo.toml +++ b/runtime-transaction/Cargo.toml @@ -35,3 +35,6 @@ rustc_version = { workspace = true, optional = true } [[bench]] name = "process_compute_budget_instructions" harness = false + +[lints] +workspace = true diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index b5df2c8bcded91..2295f01433d4d8 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -132,3 +132,6 @@ frozen-abi = [ [[bench]] name = "prioritization_fee_cache" + +[lints] +workspace = true diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 51985806fcac46..a56a283d2abc1b 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.78.0" +channel = "1.80.1" diff --git a/scripts/coverage.sh b/scripts/coverage.sh index 9fc43be5eba03b..6a144316ba50c1 100755 --- a/scripts/coverage.sh +++ b/scripts/coverage.sh @@ -28,6 +28,14 @@ fi # shellcheck source=ci/rust-version.sh source "$here/../ci/rust-version.sh" nightly +# Check llvm path +llvm_profdata="$(find "$(rustc +"$rust_nightly" --print sysroot)" -name llvm-profdata)" +if [ -z "$llvm_profdata" ]; then + echo "Error: couldn't find llvm-profdata. Try installing the llvm-tools component with \`rustup component add llvm-tools-preview --toolchain=$rust_nightly\`" + exit 1 +fi +llvm_path="$(dirname "$llvm_profdata")" + # get commit hash. it will be used to name output folder if [ -z "$COMMIT_HASH" ]; then COMMIT_HASH=$(git rev-parse --short=9 HEAD) @@ -66,6 +74,7 @@ grcov_common_args=( --source-dir "$here/.." --binary-path "$here/../target/cov/debug" --llvm + --llvm-path "$llvm_path" --ignore \*.cargo\* --ignore \*build.rs --ignore bench-tps\* diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index d19d16a5a3fc71..faf38677af31c8 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -119,3 +119,6 @@ targets = ["x86_64-unknown-linux-gnu"] [lib] crate-type = ["cdylib", "rlib"] + +[lints] +workspace = true diff --git a/sdk/msg/Cargo.toml b/sdk/msg/Cargo.toml index afa4a94d07c790..1c6addc97e1dda 100644 --- a/sdk/msg/Cargo.toml +++ b/sdk/msg/Cargo.toml @@ -14,3 +14,6 @@ solana-define-syscall = { workspace = true } [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/sdk/program-memory/Cargo.toml b/sdk/program-memory/Cargo.toml index f47f6adfd792ab..27d848f59a8275 100644 --- a/sdk/program-memory/Cargo.toml +++ b/sdk/program-memory/Cargo.toml @@ -17,3 +17,6 @@ targets = ["x86_64-unknown-linux-gnu"] [target.'cfg(target_os = "solana")'.dependencies] solana-define-syscall = { workspace = true } + +[lints] +workspace = true diff --git a/sdk/program/Cargo.toml b/sdk/program/Cargo.toml index cc220b1711db65..7b96ccf7d1f0e1 100644 --- a/sdk/program/Cargo.toml +++ b/sdk/program/Cargo.toml @@ -104,3 +104,6 @@ frozen-abi = [ "dep:solana-frozen-abi-macro", "solana-short-vec/frozen-abi", ] + +[lints] +workspace = true diff --git a/short-vec/Cargo.toml b/short-vec/Cargo.toml index 2b0c7baf5f12ce..2ab13eaad53a34 100644 --- a/short-vec/Cargo.toml +++ b/short-vec/Cargo.toml @@ -27,3 +27,6 @@ frozen-abi = ["dep:rustc_version", "dep:solana-frozen-abi", "dep:solana-frozen-a [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/svm/Cargo.toml b/svm/Cargo.toml index e387a21eeedf6c..603f0c8ae8a1d5 100644 --- a/svm/Cargo.toml +++ b/svm/Cargo.toml @@ -76,3 +76,6 @@ shuttle-test = [ "solana-bpf-loader-program/shuttle-test", "solana-loader-v4-program/shuttle-test", ] + +[lints] +workspace = true diff --git a/version/Cargo.toml b/version/Cargo.toml index 7c8ae8f6820155..81f37b111b300a 100644 --- a/version/Cargo.toml +++ b/version/Cargo.toml @@ -36,3 +36,6 @@ targets = ["x86_64-unknown-linux-gnu"] [build-dependencies] rustc_version = { workspace = true, optional = true } + +[lints] +workspace = true diff --git a/vote/Cargo.toml b/vote/Cargo.toml index 89c4808ede0ed7..2eb821eac407a4 100644 --- a/vote/Cargo.toml +++ b/vote/Cargo.toml @@ -41,3 +41,6 @@ frozen-abi = [ "dep:solana-frozen-abi-macro", "solana-sdk/frozen-abi", ] + +[lints] +workspace = true diff --git a/zk-sdk/Cargo.toml b/zk-sdk/Cargo.toml index a57b994e017d2f..236c7a5e06dbf3 100644 --- a/zk-sdk/Cargo.toml +++ b/zk-sdk/Cargo.toml @@ -39,3 +39,6 @@ zeroize = { workspace = true, features = ["zeroize_derive"] } [lib] crate-type = ["cdylib", "rlib"] + +[lints] +workspace = true diff --git a/zk-token-sdk/Cargo.toml b/zk-token-sdk/Cargo.toml index d466d2ba0af22d..cc4f785550a73b 100644 --- a/zk-token-sdk/Cargo.toml +++ b/zk-token-sdk/Cargo.toml @@ -41,3 +41,6 @@ zeroize = { workspace = true, features = ["zeroize_derive"] } [lib] crate-type = ["cdylib", "rlib"] + +[lints] +workspace = true