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 ¶
- func Validate(ctx context.Context, log observability.ContextualLogger, url string) error
- type Bootstrap
- func (b *Bootstrap) Bodies(ctx context.Context, hashes []common.Hash) ([]eth.BlockBody, error)
- func (b *Bootstrap) CurrentStatus(ctx context.Context) (*statusSnapshot, error)
- func (b *Bootstrap) Headers(ctx context.Context, request *eth.GetBlockHeadersRequest) ([]*types.Header, error)
- func (b *Bootstrap) Receipts(ctx context.Context, request mimicry.ReceiptRequest) ([]*eth.ReceiptList, error)
- func (b *Bootstrap) Status(ctx context.Context, protocolVersion uint, peerStatus mimicry.Status) (mimicry.Status, error)
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 ¶
func New(ctx context.Context, log observability.ContextualLogger, url string) (*Bootstrap, error)
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) CurrentStatus ¶
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.