Update to rust 1.44.0 (#10585)

* Update rust 1.44.0

* Update rust nightly 1.46.0

* Update docs

* Fix clippy errors

* Compile all source code with stable and nightly

* Add another note

* script tweaks

* Fix a test...

* Add another workaround

* Add hack

* Increase timeout...

* Revert "Add hack"

This reverts commit 5960f087203be8792ec0728a6755288c317a2788.

* Revert "Add another workaround"

This reverts commit e14300d01ffd1b8e86e676662177545549b45c13.

* Require nightly rustfmt and use older nightly a bit

* Improve document a bit

* Revert now not-existing clippy check...
This commit is contained in:
Ryo Onodera 2020-06-17 01:32:16 +09:00 committed by GitHub
parent 2d2e23ab59
commit 40ccade5cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 41 additions and 17 deletions

View File

@ -115,7 +115,7 @@ fn main() {
// Sort keypairs so that do_bench_tps() uses the same subset of accounts for each run. // Sort keypairs so that do_bench_tps() uses the same subset of accounts for each run.
// This prevents the amount of storage needed for bench-tps accounts from creeping up // This prevents the amount of storage needed for bench-tps accounts from creeping up
// across multiple runs. // across multiple runs.
keypairs.sort_by(|x, y| x.pubkey().to_string().cmp(&y.pubkey().to_string())); keypairs.sort_by_key(|x| x.pubkey().to_string());
(keypairs, None) (keypairs, None)
} else { } else {
generate_and_fund_keypairs( generate_and_fund_keypairs(

View File

@ -60,6 +60,12 @@ if [[ -z "$SOLANA_DOCKER_RUN_NOSETUID" ]]; then
ARGS+=(--user "$(id -u):$(id -g)") ARGS+=(--user "$(id -u):$(id -g)")
fi fi
if [[ -n $SOLANA_ALLOCATE_TTY ]]; then
# Colored output, progress bar and Ctrl-C:
# https://stackoverflow.com/a/41099052/10242004
ARGS+=(--interactive --tty)
fi
# Environment variables to propagate into the container # Environment variables to propagate into the container
ARGS+=( ARGS+=(
--env BUILDKITE --env BUILDKITE

View File

@ -1,9 +1,10 @@
FROM solanalabs/rust:1.43.0 FROM solanalabs/rust:1.44.0
ARG date ARG date
RUN set -x \ RUN set -x \
&& rustup install nightly-$date \ && rustup install nightly-$date \
&& rustup component add clippy --toolchain=nightly-$date \ && rustup component add clippy --toolchain=nightly-$date \
&& rustup component add rustfmt --toolchain=nightly-$date \
&& rustup show \ && rustup show \
&& rustc --version \ && rustc --version \
&& cargo --version \ && cargo --version \

View File

@ -2,23 +2,27 @@ Docker image containing rust nightly and some preinstalled crates used in CI.
This image may be manually updated by running `CI=true ./build.sh` if you are a member This image may be manually updated by running `CI=true ./build.sh` if you are a member
of the [Solana Labs](https://hub.docker.com/u/solanalabs/) Docker Hub of the [Solana Labs](https://hub.docker.com/u/solanalabs/) Docker Hub
organization, but it is also automatically updated periodically by organization.
[this automation](https://buildkite.com/solana-labs/solana-ci-docker-rust-nightly).
## Moving to a newer nightly ## Moving to a newer nightly
NOTE: Follow instructions in docker-rust/README.md before this when updating the stable
rust version as well.
We pin the version of nightly (see the `ARG nightly=xyz` line in `Dockerfile`) We pin the version of nightly (see the `ARG nightly=xyz` line in `Dockerfile`)
to avoid the build breaking at unexpected times, as occasionally nightly will to avoid the build breaking at unexpected times, as occasionally nightly will
introduce breaking changes. introduce breaking changes.
To update the pinned version: To update the pinned version:
1. Edit `Dockerfile` to match the desired stable rust version to base on if needed.
1. Run `ci/docker-rust-nightly/build.sh` to rebuild the nightly image locally, 1. Run `ci/docker-rust-nightly/build.sh` to rebuild the nightly image locally,
or potentially `ci/docker-rust-nightly/build.sh YYYY-MM-DD` if there's a or potentially `ci/docker-rust-nightly/build.sh YYYY-MM-DD` if there's a
specific YYYY-MM-DD that is desired (default is today's build). specific YYYY-MM-DD that is desired (default is today's build).
Check https://rust-lang.github.io/rustup-components-history/ for build Check https://rust-lang.github.io/rustup-components-history/ for build
status status
1. Update `ci/rust-version.sh` to reflect the new nightly `YYY-MM-DD` 1. Update `ci/rust-version.sh` to reflect the new nightly `YYY-MM-DD`
1. Run `SOLANA_DOCKER_RUN_NOSETUID=1 ci/docker-run.sh --nopull solanalabs/rust-nightly:YYYY-MM-DD ci/test-coverage.sh` 1. Run `SOLANA_ALLOCATE_TTY=1 SOLANA_DOCKER_RUN_NOSETUID=1 ci/docker-run.sh --nopull solanalabs/rust-nightly:YYYY-MM-DD ci/test-checks.sh`
and `SOLANA_ALLOCATE_TTY=1 SOLANA_DOCKER_RUN_NOSETUID=1 ci/docker-run.sh --nopull solanalabs/rust-nightly:YYYY-MM-DD ci/test-coverage.sh [args]...`
to confirm the new nightly image builds. Fix any issues as needed to confirm the new nightly image builds. Fix any issues as needed
1. Run `docker login` to enable pushing images to Docker Hub, if you're authorized. 1. Run `docker login` to enable pushing images to Docker Hub, if you're authorized.
1. Run `CI=true ci/docker-rust-nightly/build.sh YYYY-MM-DD` to push the new nightly image to dockerhub.com. 1. Run `CI=true ci/docker-rust-nightly/build.sh YYYY-MM-DD` to push the new nightly image to dockerhub.com.

View File

@ -1,6 +1,6 @@
# Note: when the rust version is changed also modify # Note: when the rust version is changed also modify
# ci/rust-version.sh to pick up the new image tag # ci/rust-version.sh to pick up the new image tag
FROM rust:1.43.0 FROM rust:1.44.0
# Add Google Protocol Buffers for Libra's metrics library. # Add Google Protocol Buffers for Libra's metrics library.
ENV PROTOC_VERSION 3.8.0 ENV PROTOC_VERSION 3.8.0

View File

@ -1,7 +1,11 @@
Docker image containing rust and some preinstalled packages used in CI. Docker image containing rust and some preinstalled packages used in CI.
NOTE: Recreate rust-nightly docker image after this when updating the stable rust
version! Both of docker images must be updated in tandem.
This image manually maintained: This image manually maintained:
1. Edit `Dockerfile` to match the desired rust version 1. Edit `Dockerfile` to match the desired rust version
2. Run `./build.sh` to publish the new image, if you are a member of the [Solana 1. Run `docker login` to enable pushing images to Docker Hub, if you're authorized.
1. Run `./build.sh` to publish the new image, if you are a member of the [Solana
Labs](https://hub.docker.com/u/solanalabs/) Docker Hub organization. Labs](https://hub.docker.com/u/solanalabs/) Docker Hub organization.

View File

@ -18,13 +18,13 @@
if [[ -n $RUST_STABLE_VERSION ]]; then if [[ -n $RUST_STABLE_VERSION ]]; then
stable_version="$RUST_STABLE_VERSION" stable_version="$RUST_STABLE_VERSION"
else else
stable_version=1.43.0 stable_version=1.44.0
fi fi
if [[ -n $RUST_NIGHTLY_VERSION ]]; then if [[ -n $RUST_NIGHTLY_VERSION ]]; then
nightly_version="$RUST_NIGHTLY_VERSION" nightly_version="$RUST_NIGHTLY_VERSION"
else else
nightly_version=2020-04-23 nightly_version=2020-06-10
fi fi

View File

@ -28,14 +28,17 @@ echo --- build environment
export RUST_BACKTRACE=1 export RUST_BACKTRACE=1
export RUSTFLAGS="-D warnings" export RUSTFLAGS="-D warnings"
if _ scripts/cargo-for-all-lock-files.sh +"$rust_nightly" check --locked --all-targets; then # Exclude --benches as it's not available in rust stable yet
if _ scripts/cargo-for-all-lock-files.sh +"$rust_stable" check --locked --tests --bins --examples; then
true true
else else
check_status=$? check_status=$?
echo "Some Cargo.lock is outdated; please update them as well" echo "Some Cargo.lock might be outdated; update them (or just be a compilation error?)"
echo "protip: you can use ./scripts/cargo-for-all-lock-files.sh [check|update] ..." echo "protip: you can use ./scripts/cargo-for-all-lock-files.sh [check|update] ..."
exit "$check_status" exit "$check_status"
fi fi
# Ensure nightly and --benches
_ scripts/cargo-for-all-lock-files.sh +"$rust_nightly" check --locked --all-targets
_ ci/order-crates-for-publishing.py _ ci/order-crates-for-publishing.py
_ cargo +"$rust_stable" fmt --all -- --check _ cargo +"$rust_stable" fmt --all -- --check

View File

@ -11,7 +11,11 @@ annotate() {
source ci/upload-ci-artifact.sh source ci/upload-ci-artifact.sh
source scripts/ulimit-n.sh source scripts/ulimit-n.sh
scripts/coverage.sh scripts/coverage.sh "$@"
if [[ -z $CI ]]; then
exit
fi
report=coverage-"${CI_COMMIT:0:9}".tar.gz report=coverage-"${CI_COMMIT:0:9}".tar.gz
mv target/cov/report.tar.gz "$report" mv target/cov/report.tar.gz "$report"

View File

@ -285,7 +285,7 @@ setup_validator_accounts() {
return 0 return 0
} }
rpc_url=$($solana_gossip rpc-url --entrypoint "$gossip_entrypoint") rpc_url=$($solana_gossip rpc-url --timeout 180 --entrypoint "$gossip_entrypoint")
[[ -r "$identity" ]] || $solana_keygen new --no-passphrase -so "$identity" [[ -r "$identity" ]] || $solana_keygen new --no-passphrase -so "$identity"
[[ -r "$vote_account" ]] || $solana_keygen new --no-passphrase -so "$vote_account" [[ -r "$vote_account" ]] || $solana_keygen new --no-passphrase -so "$vote_account"

View File

@ -40,10 +40,12 @@ pub fn years_as_slots(years: f64, tick_duration: &Duration, ticks_per_slot: u64)
/// From slots per year to slot duration /// From slots per year to slot duration
pub fn slot_duration_from_slots_per_year(slots_per_year: f64) -> Duration { pub fn slot_duration_from_slots_per_year(slots_per_year: f64) -> Duration {
// Regarding division by zero potential below: for some reason, if Rust stores an `inf` f64 and // Recently, rust changed from infinity as usize being zero to 2^64-1; ensure it's zero here
// then converts it to a u64 on use, it always returns 0, as opposed to std::u64::MAX or any let slot_in_ns = if slots_per_year != 0.0 {
// other huge value (SECONDS_PER_YEAR * 1_000_000_000.0) / slots_per_year
let slot_in_ns = (SECONDS_PER_YEAR * 1_000_000_000.0) / slots_per_year; } else {
0.0
};
Duration::from_nanos(slot_in_ns as u64) Duration::from_nanos(slot_in_ns as u64)
} }