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

Change name of weight files for multiple pallet_balances instances of Kusama runtime. #58

Merged

Conversation

bkontur
Copy link
Contributor

@bkontur bkontur commented Oct 10, 2023

Based on: #57

Summary

This PR changes benchmarking setup for generating nicer output weight file names for multiple pallet_balances instance of Kusama runtime:

  • pallet_balances_balances.rs -> pallet_balances_native.rs
  • pallet_balances_nis_counterpart_balances.rs -> pallet_balances_nis.rs

TODO

  • run benchmarking for Kusama runtime, just to be sure, that it works as expected (need to find a way how to run them)

@bkontur
Copy link
Contributor Author

bkontur commented Nov 16, 2023

finally I was able to test it and generate weights for kusama locally:

# my fork with fix commit for runtime-benchmarks feautre enabled
git checkout -b bkontur/bkchr-chain-spec-generator
git merge bko-on-oty-weight-cleanup
cargo build --release -p chain-spec-generator --features runtime-benchmarks
./target/release/chain-spec-generator kusama-dev --raw > kusama-dev-raw.json

../../polkadot-sdk/target/release/polkadot benchmark pallet --chain kusama-dev-raw.json --pallet pallet-balances --extrinsic "*" --steps=2 --repeat=1 --output=./relay/kusama/src/weights


bparity@bkontur-ThinkPad-P14s-Gen-2i:~/parity/polkadot-fellows/runtimes$ ../../polkadot-sdk/target/release/polkadot benchmark pallet --chain kusama-dev-raw.json --pallet pallet-balances --extrinsic "*" --steps=2 --repeat=1 --output=./relay/kusama/src/weights
2023-11-16 10:49:51 Starting benchmark: pallet_balances::transfer_allow_death    
2023-11-16 10:49:51 Starting benchmark: pallet_balances::transfer_keep_alive    
2023-11-16 10:49:51 Starting benchmark: pallet_balances::force_set_balance_creating    
2023-11-16 10:49:51 Starting benchmark: pallet_balances::force_set_balance_killing    
2023-11-16 10:49:51 Starting benchmark: pallet_balances::force_transfer    
2023-11-16 10:49:51 Starting benchmark: pallet_balances::transfer_all    
2023-11-16 10:49:51 Starting benchmark: pallet_balances::force_unreserve    
2023-11-16 10:49:51 Starting benchmark: pallet_balances::upgrade_accounts    
2023-11-16 10:49:52 Starting benchmark: pallet_balances::transfer_allow_death    
2023-11-16 10:49:52 Starting benchmark: pallet_balances::transfer_keep_alive    
2023-11-16 10:49:52 Starting benchmark: pallet_balances::force_set_balance_creating    
2023-11-16 10:49:52 Starting benchmark: pallet_balances::force_set_balance_killing    
2023-11-16 10:49:52 Starting benchmark: pallet_balances::force_transfer    
2023-11-16 10:49:52 Starting benchmark: pallet_balances::transfer_all    
2023-11-16 10:49:52 Starting benchmark: pallet_balances::force_unreserve    
2023-11-16 10:49:52 Starting benchmark: pallet_balances::upgrade_accounts    
Pallet: "pallet_balances", Extrinsic: "transfer_allow_death", Lowest values: [], Highest values: [], Steps: 2, Repeat: 1
Raw Storage Info
========
Storage: `System::Account` (r:1 w:1)
Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    77.18
              µs

Reads = 1
Writes = 1
Recorded proof Size = 0

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=    77.18
              µs

Reads = 1
Writes = 1
Recorded proof Size = 0

Pallet: "pallet_balances", Extrinsic: "transfer_allow_death", Lowest values: [], Highest values: [], Steps: 2, Repeat: 1
Raw Storage Info
========
Storage: `NisCounterpartBalances::Account` (r:2 w:2)
Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`)
Storage: `System::Account` (r:1 w:1)
Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    64.33
              µs

Reads = 3
Writes = 3
Recorded proof Size = 103

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=    64.33
              µs

Reads = 3
Writes = 3
Recorded proof Size = 103

Pallet: "pallet_balances", Extrinsic: "transfer_keep_alive", Lowest values: [], Highest values: [], Steps: 2, Repeat: 1
Raw Storage Info
========
Storage: `System::Account` (r:1 w:1)
Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    61.52
              µs

Reads = 1
Writes = 1
Recorded proof Size = 0

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=    61.52
              µs

Reads = 1
Writes = 1
Recorded proof Size = 0

Pallet: "pallet_balances", Extrinsic: "transfer_keep_alive", Lowest values: [], Highest values: [], Steps: 2, Repeat: 1
Raw Storage Info
========
Storage: `NisCounterpartBalances::Account` (r:2 w:2)
Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`)
Storage: `System::Account` (r:1 w:1)
Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    49.54
              µs

