consensus

package
v0.0.0-...-bbb243d Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GasElasticityMultiplier         = 2
	BaseFeeChangeDenominator uint64 = 8
)

Variables

This section is empty.

Functions

func FetchRandao

func FetchRandao(ctx context.Context, httpClient *eth2api.Eth2HttpClient, slot types.Slot) (types.Hash, error)

Types

type Client

type Client struct {
	SlotsPerEpoch  uint64
	SecondsPerSlot uint64
	GenesisTime    uint64

	GenesisValidatorsRoot types.Root
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, endpoint string, logger *zap.Logger) (*Client, error)

func (*Client) FetchBlock

func (c *Client) FetchBlock(ctx context.Context, slot types.Slot) error

func (*Client) FetchProposers

func (c *Client) FetchProposers(ctx context.Context, epoch types.Epoch) error

func (*Client) FetchValidators

func (c *Client) FetchValidators(ctx context.Context) error

TODO handle reorgs

func (*Client) GetBaseFeeForProposal

func (c *Client) GetBaseFeeForProposal(slot types.Slot) (*types.Uint256, error)

func (*Client) GetBlock

func (c *Client) GetBlock(slot types.Slot) (*bellatrix.SignedBeaconBlock, error)

func (*Client) GetBlockNumberForProposal

func (c *Client) GetBlockNumberForProposal(slot types.Slot) (uint64, error)

func (*Client) GetForkVersion

func (c *Client) GetForkVersion(slot types.Slot) types.ForkVersion

NOTE: this assumes the fork schedule is presented in ascending order

func (*Client) GetParentGasLimit

func (c *Client) GetParentGasLimit(ctx context.Context, blockNumber uint64) (uint64, error)

func (*Client) GetParentHash

func (c *Client) GetParentHash(ctx context.Context, slot types.Slot) (types.Hash, error)

func (*Client) GetProposer

func (c *Client) GetProposer(slot types.Slot) (*ValidatorInfo, error)

func (*Client) GetProposerPublicKey

func (c *Client) GetProposerPublicKey(ctx context.Context, slot types.Slot) (*types.PublicKey, error)

func (*Client) GetPublicKeyForIndex

func (c *Client) GetPublicKeyForIndex(ctx context.Context, validatorIndex types.ValidatorIndex) (*types.PublicKey, error)

func (*Client) GetRandomnessForProposal

func (c *Client) GetRandomnessForProposal(slot types.Slot) (types.Hash, error)

func (*Client) GetValidator

func (c *Client) GetValidator(publicKey *types.PublicKey) (*eth2api.ValidatorResponse, error)

func (*Client) GetValidatorStatus

func (c *Client) GetValidatorStatus(publicKey *types.PublicKey) (ValidatorStatus, error)

func (*Client) LoadCurrentContext

func (c *Client) LoadCurrentContext(ctx context.Context, currentSlot types.Slot, currentEpoch types.Epoch) error

func (*Client) SignatureDomain

func (c *Client) SignatureDomain(slot types.Slot) crypto.Domain

func (*Client) SignatureDomainForBuilder

func (c *Client) SignatureDomainForBuilder() crypto.Domain

func (*Client) StreamHeads

func (c *Client) StreamHeads(ctx context.Context) <-chan types.Coordinate

type Clock

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

func NewClock

func NewClock(genesisTime, secondsPerSlot, slotsPerEpoch uint64) *Clock

func (*Clock) CurrentSlot

func (c *Clock) CurrentSlot(currentTime int64) types.Slot

func (*Clock) EpochForSlot

func (c *Clock) EpochForSlot(slot types.Slot) types.Epoch

func (*Clock) SlotInSeconds

func (c *Clock) SlotInSeconds(slot types.Slot) int64

func (*Clock) TickEpochs

func (c *Clock) TickEpochs(ctx context.Context) chan types.Epoch

func (*Clock) TickSlots

func (c *Clock) TickSlots(ctx context.Context) chan types.Slot

type RandaoResponse

type RandaoResponse struct {
	Randao common.Root `json:"randao"`
}

type ValidatorInfo

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

type ValidatorStatus

type ValidatorStatus string
const (
	StatusValidatorUnknown ValidatorStatus = "unknown"
	StatusValidatorActive  ValidatorStatus = "active"
	StatusValidatorPending ValidatorStatus = "pending"
)

Jump to

Keyboard shortcuts

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