ethereum

package
v0.0.164 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ForkNamePhase0    = "PHASE0"
	ForkNameAltair    = "ALTAIR"
	ForkNameBellatrix = "BELLATRIX"
	ForkNameCapella   = "CAPELLA"
	ForkNameDeneb     = "DENEB"
	ForkNameElectra   = "ELECTRA"
)

Functions

func CountConsecutiveEmptyBytes added in v0.0.146

func CountConsecutiveEmptyBytes(byteArray []byte, threshold int) int

Types

type BeaconNode

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

func NewBeaconNode

func NewBeaconNode(ctx context.Context, name string, config *Config, log logrus.FieldLogger) (*BeaconNode, error)

func (*BeaconNode) Duties added in v0.0.139

func (b *BeaconNode) Duties() *services.DutiesService

func (*BeaconNode) GetBeaconBlock

func (b *BeaconNode) GetBeaconBlock(ctx context.Context, identifier string, ignoreMetrics ...bool) (*spec.VersionedSignedBeaconBlock, error)

GetBeaconBlock returns a beacon block by its identifier. Blocks can be cached internally.

func (*BeaconNode) LazyLoadBeaconBlock

func (b *BeaconNode) LazyLoadBeaconBlock(identifier string)

func (*BeaconNode) Metadata

func (b *BeaconNode) Metadata() *services.MetadataService

func (*BeaconNode) Node

func (b *BeaconNode) Node() beacon.Node

func (*BeaconNode) OnReady

func (b *BeaconNode) OnReady(_ context.Context, callback func(ctx context.Context) error)

func (*BeaconNode) Start

func (b *BeaconNode) Start(ctx context.Context) error

func (*BeaconNode) Synced

func (b *BeaconNode) Synced(ctx context.Context) error

type Config

type Config struct {
	// The address of the Beacon node to connect to
	BeaconNodeAddress string `yaml:"beaconNodeAddress"`
	// OverrideNetworkName is the name of the network to use for the sentry.
	// If not set, the network name will be retrieved from the beacon node.
	OverrideNetworkName string `yaml:"overrideNetworkName"  default:""`
	// BeaconNodeHeaders is a map of headers to send to the beacon node.
	BeaconNodeHeaders map[string]string `yaml:"beaconNodeHeaders"`
	// BlockCacheSize is the number of blocks to cache.
	BlockCacheSize uint64 `yaml:"blockCacheSize" default:"1000"`
	// BlockCacheTTL is the time to live for blocks in the cache.
	BlockCacheTTL human.Duration `yaml:"blockCacheTtl" default:"1h"`
	// BlockPreloadWorkers is the number of workers to use for preloading blocks.
	BlockPreloadWorkers uint64 `yaml:"blockPreloadWorkers" default:"5"`
	// BlockPreloadQueueSize is the size of the queue for preloading blocks.
	BlockPreloadQueueSize uint64 `yaml:"blockPreloadQueueSize" default:"5000"`
}

func (*Config) Validate

func (c *Config) Validate() error

type Metrics

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

func NewMetrics

func NewMetrics(namespace, beaconNodeName string) *Metrics

func (*Metrics) IncBlockCacheHit

func (m *Metrics) IncBlockCacheHit(network string)

func (*Metrics) IncBlockCacheMiss

func (m *Metrics) IncBlockCacheMiss(network string)

func (*Metrics) IncBlocksFetchErrors

func (m *Metrics) IncBlocksFetchErrors(network string)

func (*Metrics) IncBlocksFetched

func (m *Metrics) IncBlocksFetched(network string)

func (*Metrics) SetPreloadBlockQueueSize

func (m *Metrics) SetPreloadBlockQueueSize(network string, size int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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