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

Weights per runtime #3019

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open

Weights per runtime #3019

wants to merge 35 commits into from

Conversation

gonzamontiel
Copy link
Contributor

@gonzamontiel gonzamontiel commented Oct 21, 2024

What does it do?

This PR replaces #2939.

It modifies pallet's benchmarks and removes magic numbers to be runtime-dependant.

What important points reviewers should know?

Pallet parachain staking had some fixed numbers that I replaced by values we get from the runtime. This might go against the testing purpose, because now a change on those parameters might go unnoticed in the test. Anyway I think it is an acceptable trade off.

Is there something left for follow-up PRs?

What alternative implementations were considered?

Are there relevant PRs or issues in other repositories (Substrate, Polkadot, Frontier, Cumulus)?

What value does it bring to the blockchain users?

TarekkMA and others added 3 commits October 17, 2024 15:55
…r-runtime

# Conflicts:
#	runtime/common/src/lib.rs
#	runtime/moonbase/src/weights/pallet_xcm_weight_trader.rs
#	runtime/moonbeam/src/lib.rs
#	runtime/moonbeam/src/precompiles.rs
#	runtime/moonriver/src/precompiles.rs
@gonzamontiel gonzamontiel added B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D5-nicetohaveaudit⚠️ PR contains trivial changes to logic that should be properly reviewed. not-breaking Does not need to be mentioned in breaking changes labels Oct 21, 2024
@gonzamontiel gonzamontiel marked this pull request as draft October 21, 2024 12:34
Copy link
Contributor

github-actions bot commented Oct 29, 2024

WASM runtime size check:

Compared to target branch

Moonbase runtime: 2256 KB (no changes) ✅

Moonbeam runtime: 2232 KB (no changes) ✅

Moonriver runtime: 2228 KB (no changes) ✅

Compared to latest release (runtime-3300)

Moonbase runtime: 2256 KB (+228 KB compared to latest release) ⚠️

Moonbeam runtime: 2232 KB (+236 KB compared to latest release) ⚠️

Moonriver runtime: 2228 KB (+236 KB compared to latest release) ⚠️

@gonzamontiel gonzamontiel marked this pull request as ready for review October 30, 2024 14:28
Copy link
Contributor

github-actions bot commented Nov 1, 2024

Coverage Report

@@                      Coverage Diff                      @@
##           master   gonza/weights-per-runtime      +/-   ##
=============================================================
- Coverage   79.00%                      74.55%   -4.45%     
+ Files         305                         375      +70     
+ Lines       88470                       94731    +6261     
=============================================================
+ Hits        69890                       70626     +736     
+ Misses      18580                       24105    +5525     
Files Changed Coverage
/precompiles/relay-data-verifier/src/mock.rs 85.53% (-2.16%) 🔽
/runtime/moonbeam/tests/common/mod.rs 94.74% (+0.06%) 🔼
/runtime/moonriver/tests/common/mod.rs 94.85% (+0.05%) 🔼

Coverage generated Fri Nov 15 20:43:30 UTC 2024

@RomarQ
Copy link
Contributor

RomarQ commented Nov 11, 2024

We also need to update .github/workflows/check-benchmarks.yml file with a strategy to run it against all runtimes.

    strategy:
      matrix:
        runtime: [moonbeam, moonbase, moonriver]

@gonzamontiel gonzamontiel requested review from a team as code owners November 11, 2024 17:00
@noandrea noandrea added the A8-mergeoncegreen Pull request is reviewed well. label Nov 15, 2024
// Standard Error: 22_805
.saturating_add(Weight::from_parts(293_496_971, 0).saturating_mul(n.into()))
// Minimum execution time: 2_128_000 picoseconds.
Weight::from_parts(91_853_295, 3517)
Copy link
Contributor

Choose a reason for hiding this comment

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

Huge increase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's weird, I don't see a big difference in the final weights comparison: 393.97ms to 393.71ms using subweight.

@RomarQ
Copy link
Contributor

RomarQ commented Nov 15, 2024

Check benchmarks workflow was successful: https://github.com/moonbeam-foundation/moonbeam/actions/runs/11854628894

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A8-mergeoncegreen Pull request is reviewed well. B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D5-nicetohaveaudit⚠️ PR contains trivial changes to logic that should be properly reviewed. not-breaking Does not need to be mentioned in breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants