rpcbootstrap

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package rpcbootstrap provides an execution-layer JSON-RPC backed source for devp2p Status, headers, bodies, and receipts. It is shared between the mimicry and discovery modules so both can act as well-behaved peers during the eth handshake using a real EL node as the source of truth for chain head and historical data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(ctx context.Context, log observability.ContextualLogger, url string) error

Validate dials the URL and confirms a Status snapshot can be built.

Types

type Bootstrap

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

Bootstrap serves devp2p Status / headers / bodies / receipts to an eth peer using a backing EL JSON-RPC endpoint as the source of truth.

func New

New returns a Bootstrap for the given EL JSON-RPC URL. Multiple callers with the same URL share a single underlying client and Status cache.

func (*Bootstrap) Bodies

func (b *Bootstrap) Bodies(ctx context.Context, hashes []common.Hash) ([]eth.BlockBody, error)

Bodies serves a GetBlockBodies response sourced from the backing RPC.

func (*Bootstrap) CurrentStatus

func (b *Bootstrap) CurrentStatus(ctx context.Context) (*statusSnapshot, error)

CurrentStatus returns the cached chain-head snapshot, refreshing it when stale.

func (*Bootstrap) Headers

func (b *Bootstrap) Headers(ctx context.Context, request *eth.GetBlockHeadersRequest) ([]*types.Header, error)

Headers serves a GetBlockHeaders response sourced from the backing RPC.

func (*Bootstrap) Receipts

func (b *Bootstrap) Receipts(ctx context.Context, request mimicry.ReceiptRequest) ([]*eth.ReceiptList, error)

Receipts serves a GetReceipts response sourced from the backing RPC.

func (*Bootstrap) Status

func (b *Bootstrap) Status(ctx context.Context, protocolVersion uint, peerStatus mimicry.Status) (mimicry.Status, error)

Status returns a Status message for the given protocolVersion sourced from the current chain head. It also validates the peer's claimed Status against our snapshot for early rejection of incompatible peers.

Jump to

Keyboard shortcuts

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