-
Notifications
You must be signed in to change notification settings - Fork 356
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
Generate weights for runtime #2442
Conversation
Coverage generated "Mon Aug 28 18:35:26 UTC 2023": Master coverage: 87.39% |
// Minimum execution time: 18_446_744_073_709_551_000 picoseconds. | ||
Weight::from_parts(500_000_000_000, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing 500_000_000_000
was hard coded, but why the huge Minimum execution time
number?
Weight::from_parts(70_805_524, 26879) | ||
// Standard Error: 8_036 | ||
.saturating_add(Weight::from_parts(84_366, 0).saturating_mul(x.into())) | ||
.saturating_add(T::DbWeight::get().reads(6_u64)) | ||
// Measured: `1421 + x * (38 ±0)` | ||
// Estimated: `4752 + x * (41 ±0)` | ||
// Minimum execution time: 75_412_000 picoseconds. | ||
Weight::from_parts(85_543_270, 4752) | ||
// Standard Error: 2_633 | ||
.saturating_add(Weight::from_parts(213_586, 0).saturating_mul(x.into())) | ||
.saturating_add(T::DbWeight::get().reads(7_u64)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pretty big increase, is it expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, did these staking ones change because they're generated by a proper runtime instead of a mock runtime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...actually, why is staking the only one where we touched the pallet-level weights? They went up for the most part, which is probably "safe." It's used by other projects which may not generate their own weights, so maybe that's a good thing 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The weights of some pallets were relying on substrate part that were not correctly configured.
I think the goal is to get default values for external team, but still generate weights for our runtimes once ready
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So yes we want to provide weight by default on pallets, and then a weight for our runtimes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I spot-checked a few of the results and they look consistently lower, which is to be expected with improved hardware.
The exception is parachain-staking
, I don't have an opinion on whether we want those changes or not, so maybe just ensure it's intentional.
parachain-staking is the one of the reasons we changed those weights, like auto-compound (which also will have a fix separately). |
Do we have a tool that would display all the weight changes per function ? |
What does it do?
Generates weights for the runtime. Uses the
./scripts/run-benches-for-runtime.sh
adapated from polkadot's. Each pallet has its own weight file that contains a generated traitWeightInfo
as per the included template. Upon running therun-benches-for-runtime.sh
the default template is used which merely implements theWeightInfo
from the respective pallet's ownweights.rs
module, with the values for the current runtime.The current PR uses weights generated by the benchmarking server, so is production ready.
Reference hardware for collators
Benchmarks introduced in this PR were run over a
c6i.4xlarge
AWS instance. It is recommended that the hardware used to run a collator matches the following specs in order to ensure the proper block production in time, as well as to prevent other performance issues.CPU
Storage
Memory
System
Network
What important points reviewers should know?
runtime-common
, however that can be easily changed if needed.moonbeam-xcm-benchmarks
diverges on how polkadot uses the generated weights - namely this runtime/weights/mod.rs file implements what we're currently doing in themoonbeam-xcm-benchmarks
pallet, this ends up causing a circular dependency onruntime-common
so the xcm weights are currently left untouched. All other pallets are migrated.Is there something left for follow-up PRs?
Figure out how to use XCM weights to be used from runtime-common isntead.
Are there relevant PRs or issues in other repositories (Substrate, Polkadot, Frontier, Cumulus)?
Fix benchmarks in frontier: polkadot-evm/frontier#1162
Currently we're using a patched substrate on our fork moonbeam-foundation/substrate#67 since the
ED = 0
constraint caused these benchmarks to fail. We should probably copy these benchmarks in moonbeam and maintain them going forward.Other repos that were fixed:
Moonsong-Labs/moonkit#4
moonbeam-foundation/crowdloan-rewards#69