From bfad9878a504ffeb68431d78b2237e2ad058b5ea Mon Sep 17 00:00:00 2001 From: Juan Ignacio Rios <54085674+JuaniRios@users.noreply.github.com> Date: Tue, 14 May 2024 13:45:24 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20polimec=20benches=20(#295)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What? - Fix Polimec benchmarks ## How? - Use the testing verifier key when running benchmarks and tests ## Testing? - `just dry-run-benchmarks polimec` --- justfile | 38 +++++++++++++++++++------------------ runtimes/polimec/Cargo.toml | 1 + runtimes/polimec/src/lib.rs | 4 ++-- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/justfile b/justfile index 4e59d0535..958b3af78 100644 --- a/justfile +++ b/justfile @@ -21,24 +21,26 @@ test-runtime-features runtime="polimec-runtime": test-integration: cargo test -p integration-tests -dry-run-benchmarks pallet="*" extrinsic="*": - cargo build --features runtime-benchmarks --release && \ - ./target/release/polimec-node benchmark pallet \ - --chain=politest-local \ - --steps=2 \ - --repeat=1 \ - --pallet={{ pallet }} \ - --extrinsic={{ extrinsic }} \ - --wasm-execution=compiled \ - --heap-pages=4096 && \ - ./target/release/polimec-node benchmark pallet \ - --chain=polimec-local \ - --steps=2 \ - --repeat=1 \ - --pallet={{ pallet }} \ - --extrinsic={{ extrinsic }} \ - --wasm-execution=compiled \ - --heap-pages=4096 +dry-run-benchmarks runtime="politest,polimec" pallet="*" extrinsic="*" : + #!/bin/bash + # Set the internal field separator for splitting the runtime variable + IFS=',' + # Read the runtime variable into an array + read -ra runtimes <<< "{{runtime}}" + # Build the project + cargo build --features runtime-benchmarks --release + # Loop over each runtime and run the benchmark + for runtime in "${runtimes[@]}"; do \ + echo -e "\033[34mRunning benchmarks for runtime: \033[92m$runtime\033[34m\033[0m" + ./target/release/polimec-node benchmark pallet \ + --chain=${runtime}-local \ + --steps=2 \ + --repeat=1 \ + --pallet={{ pallet }} \ + --extrinsic={{ extrinsic }} \ + --wasm-execution=compiled \ + --heap-pages=4096 + done # src: https://github.com/polkadot-fellows/runtimes/blob/48ccfae6141d2924f579d81e8b1877efd208693f/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/cumulus_pallet_xcmp_queue.rs # Benchmark a specific pallet on the "Polimec" Runtime diff --git a/runtimes/polimec/Cargo.toml b/runtimes/polimec/Cargo.toml index be71449d2..ecade4106 100644 --- a/runtimes/polimec/Cargo.toml +++ b/runtimes/polimec/Cargo.toml @@ -184,6 +184,7 @@ std = [ ] runtime-benchmarks = [ + "development-settings", "cumulus-pallet-dmp-queue/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", "cumulus-pallet-session-benchmarking/runtime-benchmarks", diff --git a/runtimes/polimec/src/lib.rs b/runtimes/polimec/src/lib.rs index 8395dc071..2c39b70ba 100644 --- a/runtimes/polimec/src/lib.rs +++ b/runtimes/polimec/src/lib.rs @@ -993,7 +993,7 @@ parameter_types! { } // Development public key -#[cfg(feature = "development-settings")] +#[cfg(any(feature = "development-settings", test))] parameter_types! { pub VerifierPublicKey: [u8; 32] = [ 32, 118, 30, 171, 58, 212, 197, 27, 146, 122, 255, 243, 34, 245, 90, 244, 221, 37, 253, @@ -1002,7 +1002,7 @@ parameter_types! { } // Production public key -#[cfg(not(feature = "development-settings"))] +#[cfg(not(any(feature = "development-settings", test)))] parameter_types! { pub VerifierPublicKey: [u8; 32] = [ 83, 49, 95, 191, 98, 138, 14, 43, 234, 192, 105, 248, 11, 96, 127, 234, 192, 62, 80,