Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pallet_nis benchmark for Kusama runtime #229

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 15 additions & 2 deletions docs/weight-generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ for pallet in "${pallets[@]}"; do
done
```

You probably want to do this inside a `tmux` session or similar, as it will take a while.
You probably want to do this inside a `tmux` session or something similar (e.g., `nohup <bench-cmd> &`), as it will take a while (several hours).

7. `rsync` the weights back to your local machine, replacing the existing weights.

Expand All @@ -78,7 +78,20 @@ You probably want to do this inside a `tmux` session or similar, as it will take

9. Commit the weight changes.

10. If not installed, `cargo install subweight`, and check the weight changes with `subweight compare commits --path-pattern "./**/weights/*.rs" --method asymptotic --ignore-errors HEAD origin/main`. Ensure the changes are reasonable.
10. Ensure the changes are reasonable. If not installed, `cargo install subweight`, check the weight changes:
```
subweight compare commits \
--path-pattern "./**/weights/**/*.rs" \
--method asymptotic \
--ignore-errors \
<LATEST-RELEASE-BRANCH> \
<ACTUAL_BRANCH_WITH_COMMITED_WEIGHTS>`
```
_Hint1: Add `--format markdown --no-color` for markdown-compatible results._

_Hint2: Change `--path-pattern "./**/weights/**/*.rs"` to e.g. `--path-pattern "./relay/polkadot/weights/**/*.rs"` for a specific runtime._

_Hint3: Add `--change added changed` to include only relevant changes._

## FAQ

Expand Down
10 changes: 5 additions & 5 deletions relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ impl pallet_balances::Config<NisCounterpartInstance> for Runtime {
type MaxLocks = ConstU32<4>;
type MaxReserves = ConstU32<4>;
type ReserveIdentifier = [u8; 8];
type WeightInfo = weights::pallet_balances_nis::WeightInfo<Runtime>;
type WeightInfo = weights::pallet_balances_nis_counterpart::WeightInfo<Runtime>;
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = ();
Expand Down Expand Up @@ -1981,7 +1981,7 @@ mod benches {
[runtime_parachains::coretime, Coretime]
// Substrate
[pallet_balances, Native]
[pallet_balances, Nis]
[pallet_balances, NisCounterpart]
[pallet_bags_list, VoterList]
[frame_benchmarking::baseline, Baseline::<Runtime>]
[pallet_bounties, Bounties]
Expand Down Expand Up @@ -2559,9 +2559,9 @@ sp_api::impl_runtime_apis! {
// Benchmark files generated for `Balances/NisCounterpartBalances` instances are by default
// `pallet_balances_balances.rs / pallet_balances_nis_counterpart_balances`, which is not really nice,
// so with this redefinition we can change names to nicer:
// `pallet_balances_native.rs / pallet_balances_nis.rs`.
// `pallet_balances_native.rs / pallet_balances_nis_counterpart.rs`.
type Native = pallet_balances::Pallet::<Runtime, ()>;
type Nis = pallet_balances::Pallet::<Runtime, NisCounterpartInstance>;
type NisCounterpart = pallet_balances::Pallet::<Runtime, NisCounterpartInstance>;

let mut list = Vec::<BenchmarkList>::new();
list_benchmarks!(list, extra);
Expand Down Expand Up @@ -2776,7 +2776,7 @@ sp_api::impl_runtime_apis! {
}

type Native = pallet_balances::Pallet::<Runtime, ()>;
type Nis = pallet_balances::Pallet::<Runtime, NisCounterpartInstance>;
type NisCounterpart = pallet_balances::Pallet::<Runtime, NisCounterpartInstance>;

let mut whitelist: Vec<TrackedStorageKey> = AllPalletsWithSystem::whitelisted_storage_keys();
let treasury_key = frame_system::Account::<Runtime>::hashed_key_for(Treasury::account_id());
Expand Down
2 changes: 1 addition & 1 deletion relay/kusama/src/weights/mod.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading