consensus

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: GPL-3.0 Imports: 18 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"`
	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"`
	ElectraForkEpoch                   *uint64           `yaml:"ELECTRA_FORK_EPOCH"`
	Eip7594ForkVersion                 phase0.Version    `yaml:"EIP7594_FORK_VERSION"`
	Eip7594ForkEpoch                   *uint64           `yaml:"EIP7594_FORK_EPOCH"`
	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"`
	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"`
	MaxWithdrawalRequestsPerPayload    uint64            `yaml:"MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD"`
	DepositChainId                     uint64            `yaml:"DEPOSIT_CHAIN_ID"`
	MinActivationBalance               uint64            `yaml:"MIN_ACTIVATION_BALANCE"`

	// EIP7594: PeerDAS
	NumberOfColumns              *uint64 `yaml:"NUMBER_OF_COLUMNS"`
	DataColumnSidecarSubnetCount *uint64 `yaml:"DATA_COLUMN_SIDECAR_SUBNET_COUNT"`
	CustodyRequirement           *uint64 `yaml:"CUSTODY_REQUIREMENT"`

	// 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

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) 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) 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) *Subscription[*v1.BlockEvent]

func (*Client) SubscribeFinalizedEvent

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

func (*Client) SubscribeHeadEvent

func (client *Client) SubscribeHeadEvent(capacity int, blocking bool) *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 Dispatcher

type Dispatcher[T interface{}] struct {
	// contains filtered or unexported fields
}

func (*Dispatcher[T]) Fire

func (d *Dispatcher[T]) Fire(data T)

func (*Dispatcher[T]) Subscribe

func (d *Dispatcher[T]) Subscribe(capacity int, blocking bool) *Subscription[T]

func (*Dispatcher[T]) Unsubscribe

func (d *Dispatcher[T]) Unsubscribe(subscription *Subscription[T])

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) *Subscription[*v1.Finality]

func (*Pool) SubscribeWallclockEpochEvent

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

func (*Pool) SubscribeWallclockSlotEvent

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

type Subscription

type Subscription[T interface{}] struct {
	// contains filtered or unexported fields
}

func (*Subscription[T]) Channel

func (s *Subscription[T]) Channel() <-chan T

func (*Subscription[T]) Unsubscribe

func (s *Subscription[T]) Unsubscribe()

Directories

Path Synopsis
rpc

Jump to

Keyboard shortcuts

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