beacon

package
v0.0.0-...-4b51c2d Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Code generated by fastssz. DO NOT EDIT. Hash: 7b06aa2a0612821c21a42cced443e791afc5c4f842d09312d0f29e40102138a3 Version: 0.1.3

Index

Constants

View Source
const (
	LightClientBootstrap        storage.ContentType = 0x10
	LightClientUpdate           storage.ContentType = 0x11
	LightClientFinalityUpdate   storage.ContentType = 0x12
	LightClientOptimisticUpdate storage.ContentType = 0x13
	HistoricalSummaries         storage.ContentType = 0x14
)
View Source
const BytesInMB uint64 = 1000 * 1000
View Source
const ContentKeyLookupQueryBeacon = `SELECT content_key FROM beacon WHERE content_id = (?1) LIMIT 1`
View Source
const ContentSizeLookupQueryBeacon = "SELECT content_size FROM beacon WHERE content_id = (?1)"
View Source
const ContentValueLookupQueryBeacon = `SELECT content_value FROM beacon WHERE content_id = (?1) LIMIT 1`
View Source
const CreateQueryDBBeacon = `` /* 242-byte string literal not displayed */
View Source
const DeleteQueryBeacon = `DELETE FROM beacon
    WHERE content_id = (?1)`
View Source
const GenesisTime uint64 = 1606824023
View Source
const InsertLCUpdateQuery = `INSERT OR IGNORE INTO lc_update (period, value, score, update_size)
				  VALUES (?1, ?2, ?3, ?4)`
View Source
const InsertQueryBeacon = `` /* 135-byte string literal not displayed */
View Source
const LCUpdateCreateTable = `` /* 241-byte string literal not displayed */
View Source
const LCUpdateLookupQuery = `SELECT value FROM lc_update WHERE period = (?1) LIMIT 1`
View Source
const LCUpdateLookupQueryByRange = `SELECT value FROM lc_update WHERE period >= (?1) AND period < (?2)`
View Source
const LCUpdatePeriodLookupQuery = `SELECT period FROM lc_update WHERE period = (?1) LIMIT 1`
View Source
const LCUpdateTotalSizeQuery = `SELECT TOTAL(update_size) FROM lc_update`
View Source
const MainnetType = iota
View Source
const MaxRequestLightClientUpdates = 128
View Source
const TotalDataSizeQueryBeacon = "SELECT TOTAL(content_size) FROM beacon"
View Source
const TotalEntryCountQueryBeacon = "SELECT COUNT(*) FROM beacon"

Variables

View Source
var (
	ErrInsufficientParticipation     = errors.New("insufficient participation")
	ErrInvalidTimestamp              = errors.New("invalid timestamp")
	ErrInvalidPeriod                 = errors.New("invalid sync committee period")
	ErrNotRelevant                   = errors.New("update not relevant")
	ErrInvalidFinalityProof          = errors.New("invalid finality proof")
	ErrInvalidNextSyncCommitteeProof = errors.New("invalid next sync committee proof")
	ErrInvalidSignature              = errors.New("invalid sync committee signature")
)
View Source
var (
	Bellatrix common.ForkDigest = [4]byte{0x0, 0x0, 0x0, 0x0}
	Capella   common.ForkDigest = [4]byte{0xbb, 0xa4, 0xda, 0x96}
	Deneb     common.ForkDigest = [4]byte{0x6a, 0x95, 0xa1, 0xa9}
)

Functions

func BuildHistoricalSummariesProof

func BuildHistoricalSummariesProof(beaconState deneb.BeaconState) ([][]byte, error)

func CalcSyncPeriod

func CalcSyncPeriod(slot uint64) uint64

func ComputeSigningRoot

func ComputeSigningRoot(root common.Root, domain common.BLSDomain) common.Root

func IsFinalityProofValid

func IsFinalityProofValid(attestedHeader common.BeaconBlockHeader, finalityHeader common.BeaconBlockHeader, finalityBranch altair.FinalizedRootProofBranch) bool

func IsNextCommitteeProofValid

func IsNextCommitteeProofValid(attestedHeader common.BeaconBlockHeader, nextCommittee common.SyncCommittee, nextCommitteeBranch altair.SyncCommitteeProofBranch) bool

func NewBeaconStorage

func NewBeaconStorage(config storage2.PortalStorageConfig, db *sql.DB) (storage2.ContentStorage, error)

Types

type API

type API struct {
	*portalwire.PortalProtocolAPI
}

func NewBeaconNetworkAPI

func NewBeaconNetworkAPI(BeaconAPI *portalwire.PortalProtocolAPI) *API

func (*API) BeaconAddEnr

func (p *API) BeaconAddEnr(enr string) (bool, error)

func (*API) BeaconDeleteEnr

func (p *API) BeaconDeleteEnr(nodeId string) (bool, error)

func (*API) BeaconFindContent

func (p *API) BeaconFindContent(enr string, contentKey string) (interface{}, error)

func (*API) BeaconFindNodes

func (p *API) BeaconFindNodes(enr string, distances []uint) ([]string, error)

func (*API) BeaconGetContent

func (p *API) BeaconGetContent(contentKeyHex string) (*portalwire.ContentInfo, error)

func (*API) BeaconGetEnr

func (p *API) BeaconGetEnr(nodeId string) (string, error)

func (*API) BeaconGossip

func (p *API) BeaconGossip(contentKeyHex, contentHex string) (int, error)

func (*API) BeaconLocalContent

func (p *API) BeaconLocalContent(contentKeyHex string) (string, error)

func (*API) BeaconLookupEnr

func (p *API) BeaconLookupEnr(nodeId string) (string, error)

func (*API) BeaconOffer

func (p *API) BeaconOffer(enr string, contentItems [][2]string) (string, error)

func (*API) BeaconPing

func (p *API) BeaconPing(enr string) (*portalwire.PortalPongResp, error)

func (*API) BeaconRecursiveFindNodes

func (p *API) BeaconRecursiveFindNodes(nodeId string) ([]string, error)

func (*API) BeaconRoutingTableInfo

func (p *API) BeaconRoutingTableInfo() *portalwire.RoutingTableInfo

func (*API) BeaconStore

func (p *API) BeaconStore(contentKeyHex string, contextHex string) (bool, error)

func (*API) BeaconTraceGetContent

func (p *API) BeaconTraceGetContent(contentKeyHex string) (*portalwire.TraceContentResult, error)

type BaseConfig

type BaseConfig struct {
	APIPort           uint64
	API               string
	DefaultCheckpoint common.Root
	Chain             ChainConfig
	Spec              *common.Spec
	MaxCheckpointAge  uint64
}

func Mainnet

func Mainnet() *BaseConfig

func ToBaseConfig

func ToBaseConfig(networkType int) (*BaseConfig, error)

type ChainConfig

type ChainConfig struct {
	ChainID     uint64
	GenesisTime uint64
	GenesisRoot common.Root
}

type Config

type Config struct {
	ConsensusAPI         string
	Port                 uint64
	DefaultCheckpoint    common.Root
	Checkpoint           common.Root
	DataDir              string
	Chain                ChainConfig
	Spec                 *common.Spec
	MaxCheckpointAge     uint64
	Fallback             string
	LoadExternalFallback bool
	StrictCheckpointAge  bool
}

type ConsensusAPI

type ConsensusAPI interface {
	GetBootstrap(blockRoot common.Root) (common.SpecObj, error)
	GetUpdates(firstPeriod, count uint64) ([]common.SpecObj, error)
	GetFinalityUpdate() (common.SpecObj, error)
	GetOptimisticUpdate() (common.SpecObj, error)
	ChainID() uint64
	Name() string
}

type ConsensusLightClient

type ConsensusLightClient struct {
	Store             LightClientStore
	API               ConsensusAPI
	InitialCheckpoint common.Root
	LastCheckpoint    common.Root
	Config            *Config
	Logger            log.Logger
}

func NewConsensusLightClient

func NewConsensusLightClient(api ConsensusAPI, config *Config, checkpointBlockRoot common.Root, logger log.Logger) (*ConsensusLightClient, error)

func (*ConsensusLightClient) Advance

func (c *ConsensusLightClient) Advance() error

func (*ConsensusLightClient) ApplyFinalityUpdate

func (c *ConsensusLightClient) ApplyFinalityUpdate(update common.SpecObj) error

func (*ConsensusLightClient) ApplyGenericUpdate

func (c *ConsensusLightClient) ApplyGenericUpdate(update *GenericUpdate)

func (*ConsensusLightClient) ApplyOptimisticUpdate

func (c *ConsensusLightClient) ApplyOptimisticUpdate(update common.SpecObj) error

func (*ConsensusLightClient) ApplyUpdate

func (c *ConsensusLightClient) ApplyUpdate(update common.SpecObj) error

func (*ConsensusLightClient) ComputeCommitteeSignRoot

func (c *ConsensusLightClient) ComputeCommitteeSignRoot(headerRoot tree.Root, slot common.Slot) common.Root

func (*ConsensusLightClient) GetFinalityHeader

func (c *ConsensusLightClient) GetFinalityHeader() *common.BeaconBlockHeader

func (*ConsensusLightClient) GetHeader

func (*ConsensusLightClient) Sync

func (c *ConsensusLightClient) Sync() error

func (*ConsensusLightClient) VerifyFinalityUpdate

func (c *ConsensusLightClient) VerifyFinalityUpdate(update common.SpecObj) error

func (*ConsensusLightClient) VerifyGenericUpdate

func (c *ConsensusLightClient) VerifyGenericUpdate(update *GenericUpdate) error

func (*ConsensusLightClient) VerifyOptimisticUpdate

func (c *ConsensusLightClient) VerifyOptimisticUpdate(update common.SpecObj) error

func (*ConsensusLightClient) VerifySyncCommitteeSignature

func (c *ConsensusLightClient) VerifySyncCommitteeSignature(pks []common.BLSPubkey, attestedHeader common.BeaconBlockHeader, signature common.BLSSignature, signatureSlot common.Slot) (bool, error)

func (*ConsensusLightClient) VerifyUpdate

func (c *ConsensusLightClient) VerifyUpdate(update common.SpecObj) error

type ForkedHistoricalSummariesWithProof

type ForkedHistoricalSummariesWithProof struct {
	ForkDigest                   common.ForkDigest
	HistoricalSummariesWithProof HistoricalSummariesWithProof
}

func (ForkedHistoricalSummariesWithProof) ByteLength

func (fhswp ForkedHistoricalSummariesWithProof) ByteLength(spec *common.Spec) uint64

func (*ForkedHistoricalSummariesWithProof) Deserialize

func (ForkedHistoricalSummariesWithProof) FixedLength

func (fhswp ForkedHistoricalSummariesWithProof) FixedLength(_ *common.Spec) uint64

func (ForkedHistoricalSummariesWithProof) HashTreeRoot

func (fhswp ForkedHistoricalSummariesWithProof) HashTreeRoot(spec *common.Spec, h tree.HashFn) common.Root

func (*ForkedHistoricalSummariesWithProof) Serialize

type ForkedLightClientBootstrap

type ForkedLightClientBootstrap struct {
	ForkDigest common.ForkDigest
	Bootstrap  common.SpecObj
}

func GetLightClientBootstrap

func GetLightClientBootstrap(number uint8) (ForkedLightClientBootstrap, error)

func (*ForkedLightClientBootstrap) ByteLength

func (flcb *ForkedLightClientBootstrap) ByteLength(spec *common.Spec) uint64

func (*ForkedLightClientBootstrap) Deserialize

func (flcb *ForkedLightClientBootstrap) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*ForkedLightClientBootstrap) FixedLength

