Documentation ¶
Overview ¶
Package p2p is a generated GoMock package.
Package p2p is a generated GoMock package.
Package p2p is a generated GoMock package.
Index ¶
- Variables
- func PreservingPeerShuffle(_ []*PeerId)
- func RandPeerShuffle(peerIds []*PeerId)
- func WithPreservingPeerShuffle(pt *peerTracker)
- type DecodedInboundMessage
- type ErrIncompleteHeaders
- type ErrInvalidFetchHeadersRange
- type ErrMissingBodies
- type ErrMissingHeaderHash
- type ErrNonSequentialHeaderHashes
- type ErrNonSequentialHeaderNumbers
- type ErrTooManyBodies
- type ErrTooManyHeaders
- type ErrUnexpectedHeaderHash
- type Fetcher
- type FetcherConfig
- type FetcherOption
- type FetcherResponse
- type MessageListener
- type MessageSender
- type MockService
- func (m *MockService) BlockHashPresent(peerId *PeerId, blockHash common.Hash)
- func (m *MockService) BlockNumMissing(peerId *PeerId, blockNum uint64)
- func (m *MockService) BlockNumPresent(peerId *PeerId, blockNum uint64)
- func (m *MockService) EXPECT() *MockServiceMockRecorder
- func (m *MockService) FetchBlocksBackwardsByHash(ctx context.Context, hash common.Hash, amount uint64, peerId *PeerId, ...) (FetcherResponse[[]*types.Block], error)
- func (m *MockService) FetchBodies(ctx context.Context, headers []*types.Header, peerId *PeerId, ...) (FetcherResponse[[]*types.Body], error)
- func (m *MockService) FetchHeaders(ctx context.Context, start, end uint64, peerId *PeerId, opts ...FetcherOption) (FetcherResponse[[]*types.Header], error)
- func (m *MockService) ListPeersMayHaveBlockNum(blockNum uint64) []*PeerId
- func (m *MockService) ListPeersMayMissBlockHash(blockHash common.Hash) []*PeerId
- func (m *MockService) MaxPeers() int
- func (m *MockService) PeerConnected(peerId *PeerId)
- func (m *MockService) PeerDisconnected(peerId *PeerId)
- func (m *MockService) Penalize(ctx context.Context, peerId *PeerId) error
- func (m *MockService) PublishNewBlock(block *types.Block, td *big.Int)
- func (m *MockService) PublishNewBlockHashes(block *types.Block)
- func (m *MockService) RegisterBlockBodiesObserver(...) UnregisterFunc
- func (m *MockService) RegisterBlockHeadersObserver(...) UnregisterFunc
- func (m *MockService) RegisterNewBlockHashesObserver(...) UnregisterFunc
- func (m *MockService) RegisterNewBlockObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc
- func (m *MockService) RegisterPeerEventObserver(observer polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc
- func (m *MockService) Run(ctx context.Context) error
- type MockServiceBlockHashPresentCall
- func (c *MockServiceBlockHashPresentCall) Do(f func(*PeerId, common.Hash)) *MockServiceBlockHashPresentCall
- func (c *MockServiceBlockHashPresentCall) DoAndReturn(f func(*PeerId, common.Hash)) *MockServiceBlockHashPresentCall
- func (c *MockServiceBlockHashPresentCall) Return() *MockServiceBlockHashPresentCall
- type MockServiceBlockNumMissingCall
- type MockServiceBlockNumPresentCall
- type MockServiceFetchBlocksBackwardsByHashCall
- func (c *MockServiceFetchBlocksBackwardsByHashCall) Do(...) *MockServiceFetchBlocksBackwardsByHashCall
- func (c *MockServiceFetchBlocksBackwardsByHashCall) DoAndReturn(...) *MockServiceFetchBlocksBackwardsByHashCall
- func (c *MockServiceFetchBlocksBackwardsByHashCall) Return(arg0 FetcherResponse[[]*types.Block], arg1 error) *MockServiceFetchBlocksBackwardsByHashCall
- type MockServiceFetchBodiesCall
- type MockServiceFetchHeadersCall
- type MockServiceListPeersMayHaveBlockNumCall
- func (c *MockServiceListPeersMayHaveBlockNumCall) Do(f func(uint64) []*PeerId) *MockServiceListPeersMayHaveBlockNumCall
- func (c *MockServiceListPeersMayHaveBlockNumCall) DoAndReturn(f func(uint64) []*PeerId) *MockServiceListPeersMayHaveBlockNumCall
- func (c *MockServiceListPeersMayHaveBlockNumCall) Return(arg0 []*PeerId) *MockServiceListPeersMayHaveBlockNumCall
- type MockServiceListPeersMayMissBlockHashCall
- func (c *MockServiceListPeersMayMissBlockHashCall) Do(f func(common.Hash) []*PeerId) *MockServiceListPeersMayMissBlockHashCall
- func (c *MockServiceListPeersMayMissBlockHashCall) DoAndReturn(f func(common.Hash) []*PeerId) *MockServiceListPeersMayMissBlockHashCall
- func (c *MockServiceListPeersMayMissBlockHashCall) Return(arg0 []*PeerId) *MockServiceListPeersMayMissBlockHashCall
- type MockServiceMaxPeersCall
- type MockServiceMockRecorder
- func (mr *MockServiceMockRecorder) BlockHashPresent(peerId, blockHash any) *MockServiceBlockHashPresentCall
- func (mr *MockServiceMockRecorder) BlockNumMissing(peerId, blockNum any) *MockServiceBlockNumMissingCall
- func (mr *MockServiceMockRecorder) BlockNumPresent(peerId, blockNum any) *MockServiceBlockNumPresentCall
- func (mr *MockServiceMockRecorder) FetchBlocksBackwardsByHash(ctx, hash, amount, peerId any, opts ...any) *MockServiceFetchBlocksBackwardsByHashCall
- func (mr *MockServiceMockRecorder) FetchBodies(ctx, headers, peerId any, opts ...any) *MockServiceFetchBodiesCall
- func (mr *MockServiceMockRecorder) FetchHeaders(ctx, start, end, peerId any, opts ...any) *MockServiceFetchHeadersCall
- func (mr *MockServiceMockRecorder) ListPeersMayHaveBlockNum(blockNum any) *MockServiceListPeersMayHaveBlockNumCall
- func (mr *MockServiceMockRecorder) ListPeersMayMissBlockHash(blockHash any) *MockServiceListPeersMayMissBlockHashCall
- func (mr *MockServiceMockRecorder) MaxPeers() *MockServiceMaxPeersCall
- func (mr *MockServiceMockRecorder) PeerConnected(peerId any) *MockServicePeerConnectedCall
- func (mr *MockServiceMockRecorder) PeerDisconnected(peerId any) *MockServicePeerDisconnectedCall
- func (mr *MockServiceMockRecorder) Penalize(ctx, peerId any) *MockServicePenalizeCall
- func (mr *MockServiceMockRecorder) PublishNewBlock(block, td any) *MockServicePublishNewBlockCall
- func (mr *MockServiceMockRecorder) PublishNewBlockHashes(block any) *MockServicePublishNewBlockHashesCall
- func (mr *MockServiceMockRecorder) RegisterBlockBodiesObserver(observer any) *MockServiceRegisterBlockBodiesObserverCall
- func (mr *MockServiceMockRecorder) RegisterBlockHeadersObserver(observer any) *MockServiceRegisterBlockHeadersObserverCall
- func (mr *MockServiceMockRecorder) RegisterNewBlockHashesObserver(observer any) *MockServiceRegisterNewBlockHashesObserverCall
- func (mr *MockServiceMockRecorder) RegisterNewBlockObserver(observer any) *MockServiceRegisterNewBlockObserverCall
- func (mr *MockServiceMockRecorder) RegisterPeerEventObserver(observer any) *MockServiceRegisterPeerEventObserverCall
- func (mr *MockServiceMockRecorder) Run(ctx any) *MockServiceRunCall
- type MockServicePeerConnectedCall
- type MockServicePeerDisconnectedCall
- type MockServicePenalizeCall
- type MockServicePublishNewBlockCall
- func (c *MockServicePublishNewBlockCall) Do(f func(*types.Block, *big.Int)) *MockServicePublishNewBlockCall
- func (c *MockServicePublishNewBlockCall) DoAndReturn(f func(*types.Block, *big.Int)) *MockServicePublishNewBlockCall
- func (c *MockServicePublishNewBlockCall) Return() *MockServicePublishNewBlockCall
- type MockServicePublishNewBlockHashesCall
- func (c *MockServicePublishNewBlockHashesCall) Do(f func(*types.Block)) *MockServicePublishNewBlockHashesCall
- func (c *MockServicePublishNewBlockHashesCall) DoAndReturn(f func(*types.Block)) *MockServicePublishNewBlockHashesCall
- func (c *MockServicePublishNewBlockHashesCall) Return() *MockServicePublishNewBlockHashesCall
- type MockServiceRegisterBlockBodiesObserverCall
- func (c *MockServiceRegisterBlockBodiesObserverCall) Do(...) *MockServiceRegisterBlockBodiesObserverCall
- func (c *MockServiceRegisterBlockBodiesObserverCall) DoAndReturn(...) *MockServiceRegisterBlockBodiesObserverCall
- func (c *MockServiceRegisterBlockBodiesObserverCall) Return(arg0 UnregisterFunc) *MockServiceRegisterBlockBodiesObserverCall
- type MockServiceRegisterBlockHeadersObserverCall
- func (c *MockServiceRegisterBlockHeadersObserverCall) Do(...) *MockServiceRegisterBlockHeadersObserverCall
- func (c *MockServiceRegisterBlockHeadersObserverCall) DoAndReturn(...) *MockServiceRegisterBlockHeadersObserverCall
- func (c *MockServiceRegisterBlockHeadersObserverCall) Return(arg0 UnregisterFunc) *MockServiceRegisterBlockHeadersObserverCall
- type MockServiceRegisterNewBlockHashesObserverCall
- func (c *MockServiceRegisterNewBlockHashesObserverCall) Do(...) *MockServiceRegisterNewBlockHashesObserverCall
- func (c *MockServiceRegisterNewBlockHashesObserverCall) DoAndReturn(...) *MockServiceRegisterNewBlockHashesObserverCall
- func (c *MockServiceRegisterNewBlockHashesObserverCall) Return(arg0 UnregisterFunc) *MockServiceRegisterNewBlockHashesObserverCall
- type MockServiceRegisterNewBlockObserverCall
- func (c *MockServiceRegisterNewBlockObserverCall) Do(...) *MockServiceRegisterNewBlockObserverCall
- func (c *MockServiceRegisterNewBlockObserverCall) DoAndReturn(...) *MockServiceRegisterNewBlockObserverCall
- func (c *MockServiceRegisterNewBlockObserverCall) Return(arg0 UnregisterFunc) *MockServiceRegisterNewBlockObserverCall
- type MockServiceRegisterPeerEventObserverCall
- func (c *MockServiceRegisterPeerEventObserverCall) Do(f func(polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc) *MockServiceRegisterPeerEventObserverCall
- func (c *MockServiceRegisterPeerEventObserverCall) DoAndReturn(f func(polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc) *MockServiceRegisterPeerEventObserverCall
- func (c *MockServiceRegisterPeerEventObserverCall) Return(arg0 UnregisterFunc) *MockServiceRegisterPeerEventObserverCall
- type MockServiceRunCall
- type MockpeerEventRegistrar
- func (m *MockpeerEventRegistrar) EXPECT() *MockpeerEventRegistrarMockRecorder
- func (m *MockpeerEventRegistrar) RegisterNewBlockHashesObserver(...) UnregisterFunc
- func (m *MockpeerEventRegistrar) RegisterNewBlockObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc
- func (m *MockpeerEventRegistrar) RegisterPeerEventObserver(observer polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc
- type MockpeerEventRegistrarMockRecorder
- func (mr *MockpeerEventRegistrarMockRecorder) RegisterNewBlockHashesObserver(observer any) *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall
- func (mr *MockpeerEventRegistrarMockRecorder) RegisterNewBlockObserver(observer any) *MockpeerEventRegistrarRegisterNewBlockObserverCall
- func (mr *MockpeerEventRegistrarMockRecorder) RegisterPeerEventObserver(observer any) *MockpeerEventRegistrarRegisterPeerEventObserverCall
- type MockpeerEventRegistrarRegisterNewBlockHashesObserverCall
- func (c *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall) Do(...) *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall
- func (c *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall) DoAndReturn(...) *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall
- func (c *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall) Return(arg0 UnregisterFunc) *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall
- type MockpeerEventRegistrarRegisterNewBlockObserverCall
- func (c *MockpeerEventRegistrarRegisterNewBlockObserverCall) Do(...) *MockpeerEventRegistrarRegisterNewBlockObserverCall
- func (c *MockpeerEventRegistrarRegisterNewBlockObserverCall) DoAndReturn(...) *MockpeerEventRegistrarRegisterNewBlockObserverCall
- func (c *MockpeerEventRegistrarRegisterNewBlockObserverCall) Return(arg0 UnregisterFunc) *MockpeerEventRegistrarRegisterNewBlockObserverCall
- type MockpeerEventRegistrarRegisterPeerEventObserverCall
- func (c *MockpeerEventRegistrarRegisterPeerEventObserverCall) Do(f func(polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc) *MockpeerEventRegistrarRegisterPeerEventObserverCall
- func (c *MockpeerEventRegistrarRegisterPeerEventObserverCall) DoAndReturn(f func(polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc) *MockpeerEventRegistrarRegisterPeerEventObserverCall
- func (c *MockpeerEventRegistrarRegisterPeerEventObserverCall) Return(arg0 UnregisterFunc) *MockpeerEventRegistrarRegisterPeerEventObserverCall
- type MockpeerProvider
- type MockpeerProviderMockRecorder
- type MockpeerProviderPeersCall
- type PeerId
- type PeerPenalizer
- type PeerShuffle
- type PeerTracker
- type PeerTrackerOption
- type Publisher
- type RequestIdGenerator
- type Service
- type UnregisterFunc
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidFetchBlocksAmount = errors.New("invalid fetch blocks amount")
var ErrPeerNotFound = errors.New("peer not found")
Functions ¶
func PreservingPeerShuffle ¶
func PreservingPeerShuffle(_ []*PeerId)
func RandPeerShuffle ¶
func RandPeerShuffle(peerIds []*PeerId)
func WithPreservingPeerShuffle ¶
func WithPreservingPeerShuffle(pt *peerTracker)
Types ¶
type DecodedInboundMessage ¶
type DecodedInboundMessage[TPacket any] struct { *sentryproto.InboundMessage Decoded TPacket PeerId *PeerId }
type ErrIncompleteHeaders ¶
type ErrIncompleteHeaders struct {
// contains filtered or unexported fields
}
func (ErrIncompleteHeaders) Error ¶
func (e ErrIncompleteHeaders) Error() string
func (ErrIncompleteHeaders) Is ¶
func (e ErrIncompleteHeaders) Is(err error) bool
func (ErrIncompleteHeaders) LowestMissingBlockNum ¶
func (e ErrIncompleteHeaders) LowestMissingBlockNum() uint64
type ErrInvalidFetchHeadersRange ¶
type ErrInvalidFetchHeadersRange struct {
// contains filtered or unexported fields
}
func (ErrInvalidFetchHeadersRange) Error ¶
func (e ErrInvalidFetchHeadersRange) Error() string
func (ErrInvalidFetchHeadersRange) Is ¶
func (e ErrInvalidFetchHeadersRange) Is(err error) bool
type ErrMissingBodies ¶
type ErrMissingBodies struct {
// contains filtered or unexported fields
}
func NewErrMissingBodies ¶
func NewErrMissingBodies(headers []*types.Header) *ErrMissingBodies
func (ErrMissingBodies) Error ¶
func (e ErrMissingBodies) Error() string
func (ErrMissingBodies) Is ¶
func (e ErrMissingBodies) Is(err error) bool
func (ErrMissingBodies) LowestMissingBlockNum ¶
func (e ErrMissingBodies) LowestMissingBlockNum() (uint64, bool)
type ErrMissingHeaderHash ¶
type ErrMissingHeaderHash struct {
// contains filtered or unexported fields
}
func (ErrMissingHeaderHash) Error ¶
func (e ErrMissingHeaderHash) Error() string
func (ErrMissingHeaderHash) Is ¶
func (e ErrMissingHeaderHash) Is(err error) bool
type ErrNonSequentialHeaderHashes ¶
type ErrNonSequentialHeaderHashes struct {
// contains filtered or unexported fields
}
func (ErrNonSequentialHeaderHashes) Error ¶
func (e ErrNonSequentialHeaderHashes) Error() string
func (ErrNonSequentialHeaderHashes) Is ¶
func (e ErrNonSequentialHeaderHashes) Is(err error) bool
type ErrNonSequentialHeaderNumbers ¶
type ErrNonSequentialHeaderNumbers struct {
// contains filtered or unexported fields
}
func (ErrNonSequentialHeaderNumbers) Error ¶
func (e ErrNonSequentialHeaderNumbers) Error() string
func (ErrNonSequentialHeaderNumbers) Is ¶
func (e ErrNonSequentialHeaderNumbers) Is(err error) bool
type ErrTooManyBodies ¶
type ErrTooManyBodies struct {
// contains filtered or unexported fields
}
func (ErrTooManyBodies) Error ¶
func (e ErrTooManyBodies) Error() string
func (ErrTooManyBodies) Is ¶
func (e ErrTooManyBodies) Is(err error) bool
type ErrTooManyHeaders ¶
type ErrTooManyHeaders struct {
// contains filtered or unexported fields
}
func (ErrTooManyHeaders) Error ¶
func (e ErrTooManyHeaders) Error() string
func (ErrTooManyHeaders) Is ¶
func (e ErrTooManyHeaders) Is(err error) bool
type ErrUnexpectedHeaderHash ¶
type ErrUnexpectedHeaderHash struct {
// contains filtered or unexported fields
}
func (ErrUnexpectedHeaderHash) Error ¶
func (e ErrUnexpectedHeaderHash) Error() string
func (ErrUnexpectedHeaderHash) Is ¶
func (e ErrUnexpectedHeaderHash) Is(err error) bool
type Fetcher ¶
type Fetcher interface { // FetchHeaders fetches [start,end) headers from a peer. Blocks until data is received. FetchHeaders( ctx context.Context, start uint64, end uint64, peerId *PeerId, opts ...FetcherOption, ) (FetcherResponse[[]*types.Header], error) // FetchBodies fetches block bodies for the given headers from a peer. Blocks until data is received. FetchBodies( ctx context.Context, headers []*types.Header, peerId *PeerId, opts ...FetcherOption, ) (FetcherResponse[[]*types.Body], error) // FetchBlocksBackwardsByHash fetches a number of blocks backwards starting from a block hash. Max amount is 1024 // blocks back. Blocks until data is received. FetchBlocksBackwardsByHash( ctx context.Context, hash common.Hash, amount uint64, peerId *PeerId, opts ...FetcherOption, ) (FetcherResponse[[]*types.Block], error) }
func NewFetcher ¶
func NewFetcher( logger log.Logger, config FetcherConfig, messageListener MessageListener, messageSender MessageSender, requestIdGenerator RequestIdGenerator, ) Fetcher
func NewPenalizingFetcher ¶
func NewPenalizingFetcher(logger log.Logger, fetcher Fetcher, peerPenalizer PeerPenalizer) Fetcher
func NewTrackingFetcher ¶
func NewTrackingFetcher(fetcher Fetcher, peerTracker PeerTracker) Fetcher
type FetcherConfig ¶
type FetcherConfig struct {
// contains filtered or unexported fields
}
func (FetcherConfig) CopyWithOptions ¶
func (fc FetcherConfig) CopyWithOptions(opts ...FetcherOption) FetcherConfig
type FetcherOption ¶
type FetcherOption func(FetcherConfig) FetcherConfig
func WithMaxRetries ¶
func WithMaxRetries(maxRetries uint64) FetcherOption
func WithResponseTimeout ¶
func WithResponseTimeout(responseTimeout time.Duration) FetcherOption
type FetcherResponse ¶
type MessageListener ¶
type MessageListener interface { Run(ctx context.Context) error RegisterNewBlockObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc RegisterNewBlockHashesObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc RegisterBlockHeadersObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.BlockHeadersPacket66]]) UnregisterFunc RegisterBlockBodiesObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.BlockBodiesPacket66]]) UnregisterFunc RegisterPeerEventObserver(observer polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc }
func NewMessageListener ¶
func NewMessageListener( logger log.Logger, sentryClient sentryproto.SentryClient, statusDataFactory sentry.StatusDataFactory, peerPenalizer PeerPenalizer, ) MessageListener
type MessageSender ¶
type MessageSender interface { SendGetBlockHeaders(ctx context.Context, peerId *PeerId, req eth.GetBlockHeadersPacket66) error SendGetBlockBodies(ctx context.Context, peerId *PeerId, req eth.GetBlockBodiesPacket66) error SendNewBlockHashes(ctx context.Context, peerId *PeerId, req eth.NewBlockHashesPacket) error SendNewBlock(ctx context.Context, peerId *PeerId, req eth.NewBlockPacket) error }
func NewMessageSender ¶
func NewMessageSender(sentryClient sentry.SentryClient) MessageSender
type MockService ¶
type MockService struct {
// contains filtered or unexported fields
}
MockService is a mock of Service interface.
func NewMockService ¶
func NewMockService(ctrl *gomock.Controller) *MockService
NewMockService creates a new mock instance.
func (*MockService) BlockHashPresent ¶
func (m *MockService) BlockHashPresent(peerId *PeerId, blockHash common.Hash)
BlockHashPresent mocks base method.
func (*MockService) BlockNumMissing ¶
func (m *MockService) BlockNumMissing(peerId *PeerId, blockNum uint64)
BlockNumMissing mocks base method.
func (*MockService) BlockNumPresent ¶
func (m *MockService) BlockNumPresent(peerId *PeerId, blockNum uint64)
BlockNumPresent mocks base method.
func (*MockService) EXPECT ¶
func (m *MockService) EXPECT() *MockServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockService) FetchBlocksBackwardsByHash ¶
func (m *MockService) FetchBlocksBackwardsByHash(ctx context.Context, hash common.Hash, amount uint64, peerId *PeerId, opts ...FetcherOption) (FetcherResponse[[]*types.Block], error)
FetchBlocksBackwardsByHash mocks base method.
func (*MockService) FetchBodies ¶
func (m *MockService) FetchBodies(ctx context.Context, headers []*types.Header, peerId *PeerId, opts ...FetcherOption) (FetcherResponse[[]*types.Body], error)
FetchBodies mocks base method.
func (*MockService) FetchHeaders ¶
func (m *MockService) FetchHeaders(ctx context.Context, start, end uint64, peerId *PeerId, opts ...FetcherOption) (FetcherResponse[[]*types.Header], error)
FetchHeaders mocks base method.
func (*MockService) ListPeersMayHaveBlockNum ¶
func (m *MockService) ListPeersMayHaveBlockNum(blockNum uint64) []*PeerId
ListPeersMayHaveBlockNum mocks base method.
func (*MockService) ListPeersMayMissBlockHash ¶
func (m *MockService) ListPeersMayMissBlockHash(blockHash common.Hash) []*PeerId
ListPeersMayMissBlockHash mocks base method.
func (*MockService) PeerConnected ¶
func (m *MockService) PeerConnected(peerId *PeerId)
PeerConnected mocks base method.
func (*MockService) PeerDisconnected ¶
func (m *MockService) PeerDisconnected(peerId *PeerId)
PeerDisconnected mocks base method.
func (*MockService) Penalize ¶
func (m *MockService) Penalize(ctx context.Context, peerId *PeerId) error
Penalize mocks base method.
func (*MockService) PublishNewBlock ¶
func (m *MockService) PublishNewBlock(block *types.Block, td *big.Int)
PublishNewBlock mocks base method.
func (*MockService) PublishNewBlockHashes ¶
func (m *MockService) PublishNewBlockHashes(block *types.Block)
PublishNewBlockHashes mocks base method.
func (*MockService) RegisterBlockBodiesObserver ¶
func (m *MockService) RegisterBlockBodiesObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.BlockBodiesPacket66]]) UnregisterFunc
RegisterBlockBodiesObserver mocks base method.
func (*MockService) RegisterBlockHeadersObserver ¶
func (m *MockService) RegisterBlockHeadersObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.BlockHeadersPacket66]]) UnregisterFunc
RegisterBlockHeadersObserver mocks base method.
func (*MockService) RegisterNewBlockHashesObserver ¶
func (m *MockService) RegisterNewBlockHashesObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc
RegisterNewBlockHashesObserver mocks base method.
func (*MockService) RegisterNewBlockObserver ¶
func (m *MockService) RegisterNewBlockObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc
RegisterNewBlockObserver mocks base method.
func (*MockService) RegisterPeerEventObserver ¶
func (m *MockService) RegisterPeerEventObserver(observer polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc
RegisterPeerEventObserver mocks base method.
type MockServiceBlockHashPresentCall ¶
MockServiceBlockHashPresentCall wrap *gomock.Call
func (*MockServiceBlockHashPresentCall) Do ¶
func (c *MockServiceBlockHashPresentCall) Do(f func(*PeerId, common.Hash)) *MockServiceBlockHashPresentCall
Do rewrite *gomock.Call.Do
func (*MockServiceBlockHashPresentCall) DoAndReturn ¶
func (c *MockServiceBlockHashPresentCall) DoAndReturn(f func(*PeerId, common.Hash)) *MockServiceBlockHashPresentCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServiceBlockHashPresentCall) Return ¶
func (c *MockServiceBlockHashPresentCall) Return() *MockServiceBlockHashPresentCall
Return rewrite *gomock.Call.Return
type MockServiceBlockNumMissingCall ¶
MockServiceBlockNumMissingCall wrap *gomock.Call
func (*MockServiceBlockNumMissingCall) Do ¶
func (c *MockServiceBlockNumMissingCall) Do(f func(*PeerId, uint64)) *MockServiceBlockNumMissingCall
Do rewrite *gomock.Call.Do
func (*MockServiceBlockNumMissingCall) DoAndReturn ¶
func (c *MockServiceBlockNumMissingCall) DoAndReturn(f func(*PeerId, uint64)) *MockServiceBlockNumMissingCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServiceBlockNumMissingCall) Return ¶
func (c *MockServiceBlockNumMissingCall) Return() *MockServiceBlockNumMissingCall
Return rewrite *gomock.Call.Return
type MockServiceBlockNumPresentCall ¶
MockServiceBlockNumPresentCall wrap *gomock.Call
func (*MockServiceBlockNumPresentCall) Do ¶
func (c *MockServiceBlockNumPresentCall) Do(f func(*PeerId, uint64)) *MockServiceBlockNumPresentCall
Do rewrite *gomock.Call.Do
func (*MockServiceBlockNumPresentCall) DoAndReturn ¶
func (c *MockServiceBlockNumPresentCall) DoAndReturn(f func(*PeerId, uint64)) *MockServiceBlockNumPresentCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServiceBlockNumPresentCall) Return ¶
func (c *MockServiceBlockNumPresentCall) Return() *MockServiceBlockNumPresentCall
Return rewrite *gomock.Call.Return
type MockServiceFetchBlocksBackwardsByHashCall ¶
MockServiceFetchBlocksBackwardsByHashCall wrap *gomock.Call
func (*MockServiceFetchBlocksBackwardsByHashCall) Do ¶
func (c *MockServiceFetchBlocksBackwardsByHashCall) Do(f func(context.Context, common.Hash, uint64, *PeerId, ...FetcherOption) (FetcherResponse[[]*types.Block], error)) *MockServiceFetchBlocksBackwardsByHashCall
Do rewrite *gomock.Call.Do
func (*MockServiceFetchBlocksBackwardsByHashCall) DoAndReturn ¶
func (c *MockServiceFetchBlocksBackwardsByHashCall) DoAndReturn(f func(context.Context, common.Hash, uint64, *PeerId, ...FetcherOption) (FetcherResponse[[]*types.Block], error)) *MockServiceFetchBlocksBackwardsByHashCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServiceFetchBlocksBackwardsByHashCall) Return ¶
func (c *MockServiceFetchBlocksBackwardsByHashCall) Return(arg0 FetcherResponse[[]*types.Block], arg1 error) *MockServiceFetchBlocksBackwardsByHashCall
Return rewrite *gomock.Call.Return
type MockServiceFetchBodiesCall ¶
MockServiceFetchBodiesCall wrap *gomock.Call
func (*MockServiceFetchBodiesCall) Do ¶
func (c *MockServiceFetchBodiesCall) Do(f func(context.Context, []*types.Header, *PeerId, ...FetcherOption) (FetcherResponse[[]*types.Body], error)) *MockServiceFetchBodiesCall
Do rewrite *gomock.Call.Do
func (*MockServiceFetchBodiesCall) DoAndReturn ¶
func (c *MockServiceFetchBodiesCall) DoAndReturn(f func(context.Context, []*types.Header, *PeerId, ...FetcherOption) (FetcherResponse[[]*types.Body], error)) *MockServiceFetchBodiesCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServiceFetchBodiesCall) Return ¶
func (c *MockServiceFetchBodiesCall) Return(arg0 FetcherResponse[[]*types.Body], arg1 error) *MockServiceFetchBodiesCall
Return rewrite *gomock.Call.Return
type MockServiceFetchHeadersCall ¶
MockServiceFetchHeadersCall wrap *gomock.Call
func (*MockServiceFetchHeadersCall) Do ¶
func (c *MockServiceFetchHeadersCall) Do(f func(context.Context, uint64, uint64, *PeerId, ...FetcherOption) (FetcherResponse[[]*types.Header], error)) *MockServiceFetchHeadersCall
Do rewrite *gomock.Call.Do
func (*MockServiceFetchHeadersCall) DoAndReturn ¶
func (c *MockServiceFetchHeadersCall) DoAndReturn(f func(context.Context, uint64, uint64, *PeerId, ...FetcherOption) (FetcherResponse[[]*types.Header], error)) *MockServiceFetchHeadersCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServiceFetchHeadersCall) Return ¶
func (c *MockServiceFetchHeadersCall) Return(arg0 FetcherResponse[[]*types.Header], arg1 error) *MockServiceFetchHeadersCall
Return rewrite *gomock.Call.Return
type MockServiceListPeersMayHaveBlockNumCall ¶
MockServiceListPeersMayHaveBlockNumCall wrap *gomock.Call
func (*MockServiceListPeersMayHaveBlockNumCall) Do ¶
func (c *MockServiceListPeersMayHaveBlockNumCall) Do(f func(uint64) []*PeerId) *MockServiceListPeersMayHaveBlockNumCall
Do rewrite *gomock.Call.Do
func (*MockServiceListPeersMayHaveBlockNumCall) DoAndReturn ¶
func (c *MockServiceListPeersMayHaveBlockNumCall) DoAndReturn(f func(uint64) []*PeerId) *MockServiceListPeersMayHaveBlockNumCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServiceListPeersMayHaveBlockNumCall) Return ¶
func (c *MockServiceListPeersMayHaveBlockNumCall) Return(arg0 []*PeerId) *MockServiceListPeersMayHaveBlockNumCall
Return rewrite *gomock.Call.Return
type MockServiceListPeersMayMissBlockHashCall ¶
MockServiceListPeersMayMissBlockHashCall wrap *gomock.Call
func (*MockServiceListPeersMayMissBlockHashCall) Do ¶
func (c *MockServiceListPeersMayMissBlockHashCall) Do(f func(common.Hash) []*PeerId) *MockServiceListPeersMayMissBlockHashCall
Do rewrite *gomock.Call.Do
func (*MockServiceListPeersMayMissBlockHashCall) DoAndReturn ¶
func (c *MockServiceListPeersMayMissBlockHashCall) DoAndReturn(f func(common.Hash) []*PeerId) *MockServiceListPeersMayMissBlockHashCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServiceListPeersMayMissBlockHashCall) Return ¶
func (c *MockServiceListPeersMayMissBlockHashCall) Return(arg0 []*PeerId) *MockServiceListPeersMayMissBlockHashCall
Return rewrite *gomock.Call.Return
type MockServiceMaxPeersCall ¶
MockServiceMaxPeersCall wrap *gomock.Call
func (*MockServiceMaxPeersCall) Do ¶
func (c *MockServiceMaxPeersCall) Do(f func() int) *MockServiceMaxPeersCall
Do rewrite *gomock.Call.Do
func (*MockServiceMaxPeersCall) DoAndReturn ¶
func (c *MockServiceMaxPeersCall) DoAndReturn(f func() int) *MockServiceMaxPeersCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServiceMaxPeersCall) Return ¶
func (c *MockServiceMaxPeersCall) Return(arg0 int) *MockServiceMaxPeersCall
Return rewrite *gomock.Call.Return
type MockServiceMockRecorder ¶
type MockServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockServiceMockRecorder is the mock recorder for MockService.
func (*MockServiceMockRecorder) BlockHashPresent ¶
func (mr *MockServiceMockRecorder) BlockHashPresent(peerId, blockHash any) *MockServiceBlockHashPresentCall
BlockHashPresent indicates an expected call of BlockHashPresent.
func (*MockServiceMockRecorder) BlockNumMissing ¶
func (mr *MockServiceMockRecorder) BlockNumMissing(peerId, blockNum any) *MockServiceBlockNumMissingCall
BlockNumMissing indicates an expected call of BlockNumMissing.
func (*MockServiceMockRecorder) BlockNumPresent ¶
func (mr *MockServiceMockRecorder) BlockNumPresent(peerId, blockNum any) *MockServiceBlockNumPresentCall
BlockNumPresent indicates an expected call of BlockNumPresent.
func (*MockServiceMockRecorder) FetchBlocksBackwardsByHash ¶
func (mr *MockServiceMockRecorder) FetchBlocksBackwardsByHash(ctx, hash, amount, peerId any, opts ...any) *MockServiceFetchBlocksBackwardsByHashCall
FetchBlocksBackwardsByHash indicates an expected call of FetchBlocksBackwardsByHash.
func (*MockServiceMockRecorder) FetchBodies ¶
func (mr *MockServiceMockRecorder) FetchBodies(ctx, headers, peerId any, opts ...any) *MockServiceFetchBodiesCall
FetchBodies indicates an expected call of FetchBodies.
func (*MockServiceMockRecorder) FetchHeaders ¶
func (mr *MockServiceMockRecorder) FetchHeaders(ctx, start, end, peerId any, opts ...any) *MockServiceFetchHeadersCall
FetchHeaders indicates an expected call of FetchHeaders.
func (*MockServiceMockRecorder) ListPeersMayHaveBlockNum ¶
func (mr *MockServiceMockRecorder) ListPeersMayHaveBlockNum(blockNum any) *MockServiceListPeersMayHaveBlockNumCall
ListPeersMayHaveBlockNum indicates an expected call of ListPeersMayHaveBlockNum.
func (*MockServiceMockRecorder) ListPeersMayMissBlockHash ¶
func (mr *MockServiceMockRecorder) ListPeersMayMissBlockHash(blockHash any) *MockServiceListPeersMayMissBlockHashCall
ListPeersMayMissBlockHash indicates an expected call of ListPeersMayMissBlockHash.
func (*MockServiceMockRecorder) MaxPeers ¶
func (mr *MockServiceMockRecorder) MaxPeers() *MockServiceMaxPeersCall
MaxPeers indicates an expected call of MaxPeers.
func (*MockServiceMockRecorder) PeerConnected ¶
func (mr *MockServiceMockRecorder) PeerConnected(peerId any) *MockServicePeerConnectedCall
PeerConnected indicates an expected call of PeerConnected.
func (*MockServiceMockRecorder) PeerDisconnected ¶
func (mr *MockServiceMockRecorder) PeerDisconnected(peerId any) *MockServicePeerDisconnectedCall
PeerDisconnected indicates an expected call of PeerDisconnected.
func (*MockServiceMockRecorder) Penalize ¶
func (mr *MockServiceMockRecorder) Penalize(ctx, peerId any) *MockServicePenalizeCall
Penalize indicates an expected call of Penalize.
func (*MockServiceMockRecorder) PublishNewBlock ¶
func (mr *MockServiceMockRecorder) PublishNewBlock(block, td any) *MockServicePublishNewBlockCall
PublishNewBlock indicates an expected call of PublishNewBlock.
func (*MockServiceMockRecorder) PublishNewBlockHashes ¶
func (mr *MockServiceMockRecorder) PublishNewBlockHashes(block any) *MockServicePublishNewBlockHashesCall
PublishNewBlockHashes indicates an expected call of PublishNewBlockHashes.
func (*MockServiceMockRecorder) RegisterBlockBodiesObserver ¶
func (mr *MockServiceMockRecorder) RegisterBlockBodiesObserver(observer any) *MockServiceRegisterBlockBodiesObserverCall
RegisterBlockBodiesObserver indicates an expected call of RegisterBlockBodiesObserver.
func (*MockServiceMockRecorder) RegisterBlockHeadersObserver ¶
func (mr *MockServiceMockRecorder) RegisterBlockHeadersObserver(observer any) *MockServiceRegisterBlockHeadersObserverCall
RegisterBlockHeadersObserver indicates an expected call of RegisterBlockHeadersObserver.
func (*MockServiceMockRecorder) RegisterNewBlockHashesObserver ¶
func (mr *MockServiceMockRecorder) RegisterNewBlockHashesObserver(observer any) *MockServiceRegisterNewBlockHashesObserverCall
RegisterNewBlockHashesObserver indicates an expected call of RegisterNewBlockHashesObserver.
func (*MockServiceMockRecorder) RegisterNewBlockObserver ¶
func (mr *MockServiceMockRecorder) RegisterNewBlockObserver(observer any) *MockServiceRegisterNewBlockObserverCall
RegisterNewBlockObserver indicates an expected call of RegisterNewBlockObserver.
func (*MockServiceMockRecorder) RegisterPeerEventObserver ¶
func (mr *MockServiceMockRecorder) RegisterPeerEventObserver(observer any) *MockServiceRegisterPeerEventObserverCall
RegisterPeerEventObserver indicates an expected call of RegisterPeerEventObserver.
func (*MockServiceMockRecorder) Run ¶
func (mr *MockServiceMockRecorder) Run(ctx any) *MockServiceRunCall
Run indicates an expected call of Run.
type MockServicePeerConnectedCall ¶
MockServicePeerConnectedCall wrap *gomock.Call
func (*MockServicePeerConnectedCall) Do ¶
func (c *MockServicePeerConnectedCall) Do(f func(*PeerId)) *MockServicePeerConnectedCall
Do rewrite *gomock.Call.Do
func (*MockServicePeerConnectedCall) DoAndReturn ¶
func (c *MockServicePeerConnectedCall) DoAndReturn(f func(*PeerId)) *MockServicePeerConnectedCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServicePeerConnectedCall) Return ¶
func (c *MockServicePeerConnectedCall) Return() *MockServicePeerConnectedCall
Return rewrite *gomock.Call.Return
type MockServicePeerDisconnectedCall ¶
MockServicePeerDisconnectedCall wrap *gomock.Call
func (*MockServicePeerDisconnectedCall) Do ¶
func (c *MockServicePeerDisconnectedCall) Do(f func(*PeerId)) *MockServicePeerDisconnectedCall
Do rewrite *gomock.Call.Do
func (*MockServicePeerDisconnectedCall) DoAndReturn ¶
func (c *MockServicePeerDisconnectedCall) DoAndReturn(f func(*PeerId)) *MockServicePeerDisconnectedCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServicePeerDisconnectedCall) Return ¶
func (c *MockServicePeerDisconnectedCall) Return() *MockServicePeerDisconnectedCall
Return rewrite *gomock.Call.Return
type MockServicePenalizeCall ¶
MockServicePenalizeCall wrap *gomock.Call
func (*MockServicePenalizeCall) Do ¶
func (c *MockServicePenalizeCall) Do(f func(context.Context, *PeerId) error) *MockServicePenalizeCall
Do rewrite *gomock.Call.Do
func (*MockServicePenalizeCall) DoAndReturn ¶
func (c *MockServicePenalizeCall) DoAndReturn(f func(context.Context, *PeerId) error) *MockServicePenalizeCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServicePenalizeCall) Return ¶
func (c *MockServicePenalizeCall) Return(arg0 error) *MockServicePenalizeCall
Return rewrite *gomock.Call.Return
type MockServicePublishNewBlockCall ¶
MockServicePublishNewBlockCall wrap *gomock.Call
func (*MockServicePublishNewBlockCall) Do ¶
func (c *MockServicePublishNewBlockCall) Do(f func(*types.Block, *big.Int)) *MockServicePublishNewBlockCall
Do rewrite *gomock.Call.Do
func (*MockServicePublishNewBlockCall) DoAndReturn ¶
func (c *MockServicePublishNewBlockCall) DoAndReturn(f func(*types.Block, *big.Int)) *MockServicePublishNewBlockCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServicePublishNewBlockCall) Return ¶
func (c *MockServicePublishNewBlockCall) Return() *MockServicePublishNewBlockCall
Return rewrite *gomock.Call.Return
type MockServicePublishNewBlockHashesCall ¶
MockServicePublishNewBlockHashesCall wrap *gomock.Call
func (*MockServicePublishNewBlockHashesCall) Do ¶
func (c *MockServicePublishNewBlockHashesCall) Do(f func(*types.Block)) *MockServicePublishNewBlockHashesCall
Do rewrite *gomock.Call.Do
func (*MockServicePublishNewBlockHashesCall) DoAndReturn ¶
func (c *MockServicePublishNewBlockHashesCall) DoAndReturn(f func(*types.Block)) *MockServicePublishNewBlockHashesCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServicePublishNewBlockHashesCall) Return ¶
func (c *MockServicePublishNewBlockHashesCall) Return() *MockServicePublishNewBlockHashesCall
Return rewrite *gomock.Call.Return
type MockServiceRegisterBlockBodiesObserverCall ¶
MockServiceRegisterBlockBodiesObserverCall wrap *gomock.Call
func (*MockServiceRegisterBlockBodiesObserverCall) Do ¶
func (c *MockServiceRegisterBlockBodiesObserverCall) Do(f func(polygoncommon.Observer[*DecodedInboundMessage[*eth.BlockBodiesPacket66]]) UnregisterFunc) *MockServiceRegisterBlockBodiesObserverCall
Do rewrite *gomock.Call.Do
func (*MockServiceRegisterBlockBodiesObserverCall) DoAndReturn ¶
func (c *MockServiceRegisterBlockBodiesObserverCall) DoAndReturn(f func(polygoncommon.Observer[*DecodedInboundMessage[*eth.BlockBodiesPacket66]]) UnregisterFunc) *MockServiceRegisterBlockBodiesObserverCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServiceRegisterBlockBodiesObserverCall) Return ¶
func (c *MockServiceRegisterBlockBodiesObserverCall) Return(arg0 UnregisterFunc) *MockServiceRegisterBlockBodiesObserverCall
Return rewrite *gomock.Call.Return
type MockServiceRegisterBlockHeadersObserverCall ¶
MockServiceRegisterBlockHeadersObserverCall wrap *gomock.Call
func (*MockServiceRegisterBlockHeadersObserverCall) Do ¶
func (c *MockServiceRegisterBlockHeadersObserverCall) Do(f func(polygoncommon.Observer[*DecodedInboundMessage[*eth.BlockHeadersPacket66]]) UnregisterFunc) *MockServiceRegisterBlockHeadersObserverCall
Do rewrite *gomock.Call.Do
func (*MockServiceRegisterBlockHeadersObserverCall) DoAndReturn ¶
func (c *MockServiceRegisterBlockHeadersObserverCall) DoAndReturn(f func(polygoncommon.Observer[*DecodedInboundMessage[*eth.BlockHeadersPacket66]]) UnregisterFunc) *MockServiceRegisterBlockHeadersObserverCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServiceRegisterBlockHeadersObserverCall) Return ¶
func (c *MockServiceRegisterBlockHeadersObserverCall) Return(arg0 UnregisterFunc) *MockServiceRegisterBlockHeadersObserverCall
Return rewrite *gomock.Call.Return
type MockServiceRegisterNewBlockHashesObserverCall ¶
MockServiceRegisterNewBlockHashesObserverCall wrap *gomock.Call
func (*MockServiceRegisterNewBlockHashesObserverCall) Do ¶
func (c *MockServiceRegisterNewBlockHashesObserverCall) Do(f func(polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc) *MockServiceRegisterNewBlockHashesObserverCall
Do rewrite *gomock.Call.Do
func (*MockServiceRegisterNewBlockHashesObserverCall) DoAndReturn ¶
func (c *MockServiceRegisterNewBlockHashesObserverCall) DoAndReturn(f func(polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc) *MockServiceRegisterNewBlockHashesObserverCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServiceRegisterNewBlockHashesObserverCall) Return ¶
func (c *MockServiceRegisterNewBlockHashesObserverCall) Return(arg0 UnregisterFunc) *MockServiceRegisterNewBlockHashesObserverCall
Return rewrite *gomock.Call.Return
type MockServiceRegisterNewBlockObserverCall ¶
MockServiceRegisterNewBlockObserverCall wrap *gomock.Call
func (*MockServiceRegisterNewBlockObserverCall) Do ¶
func (c *MockServiceRegisterNewBlockObserverCall) Do(f func(polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc) *MockServiceRegisterNewBlockObserverCall
Do rewrite *gomock.Call.Do
func (*MockServiceRegisterNewBlockObserverCall) DoAndReturn ¶
func (c *MockServiceRegisterNewBlockObserverCall) DoAndReturn(f func(polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc) *MockServiceRegisterNewBlockObserverCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServiceRegisterNewBlockObserverCall) Return ¶
func (c *MockServiceRegisterNewBlockObserverCall) Return(arg0 UnregisterFunc) *MockServiceRegisterNewBlockObserverCall
Return rewrite *gomock.Call.Return
type MockServiceRegisterPeerEventObserverCall ¶
MockServiceRegisterPeerEventObserverCall wrap *gomock.Call
func (*MockServiceRegisterPeerEventObserverCall) Do ¶
func (c *MockServiceRegisterPeerEventObserverCall) Do(f func(polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc) *MockServiceRegisterPeerEventObserverCall
Do rewrite *gomock.Call.Do
func (*MockServiceRegisterPeerEventObserverCall) DoAndReturn ¶
func (c *MockServiceRegisterPeerEventObserverCall) DoAndReturn(f func(polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc) *MockServiceRegisterPeerEventObserverCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServiceRegisterPeerEventObserverCall) Return ¶
func (c *MockServiceRegisterPeerEventObserverCall) Return(arg0 UnregisterFunc) *MockServiceRegisterPeerEventObserverCall
Return rewrite *gomock.Call.Return
type MockServiceRunCall ¶
MockServiceRunCall wrap *gomock.Call
func (*MockServiceRunCall) Do ¶
func (c *MockServiceRunCall) Do(f func(context.Context) error) *MockServiceRunCall
Do rewrite *gomock.Call.Do
func (*MockServiceRunCall) DoAndReturn ¶
func (c *MockServiceRunCall) DoAndReturn(f func(context.Context) error) *MockServiceRunCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockServiceRunCall) Return ¶
func (c *MockServiceRunCall) Return(arg0 error) *MockServiceRunCall
Return rewrite *gomock.Call.Return
type MockpeerEventRegistrar ¶
type MockpeerEventRegistrar struct {
// contains filtered or unexported fields
}
MockpeerEventRegistrar is a mock of peerEventRegistrar interface.
func NewMockpeerEventRegistrar ¶
func NewMockpeerEventRegistrar(ctrl *gomock.Controller) *MockpeerEventRegistrar
NewMockpeerEventRegistrar creates a new mock instance.
func (*MockpeerEventRegistrar) EXPECT ¶
func (m *MockpeerEventRegistrar) EXPECT() *MockpeerEventRegistrarMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockpeerEventRegistrar) RegisterNewBlockHashesObserver ¶
func (m *MockpeerEventRegistrar) RegisterNewBlockHashesObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc
RegisterNewBlockHashesObserver mocks base method.
func (*MockpeerEventRegistrar) RegisterNewBlockObserver ¶
func (m *MockpeerEventRegistrar) RegisterNewBlockObserver(observer polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc
RegisterNewBlockObserver mocks base method.
func (*MockpeerEventRegistrar) RegisterPeerEventObserver ¶
func (m *MockpeerEventRegistrar) RegisterPeerEventObserver(observer polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc
RegisterPeerEventObserver mocks base method.
type MockpeerEventRegistrarMockRecorder ¶
type MockpeerEventRegistrarMockRecorder struct {
// contains filtered or unexported fields
}
MockpeerEventRegistrarMockRecorder is the mock recorder for MockpeerEventRegistrar.
func (*MockpeerEventRegistrarMockRecorder) RegisterNewBlockHashesObserver ¶
func (mr *MockpeerEventRegistrarMockRecorder) RegisterNewBlockHashesObserver(observer any) *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall
RegisterNewBlockHashesObserver indicates an expected call of RegisterNewBlockHashesObserver.
func (*MockpeerEventRegistrarMockRecorder) RegisterNewBlockObserver ¶
func (mr *MockpeerEventRegistrarMockRecorder) RegisterNewBlockObserver(observer any) *MockpeerEventRegistrarRegisterNewBlockObserverCall
RegisterNewBlockObserver indicates an expected call of RegisterNewBlockObserver.
func (*MockpeerEventRegistrarMockRecorder) RegisterPeerEventObserver ¶
func (mr *MockpeerEventRegistrarMockRecorder) RegisterPeerEventObserver(observer any) *MockpeerEventRegistrarRegisterPeerEventObserverCall
RegisterPeerEventObserver indicates an expected call of RegisterPeerEventObserver.
type MockpeerEventRegistrarRegisterNewBlockHashesObserverCall ¶
MockpeerEventRegistrarRegisterNewBlockHashesObserverCall wrap *gomock.Call
func (*MockpeerEventRegistrarRegisterNewBlockHashesObserverCall) Do ¶
func (c *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall) Do(f func(polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc) *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall
Do rewrite *gomock.Call.Do
func (*MockpeerEventRegistrarRegisterNewBlockHashesObserverCall) DoAndReturn ¶
func (c *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall) DoAndReturn(f func(polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockHashesPacket]]) UnregisterFunc) *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockpeerEventRegistrarRegisterNewBlockHashesObserverCall) Return ¶
func (c *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall) Return(arg0 UnregisterFunc) *MockpeerEventRegistrarRegisterNewBlockHashesObserverCall
Return rewrite *gomock.Call.Return
type MockpeerEventRegistrarRegisterNewBlockObserverCall ¶
MockpeerEventRegistrarRegisterNewBlockObserverCall wrap *gomock.Call
func (*MockpeerEventRegistrarRegisterNewBlockObserverCall) Do ¶
func (c *MockpeerEventRegistrarRegisterNewBlockObserverCall) Do(f func(polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc) *MockpeerEventRegistrarRegisterNewBlockObserverCall
Do rewrite *gomock.Call.Do
func (*MockpeerEventRegistrarRegisterNewBlockObserverCall) DoAndReturn ¶
func (c *MockpeerEventRegistrarRegisterNewBlockObserverCall) DoAndReturn(f func(polygoncommon.Observer[*DecodedInboundMessage[*eth.NewBlockPacket]]) UnregisterFunc) *MockpeerEventRegistrarRegisterNewBlockObserverCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockpeerEventRegistrarRegisterNewBlockObserverCall) Return ¶
func (c *MockpeerEventRegistrarRegisterNewBlockObserverCall) Return(arg0 UnregisterFunc) *MockpeerEventRegistrarRegisterNewBlockObserverCall
Return rewrite *gomock.Call.Return
type MockpeerEventRegistrarRegisterPeerEventObserverCall ¶
MockpeerEventRegistrarRegisterPeerEventObserverCall wrap *gomock.Call
func (*MockpeerEventRegistrarRegisterPeerEventObserverCall) Do ¶
func (c *MockpeerEventRegistrarRegisterPeerEventObserverCall) Do(f func(polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc) *MockpeerEventRegistrarRegisterPeerEventObserverCall
Do rewrite *gomock.Call.Do
func (*MockpeerEventRegistrarRegisterPeerEventObserverCall) DoAndReturn ¶
func (c *MockpeerEventRegistrarRegisterPeerEventObserverCall) DoAndReturn(f func(polygoncommon.Observer[*sentryproto.PeerEvent]) UnregisterFunc) *MockpeerEventRegistrarRegisterPeerEventObserverCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockpeerEventRegistrarRegisterPeerEventObserverCall) Return ¶
func (c *MockpeerEventRegistrarRegisterPeerEventObserverCall) Return(arg0 UnregisterFunc) *MockpeerEventRegistrarRegisterPeerEventObserverCall
Return rewrite *gomock.Call.Return
type MockpeerProvider ¶
type MockpeerProvider struct {
// contains filtered or unexported fields
}
MockpeerProvider is a mock of peerProvider interface.
func NewMockpeerProvider ¶
func NewMockpeerProvider(ctrl *gomock.Controller) *MockpeerProvider
NewMockpeerProvider creates a new mock instance.
func (*MockpeerProvider) EXPECT ¶
func (m *MockpeerProvider) EXPECT() *MockpeerProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockpeerProvider) Peers ¶
func (m *MockpeerProvider) Peers(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*sentryproto.PeersReply, error)
Peers mocks base method.
type MockpeerProviderMockRecorder ¶
type MockpeerProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockpeerProviderMockRecorder is the mock recorder for MockpeerProvider.
func (*MockpeerProviderMockRecorder) Peers ¶
func (mr *MockpeerProviderMockRecorder) Peers(ctx, in any, opts ...any) *MockpeerProviderPeersCall
Peers indicates an expected call of Peers.
type MockpeerProviderPeersCall ¶
MockpeerProviderPeersCall wrap *gomock.Call
func (*MockpeerProviderPeersCall) Do ¶
func (c *MockpeerProviderPeersCall) Do(f func(context.Context, *emptypb.Empty, ...grpc.CallOption) (*sentryproto.PeersReply, error)) *MockpeerProviderPeersCall
Do rewrite *gomock.Call.Do
func (*MockpeerProviderPeersCall) DoAndReturn ¶
func (c *MockpeerProviderPeersCall) DoAndReturn(f func(context.Context, *emptypb.Empty, ...grpc.CallOption) (*sentryproto.PeersReply, error)) *MockpeerProviderPeersCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockpeerProviderPeersCall) Return ¶
func (c *MockpeerProviderPeersCall) Return(arg0 *sentryproto.PeersReply, arg1 error) *MockpeerProviderPeersCall
Return rewrite *gomock.Call.Return
type PeerId ¶
type PeerId [64]byte
func PeerIdFromEnode ¶
func PeerIdFromH512 ¶
func PeerIdFromH512(h512 *typesproto.H512) *PeerId
func PeerIdFromUint64 ¶
PeerIdFromUint64 is useful for testing and that is its main intended purpose
func (*PeerId) H512 ¶
func (pid *PeerId) H512() *typesproto.H512
type PeerPenalizer ¶
func NewPeerPenalizer ¶
func NewPeerPenalizer(sentryClient sentry.SentryClient) PeerPenalizer
type PeerShuffle ¶
type PeerShuffle func(peerIds []*PeerId)
type PeerTracker ¶
type PeerTracker interface { Run(ctx context.Context) error ListPeersMayHaveBlockNum(blockNum uint64) []*PeerId BlockNumPresent(peerId *PeerId, blockNum uint64) BlockNumMissing(peerId *PeerId, blockNum uint64) ListPeersMayMissBlockHash(blockHash common.Hash) []*PeerId BlockHashPresent(peerId *PeerId, blockHash common.Hash) PeerConnected(peerId *PeerId) PeerDisconnected(peerId *PeerId) }
func NewPeerTracker ¶
func NewPeerTracker( logger log.Logger, peerProvider peerProvider, peerEventRegistrar peerEventRegistrar, opts ...PeerTrackerOption, ) PeerTracker
type PeerTrackerOption ¶
type PeerTrackerOption func(*peerTracker)
type Publisher ¶
type Publisher interface { PublishNewBlock(block *types.Block, td *big.Int) PublishNewBlockHashes(block *types.Block) Run(ctx context.Context) error }
func NewPublisher ¶
func NewPublisher(logger log.Logger, messageSender MessageSender, peerTracker PeerTracker) Publisher
type RequestIdGenerator ¶
type RequestIdGenerator func() uint64
type Service ¶
type Service interface { Fetcher MessageListener PeerTracker PeerPenalizer Publisher Run(ctx context.Context) error MaxPeers() int }
func NewService ¶
func NewService( maxPeers int, logger log.Logger, sentryClient sentryproto.SentryClient, statusDataFactory sentry.StatusDataFactory, ) Service
type UnregisterFunc ¶
type UnregisterFunc = polygoncommon.UnregisterFunc
Source Files ¶
- fetcher_base.go
- fetcher_config.go
- fetcher_errors.go
- fetcher_penalizing.go
- fetcher_tracking.go
- message_listener.go
- message_sender.go
- peer_event_registrar.go
- peer_event_registrar_mock.go
- peer_id.go
- peer_penalizer.go
- peer_provider.go
- peer_provider_mock.go
- peer_shuffle.go
- peer_sync_progress.go
- peer_tracker.go
- peer_tracker_option.go
- publisher.go
- service.go
- service_mock.go