-
Notifications
You must be signed in to change notification settings - Fork 1.6k
inherent disputes: remove per block initializer and disputes timeout event #6937
Changes from 3 commits
4e0f65b
de17b48
882e7d3
a5ba764
91efd2b
4790096
96a5804
4aa0170
0c52e6b
0b98d33
2cc2574
93d9b3a
3abaf1f
eb00f89
589733c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
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. Yes:
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.
Yes, but maybe we should be reverting a block if the dispute hasn't concluded instead of finalizing it after some time? 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. Yes, what we could and probably should do: Revert immediately once f+1 validators voted against a candidate. |
||
<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. | ||
|
Uh oh!
There was an error while loading. Please reload this page.