func (flcb *ForkedLightClientBootstrap) FixedLength(_ *common.Spec) uint64

func (*ForkedLightClientBootstrap) HashTreeRoot

func (flcb *ForkedLightClientBootstrap) HashTreeRoot(spec *common.Spec, h tree.HashFn) common.Root

func (*ForkedLightClientBootstrap) Serialize

func (flcb *ForkedLightClientBootstrap) Serialize(spec *common.Spec, w *codec.EncodingWriter) error

type ForkedLightClientFinalityUpdate

type ForkedLightClientFinalityUpdate struct {
	ForkDigest                common.ForkDigest
	LightClientFinalityUpdate common.SpecObj
}

func GetLightClientFinalityUpdate

func GetLightClientFinalityUpdate(number uint8) (ForkedLightClientFinalityUpdate, error)

func (*ForkedLightClientFinalityUpdate) ByteLength

func (flcfu *ForkedLightClientFinalityUpdate) ByteLength(spec *common.Spec) uint64

func (*ForkedLightClientFinalityUpdate) Deserialize

func (flcfu *ForkedLightClientFinalityUpdate) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*ForkedLightClientFinalityUpdate) FixedLength

func (flcfu *ForkedLightClientFinalityUpdate) FixedLength(_ *common.Spec) uint64

func (*ForkedLightClientFinalityUpdate) HashTreeRoot

func (flcfu *ForkedLightClientFinalityUpdate) HashTreeRoot(spec *common.Spec, h tree.HashFn) common.Root

func (*ForkedLightClientFinalityUpdate) Serialize

type ForkedLightClientOptimisticUpdate

type ForkedLightClientOptimisticUpdate struct {
	ForkDigest                  common.ForkDigest
	LightClientOptimisticUpdate common.SpecObj
}

func GetLightClientOptimisticUpdate

func GetLightClientOptimisticUpdate(number uint8) (ForkedLightClientOptimisticUpdate, error)

func (*ForkedLightClientOptimisticUpdate) ByteLength

func (flcou *ForkedLightClientOptimisticUpdate) ByteLength(spec *common.Spec) uint64

func (*ForkedLightClientOptimisticUpdate) Deserialize

func (flcou *ForkedLightClientOptimisticUpdate) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*ForkedLightClientOptimisticUpdate) FixedLength

func (flcou *ForkedLightClientOptimisticUpdate) FixedLength(_ *common.Spec) uint64

func (*ForkedLightClientOptimisticUpdate) HashTreeRoot

func (flcou *ForkedLightClientOptimisticUpdate) HashTreeRoot(spec *common.Spec, h tree.HashFn) common.Root

func (*ForkedLightClientOptimisticUpdate) Serialize

type ForkedLightClientUpdate

type ForkedLightClientUpdate struct {
	ForkDigest        common.ForkDigest
	LightClientUpdate common.SpecObj
}

func GetClientUpdate

func GetClientUpdate(number uint8) (ForkedLightClientUpdate, error)

func (*ForkedLightClientUpdate) ByteLength

func (flcu *ForkedLightClientUpdate) ByteLength(spec *common.Spec) uint64

func (*ForkedLightClientUpdate) Deserialize

func (flcu *ForkedLightClientUpdate) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*ForkedLightClientUpdate) FixedLength

func (flcu *ForkedLightClientUpdate) FixedLength(_ *common.Spec) uint64

func (*ForkedLightClientUpdate) HashTreeRoot

func (flcu *ForkedLightClientUpdate) HashTreeRoot(spec *common.Spec, h tree.HashFn) common.Root

func (*ForkedLightClientUpdate) Serialize

func (flcu *ForkedLightClientUpdate) Serialize(spec *common.Spec, w *codec.EncodingWriter) error

type GenericBootstrap

type GenericBootstrap struct {
	Header                     *common.BeaconBlockHeader
	CurrentSyncCommittee       common.SyncCommittee
	CurrentSyncCommitteeBranch altair.SyncCommitteeProofBranch
}

func FromBootstrap

