Documentation
¶
Index ¶
- Variables
- func BitArrayFromAttestationSubnets(subnets []uint64) bitfield.Bitvector64
- func BitArrayFromSyncSubnets(subnets []uint64) bitfield.Bitvector4
- func FetchBootnodeENRsFromURL(ctx context.Context, url string) ([]string, error)
- func FetchConfigFromURL(ctx context.Context, url string) (*params.BeaconChainConfig, error)
- func FetchDepositContractBlockFromURL(ctx context.Context, url string) (uint64, error)
- func FetchGenesisDetailsFromURL(ctx context.Context, url string) (uint64, [32]byte, error)
- func GetCurrentForkVersion(epoch primitives.Epoch, beaconConfg *params.BeaconChainConfig) ([4]byte, error)
- func GetSubscribedSubnets(config *SubnetConfig, totalSubnets uint64) []uint64
- func HasSubnets(topic string) (subnets uint64, hasSubnets bool)
- func NewFullOutput(cfg *PubSubConfig) host.DataStreamRenderer
- func NewKinesisOutput(cfg *PubSubConfig) host.DataStreamRenderer
- type AddrWatcher
- type AuthConfig
- type Chain
- func (c *Chain) Close() error
- func (c *Chain) CurrentFork() chainFork
- func (c *Chain) CurrentForkDigest() [4]byte
- func (c *Chain) CurrentSeqNumber() primitives.SSZUint64
- func (c *Chain) GetColumnCustodySubnets(nodeId enode.ID) []uint64
- func (c *Chain) GetMetadata(v metadataVersion) any
- func (c *Chain) GetStatus(v statusVersion) any
- func (c *Chain) IsInit() (bool, string)
- func (c *Chain) RegisterChainUpgrade(fn chainUpgradeSubFn)
- func (c *Chain) Serve(ctx context.Context) error
- func (c *Chain) UpdateMetadata(v metadataVersion, md any) error
- func (c *Chain) UpdateStatus(v statusVersion, st any) error
- type ChainConfig
- type ContextStreamHandler
- type DevnetOptions
- type DiscoveredPeer
- type Discovery
- type DiscoveryConfig
- type ForkVersion
- type FullOutput
- type GenesisConfig
- type KinesisOutput
- type MetadataHolder
- func (m *MetadataHolder) Attnets() bitfield.Bitvector64
- func (m *MetadataHolder) CustodyGroupCount() (uint64, bool)
- func (m *MetadataHolder) GetV0() *pb.MetaDataV0
- func (m *MetadataHolder) GetV1() *pb.MetaDataV1
- func (m *MetadataHolder) GetV2() *pb.MetaDataV2
- func (m *MetadataHolder) SeqNumber() uint64
- func (m *MetadataHolder) SetV0(md *pb.MetaDataV0)
- func (m *MetadataHolder) SetV1(md *pb.MetaDataV1)
- func (m *MetadataHolder) SetV2(md *pb.MetaDataV2)
- func (m *MetadataHolder) Syncnets() (bitfield.Bitvector4, bool)
- func (m *MetadataHolder) Version() int
- type NetworkConfig
- type Node
- func (n *Node) CanSubscribe(topic string) bool
- func (n *Node) Connected(net network.Network, c network.Conn)
- func (n *Node) Disconnected(net network.Network, c network.Conn)
- func (n *Node) FilterIncomingSubscriptions(id peer.ID, subs []*pubsubpb.RPC_SubOpts) ([]*pubsubpb.RPC_SubOpts, error)
- func (n *Node) Listen(net network.Network, maddr ma.Multiaddr)
- func (n *Node) ListenClose(net network.Network, maddr ma.Multiaddr)
- func (n *Node) OnEvent(cb func(ctx context.Context, event *host.TraceEvent))
- func (n *Node) Start(ctx context.Context) error
- type NodeConfig
- type PeerDialer
- type Peerer
- type PrysmClient
- func (p *PrysmClient) AddTrustedPeer(ctx context.Context, pid peer.ID, maddr ma.Multiaddr) (err error)
- func (p *PrysmClient) ChainHead(ctx context.Context) (chainHead *eth.ChainHead, err error)
- func (p *PrysmClient) FetchAndSetBlobSchedule(ctx context.Context) error
- func (p *PrysmClient) Identity(ctx context.Context) (addrInfo *peer.AddrInfo, err error)
- func (p *PrysmClient) ListTrustedPeers(ctx context.Context) (peers map[peer.ID]*structs.Peer, err error)
- func (p *PrysmClient) RemoveTrustedPeer(ctx context.Context, pid peer.ID) (err error)
- type PubSub
- type PubSubConfig
- type ReqResp
- func (r *ReqResp) BlocksByRangeV2(ctx context.Context, pid peer.ID, firstSlot, lastSlot uint64) ([]interfaces.ReadOnlySignedBeaconBlock, error)
- func (r *ReqResp) DataColumnsByRangeV1Handler(ctx context.Context, stream network.Stream) (map[string]any, error)
- func (r *ReqResp) DataColumnsByRootV1Handler(ctx context.Context, stream network.Stream) (map[string]any, error)
- func (r *ReqResp) MetaDataV1(ctx context.Context, pid peer.ID) (resp *pb.MetaDataV1, err error)
- func (r *ReqResp) MetaDataV2(ctx context.Context, pid peer.ID) (resp *pb.MetaDataV2, err error)
- func (r *ReqResp) Ping(ctx context.Context, pid peer.ID) (err error)
- func (r *ReqResp) RegisterHandlers(ctx context.Context) error
- func (r *ReqResp) Status(ctx context.Context, pid peer.ID) (status *pb.Status, err error)
- func (r *ReqResp) StatusV2(ctx context.Context, pid peer.ID) (status *pb.StatusV2, err error)
- type ReqRespConfig
- type StatusHolder
- func (s *StatusHolder) EarliestAvailableSlot() (primitives.Slot, bool)
- func (s *StatusHolder) FinalizedEpoch() primitives.Epoch
- func (s *StatusHolder) FinalizedRoot() []byte
- func (s *StatusHolder) ForkDigest() []byte
- func (s *StatusHolder) GetV1() *pb.Status
- func (s *StatusHolder) GetV2() *pb.StatusV2
- func (s *StatusHolder) HeadRoot() []byte
- func (s *StatusHolder) HeadSlot() primitives.Slot
- func (s *StatusHolder) IsV2() bool
- func (s *StatusHolder) SetV1(status *pb.Status)
- func (s *StatusHolder) SetV2(status *pb.StatusV2)
- type SubnetConfig
- type SubnetSelectionType
- type TraceEventAltairBlock
- type TraceEventAttestation
- type TraceEventAttestationElectra
- type TraceEventAttesterSlashing
- type TraceEventBLSToExecutionChange
- type TraceEventBellatrixBlock
- type TraceEventBlobSidecar
- type TraceEventCapellaBlock
- type TraceEventDataColumnSidecar
- type TraceEventDenebBlock
- type TraceEventElectraBlock
- type TraceEventFuluBlock
- type TraceEventPhase0Block
- type TraceEventProposerSlashing
- type TraceEventSignedAggregateAttestationAndProof
- type TraceEventSignedAggregateAttestationAndProofElectra
- type TraceEventSignedContributionAndProof
- type TraceEventSingleAttestation
- type TraceEventSyncCommitteeMessage
- type TraceEventVoluntaryExit
Constants ¶
This section is empty.
Variables ¶
var GenesisConfigs = map[string]*GenesisConfig{ params.MainnetName: { GenesisValidatorRoot: hexToBytes("4b363db94e286120d76eb905340fdd4e54bfe9f06bf33ff6cf5ad27f511bfe95"), GenesisTime: time.Unix(1606824023, 0), }, params.SepoliaName: { GenesisValidatorRoot: hexToBytes("d8ea171f3c94aea21ebc42a1ed61052acf3f9209c00e4efbaaddac09ed9b8078"), GenesisTime: time.Unix(1655733600, 0), }, params.HoleskyName: { GenesisValidatorRoot: hexToBytes("9143aa7c615a7f7115e2b6aac319c03529df8242ae705fba9df39b79c59fa8b1"), GenesisTime: time.Unix(1695902400, 0), }, params.HoodiName: { GenesisValidatorRoot: hexToBytes("212f13fc4df078b6cb7db228f1c8307566dcecf900867401a92023d7ba99cb5f"), GenesisTime: time.Unix(1742213400, 0), }, GnosisName: { GenesisValidatorRoot: hexToBytes("f5dcb5564e829aab27264b9becd5dfaa017085611224cb3036f573368dbb9d47"), GenesisTime: time.Unix(1638968400, 0), }, }
var GnosisName = "gnosis"
Functions ¶
func BitArrayFromAttestationSubnets ¶
func BitArrayFromAttestationSubnets(subnets []uint64) bitfield.Bitvector64
BitArrayFromAttestationSubnets returns the bitVector representation of the subscribed attestation subnets
func BitArrayFromSyncSubnets ¶
func BitArrayFromSyncSubnets(subnets []uint64) bitfield.Bitvector4
BitArrayFromSyncSubnets returns the bitVector representation of the subscribed sync subnets
func FetchBootnodeENRsFromURL ¶
FetchBootnodeENRsFromURL fetches the bootnode ENRs from a given URL.
func FetchConfigFromURL ¶
FetchConfigFromURL fetches the beacon chain config from a given URL.
func FetchDepositContractBlockFromURL ¶
FetchDepositContractBlockFromURL fetches the deposit contract block from a given URL.
func FetchGenesisDetailsFromURL ¶
FetchGenesisDetailsFromURL fetches the genesis time and validators root from a given URL.
func GetCurrentForkVersion ¶
func GetCurrentForkVersion(epoch primitives.Epoch, beaconConfg *params.BeaconChainConfig) ([4]byte, error)
func GetSubscribedSubnets ¶
func GetSubscribedSubnets(config *SubnetConfig, totalSubnets uint64) []uint64
GetSubscribedSubnets computes, stores and returns the subnet IDs to subscribe to for a given topic. It handles the selection logic based on the subnet configuration.
The function implements the following selection strategies: - SubnetStatic: Uses the exact subnet IDs provided in config.Subnets - SubnetRandom: Selects a random set of subnets based on config.Count - SubnetStaticRange: Selects all subnets in the range [config.Start, config.End) - SubnetAll (or nil config): Selects all available subnets (0 to totalSubnets-1)
This centralized function allows consistent subnet selection across the codebase.
func HasSubnets ¶
HasSubnets determines if a gossip topic has subnets, and if so, how many. It returns the number of subnets for the topic and a boolean indicating whether the topic has subnets.
func NewFullOutput ¶
func NewFullOutput(cfg *PubSubConfig) host.DataStreamRenderer
NewFullOutput creates a new instance of FullOutput.
func NewKinesisOutput ¶
func NewKinesisOutput(cfg *PubSubConfig) host.DataStreamRenderer
NewKinesisOutput creates a new instance of KinesisOutput.
Types ¶
type AddrWatcher ¶
type AddrWatcher struct {
// contains filtered or unexported fields
}
type AuthConfig ¶
Add new struct to hold auth info
type Chain ¶
type Chain struct {
Fork chainFork
// contains filtered or unexported fields
}
func (*Chain) CurrentFork ¶
func (c *Chain) CurrentFork() chainFork
func (*Chain) CurrentForkDigest ¶
func (*Chain) CurrentSeqNumber ¶
func (c *Chain) CurrentSeqNumber() primitives.SSZUint64
func (*Chain) GetColumnCustodySubnets ¶
func (*Chain) GetMetadata ¶
func (*Chain) RegisterChainUpgrade ¶
func (c *Chain) RegisterChainUpgrade(fn chainUpgradeSubFn)
func (*Chain) UpdateMetadata ¶
func (*Chain) UpdateStatus ¶
type ChainConfig ¶
type ChainConfig struct {
// Fork configuration for version-aware decisions
BeaconConfig *params.BeaconChainConfig
GenesisConfig *GenesisConfig
NetworkConfig *params.NetworkConfig
// Subnets configuration
AttestationSubnetConfig *SubnetConfig
SyncSubnetConfig *SubnetConfig
ColumnSubnetConfig *SubnetConfig
// contains filtered or unexported fields
}
type ContextStreamHandler ¶
type DevnetOptions ¶
type DevnetOptions struct {
ConfigURL string
BootnodesURL string
DepositContractBlockURL string
GenesisSSZURL string
}
func (*DevnetOptions) Validate ¶
func (o *DevnetOptions) Validate() error
type DiscoveredPeer ¶
func NewDiscoveredPeer ¶
func NewDiscoveredPeer(node *enode.Node) (*DiscoveredPeer, error)
type Discovery ¶
type Discovery struct {
// Metrics
MeterDiscoveredPeers metric.Int64Counter
// contains filtered or unexported fields
}
Discovery is a suture service that periodically queries the discv5 DHT for random peers and publishes the discovered peers on the `out` channel. Users of this Discovery service are required to read from the channel. Otherwise, the discovery will block forever.
func NewDiscovery ¶
func NewDiscovery(privKey *ecdsa.PrivateKey, cfg *DiscoveryConfig) (*Discovery, error)
type DiscoveryConfig ¶
type DiscoveryConfig struct {
Addr string
UDPPort int
TCPPort int
Tracer trace.Tracer
Meter metric.Meter
Chain *Chain
}
func (*DiscoveryConfig) BootstrapNodes ¶
func (d *DiscoveryConfig) BootstrapNodes() ([]*enode.Node, error)
type ForkVersion ¶
type ForkVersion [4]byte
list of ForkVersions 1st byte trick
var ( Phase0ForkVersion ForkVersion AltairForkVersion ForkVersion BellatrixForkVersion ForkVersion CapellaForkVersion ForkVersion DenebForkVersion ForkVersion ElectraForkVersion ForkVersion FuluForkVersion ForkVersion GlobalBeaconConfig = params.MainnetConfig() // init with Mainnet (we would override if needed) )
func GetForkVersionFromForkDigest ¶
func GetForkVersionFromForkDigest(forkD [4]byte) (forkV ForkVersion, err error)
GetForkVersionFromForkDigest returns the fork version for a given fork digest. This function is BPO-aware as it uses params.ForkDataFromDigest which handles the network schedule including BPO phases for Fulu+.
func (ForkVersion) String ¶
func (fv ForkVersion) String() string
type FullOutput ¶
type FullOutput struct {
// contains filtered or unexported fields
}
FullOutput is a renderer for full output.
func (*FullOutput) RenderPayload ¶
func (t *FullOutput) RenderPayload(evt *host.TraceEvent, msg *pubsub.Message, dst ssz.Unmarshaler) (*host.TraceEvent, error)
RenderPayload renders message into the destination.
type GenesisConfig ¶
type GenesisConfig struct {
GenesisValidatorRoot []byte // Merkle Root at Genesis
GenesisTime time.Time // Time at Genesis
}
GenesisConfig represents the Genesis configuration with the Merkle Root at Genesis and the Time at Genesis.
type KinesisOutput ¶
type KinesisOutput struct {
// contains filtered or unexported fields
}
KinesisOutput is a renderer for Kinesis output.
func (*KinesisOutput) RenderPayload ¶
func (k *KinesisOutput) RenderPayload(evt *host.TraceEvent, msg *pubsub.Message, dst ssz.Unmarshaler) (*host.TraceEvent, error)
RenderPayload renders message into the destination.
type MetadataHolder ¶
type MetadataHolder struct {
// contains filtered or unexported fields
}
MetadataHolder wraps different metadata versions
func (*MetadataHolder) Attnets ¶
func (m *MetadataHolder) Attnets() bitfield.Bitvector64
Attnets returns the attestation subnets from any version
func (*MetadataHolder) CustodyGroupCount ¶
func (m *MetadataHolder) CustodyGroupCount() (uint64, bool)
CustodyGroupCount returns the custody group count if V2, otherwise returns 0 and false
func (*MetadataHolder) GetV0 ¶
func (m *MetadataHolder) GetV0() *pb.MetaDataV0
GetV0 returns the V0 metadata or nil if not set
func (*MetadataHolder) GetV1 ¶
func (m *MetadataHolder) GetV1() *pb.MetaDataV1
GetV1 returns the V1 metadata or nil if not set
func (*MetadataHolder) GetV2 ¶
func (m *MetadataHolder) GetV2() *pb.MetaDataV2
GetV2 returns the V2 metadata or nil if not set
func (*MetadataHolder) SeqNumber ¶
func (m *MetadataHolder) SeqNumber() uint64
SeqNumber returns the sequence number from any version
func (*MetadataHolder) SetV0 ¶
func (m *MetadataHolder) SetV0(md *pb.MetaDataV0)
SetV0 sets the V0 metadata
func (*MetadataHolder) SetV1 ¶
func (m *MetadataHolder) SetV1(md *pb.MetaDataV1)
SetV1 sets the V1 metadata
func (*MetadataHolder) SetV2 ¶
func (m *MetadataHolder) SetV2(md *pb.MetaDataV2)
SetV2 sets the V2 metadata
func (*MetadataHolder) Syncnets ¶
func (m *MetadataHolder) Syncnets() (bitfield.Bitvector4, bool)
Syncnets returns the sync committee subnets if available (V1 and V2 only)
func (*MetadataHolder) Version ¶
func (m *MetadataHolder) Version() int
Version returns the version number of the stored metadata
type NetworkConfig ¶
type NetworkConfig struct {
Genesis *GenesisConfig
Network *params.NetworkConfig
Beacon *params.BeaconChainConfig
}
func DeriveDevnetConfig ¶
func DeriveDevnetConfig(ctx context.Context, options DevnetOptions) (*NetworkConfig, error)
func DeriveKnownNetworkConfig ¶
func DeriveKnownNetworkConfig(ctx context.Context, network string) (*NetworkConfig, error)
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is the main entry point to listening to the Ethereum GossipSub mesh.
func NewNode ¶
func NewNode(cfg *NodeConfig) (*Node, error)
NewNode initializes a new Node using the provided configuration. It first validates the node configuration. Then it initializes the libp2p host using the libp2p options from the given configuration object. Next, it initializes the Ethereum node by extracting the ECDSA private key, creating a new discovery service, creating a new ReqResp server, creating a new PubSub server, and creating a new Prysm client. Finally, it initializes the Hermes node by setting the configuration and dependencies.
func (*Node) CanSubscribe ¶
CanSubscribe originally returns true if the topic is of interest, and we could subscribe to it.
func (*Node) FilterIncomingSubscriptions ¶
func (n *Node) FilterIncomingSubscriptions(id peer.ID, subs []*pubsubpb.RPC_SubOpts) ([]*pubsubpb.RPC_SubOpts, error)
FilterIncomingSubscriptions is invoked for all RPCs containing subscription notifications. This method returns only the topics of interest and may return an error if the subscription request contains too many topics.
type NodeConfig ¶
type NodeConfig struct {
// A custom struct that holds information about the GenesisTime and GenesisValidatorRoot hash
GenesisConfig *GenesisConfig
// The beacon network config which holds, e.g., information about certain
// ENR keys and the list of bootstrap nodes
NetworkConfig *params.NetworkConfig
// The beacon chain configuration that holds tons of information. Check out its definition
BeaconConfig *params.BeaconChainConfig
// The fork digest of the network Hermes participates in
ForkDigest [4]byte
ForkVersion ForkVersion
// The private key for the libp2p host and local enode in hex format
PrivateKeyStr string
// General timeout when communicating with other network participants
DialTimeout time.Duration
// The address information of the local ethereuem [enode.Node].
Devp2pHost string
Devp2pPort int
// The address information of the local libp2p host
Libp2pHost string
Libp2pPort int
Libp2pPeerscoreSnapshotFreq time.Duration
// Message encoders
GossipSubMessageEncoder encoder.NetworkEncoding
RPCEncoder encoder.NetworkEncoding
// The address information where the Beacon API or Prysm's custom API is accessible at
LocalTrustedAddr bool
PrysmHost string
PrysmPortHTTP int
PrysmPortGRPC int
PrysmUseTLS bool
// The Data Stream configuration
DataStreamType host.DataStreamType
AWSConfig *aws.Config
S3Config *host.S3DSConfig
KinesisRegion string
KinesisStream string
// The maximum number of peers our libp2p host can be connected to.
MaxPeers int
// Limits the number of concurrent connection establishment routines. When
// we discover peers over discv5 and are not at our MaxPeers limit we try
// to establish a connection to a peer. However, we limit the concurrency to
// this DialConcurrency value.
DialConcurrency int
// It is set at this limit to handle the possibility
// of double topic subscriptions at fork boundaries.
// -> 64 Attestation Subnets * 2.
// -> 4 Sync Committee Subnets * 2.
// -> Block,Aggregate,ProposerSlashing,AttesterSlashing,Exits,SyncContribution * 2.
PubSubSubscriptionRequestLimit int
PubSubValidateQueueSize int
PubSubMaxOutputQueue int
// Configuration for subnet selection by topic
SubnetConfigs map[string]*SubnetConfig
// SubscriptionTopics is a list of topics to subscribe to. If not set,
// the default list of topics will be used.
SubscriptionTopics []string
// Telemetry accessors
Tracer trace.Tracer
Meter metric.Meter
// PeerFilter configuration for filtering peers (passed to host)
PeerFilter *host.FilterConfig
// DirectConnections ensurest that our host doesn't prune the connection from these nodes
DirectConnections []string
// contains filtered or unexported fields
}
func (*NodeConfig) DirectMultiaddrs ¶
func (n *NodeConfig) DirectMultiaddrs() []peer.AddrInfo
DirectMultiaddrs returns the []peer.AddrInfo for the given direct connction peers
func (*NodeConfig) ECDSAPrivateKey ¶
func (n *NodeConfig) ECDSAPrivateKey() (*ecdsa.PrivateKey, error)
ECDSAPrivateKey returns the ECDSA private key associated with the NodeConfig. It retrieves the private key using the PrivateKey method and then converts it to ECDSA format. If there is an error retrieving the private key or converting it to ECDSA format, an error is returned.
func (*NodeConfig) PrivateKey ¶
func (n *NodeConfig) PrivateKey() (*crypto.Secp256k1PrivateKey, error)
PrivateKey returns a parsed Secp256k1 private key from the given PrivateKeyStr. If that's unset, a new one will be generated. In any case, the result will be cached, so that the private key won't be generated twice.
func (*NodeConfig) Validate ¶
func (n *NodeConfig) Validate() error
Validate validates the NodeConfig Node configuration.
type PeerDialer ¶
type PeerDialer struct {
// contains filtered or unexported fields
}
PeerDialer is a suture service that reads peers from the peerChan (which is filled by the Discovery service until that peerChan channel is closed. When PeerDialer sees a new peer, it does a few sanity checks and tries to establish a connection.
type Peerer ¶
type Peerer struct {
// contains filtered or unexported fields
}
Peerer is a suture service that ensures Hermes' registration as a trusted peer with the beacon node. Based on the type of beacon node, different [PeererClient] implementations can be used. In the case of Prysm, use the PrysmClient implementation as it implements [PeererClient].
func NewPeerer ¶
func NewPeerer(h *host.Host, pryClient *PrysmClient, localTrustedAddr bool) *Peerer
NewPeerer creates a new instance of the Peerer struct. It takes a pointer to a *host.Host and a [PeererClient] implementation as parameters. It returns a pointer to the newly created Peerer instance.
type PrysmClient ¶
type PrysmClient struct {
// contains filtered or unexported fields
}
PrysmClient is an HTTP client for Prysm's JSON RPC API.
func NewPrysmClient ¶
func NewPrysmClient(host string, portHTTP int, portGRPC int, timeout time.Duration, genesis *GenesisConfig) (*PrysmClient, error)
func NewPrysmClientWithTLS ¶
func NewPrysmClientWithTLS(host string, portHTTP int, portGRPC int, useTLS bool, timeout time.Duration, genesis *GenesisConfig) (*PrysmClient, error)
func (*PrysmClient) AddTrustedPeer ¶
func (*PrysmClient) FetchAndSetBlobSchedule ¶
func (p *PrysmClient) FetchAndSetBlobSchedule(ctx context.Context) error
FetchAndSetBlobSchedule fetches the BLOB_SCHEDULE from Prysm's spec endpoint and sets it in the params configuration to ensure correct fork digest calculation for BPO.
func (*PrysmClient) ListTrustedPeers ¶
func (*PrysmClient) RemoveTrustedPeer ¶
type PubSubConfig ¶
type PubSubConfig struct {
Chain *Chain
Topics []string
Encoder encoder.NetworkEncoding
SecondsPerSlot time.Duration
DataStream host.DataStream
}
func (PubSubConfig) Validate ¶
func (p PubSubConfig) Validate() error
type ReqResp ¶
type ReqResp struct {
// contains filtered or unexported fields
}
ReqResp implements the request response domain of the eth2 RPC spec: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/p2p-interface.md
func NewReqResp ¶
func NewReqResp(h host.Host, cfg *ReqRespConfig) (*ReqResp, error)
func (*ReqResp) BlocksByRangeV2 ¶
func (r *ReqResp) BlocksByRangeV2(ctx context.Context, pid peer.ID, firstSlot, lastSlot uint64) ([]interfaces.ReadOnlySignedBeaconBlock, error)
func (*ReqResp) DataColumnsByRangeV1Handler ¶
func (*ReqResp) DataColumnsByRootV1Handler ¶
func (*ReqResp) MetaDataV1 ¶
MetaData requests V1 metadata from a peer
func (*ReqResp) MetaDataV2 ¶
MetaDataV2 requests V2 metadata from a peer (includes custody group count)
func (*ReqResp) RegisterHandlers ¶
RegisterHandlers registers all RPC handlers. It checks first if all preconditions are met. This includes valid initial status and metadata values.
type ReqRespConfig ¶
type ReqRespConfig struct {
Encoder encoder.NetworkEncoding
DataStream hermeshost.DataStream
ReadTimeout time.Duration
WriteTimeout time.Duration
// Chain related info
Chain *Chain
// Telemetry accessors
Tracer trace.Tracer
Meter metric.Meter
}
type StatusHolder ¶
type StatusHolder struct {
// contains filtered or unexported fields
}
StatusHolder wraps different status versions
func (*StatusHolder) EarliestAvailableSlot ¶
func (s *StatusHolder) EarliestAvailableSlot() (primitives.Slot, bool)
EarliestAvailableSlot returns the earliest available slot if V2, otherwise returns 0 and false
func (*StatusHolder) FinalizedEpoch ¶
func (s *StatusHolder) FinalizedEpoch() primitives.Epoch
FinalizedEpoch returns the finalized epoch from either version
func (*StatusHolder) FinalizedRoot ¶
func (s *StatusHolder) FinalizedRoot() []byte
FinalizedRoot returns the finalized root from either version
func (*StatusHolder) ForkDigest ¶
func (s *StatusHolder) ForkDigest() []byte
ForkDigest returns the fork digest from either version
func (*StatusHolder) GetV1 ¶
func (s *StatusHolder) GetV1() *pb.Status
GetV1 returns the V1 status or nil if not set
func (*StatusHolder) GetV2 ¶
func (s *StatusHolder) GetV2() *pb.StatusV2
GetV2 returns the V2 status or nil if not set
func (*StatusHolder) HeadRoot ¶
func (s *StatusHolder) HeadRoot() []byte
HeadRoot returns the head root from either version
func (*StatusHolder) HeadSlot ¶
func (s *StatusHolder) HeadSlot() primitives.Slot
HeadSlot returns the head slot from either version
func (*StatusHolder) IsV2 ¶
func (s *StatusHolder) IsV2() bool
IsV2 returns true if this holder contains a V2 status
func (*StatusHolder) SetV1 ¶
func (s *StatusHolder) SetV1(status *pb.Status)
SetV1 sets the V1 status
func (*StatusHolder) SetV2 ¶
func (s *StatusHolder) SetV2(status *pb.StatusV2)
SetV2 sets the V2 status
type SubnetConfig ¶
type SubnetConfig struct {
// Type of subnet selection.
Type SubnetSelectionType
// Specific subnet IDs to use when Type is Static.
Subnets []uint64
// Count of random subnets to select when Type is Random.
Count uint64
// Range start (inclusive) when Type is StaticRange.
Start uint64
// Range end (exclusive) when Type is StaticRange.
End uint64
}
SubnetConfig configures which subnets to subscribe to for a topic.
type SubnetSelectionType ¶
type SubnetSelectionType string
SubnetSelectionType defines how subnets are selected for any topic
const ( // SubnetAll subscribes to all possible subnets. SubnetAll SubnetSelectionType = "all" // SubnetStatic subscribes to specific subnets. SubnetStatic SubnetSelectionType = "static" // SubnetRandom subscribes to a random set of subnets. SubnetRandom SubnetSelectionType = "random" // SubnetStaticRange subscribes to a range of subnets. SubnetStaticRange SubnetSelectionType = "static_range" )
type TraceEventAltairBlock ¶
type TraceEventAltairBlock struct {
host.TraceEventPayloadMetaData
Block *ethtypes.SignedBeaconBlockAltair
}
type TraceEventAttestation ¶
type TraceEventAttestation struct {
host.TraceEventPayloadMetaData
Attestation *ethtypes.Attestation
}
type TraceEventAttestationElectra ¶
type TraceEventAttestationElectra struct {
host.TraceEventPayloadMetaData
AttestationElectra *ethtypes.AttestationElectra
}
type TraceEventAttesterSlashing ¶
type TraceEventAttesterSlashing struct {
host.TraceEventPayloadMetaData
AttesterSlashing *ethtypes.AttesterSlashing
}
type TraceEventBLSToExecutionChange ¶
type TraceEventBLSToExecutionChange struct {
host.TraceEventPayloadMetaData
BLSToExecutionChange *ethtypes.BLSToExecutionChange
}
type TraceEventBellatrixBlock ¶
type TraceEventBellatrixBlock struct {
host.TraceEventPayloadMetaData
Block *ethtypes.SignedBeaconBlockBellatrix
}
type TraceEventBlobSidecar ¶
type TraceEventBlobSidecar struct {
host.TraceEventPayloadMetaData
BlobSidecar *ethtypes.BlobSidecar
}
type TraceEventCapellaBlock ¶
type TraceEventCapellaBlock struct {
host.TraceEventPayloadMetaData
Block *ethtypes.SignedBeaconBlockCapella
}
type TraceEventDataColumnSidecar ¶
type TraceEventDataColumnSidecar struct {
host.TraceEventPayloadMetaData
DataColumnSidecar *ethtypes.DataColumnSidecar
}
type TraceEventDenebBlock ¶
type TraceEventDenebBlock struct {
host.TraceEventPayloadMetaData
Block *ethtypes.SignedBeaconBlockDeneb
}
type TraceEventElectraBlock ¶
type TraceEventElectraBlock struct {
host.TraceEventPayloadMetaData
Block *ethtypes.SignedBeaconBlockElectra
}
type TraceEventFuluBlock ¶
type TraceEventFuluBlock struct {
host.TraceEventPayloadMetaData
Block *ethtypes.SignedBeaconBlockFulu
}
type TraceEventPhase0Block ¶
type TraceEventPhase0Block struct {
host.TraceEventPayloadMetaData
Block *ethtypes.SignedBeaconBlock
}
type TraceEventProposerSlashing ¶
type TraceEventProposerSlashing struct {
host.TraceEventPayloadMetaData
ProposerSlashing *ethtypes.ProposerSlashing
}
type TraceEventSignedAggregateAttestationAndProof ¶
type TraceEventSignedAggregateAttestationAndProof struct {
host.TraceEventPayloadMetaData
SignedAggregateAttestationAndProof *ethtypes.SignedAggregateAttestationAndProof
}
type TraceEventSignedAggregateAttestationAndProofElectra ¶
type TraceEventSignedAggregateAttestationAndProofElectra struct {
host.TraceEventPayloadMetaData
SignedAggregateAttestationAndProofElectra *ethtypes.SignedAggregateAttestationAndProofElectra
}
type TraceEventSignedContributionAndProof ¶
type TraceEventSignedContributionAndProof struct {
host.TraceEventPayloadMetaData
SignedContributionAndProof *ethtypes.SignedContributionAndProof
}
type TraceEventSingleAttestation ¶
type TraceEventSingleAttestation struct {
host.TraceEventPayloadMetaData
SingleAttestation *ethtypes.SingleAttestation
}
type TraceEventSyncCommitteeMessage ¶
type TraceEventSyncCommitteeMessage struct {
host.TraceEventPayloadMetaData
SyncCommitteeMessage *ethtypes.SyncCommitteeMessage //lint:ignore SA1019 gRPC API deprecated but still supported until v8 (2026)
}
type TraceEventVoluntaryExit ¶
type TraceEventVoluntaryExit struct {
host.TraceEventPayloadMetaData
VoluntaryExit *ethtypes.VoluntaryExit
}