proposerpreferences

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package proposerpreferences handles listening to, validating, and caching proposer preferences received via the P2P gossip network.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache stores proposer preferences by slot. Thread-safe. Only the first valid preference per slot is stored (subsequent ones for the same slot are ignored).

func NewCache

func NewCache() *Cache

NewCache creates an empty proposer preferences cache.

func (*Cache) Add

func (c *Cache) Add(slot phase0.Slot, prefs *gloas.SignedProposerPreferences) bool

Add stores proposer preferences for a slot. If the slot already exists, the existing value is kept and false is returned.

func (*Cache) Clear

func (c *Cache) Clear()

Clear removes all cached proposer preferences.

func (*Cache) Get

Get returns proposer preferences for a slot.

func (*Cache) GetAll

func (c *Cache) GetAll() map[phase0.Slot]*gloas.SignedProposerPreferences

GetAll returns a copy of all cached proposer preferences.

func (*Cache) Has

func (c *Cache) Has(slot phase0.Slot) bool

Has returns true if proposer preferences for the slot already exist.

func (*Cache) PruneBefore

func (c *Cache) PruneBefore(slot phase0.Slot)

PruneBefore removes all proposer preferences for slots before the provided slot.

func (*Cache) SetStateDB

func (c *Cache) SetStateDB(stateDB *db.Database, log logrus.FieldLogger)

SetStateDB attaches an optional state-db for best-effort write-through persistence and loads any previously-persisted preferences into the cache.

type Service

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

Service listens to proposer preferences from the beacon node's SSE event stream and caches the latest preference per slot.

func NewService

func NewService(clClient *beacon.Client, log logrus.FieldLogger) *Service

NewService creates a new proposer preferences service.

func (*Service) GetCache

func (s *Service) GetCache() *Cache

GetCache returns the underlying cache for direct access.

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

Start subscribes to the proposer_preferences SSE topic and begins processing events.

func (*Service) Stop

func (s *Service) Stop()

Stop stops the service.

Jump to

Keyboard shortcuts

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