Use this documentation on benchmarking. It is very good and will give all info you need.
To start existing benchmark tests I propose following steps:
- rename
pallets/rmrk-core/src/weights.rstoold_weights.rs. Just to keep it for referrence - examine the tests in
benchmarks.rsfiles. They will produce measurements for the newweights.rsfile - compile node with --features runtime-benchmarks
- since rmrk node is missing production profile, use
--profile=releasein cargo build. Therefore instead of:
cd bin/node/cli
cargo build --profile=production --features runtime-benchmarksuse this:
cd bin/node/cli
cargo build --profile=release --features runtime-benchmarks- after building, run the node with:
./target/release/rmrk-substrate benchmark pallet \
--chain dev \
--execution=wasm \
--wasm-execution=compiled \
--pallet pallet_rmrk_core \
--extrinsic "*" \
--steps 50 \
--repeat 20 \
--output pallets/rmrk-core/src/weight.rs
- this will generate new
pallets/rmrk-core/src/weight.rs
- compare
old_weights.rsand newly genetatedweights.rs. You will see missing trait and some renaming. This could be fixed with template file like this- I never found time to explore that and I mannualy changed that trait
- check also
runtime/src/libfile. in the pallet_rmrk_core there is nowWeightInfowhich points to this newly generatedweights.rsfile
type WeightInfo = pallet_rmrk_core::weights::SubstrateWeight<Runtime>;
- you can also run all benchmark tests before building node:
cargo test --package pallet-rmrk-core --features runtime-benchmarks