pub trait DisputesHandler<BlockNumber: Ord> {
// Required methods
fn is_frozen() -> bool;
fn filter_dispute_data(
statement_set: DisputeStatementSet,
post_conclusion_acceptance_period: BlockNumber,
) -> Option<CheckedDisputeStatementSet>;
fn process_checked_multi_dispute_data(
statement_sets: &CheckedMultiDisputeStatementSet,
) -> Result<Vec<(SessionIndex, CandidateHash)>, DispatchError>;
fn note_included(
session: SessionIndex,
candidate_hash: CandidateHash,
included_in: BlockNumber,
);
fn included_state(
session: SessionIndex,
candidate_hash: CandidateHash,
) -> Option<BlockNumber>;
fn concluded_invalid(
session: SessionIndex,
candidate_hash: CandidateHash,
) -> bool;
fn initializer_initialize(now: BlockNumber) -> Weight;
fn initializer_finalize();
fn initializer_on_new_session(
notification: &SessionChangeNotification<BlockNumber>,
);
// Provided method
fn deduplicate_and_sort_dispute_data(
statement_sets: &mut MultiDisputeStatementSet,
) -> Result<(), ()> { ... }
}
Expand description
Hook into disputes handling.
Allows decoupling parachains handling from disputes so that it can potentially be disabled when instantiating a specific runtime.
Required Methods§
sourcefn is_frozen() -> bool
fn is_frozen() -> bool
Whether the chain is frozen, if the chain is frozen it will not accept any new parachain blocks for backing or inclusion.
sourcefn filter_dispute_data(
statement_set: DisputeStatementSet,
post_conclusion_acceptance_period: BlockNumber,
) -> Option<CheckedDisputeStatementSet>
fn filter_dispute_data( statement_set: DisputeStatementSet, post_conclusion_acceptance_period: BlockNumber, ) -> Option<CheckedDisputeStatementSet>
Filter a single dispute statement set.
Used in cases where more granular control is required, i.e. when accounting for maximum block weight.
sourcefn process_checked_multi_dispute_data(
statement_sets: &CheckedMultiDisputeStatementSet,
) -> Result<Vec<(SessionIndex, CandidateHash)>, DispatchError>
fn process_checked_multi_dispute_data( statement_sets: &CheckedMultiDisputeStatementSet, ) -> Result<Vec<(SessionIndex, CandidateHash)>, DispatchError>
Handle sets of dispute statements corresponding to 0 or more candidates. Returns a vector of freshly created disputes.
sourcefn note_included(
session: SessionIndex,
candidate_hash: CandidateHash,
included_in: BlockNumber,
)
fn note_included( session: SessionIndex, candidate_hash: CandidateHash, included_in: BlockNumber, )
Note that the given candidate has been included.
sourcefn included_state(
session: SessionIndex,
candidate_hash: CandidateHash,
) -> Option<BlockNumber>
fn included_state( session: SessionIndex, candidate_hash: CandidateHash, ) -> Option<BlockNumber>
Retrieve the included state of a given candidate in a particular session. If it
returns Some
, then we have a local dispute for the given candidate_hash
.
sourcefn concluded_invalid(
session: SessionIndex,
candidate_hash: CandidateHash,
) -> bool
fn concluded_invalid( session: SessionIndex, candidate_hash: CandidateHash, ) -> bool
Whether the given candidate concluded invalid in a dispute with supermajority.
sourcefn initializer_initialize(now: BlockNumber) -> Weight
fn initializer_initialize(now: BlockNumber) -> Weight
Called by the initializer to initialize the disputes pallet.
sourcefn initializer_finalize()
fn initializer_finalize()
Called by the initializer to finalize the disputes pallet.
sourcefn initializer_on_new_session(
notification: &SessionChangeNotification<BlockNumber>,
)
fn initializer_on_new_session( notification: &SessionChangeNotification<BlockNumber>, )
Called by the initializer to note that a new session has started.
Provided Methods§
sourcefn deduplicate_and_sort_dispute_data(
statement_sets: &mut MultiDisputeStatementSet,
) -> Result<(), ()>
fn deduplicate_and_sort_dispute_data( statement_sets: &mut MultiDisputeStatementSet, ) -> Result<(), ()>
Remove dispute statement duplicates and sort the non-duplicates based on local (lower indices) vs remotes (higher indices) and age (older with lower indices).
Returns Ok(())
if no duplicates were present, Err(())
otherwise.
Unsorted data does not change the return value, while the node side is generally expected to pass them in sorted.