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 ¶
- type PendingAttesterSlashing
- type Pool
- func (p *Pool) InsertAttesterSlashing(ctx context.Context, state state.ReadOnlyBeaconState, ...) error
- func (p *Pool) InsertProposerSlashing(ctx context.Context, state state.ReadOnlyBeaconState, ...) error
- func (p *Pool) MarkIncludedAttesterSlashing(as ethpb.AttSlashing)
- func (p *Pool) MarkIncludedProposerSlashing(ps *ethpb.ProposerSlashing)
- func (p *Pool) PendingAttesterSlashings(ctx context.Context, state state.ReadOnlyBeaconState, noLimit bool) []ethpb.AttSlashing
- func (p *Pool) PendingProposerSlashings(ctx context.Context, state state.ReadOnlyBeaconState, noLimit bool) []*ethpb.ProposerSlashing
- type PoolInserter
- type PoolManager
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 is a concrete implementation of PoolManager.
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 state.ReadOnlyBeaconState, slashing ethpb.AttSlashing, ) 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 state.ReadOnlyBeaconState, 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.AttSlashing)
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 state.ReadOnlyBeaconState, noLimit bool) []ethpb.AttSlashing
PendingAttesterSlashings returns attester slashings that are able to be included into a block. This method will return the amount of pending attester slashings for a block transition unless parameter `noLimit` is true to indicate the request is for noLimit pending items.
func (*Pool) PendingProposerSlashings ¶
func (p *Pool) PendingProposerSlashings(ctx context.Context, state state.ReadOnlyBeaconState, noLimit bool) []*ethpb.ProposerSlashing
PendingProposerSlashings returns proposer slashings that are able to be included into a block. This method will return the amount of pending proposer slashings for a block transition unless the `noLimit` parameter is set to true to indicate the request is for noLimit pending items.
type PoolInserter ¶
type PoolInserter interface { InsertAttesterSlashing( ctx context.Context, state state.ReadOnlyBeaconState, slashing ethpb.AttSlashing, ) error InsertProposerSlashing( ctx context.Context, state state.ReadOnlyBeaconState, slashing *ethpb.ProposerSlashing, ) error }
PoolInserter is capable of inserting new slashing objects into the operations pool.
type PoolManager ¶
type PoolManager interface { PoolInserter PendingAttesterSlashings(ctx context.Context, state state.ReadOnlyBeaconState, noLimit bool) []ethpb.AttSlashing PendingProposerSlashings(ctx context.Context, state state.ReadOnlyBeaconState, noLimit bool) []*ethpb.ProposerSlashing MarkIncludedAttesterSlashing(as ethpb.AttSlashing) MarkIncludedProposerSlashing(ps *ethpb.ProposerSlashing) }
PoolManager maintains a pool of pending and recently included attester and proposer slashings. This pool is used by proposers to insert data into new blocks.