Trait sp_staking::offence::OffenceReportSystem
source · pub trait OffenceReportSystem<Reporter, Evidence> {
type Longevity: Get<u64>;
// Required methods
fn publish_evidence(evidence: Evidence) -> Result<(), ()>;
fn check_evidence(
evidence: Evidence
) -> Result<(), TransactionValidityError>;
fn process_evidence(
reporter: Reporter,
evidence: Evidence
) -> Result<(), DispatchError>;
}
Expand description
An abstract system to publish, check and process offence evidences.
Implementation details are left opaque and we don’t assume any specific usage scenario for this trait at this level. The main goal is to group together some common actions required during a typical offence report flow.
Even though this trait doesn’t assume too much, this is a general guideline for a typical usage scenario:
-
An offence is detected and an evidence is submitted on-chain via the
OffenceReportSystem::publish_evidence
method. This will construct and submit an extrinsic transaction containing the offence evidence. -
If the extrinsic is unsigned then the transaction receiver may want to perform some preliminary checks before further processing. This is a good place to call the
OffenceReportSystem::check_evidence
method. -
Finally the report extrinsic is executed on-chain. This is where the user calls the
OffenceReportSystem::process_evidence
to consume the offence report and enact any required action.
Required Associated Types§
Required Methods§
sourcefn publish_evidence(evidence: Evidence) -> Result<(), ()>
fn publish_evidence(evidence: Evidence) -> Result<(), ()>
Publish an offence evidence.
Common usage: submit the evidence on-chain via some kind of extrinsic.
sourcefn check_evidence(evidence: Evidence) -> Result<(), TransactionValidityError>
fn check_evidence(evidence: Evidence) -> Result<(), TransactionValidityError>
Check an offence evidence.
Common usage: preliminary validity check before execution (e.g. for unsigned extrinsic quick checks).
sourcefn process_evidence(
reporter: Reporter,
evidence: Evidence
) -> Result<(), DispatchError>
fn process_evidence( reporter: Reporter, evidence: Evidence ) -> Result<(), DispatchError>
Process an offence evidence.
Common usage: enact some form of slashing directly or by forwarding
the evidence to a lower level specialized subsystem (e.g. a handler
implementing ReportOffence
trait).
Implementations on Foreign Types§
source§impl<Reporter, Evidence> OffenceReportSystem<Reporter, Evidence> for ()
impl<Reporter, Evidence> OffenceReportSystem<Reporter, Evidence> for ()
Dummy offence report system.
Doesn’t do anything special and returns Ok(())
for all the actions.