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

Update System Weights #5888

Merged
merged 28 commits into from
May 7, 2020
Merged

Update System Weights #5888

merged 28 commits into from
May 7, 2020

Conversation

shawntabrizi
Copy link
Member

@shawntabrizi shawntabrizi commented May 4, 2020

This PR updates the weights of FRAME System

Pretty straightforward, but we should be extra careful of the functions that use a full block (set_code and set_code_without_checks).

I would like to make sure there is no trivial mistake here that would prevent this extrinsic from entering a block. Does anyone see any issues?

Notable Changes:

  • I updated the API for kill_prefix to allow the Root user to tell us the number of subkeys under a prefix so that we may weight the function correctly. This parameter is not checked.
  • I added to Sudo pallet a sudo_unchecked_weight function, which ignores the weight of the dispatch call and instead uses any weight defined by the Sudo user. This can be helpful when trying to push a runtime upgrade where you dont have (or want) the scheduler.

frame/system/src/lib.rs Outdated Show resolved Hide resolved
frame/system/src/lib.rs Outdated Show resolved Hide resolved
frame/system/src/lib.rs Outdated Show resolved Hide resolved
@shawntabrizi shawntabrizi added the A0-please_review Pull request needs code review. label May 5, 2020
@shawntabrizi shawntabrizi added this to the 2.0 milestone May 5, 2020
@shawntabrizi shawntabrizi changed the title Update System Weights Update System and Offences Weights May 5, 2020
@shawntabrizi shawntabrizi changed the title Update System and Offences Weights Update System Weights May 5, 2020
@shawntabrizi shawntabrizi added A3-in_progress Pull request is in progress. No review needed at this stage. and removed A0-please_review Pull request needs code review. labels May 5, 2020
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.

just some suggestions

frame/system/src/lib.rs Outdated Show resolved Hide resolved
frame/system/src/lib.rs Outdated Show resolved Hide resolved
frame/system/src/lib.rs Outdated Show resolved Hide resolved
frame/system/src/lib.rs Outdated Show resolved Hide resolved
@gavofyork
Copy link
Member

This also updates the configuration of Scheduler so that MaximumWeight is always MaximumBlockWeight as defined in System throughout tests and in the node-runtime

This is erroneous. There are instances where you may wish the Scheduler to be able to schedule a lower amount of weight than the block. It's quite reasonable, for instance, that you would only want to give 50% of the block over to (non-mandatory) scheduled tasks and leave the remainder for transactions.

frame/scheduler/src/lib.rs Outdated Show resolved Hide resolved
frame/sudo/src/lib.rs Show resolved Hide resolved
@shawntabrizi
Copy link
Member Author

The weight is now updated using append on deposit_log.

So I believe this can get any final reviews and green check-marks.

@shawntabrizi shawntabrizi requested review from athei, gui1117 and apopiak May 6, 2020 22:37
bin/node/runtime/src/lib.rs Outdated Show resolved Hide resolved
frame/scheduler/src/lib.rs Outdated Show resolved Hide resolved
frame/system/src/lib.rs Outdated Show resolved Hide resolved
@shawntabrizi shawntabrizi added A8-mergeoncegreen and removed A0-please_review Pull request needs code review. labels May 7, 2020
@shawntabrizi
Copy link
Member Author

bot merge

@gavofyork gavofyork merged commit 6b66b17 into master May 7, 2020
@gavofyork gavofyork deleted the shawntabrizi-system-weight branch May 7, 2020 12:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants