This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Weights for enacting candidates in paras inherent #4172
Open
emostov
wants to merge
36
commits into
master
Choose a base branch
from
zeke-track-enact-candidate
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
7cc81f5
Weights for enacting candidates
emostov eabde24
Multiply enactments by cores
emostov 6b6b037
Apply suggestions from code review
emostov 4187793
Some improvements
emostov 740f71b
Merge branch 'zeke-track-enact-candidate' of https://github.com/parit…
emostov 8724e9a
Apply suggestions from code review
emostov 5ecc2bb
Apply suggestions from code review
emostov eeb158e
Apply suggestions from code review
emostov 973ceeb
Update schedule code upgrade
emostov 5c18ff3
Merge branch 'zeke-track-enact-candidate' of https://github.com/parit…
emostov 9b325b3
fmt
emostov b8a12f2
Add MAX_EXPECTED_CORES_FOR_WEIGHT_CALC
emostov c72080f
Wip
emostov 244ac54
Update to refund with weight based on enact candidates
emostov 8f6113a
fmt
emostov fc713d3
Use saturating arith in enact_candidates_weight
emostov b8bb54e
Try merge origin master
emostov 8443b88
add code comment'
emostov c8bffed
Merge remote-tracking branch 'origin' into zeke-track-enact-candidate
emostov 7b1bc7a
Account for enact_candidate based on availability bitfields
emostov 7e9dcca
Formatting
emostov b9e81bf
Account for enact_candidate weight when calculating total weight
emostov 75c8b96
Or together or bitfields
emostov 615e788
Add cheap bitfields checks when counting ones
emostov 14faefb
Track cores voted for in sanitize_bitfields
emostov ecf1a67
Merge commit '0d92fb4c8b4b418ef1670aab729eeb874f0383a3' into zeke-tra…
emostov 0c0c6a5
Prepare paras_inherent for merging master
emostov a43f56a
Prepare inclusion for merging master
emostov 86fe00f
fmt
emostov 5accd10
Merge 888162259348c7fa3e9ad7454e8056235565efa6 (#4419)
emostov dcb91aa
Merge remote-tracking branch 'origin' into zeke-track-enact-candidate
emostov b97fac2
fmt
emostov a549397
fix diff with file header
emostov 9efb72f
Remove stale TODOs
emostov 3777172
Try merge origin master
emostov 1c10c27
Update runtime/parachains/src/paras.rs
emostov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -964,7 +964,7 @@ impl<T: Config> Pallet<T> { | |
) -> Weight { | ||
<Self as Store>::FutureCodeUpgrades::mutate(&id, |up| { | ||
if up.is_some() { | ||
T::DbWeight::get().reads_writes(1, 0) | ||
T::DbWeight::get().reads_writes(1, 1) | ||
} else { | ||
let expected_at = relay_parent_number + cfg.validation_upgrade_delay; | ||
let next_possible_upgrade_at = | ||
|
@@ -997,11 +997,16 @@ impl<T: Config> Pallet<T> { | |
|
||
let (reads, writes) = Self::increase_code_ref(&new_code_hash, &new_code); | ||
FutureCodeHash::<T>::insert(&id, new_code_hash); | ||
T::DbWeight::get().reads_writes(2 + reads, 3 + writes) | ||
T::DbWeight::get().reads_writes(3 + reads, 3 + writes) | ||
} | ||
}) | ||
} | ||
|
||
/// Worst case weight for `schedule_code_upgrade`. | ||
pub(crate) fn schedule_code_upgrade_weight() -> Weight { | ||
T::DbWeight::get().reads_writes(4, 5) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^ these are notes about how I counted reads and writes |
||
} | ||
|
||
/// Note that a para has progressed to a new head, where the new head was executed in the context | ||
/// of a relay-chain block with given number. This will apply pending code upgrades based | ||
/// on the relay-parent block number provided. | ||
|
@@ -1040,6 +1045,11 @@ impl<T: Config> Pallet<T> { | |
} | ||
} | ||
|
||
/// Worst case weight for `note_new_head`. | ||
pub(crate) fn note_new_head_weight() -> Weight { | ||
T::DbWeight::get().reads_writes(6, 6) | ||
} | ||
emostov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// Fetches the validation code hash for the validation code to be used when validating a block | ||
/// in the context of the given relay-chain height. A second block number parameter may be used | ||
/// to tell the lookup to proceed as if an intermediate parablock has been with the given | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -451,6 +451,18 @@ impl<T: Config> Pallet<T> { | |
weight | ||
} | ||
|
||
/// Worst case weight for `receive_upward_messages`. | ||
pub(crate) fn receive_upward_messages_weight( | ||
max_upward_message_num_per_candidate: u32, | ||
) -> Weight { | ||
use sp_runtime::traits::Zero; | ||
if !max_upward_message_num_per_candidate.is_zero() { | ||
T::DbWeight::get().reads_writes(3, 3) | ||
} else { | ||
0 | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
/// Devote some time into dispatching pending upward messages. | ||
pub(crate) fn process_pending_upward_messages() -> Weight { | ||
let mut weight_used = 0; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.