fix: Complete snowbridge pezpallet rebrand and critical bug fixes
- snowbridge-pezpallet-* → pezsnowbridge-pezpallet-* (201 refs) - pallet/ directories → pezpallet/ (4 locations) - Fixed pezpallet.rs self-include recursion bug - Fixed sc-chain-spec hardcoded crate name in derive macro - Reverted .pezpallet_by_name() to .pallet_by_name() (subxt API) - Added BizinikiwiConfig type alias for zombienet tests - Deleted obsolete session state files Verified: pezsnowbridge-pezpallet-*, pezpallet-staking, pezpallet-staking-async, pezframe-benchmarking-cli all pass cargo check
This commit is contained in:
@@ -48,7 +48,7 @@ impl RemarkBuilder {
|
||||
}
|
||||
|
||||
impl pezframe_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder {
|
||||
fn pallet(&self) -> &str {
|
||||
fn pezpallet(&self) -> &str {
|
||||
"system"
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ impl TransferKeepAliveBuilder {
|
||||
}
|
||||
|
||||
impl pezframe_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {
|
||||
fn pallet(&self) -> &str {
|
||||
fn pezpallet(&self) -> &str {
|
||||
"balances"
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ pub enum Subcommand {
|
||||
|
||||
/// Sub-commands concerned with benchmarking.
|
||||
///
|
||||
/// The pallet benchmarking moved to the `pallet` sub-command.
|
||||
/// The pezpallet benchmarking moved to the `pezpallet` sub-command.
|
||||
#[command(subcommand)]
|
||||
Benchmark(pezframe_benchmarking_cli::BenchmarkCmd),
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ pub fn run() -> Result<()> {
|
||||
// This switch needs to be in the client, since the client decides
|
||||
// which sub-commands it wants to support.
|
||||
match cmd {
|
||||
BenchmarkCmd::Pallet(cmd) => {
|
||||
BenchmarkCmd::Pezpallet(cmd) => {
|
||||
if !cfg!(feature = "runtime-benchmarks") {
|
||||
return Err(
|
||||
"Runtime benchmarking wasn't enabled when building the node. \
|
||||
|
||||
@@ -381,7 +381,7 @@ fn full_native_block_import_works() {
|
||||
EventRecord {
|
||||
phase: Phase::ApplyExtrinsic(1),
|
||||
event: RuntimeEvent::Balances(pezpallet_balances::Event::Deposit {
|
||||
who: pezpallet_treasury::Pallet::<Runtime>::account_id(),
|
||||
who: pezpallet_treasury::Pezpallet::<Runtime>::account_id(),
|
||||
amount: fees_after_refund,
|
||||
}),
|
||||
topics: vec![],
|
||||
@@ -478,7 +478,7 @@ fn full_native_block_import_works() {
|
||||
EventRecord {
|
||||
phase: Phase::ApplyExtrinsic(1),
|
||||
event: RuntimeEvent::Balances(pezpallet_balances::Event::Deposit {
|
||||
who: pezpallet_treasury::Pallet::<Runtime>::account_id(),
|
||||
who: pezpallet_treasury::Pezpallet::<Runtime>::account_id(),
|
||||
amount: fees_after_refund,
|
||||
}),
|
||||
topics: vec![],
|
||||
@@ -525,7 +525,7 @@ fn full_native_block_import_works() {
|
||||
EventRecord {
|
||||
phase: Phase::ApplyExtrinsic(2),
|
||||
event: RuntimeEvent::Balances(pezpallet_balances::Event::Deposit {
|
||||
who: pezpallet_treasury::Pallet::<Runtime>::account_id(),
|
||||
who: pezpallet_treasury::Pezpallet::<Runtime>::account_id(),
|
||||
amount: fees_after_refund,
|
||||
}),
|
||||
topics: vec![],
|
||||
@@ -701,7 +701,7 @@ fn deploying_wasm_contract_should_work() {
|
||||
let transfer_ch = <Runtime as pezframe_system::Config>::Hashing::hash(&transfer_code);
|
||||
|
||||
let addr =
|
||||
pezpallet_contracts::Pallet::<Runtime>::contract_address(&charlie(), &transfer_ch, &[], &[]);
|
||||
pezpallet_contracts::Pezpallet::<Runtime>::contract_address(&charlie(), &transfer_ch, &[], &[]);
|
||||
|
||||
let time = 42 * 1000;
|
||||
let b = construct_block(
|
||||
@@ -747,7 +747,7 @@ fn deploying_wasm_contract_should_work() {
|
||||
t.execute_with(|| {
|
||||
// Verify that the contract does exist by querying some of its storage items
|
||||
// It does not matter that the storage item itself does not exist.
|
||||
assert!(&pezpallet_contracts::Pallet::<Runtime>::get_storage(addr, vec![]).is_ok());
|
||||
assert!(&pezpallet_contracts::Pezpallet::<Runtime>::get_storage(addr, vec![]).is_ok());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -28,15 +28,15 @@ fn benchmark_extrinsic_works() {
|
||||
benchmark_extrinsic("balances", "transfer_keep_alive");
|
||||
}
|
||||
|
||||
/// Checks that the `benchmark extrinsic` command works for the given pallet and extrinsic.
|
||||
fn benchmark_extrinsic(pallet: &str, extrinsic: &str) {
|
||||
/// Checks that the `benchmark extrinsic` command works for the given pezpallet and extrinsic.
|
||||
fn benchmark_extrinsic(pezpallet: &str, extrinsic: &str) {
|
||||
let base_dir = tempdir().expect("could not create a temp dir");
|
||||
|
||||
let status = Command::new(cargo_bin("bizinikiwi-node"))
|
||||
.args(&["benchmark", "extrinsic", "--dev"])
|
||||
.arg("-d")
|
||||
.arg(base_dir.path())
|
||||
.args(&["--pallet", pallet, "--extrinsic", extrinsic])
|
||||
.args(&["--pezpallet", pezpallet, "--extrinsic", extrinsic])
|
||||
// Run with low repeats for faster execution.
|
||||
.args(["--warmup=10", "--repeat=10", "--max-ext-per-block=10"])
|
||||
.args(["--wasm-execution=compiled"])
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
use assert_cmd::cargo::cargo_bin;
|
||||
use std::process::Command;
|
||||
|
||||
/// `benchmark pallet` works for the different combinations of `steps` and `repeat`.
|
||||
/// `benchmark pezpallet` works for the different combinations of `steps` and `repeat`.
|
||||
#[test]
|
||||
fn benchmark_pallet_works() {
|
||||
// Some invalid combinations:
|
||||
@@ -35,32 +35,32 @@ fn benchmark_pallet_works() {
|
||||
|
||||
#[test]
|
||||
fn benchmark_pallet_args_work() {
|
||||
benchmark_pallet_args(&["--list", "--pallet=pezpallet_balances"], true);
|
||||
benchmark_pallet_args(&["--list", "--pallet=pezpallet_balances"], true);
|
||||
benchmark_pallet_args(&["--list", "--pezpallet=pezpallet_balances"], true);
|
||||
benchmark_pallet_args(&["--list", "--pezpallet=pezpallet_balances"], true);
|
||||
benchmark_pallet_args(
|
||||
&["--list", "--pallet=pezpallet_balances", "--genesis-builder=spec-genesis"],
|
||||
&["--list", "--pezpallet=pezpallet_balances", "--genesis-builder=spec-genesis"],
|
||||
true,
|
||||
);
|
||||
benchmark_pallet_args(
|
||||
&["--list", "--pallet=pezpallet_balances", "--chain=dev", "--genesis-builder=spec-genesis"],
|
||||
&["--list", "--pezpallet=pezpallet_balances", "--chain=dev", "--genesis-builder=spec-genesis"],
|
||||
true,
|
||||
);
|
||||
benchmark_pallet_args(
|
||||
&["--list", "--pallet=pezpallet_balances", "--chain=dev", "--genesis-builder=spec-runtime"],
|
||||
&["--list", "--pezpallet=pezpallet_balances", "--chain=dev", "--genesis-builder=spec-runtime"],
|
||||
true,
|
||||
);
|
||||
// Error because no runtime is provided:
|
||||
benchmark_pallet_args(
|
||||
&["--list", "--pallet=pezpallet_balances", "--chain=dev", "--genesis-builder=runtime"],
|
||||
&["--list", "--pezpallet=pezpallet_balances", "--chain=dev", "--genesis-builder=runtime"],
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
fn benchmark_pallet(steps: u32, repeat: u32, should_work: bool) {
|
||||
let status = Command::new(cargo_bin("bizinikiwi-node"))
|
||||
.args(["benchmark", "pallet", "--dev"])
|
||||
.args(["benchmark", "pezpallet", "--dev"])
|
||||
// Use the `addition` benchmark since is the fastest.
|
||||
.args(["--pallet", "pezframe-benchmarking", "--extrinsic", "addition"])
|
||||
.args(["--pezpallet", "pezframe-benchmarking", "--extrinsic", "addition"])
|
||||
.args(["--steps", &format!("{}", steps), "--repeat", &format!("{}", repeat)])
|
||||
.args([
|
||||
"--wasm-execution=compiled",
|
||||
@@ -77,7 +77,7 @@ fn benchmark_pallet(steps: u32, repeat: u32, should_work: bool) {
|
||||
|
||||
fn benchmark_pallet_args(args: &[&str], should_work: bool) {
|
||||
let status = Command::new(cargo_bin("bizinikiwi-node"))
|
||||
.args(["benchmark", "pallet"])
|
||||
.args(["benchmark", "pezpallet"])
|
||||
.args(args)
|
||||
.status()
|
||||
.unwrap();
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#![cfg(feature = "runtime-benchmarks")]
|
||||
|
||||
use assert_cmd::cargo::cargo_bin;
|
||||
use std::process::Command;
|
||||
|
||||
/// `benchmark pezpallet` works for the different combinations of `steps` and `repeat`.
|
||||
#[test]
|
||||
fn benchmark_pezpallet_works() {
|
||||
// Some invalid combinations:
|
||||
benchmark_pezpallet(0, 10, false);
|
||||
benchmark_pezpallet(1, 10, false);
|
||||
// ... and some valid:
|
||||
benchmark_pezpallet(2, 1, true);
|
||||
benchmark_pezpallet(50, 20, true);
|
||||
benchmark_pezpallet(20, 50, true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn benchmark_pezpallet_args_work() {
|
||||
benchmark_pezpallet_args(&["--list", "--pezpallet=pezpallet_balances"], true);
|
||||
benchmark_pezpallet_args(&["--list", "--pezpallet=pezpallet_balances"], true);
|
||||
benchmark_pezpallet_args(
|
||||
&["--list", "--pezpallet=pezpallet_balances", "--genesis-builder=spec-genesis"],
|
||||
true,
|
||||
);
|
||||
benchmark_pezpallet_args(
|
||||
&["--list", "--pezpallet=pezpallet_balances", "--chain=dev", "--genesis-builder=spec-genesis"],
|
||||
true,
|
||||
);
|
||||
benchmark_pezpallet_args(
|
||||
&["--list", "--pezpallet=pezpallet_balances", "--chain=dev", "--genesis-builder=spec-runtime"],
|
||||
true,
|
||||
);
|
||||
// Error because no runtime is provided:
|
||||
benchmark_pezpallet_args(
|
||||
&["--list", "--pezpallet=pezpallet_balances", "--chain=dev", "--genesis-builder=runtime"],
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
fn benchmark_pezpallet(steps: u32, repeat: u32, should_work: bool) {
|
||||
let status = Command::new(cargo_bin("bizinikiwi-node"))
|
||||
.args(["benchmark", "pezpallet", "--dev"])
|
||||
// Use the `addition` benchmark since is the fastest.
|
||||
.args(["--pezpallet", "pezframe-benchmarking", "--extrinsic", "addition"])
|
||||
.args(["--steps", &format!("{}", steps), "--repeat", &format!("{}", repeat)])
|
||||
.args([
|
||||
"--wasm-execution=compiled",
|
||||
"--no-storage-info",
|
||||
"--no-median-slopes",
|
||||
"--no-min-squares",
|
||||
"--heap-pages=4096",
|
||||
])
|
||||
.status()
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(status.success(), should_work);
|
||||
}
|
||||
|
||||
fn benchmark_pezpallet_args(args: &[&str], should_work: bool) {
|
||||
let status = Command::new(cargo_bin("bizinikiwi-node"))
|
||||
.args(["benchmark", "pezpallet"])
|
||||
.args(args)
|
||||
.status()
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(status.success(), should_work);
|
||||
}
|
||||
Reference in New Issue
Block a user