pub trait HandleEquivocation<T: Config> {
    type Offence: GrandpaOffence<T::KeyOwnerIdentification>;
    type ReportLongevity: Get<u64>;

    // Required methods
    fn report_offence(
        reporters: Vec<T::AccountId>,
        offence: Self::Offence
    ) -> Result<(), OffenceError>;
    fn is_known_offence(
        offenders: &[T::KeyOwnerIdentification],
        time_slot: &<Self::Offence as Offence<T::KeyOwnerIdentification>>::TimeSlot
    ) -> bool;
    fn submit_unsigned_equivocation_report(
        equivocation_proof: EquivocationProof<T::Hash, T::BlockNumber>,
        key_owner_proof: T::KeyOwnerProof
    ) -> DispatchResult;
    fn block_author() -> Option<T::AccountId>;
}
Expand description

A trait with utility methods for handling equivocation reports in GRANDPA. The offence type is generic, and the trait provides , reporting an offence triggered by a valid equivocation report, and also for creating and submitting equivocation report extrinsics (useful only in offchain context).

Required Associated Types§

source

type Offence: GrandpaOffence<T::KeyOwnerIdentification>

The offence type used for reporting offences on valid equivocation reports.

source

type ReportLongevity: Get<u64>

The longevity, in blocks, that the equivocation report is valid for. When using the staking pallet this should be equal to the bonding duration (in blocks, not eras).

Required Methods§

source

fn report_offence( reporters: Vec<T::AccountId>, offence: Self::Offence ) -> Result<(), OffenceError>

Report an offence proved by the given reporters.

source

fn is_known_offence( offenders: &[T::KeyOwnerIdentification], time_slot: &<Self::Offence as Offence<T::KeyOwnerIdentification>>::TimeSlot ) -> bool

Returns true if all of the offenders at the given time slot have already been reported.

source

fn submit_unsigned_equivocation_report( equivocation_proof: EquivocationProof<T::Hash, T::BlockNumber>, key_owner_proof: T::KeyOwnerProof ) -> DispatchResult

Create and dispatch an equivocation report extrinsic.

source

fn block_author() -> Option<T::AccountId>

Fetch the current block author id, if defined.

Implementations on Foreign Types§

source§

impl<T: Config> HandleEquivocation<T> for ()

Implementors§