Skip to content

Commit 7013a81

Browse files
authored
Update polkadot-stable2503 (#9)
* update polkadot-stable2503 * fix clippy * fix * fix clippy
1 parent c4fa8e8 commit 7013a81

File tree

11 files changed

+991
-689
lines changed

11 files changed

+991
-689
lines changed

Cargo.lock

Lines changed: 934 additions & 637 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ resolver = "2"
1616
split-debuginfo = "unpacked"
1717

1818
[workspace.dependencies]
19-
frame-support = { version = "37.0.0", default-features = false }
20-
frame-system = { version = "37.0.0", default-features = false }
21-
pallet-balances = { version = "38.0.0", default-features = false }
22-
sc-client-db = { version = "0.44.0", default-features = false }
23-
sc-executor = { version = "0.40.0", default-features = false }
24-
sc-executor-common = { version = "0.35.0", default-features = false }
25-
sp-core = { version = "34.0.0", default-features = false }
26-
sp-externalities = { version = "0.29.0", default-features = false }
27-
sp-io = { version = "38.0.0", default-features = false }
19+
frame-support = { version = "40.1.0", default-features = false }
20+
frame-system = { version = "40.1.0", default-features = false }
21+
pallet-balances = { version = "41.1.0", default-features = false }
22+
sc-client-db = { version = "0.46.0", default-features = false }
23+
sc-executor = { version = "0.42.0", default-features = false }
24+
sc-executor-common = { version = "0.38.0", default-features = false }
25+
sp-core = { version = "36.1.0", default-features = false }
26+
sp-externalities = { version = "0.30.0", default-features = false }
27+
sp-io = { version = "40.0.0", default-features = false }
2828
sp-maybe-compressed-blob = { version = "11.0.0", default-features = false }
29-
sp-runtime = { version = "39.0.0", default-features = false }
30-
sp-runtime-interface = { version = "28.0.0", default-features = false }
31-
sp-state-machine = { version = "0.43.0", default-features = false }
29+
sp-runtime = { version = "41.1.0", default-features = false }
30+
sp-runtime-interface = { version = "29.0.1", default-features = false }
31+
sp-state-machine = { version = "0.45.0", default-features = false }
3232
sp-std = { version = "14.0.0", default-features = false }
33-
sp-storage = { version = "21.0.0", default-features = false }
33+
sp-storage = { version = "22.0.0", default-features = false }

bencher/src/build_wasm/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ pub fn build() -> std::io::Result<Vec<u8>> {
123123
let cargo_cmd = match prerequisites::check() {
124124
Ok(cmd) => cmd,
125125
Err(err_msg) => {
126-
eprintln!("{}", err_msg);
126+
eprintln!("{err_msg}");
127127
std::process::exit(1);
128128
},
129129
};

bencher/src/build_wasm/wasm_project.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ fn create_project_cargo_toml(
307307
}
308308

309309
let mut package = Table::new();
310-
package.insert("name".into(), format!("{}-wasm", crate_name).into());
310+
package.insert("name".into(), format!("{crate_name}-wasm").into());
311311
package.insert("version".into(), "1.0.0".into());
312312
package.insert("edition".into(), "2021".into());
313313

@@ -366,8 +366,7 @@ fn find_package_by_manifest_path<'a>(
366366
if let Some(pkg) = pkgs_by_name.first() {
367367
if pkgs_by_name.len() > 1 {
368368
panic!(
369-
"Found multiple packages matching the name {pkg_name} ({manifest_path:?}): {:?}",
370-
pkgs_by_name
369+
"Found multiple packages matching the name {pkg_name} ({manifest_path:?}): {pkgs_by_name:?}"
371370
);
372371
}
373372
pkg
@@ -403,7 +402,7 @@ fn project_enabled_features(
403402
// features already being present in nightly, we need this code to make
404403
// runtimes compile with all the possible rustc versions.
405404
if v.len() == 1
406-
&& v.first().map_or(false, |v| *v == format!("dep:{}", f))
405+
&& v.first().is_some_and(|v| *v == format!("dep:{f}"))
407406
&& std_enabled.as_ref().map(|e| e.iter().any(|ef| ef == *f)).unwrap_or(false)
408407
{
409408
return false;
@@ -413,7 +412,7 @@ fn project_enabled_features(
413412
// we need to check if the feature is enabled by checking the env variable.
414413
*f != "std"
415414
&& *f != "default"
416-
&& env::var(format!("CARGO_FEATURE_{}", feature_env))
415+
&& env::var(format!("CARGO_FEATURE_{feature_env}"))
417416
.map(|v| v == "1")
418417
.unwrap_or_default()
419418
})
@@ -596,7 +595,7 @@ impl Profile {
596595

597596
/// Check environment whether we should build without network
598597
fn offline_build() -> bool {
599-
env::var(OFFLINE).map_or(false, |v| v == "true")
598+
env::var(OFFLINE).is_ok_and(|v| v == "true")
600599
}
601600

602601
/// Build the project to create the WASM binary.
@@ -675,10 +674,10 @@ fn compact_wasm_file(
675674
let in_path = project
676675
.join("target/wasm32-unknown-unknown")
677676
.join(profile.directory())
678-
.join(format!("{}.wasm", default_out_name));
677+
.join(format!("{default_out_name}.wasm"));
679678

680679
let (wasm_compact_path, wasm_compact_compressed_path) = if profile.wants_compact() {
681-
let wasm_compact_path = project.join(format!("{}.compact.wasm", out_name,));
680+
let wasm_compact_path = project.join(format!("{out_name}.compact.wasm"));
682681
wasm_opt::OptimizationOptions::new_opt_level_0()
683682
.mvp_features_only()
684683
.debug_info(true)
@@ -687,7 +686,7 @@ fn compact_wasm_file(
687686
.expect("Failed to compact generated WASM binary.");
688687

689688
let wasm_compact_compressed_path =
690-
project.join(format!("{}.compact.compressed.wasm", out_name));
689+
project.join(format!("{out_name}.compact.compressed.wasm"));
691690
if compress_wasm(&wasm_compact_path, &wasm_compact_compressed_path) {
692691
(
693692
Some(WasmBinary(wasm_compact_path)),
@@ -700,7 +699,7 @@ fn compact_wasm_file(
700699
(None, None)
701700
};
702701

703-
let bloaty_path = project.join(format!("{}.wasm", out_name));
702+
let bloaty_path = project.join(format!("{out_name}.wasm"));
704703
fs::copy(in_path, &bloaty_path).expect("Copying the bloaty file to the project dir.");
705704

706705
(
@@ -746,21 +745,21 @@ impl<'a> From<&'a cargo_metadata::Package> for DeduplicatePackage<'a> {
746745
}
747746
}
748747

749-
impl<'a> Hash for DeduplicatePackage<'a> {
748+
impl Hash for DeduplicatePackage<'_> {
750749
fn hash<H: Hasher>(&self, state: &mut H) {
751750
self.identifier.hash(state);
752751
}
753752
}
754753

755-
impl<'a> PartialEq for DeduplicatePackage<'a> {
754+
impl PartialEq for DeduplicatePackage<'_> {
756755
fn eq(&self, other: &Self) -> bool {
757756
self.identifier == other.identifier
758757
}
759758
}
760759

761-
impl<'a> Eq for DeduplicatePackage<'a> {}
760+
impl Eq for DeduplicatePackage<'_> {}
762761

763-
impl<'a> Deref for DeduplicatePackage<'a> {
762+
impl Deref for DeduplicatePackage<'_> {
764763
type Target = cargo_metadata::Package;
765764

766765
fn deref(&self) -> &Self::Target {

bencher/src/handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,5 @@ pub fn save_output_json(data: Vec<BenchData>, storage_infos: Vec<StorageMetadata
152152
writer.write_all(b"\n").unwrap();
153153
writer.flush().unwrap();
154154

155-
println!("\nOutput JSON file:\n{}", json_path);
155+
println!("\nOutput JSON file:\n{json_path}");
156156
}

bencher/src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/// ```
2121
///
2222
/// Create a file `benches/module_benches.rs` must be the same as bench name.
23-
/// ```.ignore
23+
/// ```ignore
2424
/// # run benches
2525
/// wasm_bencher::main!();
2626
/// # or, run benches with storage info, required by `wasm-bencher` to generate output json

bencher/test/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::useless_conversion)]
2+
13
#![cfg_attr(not(feature = "std"), no_std)]
24

35
pub mod benches;

rust-toolchain.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[toolchain]
2-
channel="1.77.0"
2+
channel="1.84.1"
33
components = [ "rustfmt", "clippy" ]
44
targets = [ "wasm32-unknown-unknown" ]
5-
profile = "minimal"
5+
profile = "minimal"

weight-gen/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,12 @@ fn main() {
187187
.render_template_to_write(&template, &hbs_data, &mut output_file)
188188
.expect("Unable to render template");
189189
println!();
190-
println!("Weights file `{}` was generated.", path);
190+
println!("Weights file `{path}` was generated.");
191191
} else {
192192
let template_string = handlebars
193193
.render_template(&template, &hbs_data)
194194
.expect("Unable to render template");
195195

196-
println!("{}", template_string);
196+
println!("{template_string}");
197197
}
198198
}

weight-meter/src/lib.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
//! `weight_meter::weight` attribute, and only when running benchmarks.
1515
//!
1616
//! 2. Create benchmarks using wasm_bencher and generate the weights with weight_gen
17-
//! After running the benchmarks and the weights have been generated then we can
18-
//! replace
17+
//! After running the benchmarks and the weights have been generated then we can
18+
//! replace
1919
//! ```ignore
2020
//! #[weight_meter::weight(0)]
2121
//! ```
@@ -25,22 +25,22 @@
2525
//! ```
2626
//!
2727
//! 3. Use WeightMeter on your calls by adding macro
28-
//! `#[weight_meter::start(weight)]` or `#[weight_meter::start]` if
29-
//! starts with zero and at the end use `weight_meter::used_weight()` to
30-
//! get used weight. ```ignore
31-
//! #[pallet::call]
32-
//! impl<T: Config> Pallet<T> {
33-
//! #[pallet::weight(T::WeightInfo::do_something())]
34-
//! #[weight_meter::start(ModuleWeights::<T>::do_something())]
35-
//! pub fn do_something(origin: OriginFor<T>, something: u32) ->
36-
//! DispatchResultWithPostInfo {
37-
//! let who = ensure_signed(origin)?;
38-
//! Self::inner_do_something(something);
39-
//! // Emit an event.
40-
//! Self::deposit_event(Event::SomethingStored(something, who));
41-
//! Ok(PostDispatchInfo::from(Some(weight_meter::used_weight())))
42-
//! }
43-
//! }
28+
//! `#[weight_meter::start(weight)]` or `#[weight_meter::start]` if
29+
//! starts with zero and at the end use `weight_meter::used_weight()` to
30+
//! get used weight. ```ignore
31+
//! #[pallet::call]
32+
//! impl<T: Config> Pallet<T> {
33+
//! #[pallet::weight(T::WeightInfo::do_something())]
34+
//! #[weight_meter::start(ModuleWeights::<T>::do_something())]
35+
//! pub fn do_something(origin: OriginFor<T>, something: u32) ->
36+
//! DispatchResultWithPostInfo {
37+
//! let who = ensure_signed(origin)?;
38+
//! Self::inner_do_something(something);
39+
//! // Emit an event.
40+
//! Self::deposit_event(Event::SomethingStored(something, who));
41+
//! Ok(PostDispatchInfo::from(Some(weight_meter::used_weight())))
42+
//! }
43+
//! }
4444
//! ```
4545
4646
type Weight = u64;

0 commit comments

Comments
 (0)