Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

WeightInfo for Session Pallet #7136

Merged
6 commits merged into from
Sep 21, 2020
Merged

WeightInfo for Session Pallet #7136

6 commits merged into from
Sep 21, 2020

Conversation

shawntabrizi
Copy link
Member

@shawntabrizi shawntabrizi commented Sep 18, 2020

polkadot companion: paritytech/polkadot#1735

This is a PR that adds WeightInfo to the Session Pallet as generated by our automated pipeline.

Note that before, the formula for weight was a function of:

T::Keys::key_ids().len()

However, this length is static for the runtime. In the case of the Substrate node, it is:

impl_opaque_keys! {
	pub struct SessionKeys {
		pub grandpa: Grandpa,
		pub babe: Babe,
		pub im_online: ImOnline,
		pub authority_discovery: AuthorityDiscovery,
	}
}

So the length is 4. When running benchmarks, we will use this static length and calculate the reads and writes, and these are consistent with the results from the automated pipeline.

For every runtime, if there is a different set of keys or it changes, they need to rebenchmark this pallet.

This PR also removes WeightInfo from the Offences pallet since it is not used or needed. Pallets that implement OnOffenceHandler will return the appropriate weight to the Offences pallet.

@shawntabrizi shawntabrizi added B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. A0-please_review Pull request needs code review. and removed D2-breaksapi labels Sep 18, 2020
Copy link
Contributor

@gui1117 gui1117 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

Copy link
Contributor

@apopiak apopiak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shawntabrizi
Copy link
Member Author

bot merge

@ghost
Copy link

ghost commented Sep 21, 2020

Trying merge.

@ghost ghost merged commit 4a6b0ae into master Sep 21, 2020
@ghost ghost deleted the shawntabrizi-session-weightinfo branch September 21, 2020 09:13
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders.
Projects
Development

Successfully merging this pull request may close these issues.

4 participants