func FromBootstrap(commonBootstrap common.SpecObj) (*GenericBootstrap, error)

type GenericUpdate

type GenericUpdate struct {
	AttestedHeader          *common.BeaconBlockHeader
	SyncAggregate           *altair.SyncAggregate
	SignatureSlot           common.Slot
	NextSyncCommittee       *common.SyncCommittee
	NextSyncCommitteeBranch *altair.SyncCommitteeProofBranch
	FinalizedHeader         *common.BeaconBlockHeader
	FinalityBranch          *altair.FinalizedRootProofBranch
}

func FromLightClientFinalityUpdate

func FromLightClientFinalityUpdate(commonFinalityUpdate common.SpecObj) (*GenericUpdate, error)

func FromLightClientOptimisticUpdate

func FromLightClientOptimisticUpdate(commonOptimisticUpdate common.SpecObj) (*GenericUpdate, error)

func FromLightClientUpdate

func FromLightClientUpdate(commonUpdate common.SpecObj) (*GenericUpdate, error)

type HistoricalSummariesProof

type HistoricalSummariesProof struct {
	Proof [5]common.Bytes32
}

func (*HistoricalSummariesProof) ByteLength

func (hsp *HistoricalSummariesProof) ByteLength() uint64

func (*HistoricalSummariesProof) Deserialize

func (hsp *HistoricalSummariesProof) Deserialize(dr *codec.DecodingReader) error

func (*HistoricalSummariesProof) FixedLength

func (hsp *HistoricalSummariesProof) FixedLength() uint64

func (*HistoricalSummariesProof) HashTreeRoot

func (hsp *HistoricalSummariesProof) HashTreeRoot(hFn tree.HashFn) common.Root

func (*HistoricalSummariesProof) Serialize

type HistoricalSummariesWithProof

type HistoricalSummariesWithProof struct {
	EPOCH               common.Epoch
	HistoricalSummaries capella.HistoricalSummaries
	Proof               HistoricalSummariesProof
}

func GetHistorySummariesWithProof

func GetHistorySummariesWithProof() (HistoricalSummariesWithProof, common.Root, error)

func (*HistoricalSummariesWithProof) ByteLength

func (hswp *HistoricalSummariesWithProof) ByteLength(spec *common.Spec) uint64

func (*HistoricalSummariesWithProof) Deserialize

func (hswp *HistoricalSummariesWithProof) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*HistoricalSummariesWithProof) FixedLength

func (hswp *HistoricalSummariesWithProof) FixedLength(_ *common.Spec) uint64

func (*HistoricalSummariesWithProof) HashTreeRoot

func (hswp *HistoricalSummariesWithProof) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root

func (*HistoricalSummariesWithProof) Serialize

type HistoricalSummariesWithProofKey

type HistoricalSummariesWithProofKey struct {
	Epoch uint64
}

func (HistoricalSummariesWithProofKey) ByteLength

func (v HistoricalSummariesWithProofKey) ByteLength() uint64

func (*HistoricalSummariesWithProofKey) Deserialize

func (HistoricalSummariesWithProofKey) FixedLength

func (v HistoricalSummariesWithProofKey) FixedLength() uint64

func (HistoricalSummariesWithProofKey) HashTreeRoot

func (HistoricalSummariesWithProofKey) Serialize

type LightClientBootstrapKey

type LightClientBootstrapKey struct {
	BlockHash []byte `ssz-size:"32"`
}

func (*LightClientBootstrapKey) GetTree

func (l *LightClientBootstrapKey) GetTree() (*ssz.Node, error)

GetTree ssz hashes the LightClientBootstrapKey object

func (*LightClientBootstrapKey) HashTreeRoot

func (l *LightClientBootstrapKey) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the LightClientBootstrapKey object

func (*LightClientBootstrapKey) HashTreeRootWith

func (l *LightClientBootstrapKey) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the LightClientBootstrapKey object with a hasher

func (*LightClientBootstrapKey) MarshalSSZ

