handlers

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: GPL-3.0, LGPL-3.0 Imports: 23 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSyncHandler

func NewSyncHandler(
	provider SyncDataProvider,
	evmTrieDB *trie.Database,
	atomicTrieDB *trie.Database,
	networkCodec codec.Manager,
	stats stats.HandlerStats,
) message.RequestHandler

NewSyncHandler constructs the handler for serving state sync.

Types

type BlockProvider added in v0.8.11

type BlockProvider interface {
	GetBlock(common.Hash, uint64) *types.Block
}

type BlockRequestHandler

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

BlockRequestHandler is a peer.RequestHandler for message.BlockRequest serving requested blocks starting at specified hash

func NewBlockRequestHandler

func NewBlockRequestHandler(blockProvider BlockProvider, codec codec.Manager, handlerStats stats.BlockRequestHandlerStats) *BlockRequestHandler

func (*BlockRequestHandler) OnBlockRequest

func (b *BlockRequestHandler) OnBlockRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, blockRequest message.BlockRequest) ([]byte, error)

OnBlockRequest handles incoming message.BlockRequest, returning blocks as requested Never returns error Expects returned errors to be treated as FATAL Returns empty response or subset of requested blocks if ctx expires during fetch Assumes ctx is active

type CodeRequestHandler

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

CodeRequestHandler is a peer.RequestHandler for message.CodeRequest serving requested contract code bytes

func NewCodeRequestHandler

func NewCodeRequestHandler(codeReader ethdb.KeyValueReader, codec codec.Manager, stats stats.CodeRequestHandlerStats) *CodeRequestHandler

func (*CodeRequestHandler) OnCodeRequest

func (n *CodeRequestHandler) OnCodeRequest(_ context.Context, nodeID ids.NodeID, requestID uint32, codeRequest message.CodeRequest) ([]byte, error)

OnCodeRequest handles request to retrieve contract code by its hash in message.CodeRequest Never returns error Returns nothing if code hash is not found Expects returned errors to be treated as FATAL Assumes ctx is active

type LeafsRequestHandler

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

LeafsRequestHandler is a peer.RequestHandler for types.LeafsRequest serving requested trie data

func NewLeafsRequestHandler

func NewLeafsRequestHandler(trieDB *trie.Database, snapshotProvider SnapshotProvider, codec codec.Manager, syncerStats stats.LeafsRequestHandlerStats) *LeafsRequestHandler

func (*LeafsRequestHandler) OnLeafsRequest

func (lrh *LeafsRequestHandler) OnLeafsRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, leafsRequest message.LeafsRequest) ([]byte, error)

OnLeafsRequest returns encoded message.LeafsResponse for a given message.LeafsRequest Returns leaves with proofs for specified (Start-End) (both inclusive) ranges Returned message.LeafsResponse may contain partial leaves within requested Start and End range if: - ctx expired while fetching leafs - number of leaves read is greater than Limit (message.LeafsRequest) Specified Limit in message.LeafsRequest is overridden to maxLeavesLimit if it is greater than maxLeavesLimit Expects returned errors to be treated as FATAL Never returns errors Expects NodeType to be one of message.AtomicTrieNode or message.StateTrieNode Returns nothing if NodeType is invalid or requested trie root is not found Assumes ctx is active

type SnapshotProvider added in v0.8.11

type SnapshotProvider interface {
	Snapshots() *snapshot.Tree
}

type SyncDataProvider added in v0.8.11

type SyncDataProvider interface {
	BlockProvider
	SnapshotProvider
}

type TestBlockProvider added in v0.8.11

type TestBlockProvider struct {
	GetBlockFn func(common.Hash, uint64) *types.Block
}

func (*TestBlockProvider) GetBlock added in v0.8.11

func (t *TestBlockProvider) GetBlock(hash common.Hash, number uint64) *types.Block

type TestSnapshotProvider added in v0.8.11

type TestSnapshotProvider struct {
	Snapshot *snapshot.Tree
}

func (*TestSnapshotProvider) Snapshots added in v0.8.11

func (t *TestSnapshotProvider) Snapshots() *snapshot.Tree

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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