consensus

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NullRoot phase0.Root = phase0.Root{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

Functions

This section is empty.

Types

type ChainSpec

type ChainSpec struct {
	PresetBase                            string            `yaml:"PRESET_BASE"`
	ConfigName                            string            `yaml:"CONFIG_NAME" check-if:"false"`
	MinGenesisTime                        time.Time         `yaml:"MIN_GENESIS_TIME"`
	GenesisForkVersion                    phase0.Version    `yaml:"GENESIS_FORK_VERSION"`
	AltairForkVersion                     phase0.Version    `yaml:"ALTAIR_FORK_VERSION"`
	AltairForkEpoch                       *uint64           `yaml:"ALTAIR_FORK_EPOCH"`
	BellatrixForkVersion                  phase0.Version    `yaml:"BELLATRIX_FORK_VERSION"`
	BellatrixForkEpoch                    *uint64           `yaml:"BELLATRIX_FORK_EPOCH"`
	CapellaForkVersion                    phase0.Version    `yaml:"CAPELLA_FORK_VERSION"`
	CapellaForkEpoch                      *uint64           `yaml:"CAPELLA_FORK_EPOCH"`
	DenebForkVersion                      phase0.Version    `yaml:"DENEB_FORK_VERSION"`
	DenebForkEpoch                        *uint64           `yaml:"DENEB_FORK_EPOCH"`
	ElectraForkVersion                    phase0.Version    `yaml:"ELECTRA_FORK_VERSION" check-if-fork:"ElectraForkEpoch"`
	ElectraForkEpoch                      *uint64           `yaml:"ELECTRA_FORK_EPOCH"   check-if-fork:"ElectraForkEpoch"`
	Eip7594ForkVersion                    phase0.Version    `yaml:"EIP7594_FORK_VERSION" check-if-fork:"Eip7594ForkEpoch"`
	Eip7594ForkEpoch                      *uint64           `yaml:"EIP7594_FORK_EPOCH"   check-if-fork:"Eip7594ForkEpoch"`
	SecondsPerSlot                        time.Duration     `yaml:"SECONDS_PER_SLOT"`
	SlotsPerEpoch                         uint64            `yaml:"SLOTS_PER_EPOCH"`
	EpochsPerHistoricalVector             uint64            `yaml:"EPOCHS_PER_HISTORICAL_VECTOR"`
	EpochsPerSlashingVector               uint64            `yaml:"EPOCHS_PER_SLASHINGS_VECTOR"`
	EpochsPerSyncCommitteePeriod          uint64            `yaml:"EPOCHS_PER_SYNC_COMMITTEE_PERIOD"`
	MinSeedLookahead                      uint64            `yaml:"MIN_SEED_LOOKAHEAD"`
	ShuffleRoundCount                     uint64            `yaml:"SHUFFLE_ROUND_COUNT"`
	MaxEffectiveBalance                   uint64            `yaml:"MAX_EFFECTIVE_BALANCE"`
	MaxEffectiveBalanceElectra            uint64            `yaml:"MAX_EFFECTIVE_BALANCE_ELECTRA" check-if-fork:"ElectraForkEpoch"`
	TargetCommitteeSize                   uint64            `yaml:"TARGET_COMMITTEE_SIZE"`
	MaxCommitteesPerSlot                  uint64            `yaml:"MAX_COMMITTEES_PER_SLOT"`
	MinPerEpochChurnLimit                 uint64            `yaml:"MIN_PER_EPOCH_CHURN_LIMIT"`
	ChurnLimitQuotient                    uint64            `yaml:"CHURN_LIMIT_QUOTIENT"`
	DomainBeaconProposer                  phase0.DomainType `yaml:"DOMAIN_BEACON_PROPOSER"`
	DomainBeaconAttester                  phase0.DomainType `yaml:"DOMAIN_BEACON_ATTESTER"`
	DomainSyncCommittee                   phase0.DomainType `yaml:"DOMAIN_SYNC_COMMITTEE"`
	SyncCommitteeSize                     uint64            `yaml:"SYNC_COMMITTEE_SIZE"`
	DepositContractAddress                []byte            `yaml:"DEPOSIT_CONTRACT_ADDRESS"`
	MaxConsolidationRequestsPerPayload    uint64            `yaml:"MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD" check-if-fork:"ElectraForkEpoch"`
	MaxWithdrawalRequestsPerPayload       uint64            `yaml:"MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD"    check-if-fork:"ElectraForkEpoch"`
	DepositChainId                        uint64            `yaml:"DEPOSIT_CHAIN_ID"`
	MinActivationBalance                  uint64            `yaml:"MIN_ACTIVATION_BALANCE"`
	MaxPendingPartialsPerWithdrawalsSweep uint64            `yaml:"MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP" check-if-fork:"ElectraForkEpoch"`
	MaxPendingDepositsPerEpoch            uint64            `yaml:"MAX_PENDING_DEPOSITS_PER_EPOCH"             check-if-fork:"ElectraForkEpoch"`
	PendingPartialWithdrawalsLimit        uint64            `yaml:"PENDING_PARTIAL_WITHDRAWALS_LIMIT"          check-if-fork:"ElectraForkEpoch"`
	PendingConsolidationsLimit            uint64            `yaml:"PENDING_CONSOLIDATIONS_LIMIT"               check-if-fork:"ElectraForkEpoch"`
	MinPerEpochChurnLimitElectra          uint64            `yaml:"MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA"          check-if-fork:"ElectraForkEpoch"`
	MaxPerEpochActivationExitChurnLimit   uint64            `yaml:"MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT"  check-if-fork:"ElectraForkEpoch"`
	EffectiveBalanceIncrement             uint64            `yaml:"EFFECTIVE_BALANCE_INCREMENT"`
	ShardCommitteePeriod                  uint64            `yaml:"SHARD_COMMITTEE_PERIOD"`

	// EIP7594: PeerDAS
	NumberOfColumns              *uint64 `yaml:"NUMBER_OF_COLUMNS"                check-if-fork:"Eip7594ForkEpoch"`
	DataColumnSidecarSubnetCount *uint64 `yaml:"DATA_COLUMN_SIDECAR_SUBNET_COUNT" check-if-fork:"Eip7594ForkEpoch"`
	CustodyRequirement           *uint64 `yaml:"CUSTODY_REQUIREMENT"              check-if-fork:"Eip7594ForkEpoch"`

	// additional dora specific specs
	WhiskForkEpoch *uint64
}

https://github.com/ethereum/consensus-specs/blob/dev/configs/mainnet.yaml

func (*ChainSpec) CheckMismatch

func (chain *ChainSpec) CheckMismatch(chain2 *ChainSpec) ([]string, error)

func (*ChainSpec) Clone

func (chain *ChainSpec) Clone() *ChainSpec

type ChainState

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

func (*ChainState) CurrentEpoch

func (cs *ChainState) CurrentEpoch() phase0.Epoch

func (*ChainState) CurrentSlot

func (cs *ChainState) CurrentSlot() phase0.Slot

func (*ChainState) EpochOfSlot

func (cs *ChainState) EpochOfSlot(slot phase0.Slot) phase0.Epoch

func (*ChainState) EpochStartSlot

func (cs *ChainState) EpochStartSlot(epoch phase0.Epoch) phase0.Slot

func (*ChainState) EpochToSlot

func (cs *ChainState) EpochToSlot(epoch phase0.Epoch) phase0.Slot

func (*ChainState) EpochToTime

func (cs *ChainState) EpochToTime(epoch phase0.Epoch) time.Time

func (*ChainState) GetActivationExitChurnLimit added in v1.15.0

func (cs *ChainState) GetActivationExitChurnLimit(totalActiveBalance uint64) uint64

func (*ChainState) GetBalanceChurnLimit added in v1.15.0

func (cs *ChainState) GetBalanceChurnLimit(totalActiveBalance uint64) uint64

func (*ChainState) GetFinalizedCheckpoint

func (cs *ChainState) GetFinalizedCheckpoint() (phase0.Epoch, phase0.Root)

func (*ChainState) GetFinalizedSlot

func (cs *ChainState) GetFinalizedSlot() phase0.Slot

func (*ChainState) GetGenesis

func (cs *ChainState) GetGenesis() *v1.Genesis

func (*ChainState) GetJustifiedCheckpoint

func (cs *ChainState) GetJustifiedCheckpoint() (phase0.Epoch, phase0.Root)

func (*ChainState) GetSpecs

func (cs *ChainState) GetSpecs() *ChainSpec

func (*ChainState) GetValidatorChurnLimit

func (cs *ChainState) GetValidatorChurnLimit(validatorCount uint64) uint64

func (*ChainState) SlotToSlotIndex

func (cs *ChainState) SlotToSlotIndex(slot phase0.Slot) phase0.Slot

func (*ChainState) SlotToTime

func (cs *ChainState) SlotToTime(slot phase0.Slot) time.Time

func (*ChainState) TimeToSlot

func (cs *ChainState) TimeToSlot(timestamp time.Time) phase0.Slot

type Client

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

func (*Client) ForceUpdateNodeMetadata added in v1.17.0

func (client *Client) ForceUpdateNodeMetadata(ctx context.Context) error

ForceUpdateNodeMetadata forces an immediate update of node metadata including ENRs, bypassing the normal epoch-based update schedule

func (*Client) GetClientType

func (client *Client) GetClientType() ClientType

func (*Client) GetContext

func (client *Client) GetContext() context.Context

func (*Client) GetEndpointConfig

func (client *Client) GetEndpointConfig() *ClientConfig

func (*Client) GetFinalityCheckpoint

func (client *Client) GetFinalityCheckpoint() (finalitedEpoch phase0.Epoch, finalizedRoot phase0.Root, justifiedEpoch phase0.Epoch, justifiedRoot phase0.Root)

func (*Client) GetIndex

func (client *Client) GetIndex() uint16

func (*Client) GetLastClientError

func (client *Client) GetLastClientError() error

func (*Client) GetLastError

func (client *Client) GetLastError() error

func (*Client) GetLastEventTime

func (client *Client) GetLastEventTime() time.Time

func (*Client) GetLastHead

func (client *Client) GetLastHead() (phase0.Slot, phase0.Root)

func (*Client) GetName

func (client *Client) GetName() string

func (*Client) GetNodeIdentity added in v1.11.2

func (client *Client) GetNodeIdentity() *rpc.NodeIdentity

func (*Client) GetNodePeers

func (client *Client) GetNodePeers() []*v1.Peer

func (*Client) GetPool

func (client *Client) GetPool() *Pool

func (*Client) GetRPCClient

func (client *Client) GetRPCClient() *rpc.BeaconClient

func (*Client) GetStatus

func (client *Client) GetStatus() ClientStatus

func (*Client) GetVersion

func (client *Client) GetVersion() string

func (*Client) SubscribeBlockEvent

func (client *Client) SubscribeBlockEvent(capacity int, blocking bool) *utils.Subscription[*v1.BlockEvent]

func (*Client) SubscribeFinalizedEvent

func (client *Client) SubscribeFinalizedEvent(capacity int) *utils.Subscription[*v1.Finality]

func (*Client) SubscribeHeadEvent

func (client *Client) SubscribeHeadEvent(capacity int, blocking bool) *utils.Subscription[*v1.HeadEvent]

type ClientConfig

type ClientConfig struct {
	URL        string
	Name       string
	Headers    map[string]string
	SshConfig  *sshtunnel.SshConfig
	DisableSSZ bool
}

type ClientStatus

type ClientStatus uint8
var (
	ClientStatusOnline        ClientStatus = 1
	ClientStatusOffline       ClientStatus = 2
	ClientStatusSynchronizing ClientStatus = 3
	ClientStatusOptimistic    ClientStatus = 4
)

func (ClientStatus) String

func (s ClientStatus) String() string

type ClientType

type ClientType int8
var (
	AnyClient        ClientType
	UnknownClient    ClientType = -1
	LighthouseClient ClientType = 1
	LodestarClient   ClientType = 2
	NimbusClient     ClientType = 3
	PrysmClient      ClientType = 4
	TekuClient       ClientType = 5
	GrandineClient   ClientType = 6
	CaplinClient     ClientType = 7
)

func ParseClientType

func ParseClientType(name string) ClientType

func (ClientType) String

func (clientType ClientType) String() string

type ForkVersion

type ForkVersion struct {
	Epoch           uint64
	CurrentVersion  []byte
	PreviousVersion []byte
}

type Pool

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

func NewPool

func NewPool(ctx context.Context, logger logrus.FieldLogger) *Pool

func (*Pool) AddEndpoint

func (pool *Pool) AddEndpoint(endpoint *ClientConfig) (*Client, error)

func (*Pool) AwaitReadyEndpoint

func (pool *Pool) AwaitReadyEndpoint(ctx context.Context, clientType ClientType) *Client

func (*Pool) GetAllEndpoints

func (pool *Pool) GetAllEndpoints() []*Client

func (*Pool) GetChainState

func (pool *Pool) GetChainState() *ChainState

func (*Pool) GetReadyEndpoint

func (pool *Pool) GetReadyEndpoint(clientType ClientType) *Client

func (*Pool) SubscribeFinalizedEvent

func (pool *Pool) SubscribeFinalizedEvent(capacity int) *utils.Subscription[*v1.Finality]

func (*Pool) SubscribeWallclockEpochEvent

func (pool *Pool) SubscribeWallclockEpochEvent(capacity int) *utils.Subscription[*ethwallclock.Epoch]

func (*Pool) SubscribeWallclockSlotEvent

func (pool *Pool) SubscribeWallclockSlotEvent(capacity int) *utils.Subscription[*ethwallclock.Slot]

Directories

Path Synopsis
rpc

Jump to

Keyboard shortcuts

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