func (l *LightClientBootstrapKey) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the LightClientBootstrapKey object

func (*LightClientBootstrapKey) MarshalSSZTo

func (l *LightClientBootstrapKey) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the LightClientBootstrapKey object to a target array

func (*LightClientBootstrapKey) SizeSSZ

func (l *LightClientBootstrapKey) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the LightClientBootstrapKey object

func (*LightClientBootstrapKey) UnmarshalSSZ

func (l *LightClientBootstrapKey) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the LightClientBootstrapKey object

type LightClientFinalityUpdateKey

type LightClientFinalityUpdateKey struct {
	FinalizedSlot uint64
}

func (*LightClientFinalityUpdateKey) GetTree

func (l *LightClientFinalityUpdateKey) GetTree() (*ssz.Node, error)

GetTree ssz hashes the LightClientFinalityUpdateKey object

func (*LightClientFinalityUpdateKey) HashTreeRoot

func (l *LightClientFinalityUpdateKey) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the LightClientFinalityUpdateKey object

func (*LightClientFinalityUpdateKey) HashTreeRootWith

func (l *LightClientFinalityUpdateKey) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the LightClientFinalityUpdateKey object with a hasher

func (*LightClientFinalityUpdateKey) MarshalSSZ

func (l *LightClientFinalityUpdateKey) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the LightClientFinalityUpdateKey object

func (*LightClientFinalityUpdateKey) MarshalSSZTo

func (l *LightClientFinalityUpdateKey) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the LightClientFinalityUpdateKey object to a target array

func (*LightClientFinalityUpdateKey) SizeSSZ

func (l *LightClientFinalityUpdateKey) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the LightClientFinalityUpdateKey object

func (*LightClientFinalityUpdateKey) UnmarshalSSZ

func (l *LightClientFinalityUpdateKey) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the LightClientFinalityUpdateKey object

type LightClientOptimisticUpdateKey

type LightClientOptimisticUpdateKey struct {
	OptimisticSlot uint64
}

func (*LightClientOptimisticUpdateKey) GetTree

func (l *LightClientOptimisticUpdateKey) GetTree() (*ssz.Node, error)

GetTree ssz hashes the LightClientOptimisticUpdateKey object

func (*LightClientOptimisticUpdateKey) HashTreeRoot

func (l *LightClientOptimisticUpdateKey) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the LightClientOptimisticUpdateKey object

func (*LightClientOptimisticUpdateKey) HashTreeRootWith

func (l *LightClientOptimisticUpdateKey) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the LightClientOptimisticUpdateKey object with a hasher

func (*LightClientOptimisticUpdateKey) MarshalSSZ

func (l *LightClientOptimisticUpdateKey) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the LightClientOptimisticUpdateKey object

func (*LightClientOptimisticUpdateKey) MarshalSSZTo

func (l *LightClientOptimisticUpdateKey) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the LightClientOptimisticUpdateKey object to a target array

func (*LightClientOptimisticUpdateKey) SizeSSZ

func (l *LightClientOptimisticUpdateKey) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the LightClientOptimisticUpdateKey object

func (*LightClientOptimisticUpdateKey) UnmarshalSSZ

func (l *LightClientOptimisticUpdateKey) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the LightClientOptimisticUpdateKey object

type LightClientStore

type LightClientStore struct {
	FinalizedHeader               *common.BeaconBlockHeader
	CurrentSyncCommittee          *common.SyncCommittee
	NextSyncCommittee             *common.SyncCommittee
	OptimisticHeader              *common.BeaconBlockHeader
	PreviousMaxActiveParticipants view.Uint64View
	CurrentMaxActiveParticipants  view.Uint64View
}

type LightClientUpdateKey

type LightClientUpdateKey struct {
	StartPeriod uint64
	Count       uint64
}

func (*LightClientUpdateKey) GetTree

func (l *LightClientUpdateKey) GetTree() (*ssz.Node, error)

GetTree ssz hashes the LightClientUpdateKey object

