referrerpolicy=no-referrer-when-downgrade

Offence

Trait Offence 

Source
pub trait Offence<Offender> {
    type Slot: Clone + Codec + Ord;

    const ID: Kind;

    // Required methods
    fn offenders(&self) -> Vec<Offender>;
    fn session_index(&self) -> SessionIndex;
    fn validator_set_count(&self) -> u32;
    fn slot(&self) -> Self::Slot;
    fn slash_fraction(&self, offenders_count: u32) -> Perbill;
}
Expand description

A trait implemented by an offence report.

This trait assumes that the offence is legitimate and was validated already.

Examples of offences include: a BABE equivocation or a GRANDPA unjustified vote.

Required Associated Constants§

Source

const ID: Kind

Identifier which is unique for this kind of offence.

Required Associated Types§

Source

type Slot: Clone + Codec + Ord

A type used for grouping offences that happened at the “same time”.

Usually this will be a time slot, representing a point in time on an abstract timescale. But it can also be a more complex grouping strategy.

See Offence::slot for details.

Required Methods§

Source

fn offenders(&self) -> Vec<Offender>

The list of all offenders involved in this incident.

The list has no duplicates, so it is rather a set.

Source

fn session_index(&self) -> SessionIndex

The session index that is used for querying the validator set for the slash_fraction function.

This is used for filtering historical sessions.

Source

fn validator_set_count(&self) -> u32

Return a validator set count at the time when the offence took place.

Source

fn slot(&self) -> Self::Slot

A slot within which this offence happened.

This is used for looking up offences that happened at the “same time”.

The slot is abstract and doesn’t have to be the same across different implementations of this trait. Two offences are considered to happen at the same time iff both session_index and slot are equal.

As an example, for GRANDPA the slot could be a round number and for BABE it could be a slot number. Note that for GRANDPA the round number is reset each epoch.

Source

fn slash_fraction(&self, offenders_count: u32) -> Perbill

A slash fraction of the total exposure that should be slashed for this particular offence for the offenders_count that happened at a singular TimeSlot.

offenders_count - the count of unique offending authorities for this TimeSlot. It is >0.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§