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.
// This prevents the amount of storage needed for bench-tps accounts from creeping up
// 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)
} else {
generate_and_fund_keypairs(

View File

@ -60,6 +60,12 @@ if [[ -z "$SOLANA_DOCKER_RUN_NOSETUID" ]]; then
ARGS+=(--user "$(id -u):$(id -g)")
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
ARGS+=(
--env BUILDKITE

View File

@ -1,9 +1,10 @@
FROM solanalabs/rust:1.43.0
FROM solanalabs/rust:1.44.0
ARG date
RUN set -x \
&& rustup install nightly-$date \
&& rustup component add clippy --toolchain=nightly-$date \
&& rustup component add rustfmt --toolchain=nightly-$date \
&& rustup show \
&& rustc --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
of the [Solana Labs](https://hub.docker.com/u/solanalabs/) Docker Hub
organization, but it is also automatically updated periodically by
[this automation](https://buildkite.com/solana-labs/solana-ci-docker-rust-nightly).
organization.
## 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`)
to avoid the build breaking at unexpected times, as occasionally nightly will
introduce breaking changes.
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,
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).
Check https://rust-lang.github.io/rustup-components-history/ for build
status
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
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.

View File

@ -1,6 +1,6 @@
# Note: when the rust version is changed also modify
# 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.
ENV PROTOC_VERSION 3.8.0

View File

@ -1,7 +1,11 @@
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:
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.

View File

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

View File

@ -28,14 +28,17 @@ echo --- build environment
export RUST_BACKTRACE=1
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
else
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] ..."
exit "$check_status"
fi
# Ensure nightly and --benches
_ scripts/cargo-for-all-lock-files.sh +"$rust_nightly" check --locked --all-targets
_ ci/order-crates-for-publishing.py
_ cargo +"$rust_stable" fmt --all -- --check

View File

@ -11,7 +11,11 @@ annotate() {
source ci/upload-ci-artifact.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
mv target/cov/report.tar.gz "$report"

View File

@ -285,7 +285,7 @@ setup_validator_accounts() {
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 "$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
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
// then converts it to a u64 on use, it always returns 0, as opposed to std::u64::MAX or any
// other huge value
let slot_in_ns = (SECONDS_PER_YEAR * 1_000_000_000.0) / slots_per_year;
// Recently, rust changed from infinity as usize being zero to 2^64-1; ensure it's zero here
let slot_in_ns = if slots_per_year != 0.0 {
(SECONDS_PER_YEAR * 1_000_000_000.0) / slots_per_year
} else {
0.0
};
Duration::from_nanos(slot_in_ns as u64)
}