From 144be21efcc86577a952a034e6f6259f6f98d945 Mon Sep 17 00:00:00 2001 From: Sam Johnson Date: Tue, 13 Aug 2024 10:21:25 -0400 Subject: [PATCH 1/2] initial script --- .github/workflows/benchmark-weights.yml | 0 scripts/benchmark_all.sh | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 .github/workflows/benchmark-weights.yml create mode 100755 scripts/benchmark_all.sh diff --git a/.github/workflows/benchmark-weights.yml b/.github/workflows/benchmark-weights.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/scripts/benchmark_all.sh b/scripts/benchmark_all.sh new file mode 100755 index 0000000000..277c39e747 --- /dev/null +++ b/scripts/benchmark_all.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +# List of pallets you want to benchmark +pallets=("admin-utils", "collective", "commitments", "registry", "subtensor") + +# Chain spec and output directory +chain_spec="dev" # or your specific chain spec + +for pallet in "${pallets[@]}" +do + echo "Benchmarking $pallet..." + cargo run --profile=production --features=runtime-benchmarks -- benchmark pallet \ + --chain $chain_spec \ + --execution=wasm \ + --wasm-execution=compiled \ + --pallet $pallet \ + --extrinsic '*' \ + --steps 50 \ + --repeat 20 \ + --output "pallets/$pallet/src/$pallet.rs" \ + --template ./.maintain/frame-weight-template.hbs # Adjust this path to your template file +done + +echo "All pallets have been benchmarked and weights updated." From 0323d506fdb3fe0e0808d97a6941274b29b5f4cb Mon Sep 17 00:00:00 2001 From: Sam Johnson Date: Tue, 13 Aug 2024 13:25:18 -0400 Subject: [PATCH 2/2] working but running into commit reveal issues --- scripts/benchmark_all.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/benchmark_all.sh b/scripts/benchmark_all.sh index 277c39e747..580e5425eb 100755 --- a/scripts/benchmark_all.sh +++ b/scripts/benchmark_all.sh @@ -1,23 +1,23 @@ #!/bin/sh +set -ex # List of pallets you want to benchmark -pallets=("admin-utils", "collective", "commitments", "registry", "subtensor") +pallets=("pallet_subtensor" "pallet_collective" "pallet_commitments" "pallet_registry" "pallet_admin_utils") # Chain spec and output directory -chain_spec="dev" # or your specific chain spec +chain_spec="finney" # or your specific chain spec for pallet in "${pallets[@]}" do echo "Benchmarking $pallet..." - cargo run --profile=production --features=runtime-benchmarks -- benchmark pallet \ + cargo run --profile=production --features=runtime-benchmarks,try-runtime --bin node-subtensor -- benchmark pallet \ --chain $chain_spec \ - --execution=wasm \ --wasm-execution=compiled \ --pallet $pallet \ --extrinsic '*' \ --steps 50 \ - --repeat 20 \ - --output "pallets/$pallet/src/$pallet.rs" \ + --repeat 5 \ + --output "pallets/$pallet/src/weights.rs" \ --template ./.maintain/frame-weight-template.hbs # Adjust this path to your template file done