Reads = 3
Writes = 3
Recorded proof Size = 103

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=    49.54
              µs

Reads = 3
Writes = 3
Recorded proof Size = 103

Pallet: "pallet_balances", Extrinsic: "force_set_balance_creating", Lowest values: [], Highest values: [], Steps: 2, Repeat: 1
Raw Storage Info
========
Storage: `System::Account` (r:1 w:1)
Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    25.11
              µs

Reads = 1
Writes = 1
Recorded proof Size = 174

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=    25.11
              µs

Reads = 1
Writes = 1
Recorded proof Size = 174

Pallet: "pallet_balances", Extrinsic: "force_set_balance_creating", Lowest values: [], Highest values: [], Steps: 2, Repeat: 1
Raw Storage Info
========
Storage: `NisCounterpartBalances::Account` (r:1 w:1)
Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    16.76
              µs

Reads = 1
Writes = 1
Recorded proof Size = 103

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=    16.76
              µs

Reads = 1
Writes = 1
Recorded proof Size = 103

Pallet: "pallet_balances", Extrinsic: "force_set_balance_killing", Lowest values: [], Highest values: [], Steps: 2, Repeat: 1
Raw Storage Info
========
Storage: `System::Account` (r:1 w:1)
Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    32.98
              µs

Reads = 1
Writes = 1
Recorded proof Size = 174

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=    32.98
              µs

Reads = 1
Writes = 1
Recorded proof Size = 174

Pallet: "pallet_balances", Extrinsic: "force_set_balance_killing", Lowest values: [], Highest values: [], Steps: 2, Repeat: 1
Raw Storage Info
========
Storage: `NisCounterpartBalances::Account` (r:1 w:1)
Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`)
Storage: `System::Account` (r:1 w:1)
Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    25.59
              µs

Reads = 2
Writes = 2
Recorded proof Size = 277

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=    25.59
              µs

Reads = 2
Writes = 2
Recorded proof Size = 277

Pallet: "pallet_balances", Extrinsic: "force_transfer", Lowest values: [], Highest values: [], Steps: 2, Repeat: 1
Raw Storage Info
========
Storage: `System::Account` (r:2 w:2)
Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=     72.2
              µs

Reads = 2
Writes = 2
Recorded proof Size = 103

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=     72.2
              µs

Reads = 2
Writes = 2
Recorded proof Size = 103

Pallet: "pallet_balances", Extrinsic: "force_transfer", Lowest values: [], Highest values: [], Steps: 2, Repeat: 1
Raw Storage Info
========
Storage: `NisCounterpartBalances::Account` (r:2 w:2)
Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`)
Storage: `System::Account` (r:2 w:2)
Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    63.39
              µs

Reads = 4
Writes = 4
Recorded proof Size = 206

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=    63.39
              µs

Reads = 4
Writes = 4
Recorded proof Size = 206

Pallet: "pallet_balances", Extrinsic: "transfer_all", Lowest values: [], Highest values: [], Steps: 2, Repeat: 1
Raw Storage Info
========
Storage: `System::Account` (r:1 w:1)
Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    67.63
              µs

Reads = 1
Writes = 1
Recorded proof Size = 0

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=    67.63
              µs

Reads = 1
Writes = 1
Recorded proof Size = 0

Pallet: "pallet_balances", Extrinsic: "transfer_all", Lowest values: [], Highest values: [], Steps: 2, Repeat: 1
Raw Storage Info
========
Storage: `NisCounterpartBalances::Account` (r:2 w:2)
Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`)
Storage: `System::Account` (r:1 w:1)
Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    59.34
              µs

Reads = 3
Writes = 3
Recorded proof Size = 103

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=    59.34
              µs

Reads = 3
Writes = 3
Recorded proof Size = 103

Pallet: "pallet_balances", Extrinsic: "force_unreserve", Lowest values: [], Highest values: [], Steps: 2, Repeat: 1
Raw Storage Info
========
Storage: `System::Account` (r:1 w:1)
Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    28.44
              µs

Reads = 1
Writes = 1
Recorded proof Size = 174

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=    28.44
              µs

Reads = 1
Writes = 1
Recorded proof Size = 174

Pallet: "pallet_balances", Extrinsic: "force_unreserve", Lowest values: [], Highest values: [], Steps: 2, Repeat: 1
Raw Storage Info
========
Storage: `NisCounterpartBalances::Account` (r:1 w:1)
Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`)
Storage: `System::Account` (r:1 w:1)
Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    22.72
              µs

