blstoexec

package
v5.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package blstoexecchanges defines an in-memory pool of received BLS-to-ETH1 change objects. Internally it uses a combination of doubly-linked list and map to handle pool objects. The linked list approach has an advantage over a slice in terms of memory usage. For our scenario, we will mostly append objects to the end and remove objects from arbitrary positions, and during block proposal we will remove objects from the front. The map is used for looking up the list node that needs to be removed when we mark an object as included in a block.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 pool.

func (*Pool) BLSToExecChangesForInclusion

func (p *Pool) BLSToExecChangesForInclusion(st state.ReadOnlyBeaconState) ([]*ethpb.SignedBLSToExecutionChange, error)

BLSToExecChangesForInclusion returns objects that are ready for inclusion. This method will not return more than the block enforced MaxBlsToExecutionChanges.

func (*Pool) InsertBLSToExecChange

func (p *Pool) InsertBLSToExecChange(change *ethpb.SignedBLSToExecutionChange)

InsertBLSToExecChange inserts an object into the pool.

func (*Pool) MarkIncluded

func (p *Pool) MarkIncluded(change *ethpb.SignedBLSToExecutionChange)

MarkIncluded is used when an object has been included in a beacon block. Every block seen by this node should call this method to include the object. This will remove the object from the pool.

func (*Pool) PendingBLSToExecChanges

func (p *Pool) PendingBLSToExecChanges() ([]*ethpb.SignedBLSToExecutionChange, error)

PendingBLSToExecChanges returns all objects from the pool.

func (*Pool) ValidatorExists

func (p *Pool) ValidatorExists(idx primitives.ValidatorIndex) bool

ValidatorExists checks if the bls to execution change object exists for that particular validator.

type PoolManager

type PoolManager interface {
	PendingBLSToExecChanges() ([]*ethpb.SignedBLSToExecutionChange, error)
	BLSToExecChangesForInclusion(beaconState state.ReadOnlyBeaconState) ([]*ethpb.SignedBLSToExecutionChange, error)
	InsertBLSToExecChange(change *ethpb.SignedBLSToExecutionChange)
	MarkIncluded(change *ethpb.SignedBLSToExecutionChange)
	ValidatorExists(idx primitives.ValidatorIndex) bool
}

PoolManager maintains pending and seen BLS-to-execution-change objects. This pool is used by proposers to insert BLS-to-execution-change objects into new blocks.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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