Skip to content

Commit

Permalink
Update to Rust stable 1.84.1 (paritytech#7625)
Browse files Browse the repository at this point in the history
Ref paritytech/ci_cd#1107

We mainly need that so that we can finally compile the `pallet_revive`
fixtures on stable. I did my best to keep the commits focused on one
thing to make review easier.

All the changes are needed because rustc introduced more warnings or is
more strict about existing ones. Most of the stuff could just be fixed
and the commits should be pretty self explanatory. However, there are a
few this that are notable:

## `non_local_definitions `

A lot of runtimes to write `impl` blocks inside functions. This makes
sense to reduce the amount of conditional compilation. I guess I could
have moved them into a module instead. But I think allowing it here
makes sense to avoid the code churn.

## `unexpected_cfgs`

The FRAME macros emit code that references various features like `std`,
`runtime-benchmarks` or `try-runtime`. If a create that uses those
macros does not have those features we get this warning. Those were
mostly when defining a `mock` runtime. I opted for silencing the warning
in this case rather than adding not needed features.

For the benchmarking ui tests I opted for adding the `runtime-benchmark`
feature to the `Cargo.toml`.

## Failing UI test

I am bumping the `trybuild` version and regenerating the ui tests. The
old version seems to be incompatible. This requires us to pass
`deny_warnings` in `CARGO_ENCODED_RUSTFLAGS` as `RUSTFLAGS` is ignored
in the new version.

## Removing toolchain file from the pallet revive fixtures

This is no longer needed since the latest stable will compile them fine
using the `RUSTC_BOOTSTRAP=1`.

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
athei and github-actions[bot] authored Feb 20, 2025
1 parent e8d17cb commit e2d3da6
Show file tree
Hide file tree
Showing 108 changed files with 417 additions and 191 deletions.
2 changes: 1 addition & 1 deletion .github/env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
IMAGE="docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558"
IMAGE="docker.io/paritytech/ci-unified:bullseye-1.84.1-2025-01-28-v202502131220"
10 changes: 5 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ workflow:

variables:
# CI_IMAGE: !reference [ .ci-unified, variables, CI_IMAGE ]
CI_IMAGE: "docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558"
CI_IMAGE: "docker.io/paritytech/ci-unified:bullseye-1.84.1-2025-01-28-v202502131220"
# BUILDAH_IMAGE is defined in group variables
BUILDAH_COMMAND: "buildah --storage-driver overlay2"
RELENG_SCRIPTS_BRANCH: "master"
Expand Down Expand Up @@ -125,18 +125,18 @@ default:
- cat .forklift/config-gitlab.toml > .forklift/config.toml
- >
if [ "$FORKLIFT_BYPASS" != "true" ]; then
echo "FORKLIFT_BYPASS not set";
echo "FORKLIFT_BYPASS not set";
if command -v forklift >/dev/null 2>&1; then
echo "forklift already exists";
echo "forklift already exists";
forklift version
else
echo "forklift does not exist, downloading";
curl --header "PRIVATE-TOKEN: $FL_CI_GROUP_TOKEN" -o forklift -L "${CI_API_V4_URL}/projects/676/packages/generic/forklift/${FL_FORKLIFT_VERSION}/forklift_${FL_FORKLIFT_VERSION}_linux_amd64";
curl --header "PRIVATE-TOKEN: $FL_CI_GROUP_TOKEN" -o forklift -L "${CI_API_V4_URL}/projects/676/packages/generic/forklift/${FL_FORKLIFT_VERSION}/forklift_${FL_FORKLIFT_VERSION}_linux_amd64";
chmod +x forklift;
export PATH=$PATH:$(pwd);
echo ${FL_FORKLIFT_VERSION};
fi
echo "Creating alias cargo='forklift cargo'";
echo "Creating alias cargo='forklift cargo'";
shopt -s expand_aliases;
alias cargo="forklift cargo";
fi
Expand Down
23 changes: 10 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ trie-bench = { version = "0.39.0" }
trie-db = { version = "0.29.1", default-features = false }
trie-root = { version = "0.18.0", default-features = false }
trie-standardmap = { version = "0.16.0" }
trybuild = { version = "1.0.89" }
trybuild = { version = "1.0.103" }
tt-call = { version = "1.0.8" }
tuplex = { version = "0.1", default-features = false }
twox-hash = { version = "1.6.3", default-features = false }
Expand Down
9 changes: 3 additions & 6 deletions bridges/modules/grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -789,12 +789,9 @@ where
pub fn synced_headers_grandpa_info() -> Vec<StoredHeaderGrandpaInfo<BridgedHeader<T, I>>> {
frame_system::Pallet::<T>::read_events_no_consensus()
.filter_map(|event| {
if let Event::<T, I>::UpdatedBestFinalizedHeader { grandpa_info, .. } =
event.event.try_into().ok()?
{
return Some(grandpa_info)
}
None
let Event::<T, I>::UpdatedBestFinalizedHeader { grandpa_info, .. } =
event.event.try_into().ok()?;
Some(grandpa_info)
})
.collect()
}
Expand Down
2 changes: 1 addition & 1 deletion bridges/primitives/test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub fn make_justification_for_header<H: HeaderT>(
);

// Roughly, how many vote ancestries do we want per fork
let target_depth = (ancestors + forks - 1) / forks;
let target_depth = ancestors.div_ceil(forks);

let mut unsigned_precommits = vec![];
for i in 0..forks {
Expand Down
1 change: 1 addition & 0 deletions bridges/relays/lib-substrate-relay/src/messages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ mod tests {
}

// mock runtime with `pallet_bridge_messages`
#[allow(unexpected_cfgs)]
mod mock {
use super::super::*;
use bp_messages::{target_chain::ForbidInboundMessages, HashedLaneId};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1884,6 +1884,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
1 change: 1 addition & 0 deletions cumulus/parachains/runtimes/testing/penpal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,7 @@ impl_runtime_apis! {
(list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ macro_rules! impl_node_runtime_apis {
unimplemented!()
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
_: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, String> {
Expand Down
2 changes: 1 addition & 1 deletion docs/contributor/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The command below allows building a Linux binary without having to even install
docker run --rm -it \
-w /polkadot-sdk \
-v $(pwd):/polkadot-sdk \
docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558 \
docker.io/paritytech/ci-unified:bullseye-1.84.1-2025-01-28-v202502131220 \
cargo build --release --locked -p polkadot-parachain-bin --bin polkadot-parachain
sudo chown -R $(id -u):$(id -g) target/
```
Expand Down
2 changes: 2 additions & 0 deletions docs/sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#![doc = simple_mermaid::mermaid!("../../mermaid/IA.mmd")]
#![warn(rustdoc::broken_intra_doc_links)]
#![warn(rustdoc::private_intra_doc_links)]
// Frame macros reference features which this crate does not have
#![allow(unexpected_cfgs)]
#![doc(html_favicon_url = "https://polkadot.com/favicon.ico")]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/docs/images/Polkadot_Logo_Horizontal_Pink_White.png"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,7 @@ async fn answer_expected_hypothetical_membership_request(
)
}

/// Assert that the correct peer is reported.
#[macro_export]
macro_rules! assert_peer_reported {
($virtual_overseer:expr, $peer_id:expr, $rep_change:expr $(,)*) => {
Expand Down
3 changes: 2 additions & 1 deletion polkadot/node/overseer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
// unused dependencies can not work for test and examples at the same time
// yielding false positives
#![warn(missing_docs)]
#![allow(dead_code)] // TODO https://github.com/paritytech/polkadot-sdk/issues/5793
// TODO https://github.com/paritytech/polkadot-sdk/issues/5793
#![allow(dead_code, irrefutable_let_patterns)]

use std::{
collections::{hash_map, HashMap},
Expand Down
1 change: 1 addition & 0 deletions polkadot/runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ std = [
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-election-provider-support/runtime-benchmarks",
"frame-support-test/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"libsecp256k1/hmac",
Expand Down
1 change: 1 addition & 0 deletions polkadot/runtime/parachains/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ std = [
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support-test/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-babe/runtime-benchmarks",
Expand Down
2 changes: 1 addition & 1 deletion polkadot/runtime/parachains/src/coretime/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ mod v_coretime {
return None
},
};
let time_slice = (valid_until + TIMESLICE_PERIOD - 1) / TIMESLICE_PERIOD;
let time_slice = valid_until.div_ceil(TIMESLICE_PERIOD);
log::trace!(target: "coretime-migration", "Sending of lease holding para {:?}, valid_until: {:?}, time_slice: {:?}", p, valid_until, time_slice);
Some(mk_coretime_call::<T>(crate::coretime::CoretimeCalls::SetLease(p.into(), time_slice)))
});
Expand Down
1 change: 1 addition & 0 deletions polkadot/runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2468,6 +2468,7 @@ sp_api::impl_runtime_apis! {
return (list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig,
) -> Result<
Expand Down
1 change: 1 addition & 0 deletions polkadot/runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2649,6 +2649,7 @@ sp_api::impl_runtime_apis! {
return (list, storage_info)
}

#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig,
) -> Result<
Expand Down
2 changes: 2 additions & 0 deletions polkadot/xcm/docs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
//!
//! ## Docs structure
#![doc = simple_mermaid::mermaid!("../mermaid/structure.mmd")]
// Frame macros reference features which this crate does not have
#![allow(unexpected_cfgs)]

/// Fundamentals of the XCM language. The virtual machine, instructions, locations and assets.
pub mod fundamentals;
Expand Down
5 changes: 5 additions & 0 deletions polkadot/xcm/xcm-simulator/example/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

// We do not declare all features used by `construct_runtime`
#[allow(unexpected_cfgs)]
mod parachain;

// We do not declare all features used by `construct_runtime`
#[allow(unexpected_cfgs)]
mod relay_chain;

#[cfg(test)]
Expand Down
5 changes: 5 additions & 0 deletions polkadot/xcm/xcm-simulator/fuzzer/src/fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

// We do not declare all features used by `construct_runtime`
#[allow(unexpected_cfgs)]
mod parachain;

// We do not declare all features used by `construct_runtime`
#[allow(unexpected_cfgs)]
mod relay_chain;

use codec::DecodeLimit;
Expand Down
Loading

0 comments on commit e2d3da6

Please sign in to comment.