slashings

package
v1.0.0-alpha.26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2020 License: GPL-3.0 Imports: 16 Imported by: 40

Documentation

Overview

Package slashings defines an in-memory pool of received slashing events by the beacon node, handling their lifecycle and performing integrity checks before serving them as objects for validators to include in blocks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PendingAttesterSlashing

type PendingAttesterSlashing struct {
	// contains filtered or unexported fields
}

PendingAttesterSlashing represents an attester slashing in the operation pool. Allows for easy binary searching of included validator indexes.

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

Pool implements a struct to maintain pending and recently included attester and proposer slashings. This pool is used by proposers to insert into new blocks.

func NewPool

func NewPool() *Pool

NewPool returns an initialized attester slashing and proposer slashing pool.

func (*Pool) InsertAttesterSlashing

func (p *Pool) InsertAttesterSlashing(
	ctx context.Context,
	state *beaconstate.BeaconState,
	slashing *ethpb.AttesterSlashing,
) error

InsertAttesterSlashing into the pool. This method is a no-op if the attester slashing already exists in the pool, has been included into a block recently, or the validator is already exited.

func (*Pool) InsertProposerSlashing

func (p *Pool) InsertProposerSlashing(
	ctx context.Context,
	state *beaconstate.BeaconState,
	slashing *ethpb.ProposerSlashing,
) error

InsertProposerSlashing into the pool. This method is a no-op if the pending slashing already exists, has been included recently, the validator is already exited, or the validator was already slashed.

func (*Pool) MarkIncludedAttesterSlashing

func (p *Pool) MarkIncludedAttesterSlashing(as *ethpb.AttesterSlashing)

MarkIncludedAttesterSlashing is used when an attester slashing has been included in a beacon block. Every block seen by this node that contains proposer slashings should call this method to include the proposer slashings.

func (*Pool) MarkIncludedProposerSlashing

func (p *Pool) MarkIncludedProposerSlashing(ps *ethpb.ProposerSlashing)

MarkIncludedProposerSlashing is used when an proposer slashing has been included in a beacon block. Every block seen by this node that contains proposer slashings should call this method to include the proposer slashings.

func (*Pool) PendingAttesterSlashings

func (p *Pool) PendingAttesterSlashings(ctx context.Context, state *beaconstate.BeaconState) []*ethpb.AttesterSlashing

PendingAttesterSlashings returns attester slashings that are able to be included into a block. This method will not return more than the block enforced MaxAttesterSlashings.

func (*Pool) PendingProposerSlashings

func (p *Pool) PendingProposerSlashings(ctx context.Context, state *beaconstate.BeaconState) []*ethpb.ProposerSlashing

PendingProposerSlashings returns proposer slashings that are able to be included into a block. This method will not return more than the block enforced MaxProposerSlashings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL