Merge development: FAZ 1 Complete - Workspace compile fixes & warning cleanup

This commit is contained in:
2026-01-02 11:46:14 +03:00
520 changed files with 4114 additions and 4558 deletions
@@ -1,6 +1,6 @@
[package]
name = "pezframe-benchmarking-cli"
version = "32.0.0"
version = "32.0.1"
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
@@ -81,17 +81,22 @@ thiserror = { workspace = true }
thousands = { workspace = true }
[dev-dependencies]
bizinikiwi-test-runtime = { workspace = true, default-features = true }
pezcumulus-test-runtime = { workspace = true, default-features = true }
zagros-runtime = { workspace = true, default-features = true }
# bizinikiwi-test-runtime = { workspace = true, default-features = true }
# pezcumulus-test-runtime = { workspace = true, default-features = true }
# zagros-runtime = { workspace = true, default-features = true }
[features]
default = []
# Enable storage benchmark command (requires frame-storage-access-test-runtime)
storage-benchmark = []
# Enable teyrchain/parachain benchmark inherent data
# Note: requires pezcumulus-client-teyrchain-inherent with mock feature (needs pezcumulus-test-relay-sproof-builder)
teyrchain-benchmarks = []
runtime-benchmarks = [
"bizinikiwi-test-runtime/runtime-benchmarks",
# "bizinikiwi-test-runtime/runtime-benchmarks",
"pezcumulus-client-teyrchain-inherent/runtime-benchmarks",
"pezcumulus-primitives-proof-size-hostfunction/runtime-benchmarks",
"pezcumulus-test-runtime/runtime-benchmarks",
# "pezcumulus-test-runtime/runtime-benchmarks",
"pezframe-benchmarking/runtime-benchmarks",
"pezframe-support/runtime-benchmarks",
"pezframe-system/runtime-benchmarks",
@@ -120,6 +125,6 @@ runtime-benchmarks = [
"pezsp-transaction-pool/runtime-benchmarks",
"pezsp-trie/runtime-benchmarks",
"pezsp-version/runtime-benchmarks",
"zagros-runtime/runtime-benchmarks",
# "zagros-runtime/runtime-benchmarks",
]
rocksdb = ["pezsc-cli/rocksdb", "pezsc-client-db/rocksdb"]
@@ -23,6 +23,7 @@ mod machine;
mod overhead;
mod pezpallet;
mod shared;
#[cfg(feature = "storage-benchmark")]
mod storage;
pub use block::BlockCmd;
@@ -34,6 +35,7 @@ pub use overhead::{
};
pub use pezpallet::PalletCmd;
pub use pezsc_service::BasePath;
#[cfg(feature = "storage-benchmark")]
pub use storage::StorageCmd;
use pezsc_cli::{
@@ -46,6 +48,7 @@ use pezsc_cli::{
#[derive(Debug, clap::Subcommand)]
pub enum BenchmarkCmd {
Pezpallet(PalletCmd),
#[cfg(feature = "storage-benchmark")]
Storage(StorageCmd),
Overhead(OverheadCmd),
Block(BlockCmd),
@@ -62,6 +65,7 @@ macro_rules! unwrap_cmd {
} => {
match $self {
BenchmarkCmd::Pezpallet($cmd) => $code,
#[cfg(feature = "storage-benchmark")]
BenchmarkCmd::Storage($cmd) => $code,
BenchmarkCmd::Overhead($cmd) => $code,
BenchmarkCmd::Block($cmd) => $code,
@@ -36,13 +36,18 @@ use crate::{
},
};
use clap::{error::ErrorKind, Args, CommandFactory, Parser};
use codec::{Decode, Encode};
use codec::Decode;
#[cfg(feature = "teyrchain-benchmarks")]
use codec::Encode;
use fake_runtime_api::RuntimeApi as FakeRuntimeApi;
use genesis_state::WARN_SPEC_GENESIS_CTOR;
use log::info;
// MockValidationDataInherentDataProvider is feature-gated because it requires pezcumulus-test-relay-sproof-builder
#[cfg(feature = "teyrchain-benchmarks")]
use pezcumulus_client_teyrchain_inherent::MockValidationDataInherentDataProvider;
use pezframe_support::Deserialize;
use pezkuwi_subxt::{client::RuntimeVersion, ext::futures, Metadata};
#[cfg(feature = "teyrchain-benchmarks")]
use pezkuwi_teyrchain_primitives::primitives::Id as ParaId;
use pezsc_block_builder::BlockBuilderApi;
use pezsc_chain_spec::{ChainSpec, ChainSpecExtension, GenesisBlockBuilder};
@@ -73,7 +78,7 @@ use std::{
};
const DEFAULT_PARA_ID: u32 = 100;
const LOG_TARGET: &'static str = "pezkuwi_sdk_frame::benchmark::overhead";
const LOG_TARGET: &'static str = "pezframe::benchmark::overhead";
/// Benchmark the execution overhead per-block and per-extrinsic.
#[derive(Debug, Parser)]
@@ -204,6 +209,8 @@ fn create_inherent_data<Client: UsageProvider<Block> + HeaderBackend<Block>, Blo
let mut inherent_data = InherentData::new();
// Para inherent can only makes sense when we are handling a teyrchain.
// This requires the teyrchain-benchmarks feature which depends on pezcumulus-test-relay-sproof-builder
#[cfg(feature = "teyrchain-benchmarks")]
if let Teyrchain(para_id) = chain_type {
let teyrchain_validation_data_provider = MockValidationDataInherentDataProvider::<()> {
para_id: ParaId::from(*para_id),
@@ -215,6 +222,10 @@ fn create_inherent_data<Client: UsageProvider<Block> + HeaderBackend<Block>, Blo
teyrchain_validation_data_provider.provide_inherent_data(&mut inherent_data),
);
}
#[cfg(not(feature = "teyrchain-benchmarks"))]
if let Teyrchain(_) = chain_type {
log::warn!("Teyrchain benchmark inherents not available. Enable the 'teyrchain-benchmarks' feature.");
}
// Teyrchain inherent that is used on relay chains to perform teyrchain validation.
let para_inherent = pezkuwi_primitives::InherentData {
@@ -30,7 +30,7 @@ use pezsc_cli::{
use std::{fmt::Debug, path::PathBuf};
/// Logging target
const LOG_TARGET: &'static str = "frame::benchmark::pezpallet";
const LOG_TARGET: &'static str = "pezframe::benchmark::pezpallet";
// Add a more relaxed parsing for pezpallet names by allowing pezpallet directory names with `-` to
// be used like crate names with `_`
@@ -22,12 +22,14 @@ pub mod record;
pub mod stats;
pub mod weight_params;
#[cfg(feature = "storage-benchmark")]
pub use record::BenchRecord;
pub use stats::{StatSelect, Stats};
pub use weight_params::WeightParams;
use clap::Args;
use pezsc_sysinfo::gather_sysinfo;
#[cfg(feature = "storage-benchmark")]
use rand::prelude::*;
use serde::Serialize;
@@ -73,6 +75,7 @@ where
/// Returns an rng and the seed that was used to create it.
///
/// Uses a random seed if none is provided.
#[cfg(feature = "storage-benchmark")]
pub fn new_rng(seed: Option<u64>) -> (impl rand::Rng, u64) {
let seed = seed.unwrap_or(rand::thread_rng().gen::<u64>());
(rand_pcg::Pcg64::seed_from_u64(seed), seed)
@@ -17,13 +17,18 @@
//! Defines the [`BenchRecord`] and its facilities for computing [`super::Stats`].
#[cfg(feature = "storage-benchmark")]
use pezsc_cli::Result;
#[cfg(feature = "storage-benchmark")]
use pezsc_service::Configuration;
#[cfg(feature = "storage-benchmark")]
use log::info;
use serde::Serialize;
#[cfg(feature = "storage-benchmark")]
use std::{fs, path::PathBuf, time::Duration};
#[cfg(feature = "storage-benchmark")]
use super::Stats;
/// Raw output of a Storage benchmark.
@@ -35,6 +40,7 @@ pub struct BenchRecord {
impl BenchRecord {
/// Appends a new record. Uses safe casts.
#[cfg(feature = "storage-benchmark")]
pub fn append(&mut self, size: usize, d: Duration) -> Result<()> {
let size: u64 = size.try_into().map_err(|e| format!("Size overflow u64: {}", e))?;
let ns: u64 = d
@@ -46,6 +52,7 @@ impl BenchRecord {
}
/// Returns the statistics for *time* and *value size*.
#[cfg(feature = "storage-benchmark")]
pub fn calculate_stats(self) -> Result<(Stats, Stats)> {
let (size, time): (Vec<_>, Vec<_>) = self.ns_per_size.into_iter().unzip();
let size = Stats::new(&size)?;
@@ -55,6 +62,7 @@ impl BenchRecord {
/// Unless a path is specified, saves the raw results in a json file in the current directory.
/// Prefixes it with the DB name and suffixed with `path_suffix`.
#[cfg(feature = "storage-benchmark")]
pub fn save_json(&self, cfg: &Configuration, out_path: &PathBuf, suffix: &str) -> Result<()> {
let mut path = PathBuf::from(out_path);
if path.is_dir() || path.as_os_str().is_empty() {
@@ -1,5 +1,5 @@
[package]
name = "frame-remote-externalities"
name = "pezframe-remote-externalities"
version = "0.35.0"
authors.workspace = true
edition.workspace = true
@@ -37,14 +37,14 @@ pezsp-runtime = { workspace = true, default-features = true }
[dev-dependencies]
assert_matches = { workspace = true }
bizinikiwi-test-runtime-client = { workspace = true }
# bizinikiwi-test-runtime-client = { workspace = true }
pezsc-transaction-pool = { workspace = true, default-features = true }
pezsp-tracing = { workspace = true, default-features = true }
tokio = { workspace = true, default-features = true }
[features]
runtime-benchmarks = [
"bizinikiwi-test-runtime-client/runtime-benchmarks",
# "bizinikiwi-test-runtime-client/runtime-benchmarks",
"pezframe-system-rpc-runtime-api/runtime-benchmarks",
"pezsc-rpc-api/runtime-benchmarks",
"pezsc-transaction-pool-api/runtime-benchmarks",
@@ -16,4 +16,30 @@
// limitations under the License.
// bizinikiwi-wasm-builder moved to integration tests to break circular dependency
fn main() {}
// This build script creates a dummy wasm_binary.rs for std builds
fn main() {
#[cfg(feature = "std")]
{
use std::io::Write;
let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR not set");
let wasm_binary_path = std::path::Path::new(&out_dir).join("wasm_binary.rs");
let content = r#"
/// Wasm binary unwrap bloat.
#[cfg(all(feature = "std", not(feature = "runtime-benchmarks")))]
pub const WASM_BINARY: Option<&[u8]> = None;
/// Wasm binary unwrap bloat (for runtime-benchmarks feature).
#[cfg(all(feature = "std", feature = "runtime-benchmarks"))]
pub const WASM_BINARY: Option<&[u8]> = None;
/// Wasm binary unwrap bloat.
#[allow(dead_code)]
pub const WASM_BINARY_BLOATY: Option<&[u8]> = None;
"#;
let mut file = std::fs::File::create(&wasm_binary_path).expect("Failed to create wasm_binary.rs");
file.write_all(content.as_bytes()).expect("Failed to write wasm_binary.rs");
}
}