mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 00:31:02 +00:00
inherent disputes: remove per block initializer and disputes timeout event (#6937)
* Limit disputes weight and remove initializer code Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * const Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * remove timeout test Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * review feedback #1 Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Remove the new weight limiting for disputes Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * cargo lock Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Remove dispute_conclusion_by_time_out_period Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Enable migrations Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Update guide Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix comment Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * More guide fixes Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Also migrate pending configs Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fix build Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fix test Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> --------- Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
use crate::{configuration, initializer::SessionChangeNotification, session_info};
|
||||
use bitvec::{bitvec, order::Lsb0 as BitOrderLsb0};
|
||||
use frame_support::{ensure, traits::Get, weights::Weight};
|
||||
use frame_support::{ensure, weights::Weight};
|
||||
use frame_system::pallet_prelude::*;
|
||||
use parity_scale_codec::{Decode, Encode};
|
||||
use primitives::{
|
||||
@@ -503,9 +503,6 @@ pub mod pallet {
|
||||
/// A dispute has concluded for or against a candidate.
|
||||
/// `\[para id, candidate hash, dispute result\]`
|
||||
DisputeConcluded(CandidateHash, DisputeResult),
|
||||
/// A dispute has timed out due to insufficient participation.
|
||||
/// `\[para id, candidate hash\]`
|
||||
DisputeTimedOut(CandidateHash),
|
||||
/// A dispute has concluded with supermajority against a candidate.
|
||||
/// Block authors should no longer build on top of this head and should
|
||||
/// instead revert the block at the given height. This should be the
|
||||
@@ -911,26 +908,8 @@ impl StatementSetFilter {
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// Called by the initializer to initialize the disputes module.
|
||||
pub(crate) fn initializer_initialize(now: T::BlockNumber) -> Weight {
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
|
||||
let mut weight = Weight::zero();
|
||||
for (session_index, candidate_hash, mut dispute) in <Disputes<T>>::iter() {
|
||||
weight += T::DbWeight::get().reads_writes(1, 0);
|
||||
|
||||
if dispute.concluded_at.is_none() &&
|
||||
dispute.start + config.dispute_conclusion_by_time_out_period < now
|
||||
{
|
||||
Self::deposit_event(Event::DisputeTimedOut(candidate_hash));
|
||||
|
||||
dispute.concluded_at = Some(now);
|
||||
<Disputes<T>>::insert(session_index, candidate_hash, &dispute);
|
||||
|
||||
weight += T::DbWeight::get().writes(1);
|
||||
}
|
||||
}
|
||||
|
||||
weight
|
||||
pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight {
|
||||
Weight::zero()
|
||||
}
|
||||
|
||||
/// Called by the initializer to finalize the disputes pallet.
|
||||
|
||||
Reference in New Issue
Block a user