diff --git a/.github/actions/rust/action.yaml b/.github/actions/rust/action.yaml index a6aa86446e0..a0d445e69ac 100644 --- a/.github/actions/rust/action.yaml +++ b/.github/actions/rust/action.yaml @@ -4,8 +4,8 @@ description: "Install dependencies" inputs: toolchain: description: Rust toolchain to use, stable / nightly / beta, or exact version - # The same as in /README.md - default: "stable" + # Update using scripts/update-rust-toolchain.sh + default: "1.76" target: description: Target Rust platform required: false @@ -17,7 +17,6 @@ inputs: description: Enable Rust cache required: false default: "true" - runs: using: composite steps: @@ -28,7 +27,6 @@ runs: toolchain: ${{ inputs.toolchain }} target: ${{ inputs.target }} components: ${{ inputs.components }} - - name: Get protoc arch shell: bash id: protoc_arch @@ -47,7 +45,6 @@ runs: exit 1 ;; esac - # TODO: Move to AMI and build every day - name: Install protoc id: deps-protoc @@ -58,18 +55,15 @@ runs: unzip /tmp/protoc.zip -d ${HOME}/.local echo "PROTOC=${HOME}/.local/bin/protoc" >> $GITHUB_ENV export PATH="${PATH}:${HOME}/.local/bin" - - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 with: version: "v0.7.1" # Must be the same as in Dockerfile if: inputs.cache == 'true' - - name: Hash ref_name id: hashed-ref-name shell: bash run: echo "key=$(echo '${{ github.ref_name }}' | sha256sum | cut -d ' ' -f1)" >> $GITHUB_OUTPUT - - name: Cache cargo registry (S3 bucket cache) uses: strophy/actions-cache@opendal-update if: inputs.cache == 'true' @@ -84,7 +78,6 @@ runs: restore-keys: | ${{ runner.os }}/cargo/registry/${{ hashFiles('**/Cargo.lock') }} ${{ runner.os }}/cargo/registry/ - # TODO: Move to AMI and build every day - name: Install clang id: deps-clang diff --git a/Dockerfile b/Dockerfile index c71825b40f9..c589ea9b74e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,7 +32,8 @@ ARG ALPINE_VERSION=3.18 ARG PROTOC_VERSION=25.2 ARG RUSTC_WRAPPER - +# Update using scripts/update-rust-toolchain.sh +ARG RUST_VERSION=1.76 # # DEPS: INSTALL AND CACHE DEPENDENCIES # @@ -67,13 +68,13 @@ RUN npm config set --global audit false # Install latest Rust toolbox ARG TARGETARCH - +ARG RUST_VERSION # TODO: It doesn't sharing PATH between stages, so we need "source $HOME/.cargo/env" everywhere RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ --profile minimal \ -y \ # Rust version the same as in /README.md - --default-toolchain stable \ + --default-toolchain ${RUST_VERSION} \ --target wasm32-unknown-unknown # Install protoc - protobuf compiler diff --git a/README.md b/README.md index c01ce4f23c9..0be0896d813 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ this repository may be used on the following networks: - Install prerequisites: - [node.js](https://nodejs.org/) v20 - [docker](https://docs.docker.com/get-docker/) v20.10+ - - [rust](https://www.rust-lang.org/tools/install) v1.73+, with wasm32 target (`rustup target add wasm32-unknown-unknown`) + - [rust](https://www.rust-lang.org/tools/install) v1.76+, with wasm32 target (`rustup target add wasm32-unknown-unknown`) - [protoc - protobuf compiler](https://github.com/protocolbuffers/protobuf/releases) v25.2+ - if needed, set PROTOC environment variable to location of `protoc` binary - [wasm-bingen toolchain](https://rustwasm.github.io/wasm-bindgen/): @@ -66,7 +66,8 @@ this repository may be used on the following networks: - `cargo install wasm-bindgen-cli@0.2.85` - *double-check that wasm-bindgen-cli version above matches wasm-bindgen version in Cargo.lock file* - *Depending on system, additional packages may need to be installed as a prerequisite for wasm-bindgen-cli. If anything is missing, installation will error and prompt what packages are missing (i.e. clang, llvm, libssl-dev)* - - essential build tools - example for Debian/Ubuntu: `apt install -y build-essential libssl-dev pkg-config clang` + +- essential build tools - example for Debian/Ubuntu: `apt install -y build-essential libssl-dev pkg-config clang` - Run `corepack enable` to enable [corepack](https://nodejs.org/dist/latest/docs/api/corepack.html) and install yarn - Run `yarn setup` to install dependencies and configure and build all packages - Run `yarn start` to start the local dev environment built from the sources diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index 9bcc325f72a..64410eb5213 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -10,7 +10,8 @@ authors = [ "Ivan Shumkov ", ] edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" license = "MIT" [features] diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index 2403a1eb230..eff0692adce 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -3,7 +3,8 @@ name = "dashpay-contract" description = "DashPay data contract schema and tools" version = "1.0.0-dev.4" edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" license = "MIT" [dependencies] diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index eece64000c7..b5c7d3a95f7 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -3,7 +3,8 @@ name = "data-contracts" description = "Dash Platform system data contracts" version = "1.0.0-dev.4" edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" license = "MIT" [dependencies] diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index 2c961e05c27..a9ed8ba9ffb 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -3,7 +3,8 @@ name = "dpns-contract" description = "DPNS data contract schema and tools" version = "1.0.0-dev.4" edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" license = "MIT" [dependencies] diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index e4f30d4225f..a9e0bcbcf85 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -3,7 +3,8 @@ name = "feature-flags-contract" description = "Feature flags data contract schema and tools" version = "1.0.0-dev.4" edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" license = "MIT" [dependencies] diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index 35dbf45f574..b0643614858 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -3,7 +3,8 @@ name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" version = "1.0.0-dev.4" edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" license = "MIT" [dependencies] diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index eaeb74d573a..85c9b93764f 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -2,6 +2,8 @@ name = "rs-dapi-client" version = "1.0.0-dev.4" edition = "2021" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" [features] default = ["mocks", "offline-testing"] diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index f6f00d3ed98..dc8639860bb 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -4,6 +4,8 @@ name = "dapi-grpc-macros" version = "1.0.0-dev.4" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" [lib] proc-macro = true diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index 30a2f2920d7..77a72cc0c7a 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -2,7 +2,8 @@ name = "dpp" version = "1.0.0-dev.4" edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" authors = [ "Anton Suprunchuk ", "Samuel Westrich ", diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index 90372484ad8..96cf36154d2 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -9,7 +9,8 @@ authors = [ "Igor Markin ", ] edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index 264c3fab227..6f7b80dac2b 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -2,7 +2,8 @@ name = "drive-proof-verifier" version = "1.0.0-dev.4" edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" crate-type = ["cdylib"] diff --git a/packages/rs-drive-verify-c-binding/Cargo.toml b/packages/rs-drive-verify-c-binding/Cargo.toml index 0d4d7371242..fa2125c745a 100644 --- a/packages/rs-drive-verify-c-binding/Cargo.toml +++ b/packages/rs-drive-verify-c-binding/Cargo.toml @@ -2,7 +2,8 @@ name = "rs-drive-verify-c-binding" version = "0.25.16-rc.3" edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index 037eed04ce7..8dbe79050c5 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -9,7 +9,8 @@ authors = [ "Wisdom Ogwu "] description = "Bincode serialization and deserialization derivations" version = "1.0.0-dev.4" edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" license = "MIT" private = true diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index 84b789941ad..e106ef4845c 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -4,7 +4,8 @@ authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" version = "1.0.0-dev.4" edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" license = "MIT" private = true diff --git a/packages/rs-platform-value-convertible/Cargo.toml b/packages/rs-platform-value-convertible/Cargo.toml index bb21c688740..61018d05991 100644 --- a/packages/rs-platform-value-convertible/Cargo.toml +++ b/packages/rs-platform-value-convertible/Cargo.toml @@ -4,7 +4,8 @@ authors = ["Samuel Westrich "] description = "Convertion to and from platform values" version = "1.0.0-dev.4" edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" license = "MIT" private = true diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index d4cb4e1cc33..aa3ed8ad345 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -4,7 +4,8 @@ authors = ["Samuel Westrich "] description = "A simple value module" version = "1.0.0-dev.4" edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" license = "MIT" private = true diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index 44635c8ba4b..795f60beaa8 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -4,7 +4,8 @@ authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" version = "1.0.0-dev.4" edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" license = "MIT" private = true diff --git a/packages/rs-platform-versioning/Cargo.toml b/packages/rs-platform-versioning/Cargo.toml index 0734256f3de..d6d1b61ad1a 100644 --- a/packages/rs-platform-versioning/Cargo.toml +++ b/packages/rs-platform-versioning/Cargo.toml @@ -4,7 +4,8 @@ authors = ["Samuel Westrich "] description = "Version derivation" version = "1.0.0-dev.4" edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" license = "MIT" private = true diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index 5b615c2ea33..b5cd6f8879a 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -2,6 +2,8 @@ name = "rs-sdk" version = "1.0.0-dev.4" edition = "2021" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" [dependencies] dpp = { path = "../rs-dpp", features = [ diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index 50876317362..d204d654ec6 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -2,7 +2,8 @@ name = "simple-signer" version = "1.0.0-dev.4" edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index 1deb64aa551..f5e062af446 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -7,7 +7,8 @@ authors = [ "Paul DeLucia ", ] edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index 708ef2f09af..1e40e92b96d 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -2,7 +2,8 @@ name = "wasm-dpp" version = "1.0.0-dev.4" edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" authors = ["Anton Suprunchuk "] [lib] diff --git a/packages/wasm-dpp/README.md b/packages/wasm-dpp/README.md index cc31d1a824e..027dbffc8f9 100644 --- a/packages/wasm-dpp/README.md +++ b/packages/wasm-dpp/README.md @@ -37,7 +37,7 @@ Library consumers must ignore class names minification for `@dashevo/wasm-dpp` l ## Prerequisites -- Install [Rust](https://www.rust-lang.org/tools/install) v1.73+ +- Install [Rust](https://www.rust-lang.org/tools/install) v1.76+ - Add wasm32 target: `$ rustup target add wasm32-unknown-unknown` - Install wasm-bingen-cli: `cargo install wasm-bindgen-cli@0.2.85` - *double-check that wasm-bindgen-cli version above matches wasm-bindgen version in Cargo.lock file* diff --git a/packages/withdrawals-contract/Cargo.toml b/packages/withdrawals-contract/Cargo.toml index 886bb5c8e36..b948cd7f8c1 100644 --- a/packages/withdrawals-contract/Cargo.toml +++ b/packages/withdrawals-contract/Cargo.toml @@ -3,7 +3,8 @@ name = "withdrawals-contract" description = "Witdrawals data contract schema and tools" version = "1.0.0-dev.4" edition = "2021" -rust-version = "1.73" +# Update using scripts/update-rust-toolchain.sh +rust-version = "1.76" license = "MIT" [dependencies] diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 0b9461857bd..08420761113 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,6 @@ [toolchain] -# Rust version the same as in /README.md -channel = "stable" + +# Update using scripts/update-rust-toolchain.sh +channel = "1.76" targets = ["wasm32-unknown-unknown"] diff --git a/scripts/update_rust_version.sh b/scripts/update_rust_version.sh new file mode 100755 index 00000000000..969adc71790 --- /dev/null +++ b/scripts/update_rust_version.sh @@ -0,0 +1,42 @@ +#! /bin/bash -e + +# This script updates the rust version to the one provided in the first argument. +# Requires `yq` to be installed: https://github.com/mikefarah/yq +PROJECT_ROOT="$(realpath "$(dirname "$0")"/..)" + +# Check if the first argument is provided +if [ -z "${1}" ]; then + echo "Please provide the new rust version as the first argument." + exit 1 +fi + +VERSION="$1" + +function check { + for file in "$@"; do + if ! grep -q "${VERSION}" "${file}"; then + echo "The file ${file} does not contain the version ${VERSION}." + exit 1 + fi + done +} + +echo Update the rust version in the Cargo.toml file +sed -i "s/^rust-version = \".*\"/rust-version = \"${VERSION}\"/" "${PROJECT_ROOT}"/*/*/Cargo.toml +check "${PROJECT_ROOT}"/*/*/Cargo.toml + +echo Update the rust version in the Dockerfile +sed -i "s/^ARG RUST_VERSION=.*$/ARG RUST_VERSION=${VERSION}/" "${PROJECT_ROOT}/Dockerfile" +check "${PROJECT_ROOT}/Dockerfile" + +echo Update the rust version in Github Actions +yq eval ".inputs.toolchain.default = \"${VERSION}\"" -i "${PROJECT_ROOT}/.github/actions/rust/action.yaml" +check "${PROJECT_ROOT}/.github/actions/rust/action.yaml" + +echo Update the rust version in the README.md +sed -i "s/\(\[rust\](https.*)\) v[0-9.]\++,/\1 v$VERSION+,/" "${PROJECT_ROOT}/README.md" +check "${PROJECT_ROOT}/README.md" + +echo Update the rust version in rust-toolchain.toml +sed -i "s/^channel = \".*\"/channel = \"${VERSION}\"/" "${PROJECT_ROOT}/rust-toolchain.toml" +check "${PROJECT_ROOT}/rust-toolchain.toml"