From aa987e18f6180ef5e2b25d4ac1298ce25d486c78 Mon Sep 17 00:00:00 2001 From: georgepisaltu Date: Fri, 1 Mar 2024 11:26:39 +0200 Subject: [PATCH 1/9] Update bench-all-substrate Signed-off-by: georgepisaltu --- commands/bench/lib/bench-all-substrate.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/commands/bench/lib/bench-all-substrate.sh b/commands/bench/lib/bench-all-substrate.sh index 9d3522d..85e9667 100644 --- a/commands/bench/lib/bench-all-substrate.sh +++ b/commands/bench/lib/bench-all-substrate.sh @@ -94,6 +94,16 @@ fi for PALLET in "${PALLETS[@]}"; do FOLDER="$(echo "${PALLET#*_}" | tr '_' '-')"; WEIGHT_FILE="$output_path/frame/${FOLDER}/src/weights.rs" + + # Special handling of custom weight paths. + if [ ["$PALLET" == "frame_system_extensions" || "$PALLET" == "frame-system-extensions"] ]; then + WEIGHT_FILE="$output_path/frame/system/src/extensions/weights.rs" + elif [ ["$PALLET" == "pallet_asset_conversion_tx_payment" || "$PALLET" == "pallet-asset-conversion-tx-payment"] ]; then + WEIGHT_FILE="$output_path/frame/transaction-payment/asset-conversion-tx-payment/src/weights.rs" + elif [ ["$PALLET" == "pallet_asset_tx_payment" || "$PALLET" == "pallet-asset-tx-payment"] ]; then + WEIGHT_FILE="$output_path/frame/transaction-payment/asset-tx-payment/src/weights.rs" + fi + echo "[+] Benchmarking $PALLET with weight file $WEIGHT_FILE"; OUTPUT=$( From 066a0d2954cffdc47a8d3b2c27eaeadebc5e239d Mon Sep 17 00:00:00 2001 From: georgepisaltu Date: Fri, 1 Mar 2024 11:26:39 +0200 Subject: [PATCH 2/9] Update bench-all-substrate Signed-off-by: georgepisaltu --- commands/bench/lib/bench-all-substrate.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/commands/bench/lib/bench-all-substrate.sh b/commands/bench/lib/bench-all-substrate.sh index b369680..a39c82d 100644 --- a/commands/bench/lib/bench-all-substrate.sh +++ b/commands/bench/lib/bench-all-substrate.sh @@ -119,6 +119,18 @@ for PALLET in "${ALL_PALLETS[@]}"; do echo "[+] Skipping $PALLET as it is in the excluded list." continue fi + + # Special handling of custom weight paths. + if [ "$PALLET" == "frame_system_extensions" ] || [ "$PALLET" == "frame-system-extensions" ] + then + WEIGHT_FILE="$output_path/frame/system/src/extensions/weights.rs" + elif [ "$PALLET" == "pallet_asset_conversion_tx_payment" ] || [ "$PALLET" == "pallet-asset-conversion-tx-payment" ] + then + WEIGHT_FILE="$output_path/frame/transaction-payment/asset-conversion-tx-payment/src/weights.rs" + elif [ "$PALLET" == "pallet_asset_tx_payment" ] || [ "$PALLET" == "pallet-asset-tx-payment" ] + then + WEIGHT_FILE="$output_path/frame/transaction-payment/asset-tx-payment/src/weights.rs" + fi echo "[+] Benchmarking $PALLET with weight file $WEIGHT_FILE"; From de1e5a41b9ae0a4c219ffa545c2e3acf66d8cee2 Mon Sep 17 00:00:00 2001 From: georgepisaltu Date: Fri, 1 Mar 2024 19:20:35 +0200 Subject: [PATCH 3/9] Fix `tasks-example` pallet bench Signed-off-by: georgepisaltu --- commands/bench/lib/bench-all-substrate.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/commands/bench/lib/bench-all-substrate.sh b/commands/bench/lib/bench-all-substrate.sh index a39c82d..be11e88 100644 --- a/commands/bench/lib/bench-all-substrate.sh +++ b/commands/bench/lib/bench-all-substrate.sh @@ -130,6 +130,9 @@ for PALLET in "${ALL_PALLETS[@]}"; do elif [ "$PALLET" == "pallet_asset_tx_payment" ] || [ "$PALLET" == "pallet-asset-tx-payment" ] then WEIGHT_FILE="$output_path/frame/transaction-payment/asset-tx-payment/src/weights.rs" + elif [ "$PALLET" == "tasks_example" ] || [ "$PALLET" == "tasks-example" ] + then + WEIGHT_FILE="$output_path/frame/examples/tasks/src/weights.rs" fi echo "[+] Benchmarking $PALLET with weight file $WEIGHT_FILE"; From 3e7b88237ed01e35aa6cd30d46dcd54e31e74684 Mon Sep 17 00:00:00 2001 From: georgepisaltu Date: Wed, 2 Oct 2024 16:07:23 +0300 Subject: [PATCH 4/9] Support asset conversion ops Signed-off-by: georgepisaltu --- commands/bench/lib/bench-all-substrate.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commands/bench/lib/bench-all-substrate.sh b/commands/bench/lib/bench-all-substrate.sh index be11e88..f78b2ec 100644 --- a/commands/bench/lib/bench-all-substrate.sh +++ b/commands/bench/lib/bench-all-substrate.sh @@ -61,6 +61,7 @@ EXCLUDED_PALLETS=( "pallet_offences" # Only used for testing, does not need real weights. "frame_benchmarking_pallet_pov" + "pallet_example_authorization_tx_extension" "pallet_example_tasks" "pallet_example_basic" "pallet_example_split" @@ -119,7 +120,7 @@ for PALLET in "${ALL_PALLETS[@]}"; do echo "[+] Skipping $PALLET as it is in the excluded list." continue fi - + # Special handling of custom weight paths. if [ "$PALLET" == "frame_system_extensions" ] || [ "$PALLET" == "frame-system-extensions" ] then @@ -133,6 +134,9 @@ for PALLET in "${ALL_PALLETS[@]}"; do elif [ "$PALLET" == "tasks_example" ] || [ "$PALLET" == "tasks-example" ] then WEIGHT_FILE="$output_path/frame/examples/tasks/src/weights.rs" + elif [ "$PALLET" == "pallet_asset_conversion_ops" ] || [ "$PALLET" == "pallet-asset-conversion-ops" ] + then + WEIGHT_FILE="$output_path/frame/asset-conversion/ops/src/weights.rs" fi echo "[+] Benchmarking $PALLET with weight file $WEIGHT_FILE"; From 5d15cc022cb7ffd50fc6a1eddaff1238071c6ea7 Mon Sep 17 00:00:00 2001 From: georgepisaltu Date: Wed, 2 Oct 2024 16:28:44 +0300 Subject: [PATCH 5/9] Remove riscv feature from bench-all polkadot Signed-off-by: georgepisaltu --- commands/bench-all/bench-all.cmd.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/bench-all/bench-all.cmd.json b/commands/bench-all/bench-all.cmd.json index c82cdab..f997646 100644 --- a/commands/bench-all/bench-all.cmd.json +++ b/commands/bench-all/bench-all.cmd.json @@ -35,7 +35,7 @@ "args": { "runtime": { "label": "Runtime", "type_one_of": ["rococo", "westend"] }, "target_dir": { "label": "Target Directory", "type_string":"polkadot" }, - "features": { "label": "Additional Features", "type_string": "riscv" } + "features": { "label": "Additional Features", "type_string": "" } } }, "cumulus": { From 61504c4fd0a10aaf88a2f22da0dc34f74816c701 Mon Sep 17 00:00:00 2001 From: Maksym H Date: Tue, 22 Oct 2024 16:17:54 +0100 Subject: [PATCH 6/9] Update bench-pallet.sh --- commands/bench/lib/bench-pallet.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/commands/bench/lib/bench-pallet.sh b/commands/bench/lib/bench-pallet.sh index f73024e..f25c11d 100644 --- a/commands/bench/lib/bench-pallet.sh +++ b/commands/bench/lib/bench-pallet.sh @@ -28,6 +28,9 @@ bench_pallet() { get_arg optional --features "$@" local additional_features="${out:-""}" + get_arg optional --machine "$@" + local machine="${out:-""}" + local features="runtime-benchmarks" if [ -n "$additional_features" ]; then features+=",$additional_features" @@ -73,6 +76,10 @@ bench_pallet() { die "Subcommand $subcommand is not supported for $target_dir in bench_pallet" ;; esac + + if [ -n "$machine" ]; then + $cargo_run_benchmarks -- benchmark machine --chain="$runtime" --allow-fail + fi ;; polkadot) # For backward compatibility: replace "-dev" with "" @@ -106,6 +113,10 @@ bench_pallet() { die "Subcommand $subcommand is not supported for $target_dir in bench_pallet" ;; esac + + if [ -n "$machine" ]; then + $cargo_run_benchmarks -- benchmark machine --chain="$runtime-dev" --allow-fail + fi ;; cumulus) get_arg required --runtime_dir "$@" @@ -147,6 +158,10 @@ bench_pallet() { die "Subcommand $subcommand is not supported for $target_dir in bench_pallet" ;; esac + + if [ -n "$machine" ]; then + $cargo_run_benchmarks -- benchmark machine --chain="$chain" --allow-fail + fi ;; *) die "Repository $target_dir is not supported in bench_pallet" From cf43c116aa9864241b34701c9e71d8cadca9da8f Mon Sep 17 00:00:00 2001 From: Maksym H Date: Tue, 22 Oct 2024 16:53:34 +0100 Subject: [PATCH 7/9] Update bench.cmd.json --- commands/bench/bench.cmd.json | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/commands/bench/bench.cmd.json b/commands/bench/bench.cmd.json index 960a72d..fd37a72 100644 --- a/commands/bench/bench.cmd.json +++ b/commands/bench/bench.cmd.json @@ -19,7 +19,8 @@ "runtime": { "label": "Runtime", "type_one_of": ["dev"] }, "pallet": { "label": "pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" }, "target_dir": { "label": "Target Directory", "type_string": "substrate" }, - "features": { "label": "AdditionalFeatures", "type_string": "riscv" } + "features": { "label": "AdditionalFeatures", "type_string": "riscv" }, + "machine": { "label": "Machine", "type_string": "" } } }, "polkadot-pallet": { @@ -30,7 +31,8 @@ "runtime": { "label": "Runtime", "type_one_of": ["rococo", "westend"] }, "pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" }, "target_dir": { "label": "Target Directory", "type_string": "polkadot" }, - "features": { "label": "Additional Features", "type_string": "" } + "features": { "label": "Additional Features", "type_string": "" }, + "machine": { "label": "Machine", "type_string": "" } } }, "cumulus-assets": { @@ -42,7 +44,8 @@ "pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" }, "runtime_dir": { "label": "Runtime Dir", "type_string": "assets" }, "target_dir": { "label": "Target Directory", "type_string": "cumulus" }, - "features": { "label": "Additional Features", "type_string": "" } + "features": { "label": "Additional Features", "type_string": "" }, + "machine": { "label": "Machine", "type_string": "" } } }, "cumulus-collectives": { @@ -54,7 +57,8 @@ "pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" }, "runtime_dir": { "label": "Runtime Dir", "type_string": "collectives" }, "target_dir": { "label": "Target Directory", "type_string": "cumulus" }, - "features": { "label": "Additional Features", "type_string": "" } + "features": { "label": "Additional Features", "type_string": "" }, + "machine": { "label": "Machine", "type_string": "" } } }, "cumulus-coretime": { @@ -66,7 +70,8 @@ "pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" }, "runtime_dir": { "label": "Runtime Dir", "type_string": "coretime" }, "target_dir": { "label": "Target Directory", "type_string": "cumulus" }, - "features": { "label": "Additional Features", "type_string": "" } + "features": { "label": "Additional Features", "type_string": "" }, + "machine": { "label": "Machine", "type_string": "" } } }, "cumulus-bridge-hubs": { @@ -78,7 +83,8 @@ "pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" }, "runtime_dir": { "label": "Runtime Dir", "type_string": "bridge-hubs" }, "target_dir": { "label": "Target Directory", "type_string": "cumulus" }, - "features": { "label": "Additional Features", "type_string": "" } + "features": { "label": "Additional Features", "type_string": "" }, + "machine": { "label": "Machine", "type_string": "" } } }, "cumulus-contracts": { @@ -90,7 +96,8 @@ "runtime_dir": { "label": "Runtime Dir", "type_string": "contracts" }, "pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" }, "target_dir": { "label": "Target Directory", "type_string": "cumulus" }, - "features": { "label": "Additional Features", "type_string": "" } + "features": { "label": "Additional Features", "type_string": "" }, + "machine": { "label": "Machine", "type_string": "" } } }, "cumulus-glutton": { @@ -102,7 +109,8 @@ "pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" }, "runtime_dir": { "label": "Runtime Dir", "type_string": "glutton" }, "target_dir": { "label": "Target Directory", "type_string": "cumulus" }, - "features": { "label": "Additional Features", "type_string": "" } + "features": { "label": "Additional Features", "type_string": "" }, + "machine": { "label": "Machine", "type_string": "" } } }, "cumulus-starters": { @@ -114,7 +122,8 @@ "pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" }, "runtime_dir": { "label": "Runtime Dir", "type_string": "starters" }, "target_dir": { "label": "Target Directory", "type_string": "cumulus" }, - "features": { "label": "Additional Features", "type_string": "" } + "features": { "label": "Additional Features", "type_string": "" }, + "machine": { "label": "Machine", "type_string": "" } } }, "cumulus-people": { @@ -126,7 +135,8 @@ "pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" }, "runtime_dir": { "label": "Runtime Dir", "type_string": "people" }, "target_dir": { "label": "Target Directory", "type_string": "cumulus" }, - "features": { "label": "Additional Features", "type_string": "" } + "features": { "label": "Additional Features", "type_string": "" }, + "machine": { "label": "Machine", "type_string": "" } } }, "cumulus-testing": { @@ -138,7 +148,8 @@ "pallet": { "label": "Pallet", "type_rule": "^([a-z_]+)([:]{2}[a-z_]+)?$", "example": "pallet_name" }, "runtime_dir": { "label": "Runtime Dir", "type_string": "testing" }, "target_dir": { "label": "Target Directory", "type_string": "cumulus" }, - "features": { "label": "Additional Features", "type_string": "" } + "features": { "label": "Additional Features", "type_string": "" }, + "machine": { "label": "Machine", "type_string": "" } } } } From 336402378bcf83325c7b0879d5537d3bf029a0e4 Mon Sep 17 00:00:00 2001 From: Maksym H Date: Tue, 22 Oct 2024 17:04:02 +0100 Subject: [PATCH 8/9] Update bench-pallet.sh --- commands/bench/lib/bench-pallet.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/bench/lib/bench-pallet.sh b/commands/bench/lib/bench-pallet.sh index f25c11d..7dab06d 100644 --- a/commands/bench/lib/bench-pallet.sh +++ b/commands/bench/lib/bench-pallet.sh @@ -78,7 +78,7 @@ bench_pallet() { esac if [ -n "$machine" ]; then - $cargo_run_benchmarks -- benchmark machine --chain="$runtime" --allow-fail + $cargo_run_benchmarks --features="$features" -- benchmark machine --chain="$runtime" --allow-fail fi ;; polkadot) @@ -115,7 +115,7 @@ bench_pallet() { esac if [ -n "$machine" ]; then - $cargo_run_benchmarks -- benchmark machine --chain="$runtime-dev" --allow-fail + $cargo_run_benchmarks --bin=polkadot --features="$features" -- benchmark machine --chain="$runtime-dev" --allow-fail fi ;; cumulus) @@ -160,7 +160,7 @@ bench_pallet() { esac if [ -n "$machine" ]; then - $cargo_run_benchmarks -- benchmark machine --chain="$chain" --allow-fail + $cargo_run_benchmarks -p=polkadot-parachain-bin --features="$features" -- benchmark machine --chain="$chain" --allow-fail fi ;; *) From 58d6cf600c96d2d18df38581aef18ebcfdaa0327 Mon Sep 17 00:00:00 2001 From: georgepisaltu Date: Thu, 7 Nov 2024 16:00:14 +0200 Subject: [PATCH 9/9] Remove `riscv` feature from substrate bench-all Signed-off-by: georgepisaltu --- commands/bench-all/bench-all.cmd.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/bench-all/bench-all.cmd.json b/commands/bench-all/bench-all.cmd.json index f997646..d128d36 100644 --- a/commands/bench-all/bench-all.cmd.json +++ b/commands/bench-all/bench-all.cmd.json @@ -26,7 +26,7 @@ "repos": ["polkadot-sdk"], "args": { "target_dir": { "label": "Target Directory", "type_string": "substrate" }, - "features": { "label": "Additional Features", "type_string": "riscv" } + "features": { "label": "Additional Features", "type_string": "" } } }, "polkadot": {