Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 28 additions & 62 deletions commands/bench/lib/bench-all-cumulus.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,65 +10,31 @@ run_cumulus_bench() {
local artifactsDir="$ARTIFACTS_DIR"
local category=$1
local runtimeName=$2
local paraId=$3

local benchmarkOutput=./parachains/runtimes/$category/$runtimeName/src/weights
local benchmarkRuntimeChain
if [[ ! -z "$paraId" ]]; then
benchmarkRuntimeChain="${runtimeName}-dev-$paraId"
else
benchmarkRuntimeChain="$runtimeName-dev"
fi

# Load all pallet names in an array.
echo "[+] Listing pallets for runtime $runtimeName for chain: $benchmarkRuntimeChain ..."
local pallets=($(
$POLKADOT_PARACHAIN benchmark pallet --list --chain="${benchmarkRuntimeChain}" |\
tail -n+2 |\
cut -d',' -f1 |\
sort |\
uniq
))

if [[ $runtimeName =~ ^(statemint|statemine|westmint)$ ]]; then
local pallets=(
pallet_assets
pallet_balances
pallet_collator_selection
pallet_multisig
pallet_proxy
pallet_session
pallet_timestamp
pallet_utility
pallet_uniques
cumulus_pallet_xcmp_queue
frame_system
pallet_xcm_benchmarks::generic
pallet_xcm_benchmarks::fungible
)
elif [[ $runtimeName == "collectives-polkadot" ]]; then
local pallets=(
pallet_alliance
pallet_balances
pallet_collator_selection
pallet_collective
pallet_multisig
pallet_proxy
pallet_session
pallet_timestamp
pallet_utility
cumulus_pallet_xcmp_queue
frame_system
)
elif [[ $runtimeName =~ ^(bridge-hub-kusama|bridge-hub-polkadot)$ ]]; then
local pallets=(
frame_system
pallet_balances
pallet_collator_selection
pallet_multisig
pallet_session
pallet_timestamp
pallet_utility
cumulus_pallet_xcmp_queue
pallet_xcm_benchmarks::generic
pallet_xcm_benchmarks::fungible
)
elif [[ $runtimeName == "bridge-hub-rococo" ]]; then
local pallets=(
frame_system
pallet_balances
pallet_collator_selection
pallet_multisig
pallet_session
pallet_timestamp
pallet_utility
cumulus_pallet_xcmp_queue
pallet_xcm_benchmarks::generic
pallet_xcm_benchmarks::fungible
)
if [ ${#pallets[@]} -ne 0 ]; then
echo "[+] Benchmarking ${#pallets[@]} pallets for runtime $runtimeName for chain: $benchmarkRuntimeChain, pallets:"
for pallet in "${pallets[@]}"; do
echo " [+] $pallet"
done
else
echo "$runtimeName pallet list not found in benchmarks-ci.sh"
exit 1
Expand All @@ -84,7 +50,7 @@ run_cumulus_bench() {
fi
$POLKADOT_PARACHAIN benchmark pallet \
$extra_args \
--chain="$runtimeName-dev" \
--chain="${benchmarkRuntimeChain}" \
--execution=wasm \
--wasm-execution=compiled \
--pallet="$pallet" \
Expand All @@ -96,7 +62,7 @@ run_cumulus_bench() {
--repeat=20 \
--json \
--header=./file_header.txt \
--output="${benchmarkOutput}/${output_file}.rs" >> "$artifactsDir/${pallet}_benchmark.json"
--output="${benchmarkOutput}" >> "$artifactsDir/${pallet}_benchmark.json"
done
}

Expand All @@ -105,9 +71,9 @@ echo "[+] Compiling benchmarks..."
cargo build --profile production --locked --features=runtime-benchmarks

# Assets
run_cumulus_bench assets statemine
run_cumulus_bench assets statemint
run_cumulus_bench assets westmint
run_cumulus_bench assets asset-hub-kusama
run_cumulus_bench assets asset-hub-polkadot
run_cumulus_bench assets asset-hub-westend

# Collectives
run_cumulus_bench collectives collectives-polkadot
Expand All @@ -118,4 +84,4 @@ run_cumulus_bench bridge-hubs bridge-hub-kusama
run_cumulus_bench bridge-hubs bridge-hub-rococo

# Glutton
run_cumulus_bench glutton glutton-kusama
run_cumulus_bench glutton glutton-kusama 1300