func (*LightClientUpdateKey) HashTreeRoot

func (l *LightClientUpdateKey) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the LightClientUpdateKey object

func (*LightClientUpdateKey) HashTreeRootWith

func (l *LightClientUpdateKey) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the LightClientUpdateKey object with a hasher

func (*LightClientUpdateKey) MarshalSSZ

func (l *LightClientUpdateKey) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the LightClientUpdateKey object

func (*LightClientUpdateKey) MarshalSSZTo

func (l *LightClientUpdateKey) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the LightClientUpdateKey object to a target array

func (*LightClientUpdateKey) SizeSSZ

func (l *LightClientUpdateKey) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the LightClientUpdateKey object

func (*LightClientUpdateKey) UnmarshalSSZ

func (l *LightClientUpdateKey) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the LightClientUpdateKey object

type LightClientUpdateRange

type LightClientUpdateRange []ForkedLightClientUpdate

func (LightClientUpdateRange) ByteLength

func (r LightClientUpdateRange) ByteLength(spec *common.Spec) (out uint64)

func (*LightClientUpdateRange) Deserialize

func (r *LightClientUpdateRange) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*LightClientUpdateRange) FixedLength

func (r *LightClientUpdateRange) FixedLength(_ *common.Spec) uint64

func (LightClientUpdateRange) HashTreeRoot

func (r LightClientUpdateRange) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root

func (LightClientUpdateRange) Serialize

type Network

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

func NewBeaconNetwork

func NewBeaconNetwork(portalProtocol *portalwire.PortalProtocol) *Network

func SetupBeaconNetwork

func SetupBeaconNetwork(addr string, bootNodes []*enode.Node) (*Network, error)

func (*Network) GetCheckpointData

func (bn *Network) GetCheckpointData(checkpointHash tree.Root) (common.SpecObj, error)

func (*Network) GetFinalityUpdate

func (bn *Network) GetFinalityUpdate(finalizedSlot uint64) (common.SpecObj, error)

func (*Network) GetOptimisticUpdate

func (bn *Network) GetOptimisticUpdate(optimisticSlot uint64) (common.SpecObj, error)

func (*Network) GetUpdates

func (bn *Network) GetUpdates(firstPeriod, count uint64) ([]common.SpecObj, error)

func (*Network) Start

func (bn *Network) Start() error

func (*Network) Stop

func (bn *Network) Stop()

type PortalLightApi

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

func NewPortalLightApi

func NewPortalLightApi() *PortalLightApi

func (*PortalLightApi) ChainID

func (p *PortalLightApi) ChainID() uint64

ChainID implements ConsensusAPI.

func (*PortalLightApi) GetBootstrap

func (p *PortalLightApi) GetBootstrap(blockRoot tree.Root) (common.SpecObj, error)

GetBootstrap implements ConsensusAPI.

func (*PortalLightApi) GetFinalityUpdate

func (p *PortalLightApi) GetFinalityUpdate() (common.SpecObj, error)

GetFinalityUpdate implements ConsensusAPI.

func (*PortalLightApi) GetOptimisticUpdate

func (p *PortalLightApi) GetOptimisticUpdate() (common.SpecObj, error)

GetOptimisticUpdate implements ConsensusAPI.

func (*PortalLightApi) GetUpdates

func (p *PortalLightApi) GetUpdates(firstPeriod uint64, count uint64) ([]common.SpecObj, error)

GetUpdates implements ConsensusAPI.

func (*PortalLightApi) Name

func (p *PortalLightApi) Name() string

Name implements ConsensusAPI.

type Storage

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

func (*Storage) Close

func (bs *Storage) Close() error

func (*Storage) Get

func (bs *Storage) Get(contentKey []byte, contentId []byte) ([]byte, error)

func (*Storage) Put

func (bs *Storage) Put(contentKey []byte, contentId []byte, content []byte) error

func (*Storage) Radius

func (bs *Storage) Radius() *uint256.Int

Jump to

Keyboard shortcuts

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