Documentation
¶
Index ¶
- Constants
- type CacheConfig
- type Config
- type Default
- func (d *Default) Finalized(ctx context.Context) (*v1.Finality, error)
- func (d *Default) Genesis(ctx context.Context) (*v1.Genesis, error)
- func (d *Default) GetBeaconStateByRoot(ctx context.Context, root phase0.Root) (*spec.VersionedBeaconState, error)
- func (d *Default) GetBeaconStateBySlot(ctx context.Context, slot phase0.Slot) (*spec.VersionedBeaconState, error)
- func (d *Default) GetBeaconStateByStateRoot(ctx context.Context, stateRoot phase0.Root) (*spec.VersionedBeaconState, error)
- func (d *Default) GetBlobSidecarsBySlot(ctx context.Context, slot phase0.Slot) ([]*deneb.BlobSidecar, error)
- func (d *Default) GetBlockByRoot(ctx context.Context, root phase0.Root) (*spec.VersionedSignedBeaconBlock, error)
- func (d *Default) GetBlockBySlot(ctx context.Context, slot phase0.Slot) (*spec.VersionedSignedBeaconBlock, error)
- func (d *Default) GetBlockByStateRoot(ctx context.Context, stateRoot phase0.Root) (*spec.VersionedSignedBeaconBlock, error)
- func (d *Default) GetDepositSnapshot(ctx context.Context, epoch phase0.Epoch) (*types.DepositSnapshot, error)
- func (d *Default) GetEpochBySlot(ctx context.Context, slot phase0.Slot) (phase0.Epoch, error)
- func (d *Default) GetSlotTime(ctx context.Context, slot phase0.Slot) (eth.SlotTime, error)
- func (d *Default) Head(ctx context.Context) (*v1.Finality, error)
- func (d *Default) Healthy(ctx context.Context) (bool, error)
- func (d *Default) ListFinalizedSlots(ctx context.Context) ([]phase0.Slot, error)
- func (d *Default) OnFinalityCheckpointHeadUpdated(ctx context.Context, ...)
- func (d *Default) OperatingMode() OperatingMode
- func (d *Default) PeerCount(ctx context.Context) (uint64, error)
- func (d *Default) Peers(ctx context.Context) (types.Peers, error)
- func (d *Default) SSZEncoder() *ssz.Encoder
- func (d *Default) Spec() (*state.Spec, error)
- func (d *Default) Start(ctx context.Context) error
- func (d *Default) StartAsync(ctx context.Context)
- func (d *Default) Syncing(ctx context.Context) (*v1.SyncState, error)
- func (d *Default) UpstreamsStatus(ctx context.Context) (map[string]*UpstreamStatus, error)
- type FinalityProvider
- type FrontendConfig
- type Metrics
- type Node
- type Nodes
- func (n Nodes) DataProviders(ctx context.Context) Nodes
- func (n Nodes) Filter(ctx context.Context, f func(*Node) bool) Nodes
- func (n Nodes) Healthy(ctx context.Context) Nodes
- func (n Nodes) NotOptimisticEL(ctx context.Context) Nodes
- func (n Nodes) NotSyncing(ctx context.Context) Nodes
- func (n Nodes) PastFinalizedCheckpoint(ctx context.Context, checkpoint *v1.Finality) Nodes
- func (n Nodes) RandomNode(ctx context.Context) (*Node, error)
- func (n Nodes) Ready(ctx context.Context) Nodes
- func (n Nodes) StartAll(ctx context.Context) error
- func (n Nodes) Syncing(ctx context.Context) Nodes
- type OperatingMode
- type UpstreamStatus
Constants ¶
View Source
const ( // FinalityHaltedServingPeriod defines how long we will happily serve finality data for after the chain has stopped finality. // TODO(sam.calder-mason): Derive from weak subjectivity period. FinalityHaltedServingPeriod = 14 * 24 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheConfig ¶
type CacheConfig struct {
// Blocks holds the block cache configuration.
Blocks store.Config `yaml:"blocks" default:"{\"MaxItems\": 30}"`
// States holds the state cache configuration.
States store.Config `yaml:"states" default:"{\"MaxItems\": 5}"`
// DepositSnapshots holds the deposit snapshot cache configuration.
DepositSnapshots store.Config `yaml:"deposit_snapshots" default:"{\"MaxItems\": 30}"`
// BlobSidecars holds the blob sidecar cache configuration.
BlobSidecars store.Config `yaml:"blob_sidecars" default:"{\"MaxItems\": 30}"`
}
Cache configuration holds configuration for the caches.
func (*CacheConfig) Validate ¶
func (c *CacheConfig) Validate() error
type Config ¶
type Config struct {
// Mode sets the operational mode of the provider.
Mode OperatingMode `yaml:"mode" default:"light"`
// CustomPreset enables the use of a custom preset for the provider.
CustomPreset bool `yaml:"custom_preset" default:"false"`
// Cache holds configuration for the caches.
Caches CacheConfig `yaml:"caches"`
// HistoricalEpochCount determines how many historical epochs the provider will cache.
HistoricalEpochCount int `yaml:"historical_epoch_count" default:"20"`
// Cache holds configuration for the caches.
Frontend FrontendConfig `yaml:"frontend"`
}
Config holds configuration for running a FinalityProvider config
type Default ¶
type Default struct {
// contains filtered or unexported fields
}
func (*Default) GetBeaconStateByRoot ¶
func (*Default) GetBeaconStateBySlot ¶
func (*Default) GetBeaconStateByStateRoot ¶
func (*Default) GetBlobSidecarsBySlot ¶ added in v0.20.0
func (*Default) GetBlockByRoot ¶
func (*Default) GetBlockBySlot ¶
func (*Default) GetBlockByStateRoot ¶
func (*Default) GetDepositSnapshot ¶ added in v0.15.0
func (*Default) GetEpochBySlot ¶
func (*Default) GetSlotTime ¶
func (*Default) ListFinalizedSlots ¶
func (*Default) OnFinalityCheckpointHeadUpdated ¶
func (*Default) OperatingMode ¶
func (d *Default) OperatingMode() OperatingMode
func (*Default) SSZEncoder ¶ added in v0.31.0
func (*Default) StartAsync ¶
func (*Default) UpstreamsStatus ¶
type FinalityProvider ¶
type FinalityProvider interface {
// Start starts the provider.
Start(ctx context.Context) error
// StartAsync starts the provider in a goroutine.
StartAsync(ctx context.Context)
// Healthy returns true if the provider is healthy.
Healthy(ctx context.Context) (bool, error)
// Peers returns the peers the provider is connected to).
Peers(ctx context.Context) (types.Peers, error)
// PeerCount returns the amount of peers the provider is connected to (the amount of healthy upstreams).
PeerCount(ctx context.Context) (uint64, error)
// Syncing returns the sync state of the provider.
Syncing(ctx context.Context) (*v1.SyncState, error)
// Head returns the head finality.
Head(ctx context.Context) (*v1.Finality, error)
// Finalized returns the finalized finality.
Finalized(ctx context.Context) (*v1.Finality, error)
// Genesis returns the chain genesis.
Genesis(ctx context.Context) (*v1.Genesis, error)
// Spec returns the chain spec.
Spec() (*state.Spec, error)
// SSZEncoder returns the SSZ encoder for the provider.
SSZEncoder() *ssz.Encoder
// UpstreamsStatus returns the status of all the upstreams.
UpstreamsStatus(ctx context.Context) (map[string]*UpstreamStatus, error)
// GetBlockBySlot returns the block at the given slot.
GetBlockBySlot(ctx context.Context, slot phase0.Slot) (*spec.VersionedSignedBeaconBlock, error)
// GetBlockByRoot returns the block with the given root.
GetBlockByRoot(ctx context.Context, root phase0.Root) (*spec.VersionedSignedBeaconBlock, error)
// GetBlockByStateRoot returns the block with the given root.
GetBlockByStateRoot(ctx context.Context, root phase0.Root) (*spec.VersionedSignedBeaconBlock, error)
// GetBeaconStateBySlot returns the beacon sate with the given slot.
GetBeaconStateBySlot(ctx context.Context, slot phase0.Slot) (*spec.VersionedBeaconState, error)
// GetBeaconStateByStateRoot returns the beacon sate with the given state root.
GetBeaconStateByStateRoot(ctx context.Context, root phase0.Root) (*spec.VersionedBeaconState, error)
// GetBeaconStateByRoot returns the beacon sate with the given root.
GetBeaconStateByRoot(ctx context.Context, root phase0.Root) (*spec.VersionedBeaconState, error)
// GetBlobSidecarsBySlot returns the blob sidecars for the given slot.
GetBlobSidecarsBySlot(ctx context.Context, slot phase0.Slot) ([]*deneb.BlobSidecar, error)
// ListFinalizedSlots returns a slice of finalized slots.
ListFinalizedSlots(ctx context.Context) ([]phase0.Slot, error)
// GetEpochBySlot returns the epoch for the given slot.
GetEpochBySlot(ctx context.Context, slot phase0.Slot) (phase0.Epoch, error)
// OperatingMode returns the mode of operation for the instance.
OperatingMode() OperatingMode
// GetSlotTime returns the wall clock for the given slot.
GetSlotTime(ctx context.Context, slot phase0.Slot) (eth.SlotTime, error)
// GetDepositSnapshot returns the deposit snapshot at the given epoch.
GetDepositSnapshot(ctx context.Context, epoch phase0.Epoch) (*types.DepositSnapshot, error)
}
FinalityProvider is a provider of finality information.
func NewDefaultProvider ¶
func NewDefaultProvider(namespace string, log logrus.FieldLogger, nodes []node.Config, config *Config) FinalityProvider
type FrontendConfig ¶
type FrontendConfig struct {
// Enabled flag enables the frontend assets to be served
Enabled bool `yaml:"enabled" default:"true"`
// PublicURL is the public URL where checkpointz will be served from
PublicURL string `yaml:"public_url"`
// BrandName is the name of the brand to display in the frontend
BrandName string `yaml:"brand_name"`
// BrandImageURL is the URL of the brand image to be displayed on the frontend
BrandImageURL string `yaml:"brand_image_url"`
}
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
func NewMetrics ¶
func (*Metrics) ObserveHeadEpoch ¶
func (*Metrics) ObserveOperatingMode ¶
func (m *Metrics) ObserveOperatingMode(mode OperatingMode)
func (*Metrics) ObserveServingEpoch ¶
type Nodes ¶
type Nodes []*Node
func NewNodesFromConfig ¶
func (Nodes) NotOptimisticEL ¶ added in v0.26.0
func (Nodes) PastFinalizedCheckpoint ¶
type OperatingMode ¶
type OperatingMode string
const ( OperatingModeFull OperatingMode = "full" OperatingModeLight OperatingMode = "light" )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.