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

Weights for enacting candidates in paras inherent #4172

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7cc81f5
Weights for enacting candidates
emostov Oct 28, 2021
eabde24
Multiply enactments by cores
emostov Oct 28, 2021
6b6b037
Apply suggestions from code review
emostov Oct 28, 2021
4187793
Some improvements
emostov Oct 29, 2021
740f71b
Merge branch 'zeke-track-enact-candidate' of https://github.com/parit…
emostov Oct 29, 2021
8724e9a
Apply suggestions from code review
emostov Oct 29, 2021
5ecc2bb
Apply suggestions from code review
emostov Oct 29, 2021
eeb158e
Apply suggestions from code review
emostov Oct 29, 2021
973ceeb
Update schedule code upgrade
emostov Oct 29, 2021
5c18ff3
Merge branch 'zeke-track-enact-candidate' of https://github.com/parit…
emostov Oct 29, 2021
9b325b3
fmt
emostov Oct 29, 2021
b8a12f2
Add MAX_EXPECTED_CORES_FOR_WEIGHT_CALC
emostov Oct 31, 2021
c72080f
Wip
emostov Nov 17, 2021
244ac54
Update to refund with weight based on enact candidates
emostov Nov 17, 2021
8f6113a
fmt
emostov Nov 17, 2021
fc713d3
Use saturating arith in enact_candidates_weight
emostov Nov 17, 2021
b8bb54e
Try merge origin master
emostov Nov 24, 2021
8443b88
add code comment'
emostov Nov 24, 2021
c8bffed
Merge remote-tracking branch 'origin' into zeke-track-enact-candidate
emostov Nov 26, 2021
7b1bc7a
Account for enact_candidate based on availability bitfields
emostov Nov 28, 2021
7e9dcca
Formatting
emostov Nov 28, 2021
b9e81bf
Account for enact_candidate weight when calculating total weight
emostov Nov 28, 2021
75c8b96
Or together or bitfields
emostov Nov 30, 2021
615e788
Add cheap bitfields checks when counting ones
emostov Dec 1, 2021
14faefb
Track cores voted for in sanitize_bitfields
emostov Dec 2, 2021
ecf1a67
Merge commit '0d92fb4c8b4b418ef1670aab729eeb874f0383a3' into zeke-tra…
emostov Dec 2, 2021
0c0c6a5
Prepare paras_inherent for merging master
emostov Dec 2, 2021
a43f56a
Prepare inclusion for merging master
emostov Dec 2, 2021
86fe00f
fmt
emostov Dec 2, 2021
5accd10
Merge 888162259348c7fa3e9ad7454e8056235565efa6 (#4419)
emostov Dec 2, 2021
dcb91aa
Merge remote-tracking branch 'origin' into zeke-track-enact-candidate
emostov Dec 2, 2021
b97fac2
fmt
emostov Dec 2, 2021
a549397
fix diff with file header
emostov Dec 6, 2021
9efb72f
Remove stale TODOs
emostov Dec 6, 2021
3777172
Try merge origin master
emostov Dec 10, 2021
1c10c27
Update runtime/parachains/src/paras.rs
emostov Dec 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion runtime/parachains/src/inclusion/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ impl<T: Config> Pallet<T> {
<AvailabilityBitfields<T>>::insert(&validator_index, record);
}

let mut enacted_candidate_weight = 0;
let mut enacted_candidate_weight: Weight = 0;
let threshold = availability_threshold(validators.len());

let mut freed_cores = Vec::with_capacity(expected_bits);
Expand Down
38 changes: 0 additions & 38 deletions runtime/parachains/src/paras.rs
Original file line number Diff line number Diff line change
Expand Up @@ -990,44 +990,6 @@ impl<T: Config> Pallet<T> {
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
/// relay-chain height as its context. This may return the hash for the past, current, or
/// (with certain choices of `assume_intermediate`) future code.
///
/// `assume_intermediate`, if provided, must be before `at`. This will return `None` if the validation
/// code has been pruned.
///
/// To get associated code see [`Self::validation_code_at`].
pub(crate) fn validation_code_hash_at(
emostov marked this conversation as resolved.
Show resolved Hide resolved
id: ParaId,
at: T::BlockNumber,
assume_intermediate: Option<T::BlockNumber>,
) -> Option<ValidationCodeHash> {
if assume_intermediate.as_ref().map_or(false, |i| &at <= i) {
return None
}

let planned_upgrade = <Self as Store>::FutureCodeUpgrades::get(&id);
let upgrade_applied_intermediate = match assume_intermediate {
Some(a) => planned_upgrade.as_ref().map_or(false, |u| u <= &a),
None => false,
};

if upgrade_applied_intermediate {
FutureCodeHash::<T>::get(&id)
} else {
match Self::past_code_meta(&id).code_at(at) {
None => None,
Some(UseCodeAt::Current) => CurrentCodeHash::<T>::get(&id),
Some(UseCodeAt::ReplacedAt(replaced)) =>
<Self as Store>::PastCodeHash::get(&(id, replaced)),
}
}
}

/// Returns the current lifecycle state of the para.
pub fn lifecycle(id: ParaId) -> Option<ParaLifecycle> {
ParaLifecycles::<T>::get(&id)
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.