Reads = 2
Writes = 2
Recorded proof Size = 277

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=    22.72
              µs

Reads = 2
Writes = 2
Recorded proof Size = 277

Pallet: "pallet_balances", Extrinsic: "upgrade_accounts", Lowest values: [], Highest values: [], Steps: 2, Repeat: 1
Raw Storage Info
========
Storage: `System::Account` (r:1000 w:1000)
Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    11.68
    + u    16.98
              µs

Reads = 0 + (1 * u)
Writes = 0 + (1 * u)
Recorded proof Size = 0 + (135 * u)

Min Squares Analysis
========
-- Extrinsic Time --

Data points distribution:
    u   mean µs  sigma µs       %
    1     28.38     0.286    1.0%
 1000     16900     89.63    0.5%

Quality and confidence:
param     error
u         0.089

Model:
Time ~=    11.49
    + u    16.89
              µs

Reads = 0 + (1 * u)
Writes = 0 + (1 * u)
Recorded proof Size = 103 + (135 * u)

Pallet: "pallet_balances", Extrinsic: "upgrade_accounts", Lowest values: [], Highest values: [], Steps: 2, Repeat: 1
Raw Storage Info
========
Storage: `NisCounterpartBalances::Account` (r:1000 w:1000)
Proof: `NisCounterpartBalances::Account` (`max_values`: None, `max_size`: Some(112), added: 2587, mode: `MaxEncodedLen`)
Storage: `System::Account` (r:1000 w:1000)
Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    4.715
    + u    17.37
              µs

Reads = 0 + (2 * u)
Writes = 0 + (2 * u)
Recorded proof Size = 0 + (255 * u)

Min Squares Analysis
========
-- Extrinsic Time --

Data points distribution:
    u   mean µs  sigma µs       %
    1     21.93     0.155    0.7%
 1000     17350     25.21    0.1%

Quality and confidence:
param     error
u         0.025

Model:
Time ~=    4.585
    + u    17.34
              µs

Reads = 0 + (2 * u)
Writes = 0 + (2 * u)
Recorded proof Size = 206 + (256 * u)

Created file: "./relay/kusama/src/weights/pallet_balances_native.rs"
Created file: "./relay/kusama/src/weights/pallet_balances_nis.rs"

it regenerated two files, exactly as expected:

git status

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   relay/kusama/src/weights/pallet_balances_native.rs
	modified:   relay/kusama/src/weights/pallet_balances_nis.rs

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	kusama-dev-raw.json

@bkontur
Copy link
Contributor Author

bkontur commented Nov 16, 2023

@ggwpez I would suggest just to cherry-pick this commit to your branch to avoid unnecessary begging for approves

bkchr pushed a commit that referenced this pull request Nov 16, 2023
Based on: #78

Without this fix we cannot run benchmarks for kusama/polkadot.

Tested here:
#58 (comment)
@ggwpez ggwpez merged commit 0115fd5 into polkadot-fellows:oty-weight-cleanup Nov 16, 2023
2 of 5 checks passed
@bkontur bkontur deleted the bko-on-oty-weight-cleanup branch November 16, 2023 14:03
fellowship-merge-bot bot added a commit that referenced this pull request Jan 10, 2024
Deleting the weight files of all pallets that were undeployed by the
OpenGov migration.
Kusama still had one duplicate file for the balances.  
Also contains #58

---------

Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Co-authored-by: Branislav Kontur <[email protected]>
Co-authored-by: fellowship-merge-bot[bot] <151052383+fellowship-merge-bot[bot]@users.noreply.github.com>
fellowship-merge-bot bot added a commit that referenced this pull request Mar 12, 2024
Relates to: #223

A type alias `type Nis = pallet_balances::Pallet::<Runtime,
NisCounterpartInstance>;` for the second `pallet_balances` instance was
introduced [here](#58).
Unfortunately, nobody (including myself) realized that `Nis` is also
used for `[pallet_nis, Nis]`. As a result, the benchmark for
`pallet_nis` runs as if it were for `pallet_balances`, and the result
can be seen here:
[link](3bb9a02#diff-9bfa230a9b7f40866df3f84e81dfea72a64cc31bd9ef6e594c3d43582ba76522).

Therefore, this PR fixes this anomaly.

<!-- Remember that you can run `/merge` to enable auto-merge in the PR
-->

<!-- Remember to modify the changelog. If you don't need to modify it,
you can check the following box.
Instead, if you have already modified it, simply delete the following
line. -->

- [x] Does not require a CHANGELOG entry

---------

Co-authored-by: fellowship-merge-bot[bot] <151052383+fellowship-merge-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants