mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 01:41:03 +00:00
[runtime] follow up relay chain cleanups (#4657)
* fix miscalculation of remaining weight * rename a var * move out enforcing filtering by dropping inherents * prepare for dispute statement validity check being split off * refactor * refactor, only check disputes we actually want to include * more refactor and documentation * refactor and minimize inherent checks * chore: warnings * fix a few tests * fix dedup regression * fix * more asserts in tests * remove some asserts * chore: fmt * skip signatures checks, some more * undo unwatend changes * Update runtime/parachains/src/paras_inherent/mod.rs Co-authored-by: sandreim <54316454+sandreim@users.noreply.github.com> * cleanups, checking CheckedDisputeStatments makes no sense * integrity, if called create_inherent_inner, it shall do the checks, and not rely on enter_inner * review comments * use from impl rather than into * remove outdated comment * adjust tests accordingly * assure no weight is lost * address review comments * remove unused import * split error into two and document * use assurance, O(n) * Revert "adjust tests accordingly" This reverts commit 3cc9a3c449f82db38cea22c48f4a21876603374b. * fix comment * fix sorting * comment Co-authored-by: sandreim <54316454+sandreim@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
883b490cae
commit
b7a05fd40b
@@ -77,18 +77,29 @@ pub fn paras_inherent_total_weight<T: Config>(
|
||||
) -> Weight {
|
||||
backed_candidates_weight::<T>(backed_candidates)
|
||||
.saturating_add(signed_bitfields_weight::<T>(bitfields.len()))
|
||||
.saturating_add(dispute_statements_weight::<T>(disputes))
|
||||
.saturating_add(multi_dispute_statement_sets_weight::<T, _, _>(disputes))
|
||||
}
|
||||
|
||||
pub fn dispute_statements_weight<T: Config>(disputes: &[DisputeStatementSet]) -> Weight {
|
||||
pub fn dispute_statement_set_weight<T: Config, S: AsRef<DisputeStatementSet>>(
|
||||
statement_set: S,
|
||||
) -> Weight {
|
||||
<<T as Config>::WeightInfo as WeightInfo>::enter_variable_disputes(
|
||||
statement_set.as_ref().statements.len() as u32,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn multi_dispute_statement_sets_weight<
|
||||
T: Config,
|
||||
D: AsRef<[S]>,
|
||||
S: AsRef<DisputeStatementSet>,
|
||||
>(
|
||||
disputes: D,
|
||||
) -> Weight {
|
||||
disputes
|
||||
.as_ref()
|
||||
.iter()
|
||||
.map(|d| {
|
||||
<<T as Config>::WeightInfo as WeightInfo>::enter_variable_disputes(
|
||||
d.statements.len() as u32
|
||||
)
|
||||
})
|
||||
.fold(0, |acc, x| acc.saturating_add(x))
|
||||
.map(|d| dispute_statement_set_weight::<T, &S>(d))
|
||||
.fold(0, |acc_weight, weight| acc_weight.saturating_add(weight))
|
||||
}
|
||||
|
||||
pub fn signed_bitfields_weight<T: Config>(bitfields_len: usize) -> Weight {
|
||||
|
||||
Reference in New Issue
Block a user