From 20c8b9f1b20d128e80d5d2dceeec872207acf79f Mon Sep 17 00:00:00 2001 From: Uncle Stinky Date: Wed, 2 Sep 2026 03:03:39 +0300 Subject: [PATCH] fix the benchmarking script Signed-off-by: Uncle Stinky --- scripts/run-all-benches.sh | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/scripts/run-all-benches.sh b/scripts/run-all-benches.sh index 8bf71a1..7de53cf 100755 --- a/scripts/run-all-benches.sh +++ b/scripts/run-all-benches.sh @@ -40,23 +40,23 @@ while getopts 'bfp:v' flag; do esac done -if [ "$skip_build" != true ] -then - echo "[+] Compiling Node with 'runtime-benchmarks' features" - cargo build --release --locked --features=runtime-benchmarks -fi - ERR_FILE="benchmarking_errors.txt" EXECUTABLE=./target/release/ghost RUNTIME="casper" rm -f $ERR_FILE +if [ "$skip_build" != true ] +then + echo "[+] Compiling Node with 'runtime-benchmarks' features" + cargo build --release --locked --features=runtime-benchmarks,$RUNTIME-native +fi + # Update the block and extrinsic overhead weights echo "[+] Benchmarking block and extrinsic overheads..." OUTPUT=$( $EXECUTABLE benchmark overhead \ - --chain="${RUNTIME}-dev" \ + --chain="${RUNTIME}-local" \ --wasm-execution=compiled \ --weight-path="./runtime/${RUNTIME}/constants/src/weights/" \ --header=./file_header.txt \ @@ -70,7 +70,7 @@ fi echo "[+] Benchmarking the machine..." OUTPUT=$( - $EXECUTABLE benchmark machine --chain=${RUNTIME}-dev 2>&1 + $EXECUTABLE benchmark machine --allow-fail --chain=${RUNTIME}-dev 2>&1 ) if [ $? -ne 0 ]; then # Do not write the error file since it is not a benchmarking error @@ -108,23 +108,18 @@ fi EXCLUDED_PALLETS=( # helper pallets - "pallet_election_provider_support_benchmarking" - # pallets without automatic benchmarking - "pallet_babe" - "pallet_grandpa" - "pallet_bags_list" - "frame_system" - "pallet_staking" - "pallet_offences" + "frame_benchmarking" ) # Load all pallet names in an array ALL_PALLETS=($( - $EXECUTABLE benchmark pallet --list=pallets --no-csv-header --chain=${RUNTIME}-dev + $EXECUTABLE benchmark pallet --list=pallets --no-csv-header --chain=${RUNTIME}-dev 2>/dev/null | grep -v ':' | grep -v 'baseline' )) # Filter out the excluded pallets by concatenating the arrays and discarding duplicates -PALLETS=($({ printf '%s\n' "${ALL_PALLETS[@]}" "${EXCLUDED_PALLETS[@]}"; } | sort | uniq -u)) +PALLETS=($( + printf '%s\n' "${ALL_PALLETS[@]}" | grep -Fvxf <(printf '%s\n' "${EXCLUDED_PALLETS[@]}") +)) TOTAL_PALLETS=${#PALLETS[@]} CURRENT=0 @@ -142,6 +137,11 @@ for PALLET in "${PALLETS[@]}"; do unset start_pallet fi + if [[ -z "$PALLET" || "$PALLET" == "::" || "$PALLET" == "baseline" || "$PALLET" == "pallet" ]]; then + echo "[+] ($CURRENT/$TOTAL_PALLETS) Skipping garbage names: '${PALLET}'" + continue + fi + FOLDER="$(echo "${PALLET#*_}" | tr '_' '-')"; WEIGHT_FILE="./runtime/${RUNTIME}/src/weights/${PALLET}.rs" echo "[+] Benchmarking $PALLET for $RUNTIME with weight file $WEIGHT_FILE ($CURRENT/$TOTAL_PALLETS)";