Documentation ¶
Overview ¶
Package common is a generated GoMock package.
Index ¶
- Constants
- func SendMixedQuery(ctx context.Context, sender Sender, vdrs []ids.NodeID, numPushTo int, ...)
- type AcceptedFrontierHandler
- type AcceptedHandler
- type AcceptedSender
- type AcceptedStateSummaryHandler
- type AcceptedStateSummarySender
- type AllGetsServer
- type AncestorsHandler
- type AppHandler
- type AppSender
- type BootstrapTracker
- type BootstrapTrackerTest
- type Bootstrapable
- type BootstrapableEngine
- type BootstrapableTest
- type Bootstrapper
- type BootstrapperTest
- type ChitsHandler
- type Config
- type CrossChainAppHandler
- type CrossChainAppSender
- type Engine
- type EngineTest
- func (e *EngineTest) Accepted(ctx context.Context, nodeID ids.NodeID, requestID uint32, ...) error
- func (e *EngineTest) AcceptedFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32, ...) error
- func (e *EngineTest) AcceptedStateSummary(ctx context.Context, validatorID ids.NodeID, requestID uint32, ...) error
- func (e *EngineTest) Ancestors(ctx context.Context, nodeID ids.NodeID, requestID uint32, containers [][]byte) error
- func (e *EngineTest) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error
- func (e *EngineTest) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, ...) error
- func (e *EngineTest) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32) error
- func (e *EngineTest) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
- func (e *EngineTest) Chits(ctx context.Context, nodeID ids.NodeID, requestID uint32, ...) error
- func (e *EngineTest) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error
- func (e *EngineTest) Context() *snow.ConsensusContext
- func (e *EngineTest) CrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, ...) error
- func (e *EngineTest) CrossChainAppRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32) error
- func (e *EngineTest) CrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, response []byte) error
- func (e *EngineTest) Default(cant bool)
- func (e *EngineTest) Disconnected(ctx context.Context, nodeID ids.NodeID) error
- func (e *EngineTest) Get(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) error
- func (e *EngineTest) GetAccepted(ctx context.Context, nodeID ids.NodeID, requestID uint32, ...) error
- func (e *EngineTest) GetAcceptedFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32) error
- func (e *EngineTest) GetAcceptedFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32) error
- func (e *EngineTest) GetAcceptedFrontierFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32) error
- func (e *EngineTest) GetAcceptedStateSummary(ctx context.Context, validatorID ids.NodeID, requestID uint32, keys []uint64) error
- func (e *EngineTest) GetAcceptedStateSummaryFailed(ctx context.Context, validatorID ids.NodeID, requestID uint32) error
- func (e *EngineTest) GetAncestors(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) error
- func (e *EngineTest) GetAncestorsFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32) error
- func (e *EngineTest) GetFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32) error
- func (e *EngineTest) GetStateSummaryFrontier(ctx context.Context, validatorID ids.NodeID, requestID uint32) error
- func (e *EngineTest) GetStateSummaryFrontierFailed(ctx context.Context, validatorID ids.NodeID, requestID uint32) error
- func (e *EngineTest) GetVM() VM
- func (e *EngineTest) Gossip(ctx context.Context) error
- func (e *EngineTest) Halt(ctx context.Context)
- func (e *EngineTest) HealthCheck(ctx context.Context) (interface{}, error)
- func (e *EngineTest) Notify(ctx context.Context, msg Message) error
- func (e *EngineTest) PullQuery(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) error
- func (e *EngineTest) PushQuery(ctx context.Context, nodeID ids.NodeID, requestID uint32, container []byte) error
- func (e *EngineTest) Put(ctx context.Context, nodeID ids.NodeID, requestID uint32, container []byte) error
- func (e *EngineTest) QueryFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32) error
- func (e *EngineTest) Shutdown(ctx context.Context) error
- func (e *EngineTest) Start(ctx context.Context, startReqID uint32) error
- func (e *EngineTest) StateSummaryFrontier(ctx context.Context, validatorID ids.NodeID, requestID uint32, summary []byte) error
- func (e *EngineTest) Timeout(ctx context.Context) error
- type FetchSender
- type Fetcher
- type FrontierSender
- type Fx
- type GetAcceptedFrontierHandler
- type GetAcceptedHandler
- type GetAcceptedStateSummaryHandler
- type GetAncestorsHandler
- type GetHandler
- type GetStateSummaryFrontierHandler
- type Gossiper
- type HTTPHandler
- type Haltable
- type Halter
- type Handler
- type InternalHandler
- type LockOption
- type Message
- type MockSender
- func (m *MockSender) Accept(arg0 *snow.ConsensusContext, arg1 ids.ID, arg2 []byte) error
- func (m *MockSender) EXPECT() *MockSenderMockRecorder
- func (m *MockSender) SendAccepted(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 []ids.ID)
- func (m *MockSender) SendAcceptedFrontier(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 []ids.ID)
- func (m *MockSender) SendAcceptedStateSummary(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 []ids.ID)
- func (m *MockSender) SendAncestors(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 [][]byte)
- func (m *MockSender) SendAppGossip(arg0 context.Context, arg1 []byte) error
- func (m *MockSender) SendAppGossipSpecific(arg0 context.Context, arg1 set.Set[ids.NodeID], arg2 []byte) error
- func (m *MockSender) SendAppRequest(arg0 context.Context, arg1 set.Set[ids.NodeID], arg2 uint32, arg3 []byte) error
- func (m *MockSender) SendAppResponse(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 []byte) error
- func (m *MockSender) SendChits(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3, arg4 []ids.ID)
- func (m *MockSender) SendCrossChainAppRequest(arg0 context.Context, arg1 ids.ID, arg2 uint32, arg3 []byte) error
- func (m *MockSender) SendCrossChainAppResponse(arg0 context.Context, arg1 ids.ID, arg2 uint32, arg3 []byte) error
- func (m *MockSender) SendGet(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 ids.ID)
- func (m *MockSender) SendGetAccepted(arg0 context.Context, arg1 set.Set[ids.NodeID], arg2 uint32, arg3 []ids.ID)
- func (m *MockSender) SendGetAcceptedFrontier(arg0 context.Context, arg1 set.Set[ids.NodeID], arg2 uint32)
- func (m *MockSender) SendGetAcceptedStateSummary(arg0 context.Context, arg1 set.Set[ids.NodeID], arg2 uint32, arg3 []uint64)
- func (m *MockSender) SendGetAncestors(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 ids.ID)
- func (m *MockSender) SendGetStateSummaryFrontier(arg0 context.Context, arg1 set.Set[ids.NodeID], arg2 uint32)
- func (m *MockSender) SendGossip(arg0 context.Context, arg1 []byte)
- func (m *MockSender) SendPullQuery(arg0 context.Context, arg1 set.Set[ids.NodeID], arg2 uint32, arg3 ids.ID)
- func (m *MockSender) SendPushQuery(arg0 context.Context, arg1 set.Set[ids.NodeID], arg2 uint32, arg3 []byte)
- func (m *MockSender) SendPut(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 []byte)
- func (m *MockSender) SendStateSummaryFrontier(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 []byte)
- type MockSenderMockRecorder
- func (mr *MockSenderMockRecorder) Accept(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendAccepted(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendAcceptedFrontier(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendAcceptedStateSummary(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendAncestors(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendAppGossip(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendAppGossipSpecific(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendAppRequest(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendAppResponse(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendChits(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendCrossChainAppRequest(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendCrossChainAppResponse(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendGet(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendGetAccepted(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendGetAcceptedFrontier(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendGetAcceptedStateSummary(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendGetAncestors(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendGetStateSummaryFrontier(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendGossip(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendPullQuery(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendPushQuery(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendPut(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockSenderMockRecorder) SendStateSummaryFrontier(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- type NetworkAppHandler
- type NetworkAppSender
- type PutHandler
- type QueryHandler
- type QuerySender
- type Requests
- func (r *Requests) Add(vdr ids.NodeID, requestID uint32, containerID ids.ID)
- func (r *Requests) Contains(containerID ids.ID) bool
- func (r *Requests) Get(vdr ids.NodeID, requestID uint32) (ids.ID, bool)
- func (r *Requests) Len() int
- func (r *Requests) Remove(vdr ids.NodeID, requestID uint32) (ids.ID, bool)
- func (r *Requests) RemoveAny(containerID ids.ID) bool
- func (r Requests) String() string
- type Sender
- type SenderTest
- func (s *SenderTest) Accept(ctx *snow.ConsensusContext, containerID ids.ID, container []byte) error
- func (s *SenderTest) Default(cant bool)
- func (s *SenderTest) SendAccepted(ctx context.Context, validatorID ids.NodeID, requestID uint32, ...)
- func (s *SenderTest) SendAcceptedFrontier(ctx context.Context, validatorID ids.NodeID, requestID uint32, ...)
- func (s *SenderTest) SendAcceptedStateSummary(ctx context.Context, validatorID ids.NodeID, requestID uint32, ...)
- func (s *SenderTest) SendAncestors(ctx context.Context, vdr ids.NodeID, requestID uint32, vtxs [][]byte)
- func (s *SenderTest) SendAppGossip(ctx context.Context, appGossipBytes []byte) error
- func (s *SenderTest) SendAppGossipSpecific(ctx context.Context, nodeIDs set.Set[ids.NodeID], appGossipBytes []byte) error
- func (s *SenderTest) SendAppRequest(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, ...) error
- func (s *SenderTest) SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, ...) error
- func (s *SenderTest) SendChits(ctx context.Context, vdr ids.NodeID, requestID uint32, votes []ids.ID, ...)
- func (s *SenderTest) SendCrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, appRequestBytes []byte) error
- func (s *SenderTest) SendCrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, appResponseBytes []byte) error
- func (s *SenderTest) SendGet(ctx context.Context, vdr ids.NodeID, requestID uint32, vtxID ids.ID)
- func (s *SenderTest) SendGetAccepted(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, ...)
- func (s *SenderTest) SendGetAcceptedFrontier(ctx context.Context, validatorIDs set.Set[ids.NodeID], requestID uint32)
- func (s *SenderTest) SendGetAcceptedStateSummary(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, ...)
- func (s *SenderTest) SendGetAncestors(ctx context.Context, validatorID ids.NodeID, requestID uint32, vtxID ids.ID)
- func (s *SenderTest) SendGetStateSummaryFrontier(ctx context.Context, validatorIDs set.Set[ids.NodeID], requestID uint32)
- func (s *SenderTest) SendGossip(ctx context.Context, container []byte)
- func (s *SenderTest) SendPullQuery(ctx context.Context, vdrs set.Set[ids.NodeID], requestID uint32, vtxID ids.ID)
- func (s *SenderTest) SendPushQuery(ctx context.Context, vdrs set.Set[ids.NodeID], requestID uint32, vtx []byte)
- func (s *SenderTest) SendPut(ctx context.Context, vdr ids.NodeID, requestID uint32, vtx []byte)
- func (s *SenderTest) SendStateSummaryFrontier(ctx context.Context, validatorID ids.NodeID, requestID uint32, summary []byte)
- type SharedConfig
- type StateSummaryFrontierHandler
- type StateSummarySender
- type StateSyncer
- type TestVM
- func (vm *TestVM) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error
- func (vm *TestVM) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, ...) error
- func (vm *TestVM) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32) error
- func (vm *TestVM) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
- func (vm *TestVM) Connected(ctx context.Context, id ids.NodeID, nodeVersion *version.Application) error
- func (vm *TestVM) CreateHandlers(ctx context.Context) (map[string]*HTTPHandler, error)
- func (vm *TestVM) CreateStaticHandlers(ctx context.Context) (map[string]*HTTPHandler, error)
- func (vm *TestVM) CrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, ...) error
- func (vm *TestVM) CrossChainAppRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32) error
- func (vm *TestVM) CrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, response []byte) error
- func (vm *TestVM) Default(cant bool)
- func (vm *TestVM) Disconnected(ctx context.Context, id ids.NodeID) error
- func (vm *TestVM) HealthCheck(ctx context.Context) (interface{}, error)
- func (vm *TestVM) Initialize(ctx context.Context, chainCtx *snow.Context, db manager.Manager, ...) error
- func (vm *TestVM) SetState(ctx context.Context, state snow.State) error
- func (vm *TestVM) Shutdown(ctx context.Context) error
- func (vm *TestVM) Version(ctx context.Context) (string, error)
- type Timer
- type TimerTest
- type VM
Constants ¶
const ( // StatusUpdateFrequency is how many containers should be processed between // logs StatusUpdateFrequency = 5000 // MaxOutstandingGetAncestorsRequests is the maximum number of GetAncestors // sent but not responded to/failed MaxOutstandingGetAncestorsRequests = 10 // MaxOutstandingBroadcastRequests is the maximum number of requests to have // outstanding when broadcasting. MaxOutstandingBroadcastRequests = 50 )
const ( WriteLock = iota ReadLock NoLock )
List of all allowed options
Variables ¶
This section is empty.
Functions ¶
func SendMixedQuery ¶ added in v1.8.4
func SendMixedQuery( ctx context.Context, sender Sender, vdrs []ids.NodeID, numPushTo int, reqID uint32, containerID ids.ID, container []byte, )
Send a query composed partially of push queries and partially of pull queries. The validators in [vdrs] will be queried. This function sends at most [numPushTo] push queries. The rest are pull queries. If [numPushTo] > len(vdrs), len(vdrs) push queries are sent. [containerID] and [container] are the ID and body of the container being queried. [sender] is used to actually send the queries.
Types ¶
type AcceptedFrontierHandler ¶
type AcceptedFrontierHandler interface { // Notify this engine of an accepted frontier. // // This function can be called by any validator. It is not safe to assume // this message is in response to a GetAcceptedFrontier message, is // utilizing a unique requestID, or that the containerIDs from a valid // frontier. AcceptedFrontier( ctx context.Context, validatorID ids.NodeID, requestID uint32, containerIDs []ids.ID, ) error // Notify this engine that a get accepted frontier request it issued has // failed. // // This function will be called if the engine sent a GetAcceptedFrontier // message that is not anticipated to be responded to. This could be because // the recipient of the message is unknown or if the message request has // timed out. // // The validatorID, and requestID, are assumed to be the same as those sent // in the GetAcceptedFrontier message. GetAcceptedFrontierFailed(ctx context.Context, validatorID ids.NodeID, requestID uint32) error }
AcceptedFrontierHandler defines how a consensus engine reacts to accepted frontier messages from other validators. Functions only return fatal errors.
func NewNoOpAcceptedFrontierHandler ¶
func NewNoOpAcceptedFrontierHandler(log logging.Logger) AcceptedFrontierHandler
type AcceptedHandler ¶
type AcceptedHandler interface { // Notify this engine of a set of accepted vertices. // // This function can be called by any validator. It is not safe to assume // this message is in response to a GetAccepted message, is utilizing a // unique requestID, or that the containerIDs are a subset of the // containerIDs from a GetAccepted message. Accepted( ctx context.Context, validatorID ids.NodeID, requestID uint32, containerIDs []ids.ID, ) error // Notify this engine that a get accepted request it issued has failed. // // This function will be called if the engine sent a GetAccepted message // that is not anticipated to be responded to. This could be because the // recipient of the message is unknown or if the message request has timed // out. // // The validatorID, and requestID, are assumed to be the same as those sent // in the GetAccepted message. GetAcceptedFailed(ctx context.Context, validatorID ids.NodeID, requestID uint32) error }
AcceptedHandler defines how a consensus engine reacts to accepted messages from other validators. Functions only return fatal errors.
func NewNoOpAcceptedHandler ¶
func NewNoOpAcceptedHandler(log logging.Logger) AcceptedHandler
type AcceptedSender ¶
type AcceptedSender interface { // SendGetAccepted requests that every node in [nodeIDs] sends an Accepted // message with all the IDs in [containerIDs] that the node thinks are // accepted. SendGetAccepted( ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, containerIDs []ids.ID, ) // SendAccepted responds to a GetAccepted message with a set of IDs of // containers that are accepted. SendAccepted(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerIDs []ids.ID) }
AcceptedSender defines how a consensus engine sends messages pertaining to accepted containers
type AcceptedStateSummaryHandler ¶ added in v1.8.4
type AcceptedStateSummaryHandler interface { // Notify this engine of a set of state summaries. // // This function can be called by any validator. It is not safe to assume // this message is in response to a GetAcceptedStateSummary message, // is utilizing a unique requestID, or that the summaryIDs are a subset of the // state summaries requested by key from a GetAcceptedStateSummary message. AcceptedStateSummary(ctx context.Context, validatorID ids.NodeID, requestID uint32, summaryIDs []ids.ID) error // Notify this engine that a get accepted state summary request it issued has // failed. // // This function will be called if the engine sent a GetAcceptedStateSummary // message that is not anticipated to be responded to. This could be because // the recipient of the message is unknown or if the message request has // timed out. // // The validatorID, and requestID, are assumed to be the same as those sent // in the GetAcceptedStateSummary message. GetAcceptedStateSummaryFailed(ctx context.Context, validatorID ids.NodeID, requestID uint32) error }
AcceptedStateSummaryHandler defines how a consensus engine reacts to an accepted state summary message from another validator. Functions only return fatal errors.
func NewNoOpAcceptedStateSummaryHandler ¶ added in v1.8.4
func NewNoOpAcceptedStateSummaryHandler(log logging.Logger) AcceptedStateSummaryHandler
type AcceptedStateSummarySender ¶ added in v1.8.4
type AcceptedStateSummarySender interface { // SendGetAcceptedStateSummary requests that every node in [nodeIDs] sends an // AcceptedStateSummary message with all the state summary IDs referenced by [heights] // that the node thinks are accepted. SendGetAcceptedStateSummary(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, heights []uint64) // SendAcceptedStateSummary responds to a AcceptedStateSummary message with a // set of summary ids that are accepted. SendAcceptedStateSummary(ctx context.Context, nodeID ids.NodeID, requestID uint32, summaryIDs []ids.ID) }
type AllGetsServer ¶
type AllGetsServer interface { GetStateSummaryFrontierHandler GetAcceptedStateSummaryHandler GetAcceptedFrontierHandler GetAcceptedHandler GetAncestorsHandler GetHandler }
type AncestorsHandler ¶
type AncestorsHandler interface { // Notify this engine of multiple containers. // // Each element of [containers] is the byte representation of a container. // // This should only be called during bootstrapping, in response to a // GetAncestors message to [validatorID] with request ID [requestID]. // // This call should contain the container requested in that message, along // with ancestors. The containers should be in BFS order (ie the first // container must be the container requested in the GetAncestors message and // further back ancestors are later in [containers] // // It is not safe to assume this message is in response to a GetAncestor // message, that this message has a unique requestID or that any of the // containers in [containers] are valid. Ancestors( ctx context.Context, validatorID ids.NodeID, requestID uint32, containers [][]byte, ) error // Notify this engine that a GetAncestors request it issued has failed. // // This function will be called if the engine sent a GetAncestors message // that is not anticipated to be responded to. This could be because the // recipient of the message is unknown or if the message request has timed // out. // // The validatorID and requestID are assumed to be the same as those sent in // the GetAncestors message. GetAncestorsFailed(ctx context.Context, validatorID ids.NodeID, requestID uint32) error }
AncestorsHandler defines how a consensus engine reacts to bootstrapping retrieval messages from other validators. Functions only return fatal errors.
func NewNoOpAncestorsHandler ¶
func NewNoOpAncestorsHandler(log logging.Logger) AncestorsHandler
type AppHandler ¶
type AppHandler interface { NetworkAppHandler CrossChainAppHandler }
AppHandler defines how a consensus engine reacts to app specific messages. Functions only return fatal errors.
func NewNoOpAppHandler ¶
func NewNoOpAppHandler(log logging.Logger) AppHandler
type AppSender ¶
type AppSender interface { NetworkAppSender CrossChainAppSender }
AppSender sends application (VM) level messages. See also common.AppHandler.
type BootstrapTracker ¶ added in v1.9.9
type BootstrapTracker interface { // Returns true iff done bootstrapping IsBootstrapped() bool // Bootstrapped marks the named chain as being bootstrapped Bootstrapped(chainID ids.ID) OnBootstrapCompleted() chan struct{} }
BootstrapTracker describes the standard interface for tracking the status of a subnet bootstrapping
type BootstrapTrackerTest ¶ added in v1.9.9
type BootstrapTrackerTest struct { T *testing.T CantIsBootstrapped, CantBootstrapped, CantOnBootstrapCompleted bool IsBootstrappedF func() bool BootstrappedF func(ids.ID) OnBootstrapCompletedF func() chan struct{} }
BootstrapTrackerTest is a test subnet
func (*BootstrapTrackerTest) Bootstrapped ¶ added in v1.9.9
func (s *BootstrapTrackerTest) Bootstrapped(chainID ids.ID)
Bootstrapped calls BootstrappedF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*BootstrapTrackerTest) Default ¶ added in v1.9.9
func (s *BootstrapTrackerTest) Default(cant bool)
Default set the default callable value to [cant]
func (*BootstrapTrackerTest) IsBootstrapped ¶ added in v1.9.9
func (s *BootstrapTrackerTest) IsBootstrapped() bool
IsBootstrapped calls IsBootstrappedF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail. Defaults to returning false.
func (*BootstrapTrackerTest) OnBootstrapCompleted ¶ added in v1.9.9
func (s *BootstrapTrackerTest) OnBootstrapCompleted() chan struct{}
type Bootstrapable ¶
type Bootstrapable interface { // Force the provided containers to be accepted. Only returns fatal errors // if they occur. ForceAccepted(ctx context.Context, acceptedContainerIDs []ids.ID) error // Clear removes all containers to be processed upon bootstrapping Clear() error }
Bootstrapable defines the functionality required to support bootstrapping
type BootstrapableEngine ¶
type BootstrapableEngine interface { Bootstrapable Engine }
func TraceBootstrapableEngine ¶ added in v1.9.2
func TraceBootstrapableEngine(bootstrapableEngine BootstrapableEngine, tracer trace.Tracer) BootstrapableEngine
type BootstrapableTest ¶
type BootstrapableTest struct { T *testing.T CantForceAccepted, CantClear bool ClearF func() error ForceAcceptedF func(ctx context.Context, acceptedContainerIDs []ids.ID) error }
BootstrapableTest is a test engine that supports bootstrapping
func (*BootstrapableTest) Clear ¶
func (b *BootstrapableTest) Clear() error
func (*BootstrapableTest) Default ¶
func (b *BootstrapableTest) Default(cant bool)
Default sets the default on call handling
func (*BootstrapableTest) ForceAccepted ¶
type Bootstrapper ¶
type Bootstrapper interface { AcceptedFrontierHandler AcceptedHandler Haltable Startup(context.Context) error Restart(ctx context.Context, reset bool) error }
func NewCommonBootstrapper ¶
func NewCommonBootstrapper(config Config) Bootstrapper
type BootstrapperTest ¶
type BootstrapperTest struct { BootstrapableTest EngineTest }
EngineTest is a test engine
func (*BootstrapperTest) Default ¶
func (b *BootstrapperTest) Default(cant bool)
type ChitsHandler ¶
type ChitsHandler interface { // Notify this engine of the specified validators preferences. // // This function can be called by any validator. It is not safe to assume // this message is in response to a PullQuery or a PushQuery message. // However, the validatorID is assumed to be authenticated. Chits( ctx context.Context, validatorID ids.NodeID, requestID uint32, preferredContainerIDs []ids.ID, acceptedContainerIDs []ids.ID, ) error // Notify this engine that a query it issued has failed. // // This function will be called if the engine sent a PullQuery or PushQuery // message that is not anticipated to be responded to. This could be because // the recipient of the message is unknown or if the message request has // timed out. // // The validatorID and the requestID are assumed to be the same as those // sent in the Query message. QueryFailed(ctx context.Context, validatorID ids.NodeID, requestID uint32) error }
ChitsHandler defines how a consensus engine reacts to query response messages from other validators. Functions only return fatal errors.
func NewNoOpChitsHandler ¶
func NewNoOpChitsHandler(log logging.Logger) ChitsHandler
type Config ¶
type Config struct { Ctx *snow.ConsensusContext Beacons validators.Set SampleK int Alpha uint64 StartupTracker tracker.Startup Sender Sender Bootstrapable Bootstrapable BootstrapTracker BootstrapTracker Timer Timer // Should Bootstrap be retried RetryBootstrap bool // Max number of times to retry bootstrap before warning the node operator RetryBootstrapWarnFrequency int // Max time to spend fetching a container and its ancestors when responding // to a GetAncestors MaxTimeGetAncestors time.Duration // Max number of containers in an ancestors message sent by this node. AncestorsMaxContainersSent int // This node will only consider the first [AncestorsMaxContainersReceived] // containers in an ancestors message it receives. AncestorsMaxContainersReceived int }
Config wraps the common configurations that are needed by a Snow consensus engine
func DefaultConfigTest ¶
func DefaultConfigTest() Config
DefaultConfigTest returns a test configuration
func (*Config) Context ¶
func (c *Config) Context() *snow.ConsensusContext
func (*Config) IsBootstrapped ¶
IsBootstrapped returns true iff this chain is done bootstrapping
type CrossChainAppHandler ¶ added in v1.9.2
type CrossChainAppHandler interface { // CrossChainAppRequest Notify this engine of a request for data from // [chainID]. // // The meaning of [request], and what should be sent in response to it, is // application (VM) specific. // // Guarantees surrounding the request are specific to the implementation of // the requesting VM. For example, the request may or may not be guaranteed // to be well-formed/valid depending on the implementation of the requesting // VM. // // This node should typically send a CrossChainAppResponse to [chainID] in // response to a valid message using the same request ID before the // deadline. However, the VM may arbitrarily choose to not send a response // to this request. CrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, request []byte) error // CrossChainAppRequestFailed notifies this engine that a // CrossChainAppRequest message it sent to [chainID] with request ID // [requestID] failed. // // This may be because the request timed out or because the message couldn't // be sent to [chainID]. // // It is guaranteed that: // * This engine sent a request to [chainID] with ID [requestID]. // * CrossChainAppRequestFailed([chainID], [requestID]) has not already been // called. // * CrossChainAppResponse([chainID], [requestID]) has not already been // called. CrossChainAppRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32) error // CrossChainAppResponse notifies this engine of a response to the // CrossChainAppRequest message it sent to [chainID] with request ID // [requestID]. // // The meaning of [response] is application (VM) specific. // // It is guaranteed that: // * This engine sent a request to [chainID] with ID [requestID]. // * CrossChainAppRequestFailed([chainID], [requestID]) has not already been // called. // * CrossChainAppResponse([chainID], [requestID]) has not already been // called. // // Guarantees surrounding the response are specific to the implementation of // the responding VM. For example, the response may or may not be guaranteed // to be well-formed/valid depending on the implementation of the requesting // VM. // // If [response] is invalid or not the expected response, the VM chooses how // to react. For example, the VM may send another CrossChainAppRequest, or // it may give up trying to get the requested information. CrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, response []byte) error }
CrossChainAppHandler defines how a consensus engine reacts to cross-chain app specific messages.
Functions only return fatal errors.
type CrossChainAppSender ¶ added in v1.9.2
type CrossChainAppSender interface { // SendCrossChainAppRequest sends an application-level request to a // specific chain. // // A nil return value guarantees that the VM corresponding to this // CrossChainAppSender eventually receives either: // * A CrossChainAppResponse from [chainID] with ID [requestID] // * A CrossChainAppRequestFailed from [chainID] with ID [requestID] // Exactly one of the above messages will eventually be received from // [chainID]. // A non-nil error should be considered fatal. SendCrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, appRequestBytes []byte) error // SendCrossChainAppResponse sends an application-level response to a // specific chain // // This response must be in response to a CrossChainAppRequest that the VM // corresponding to this CrossChainAppSender received from [chainID] with ID // [requestID]. // A non-nil error should be considered fatal. SendCrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, appResponseBytes []byte) error }
CrossChainAppSender sends local VM-level messages to another VM.
type Engine ¶
type Engine interface { Handler // Return the context of the chain this engine is working on Context() *snow.ConsensusContext // Start engine operations from given request ID Start(ctx context.Context, startReqID uint32) error // Returns nil if the engine is healthy. // Periodically called and reported through the health API health.Checker // GetVM returns this engine's VM GetVM() VM }
Engine describes the standard interface of a consensus engine
type EngineTest ¶
type EngineTest struct { T *testing.T CantStart, CantIsBootstrapped, CantTimeout, CantGossip, CantHalt, CantShutdown, CantContext, CantNotify, CantGetStateSummaryFrontier, CantGetStateSummaryFrontierFailed, CantStateSummaryFrontier, CantGetAcceptedStateSummary, CantGetAcceptedStateSummaryFailed, CantAcceptedStateSummary, CantGetAcceptedFrontier, CantGetAcceptedFrontierFailed, CantAcceptedFrontier, CantGetAccepted, CantGetAcceptedFailed, CantAccepted, CantGet, CantGetAncestors, CantGetFailed, CantGetAncestorsFailed, CantPut, CantAncestors, CantPushQuery, CantPullQuery, CantQueryFailed, CantChits, CantConnected, CantDisconnected, CantHealth, CantCrossChainAppRequest, CantCrossChainAppRequestFailed, CantCrossChainAppResponse, CantAppRequest, CantAppResponse, CantAppGossip, CantAppRequestFailed, CantGetVM bool StartF func(ctx context.Context, startReqID uint32) error IsBootstrappedF func() bool ContextF func() *snow.ConsensusContext HaltF func(context.Context) TimeoutF, GossipF, ShutdownF func(context.Context) error NotifyF func(context.Context, Message) error GetF, GetAncestorsF, PullQueryF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) error PutF, PushQueryF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, container []byte) error AncestorsF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, containers [][]byte) error AcceptedFrontierF, GetAcceptedF, AcceptedF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, preferredIDs []ids.ID) error ChitsF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, preferredIDs []ids.ID, acceptedIDs []ids.ID) error GetStateSummaryFrontierF, GetStateSummaryFrontierFailedF, GetAcceptedStateSummaryFailedF, GetAcceptedFrontierF, GetFailedF, GetAncestorsFailedF, QueryFailedF, GetAcceptedFrontierFailedF, GetAcceptedFailedF func(ctx context.Context, nodeID ids.NodeID, requestID uint32) error AppRequestFailedF func(ctx context.Context, nodeID ids.NodeID, requestID uint32) error StateSummaryFrontierF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, summary []byte) error GetAcceptedStateSummaryF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, keys []uint64) error AcceptedStateSummaryF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, summaryIDs []ids.ID) error ConnectedF func(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error DisconnectedF func(ctx context.Context, nodeID ids.NodeID) error HealthF func(context.Context) (interface{}, error) GetVMF func() VM AppRequestF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, msg []byte) error AppResponseF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, msg []byte) error AppGossipF func(ctx context.Context, nodeID ids.NodeID, msg []byte) error CrossChainAppRequestF func(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, msg []byte) error CrossChainAppResponseF func(ctx context.Context, chainID ids.ID, requestID uint32, msg []byte) error CrossChainAppRequestFailedF func(ctx context.Context, chainID ids.ID, requestID uint32) error }
EngineTest is a test engine
func (*EngineTest) AcceptedFrontier ¶
func (*EngineTest) AcceptedStateSummary ¶ added in v1.8.4
func (*EngineTest) AppRequest ¶
func (*EngineTest) AppRequestFailed ¶
func (*EngineTest) AppResponse ¶
func (*EngineTest) Connected ¶
func (e *EngineTest) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error
func (*EngineTest) Context ¶
func (e *EngineTest) Context() *snow.ConsensusContext
func (*EngineTest) CrossChainAppRequest ¶ added in v1.9.2
func (*EngineTest) CrossChainAppRequestFailed ¶ added in v1.9.2
func (*EngineTest) CrossChainAppResponse ¶ added in v1.9.2
func (*EngineTest) Default ¶
func (e *EngineTest) Default(cant bool)
func (*EngineTest) Disconnected ¶
func (*EngineTest) GetAccepted ¶
func (*EngineTest) GetAcceptedFailed ¶
func (*EngineTest) GetAcceptedFrontier ¶
func (*EngineTest) GetAcceptedFrontierFailed ¶
func (*EngineTest) GetAcceptedStateSummary ¶ added in v1.8.4
func (*EngineTest) GetAcceptedStateSummaryFailed ¶ added in v1.8.4
func (*EngineTest) GetAncestors ¶
func (*EngineTest) GetAncestorsFailed ¶
func (*EngineTest) GetStateSummaryFrontier ¶ added in v1.8.4
func (*EngineTest) GetStateSummaryFrontierFailed ¶ added in v1.8.4
func (*EngineTest) GetVM ¶
func (e *EngineTest) GetVM() VM
func (*EngineTest) Halt ¶
func (e *EngineTest) Halt(ctx context.Context)
func (*EngineTest) HealthCheck ¶
func (e *EngineTest) HealthCheck(ctx context.Context) (interface{}, error)
func (*EngineTest) QueryFailed ¶
func (*EngineTest) StateSummaryFrontier ¶ added in v1.8.4
type FetchSender ¶
type FetchSender interface { // Request that the specified node send the specified container to this // node. SendGet(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) // SendGetAncestors requests that node [nodeID] send container [containerID] // and its ancestors. SendGetAncestors(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) // Tell the specified node about [container]. SendPut(ctx context.Context, nodeID ids.NodeID, requestID uint32, container []byte) // Give the specified node several containers at once. Should be in response // to a GetAncestors message with request ID [requestID] from the node. SendAncestors(ctx context.Context, nodeID ids.NodeID, requestID uint32, containers [][]byte) }
FetchSender defines how a consensus engine sends retrieval messages to other nodes.
type FrontierSender ¶
type FrontierSender interface { // SendGetAcceptedFrontier requests that every node in [nodeIDs] sends an // AcceptedFrontier message. SendGetAcceptedFrontier(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32) // SendAcceptedFrontier responds to a AcceptedFrontier message with this // engine's current accepted frontier. SendAcceptedFrontier( ctx context.Context, nodeID ids.NodeID, requestID uint32, containerIDs []ids.ID, ) }
FrontierSender defines how a consensus engine sends frontier messages to other nodes.
type GetAcceptedFrontierHandler ¶
type GetAcceptedFrontierHandler interface { // Notify this engine of a request for the accepted frontier of vertices. // // The accepted frontier is the set of accepted vertices that do not have // any accepted descendants. // // This function can be called by any validator. It is not safe to assume // this message is utilizing a unique requestID. // // This engine should respond with an AcceptedFrontier message with the same // requestID, and the engine's current accepted frontier. GetAcceptedFrontier(ctx context.Context, validatorID ids.NodeID, requestID uint32) error }
GetAcceptedFrontierHandler defines how a consensus engine reacts to a get accepted frontier message from another validator. Functions only return fatal errors.
type GetAcceptedHandler ¶
type GetAcceptedHandler interface { // Notify this engine of a request to filter non-accepted vertices. // // This function can be called by any validator. It is not safe to assume // this message is utilizing a unique requestID. However, the validatorID is // assumed to be authenticated. // // This engine should respond with an Accepted message with the same // requestID, and the subset of the containerIDs that this node has decided // are accepted. GetAccepted( ctx context.Context, validatorID ids.NodeID, requestID uint32, containerIDs []ids.ID, ) error }
GetAcceptedHandler defines how a consensus engine reacts to a get accepted message from another validator. Functions only return fatal errors.
type GetAcceptedStateSummaryHandler ¶ added in v1.8.4
type GetAcceptedStateSummaryHandler interface { // Notify this engine of a request to return state summary IDs referenced by // the provided keys. // // This function can be called by any validator. It is not safe to assume // this message is utilizing a unique requestID. However, the validatorID is // assumed to be authenticated. // // This engine should respond with an AcceptedStateSummary message with the // same requestID, and the subset of the state summaries that this node has // locally available. GetAcceptedStateSummary(ctx context.Context, validatorID ids.NodeID, requestID uint32, keys []uint64) error }
GetAcceptedStateSummaryHandler defines how a consensus engine reacts to a get accepted state summary message from another validator. Functions only return fatal errors.
type GetAncestorsHandler ¶
type GetAncestorsHandler interface { // Notify this engine of a request for a container and its ancestors. // // The request is from validator [validatorID]. The requested container is // [containerID]. // // This function can be called by any validator. It is not safe to assume // this message is utilizing a unique requestID. It is also not safe to // assume the requested containerID exists. // // This engine should respond with an Ancestors message with the same // requestID, which contains [containerID] as well as its ancestors. See // Ancestors's documentation. // // If this engine doesn't have some ancestors, it should reply with its best // effort attempt at getting them. If this engine doesn't have [containerID] // it can ignore this message. GetAncestors(ctx context.Context, validatorID ids.NodeID, requestID uint32, containerID ids.ID) error }
GetAncestorsHandler defines how a consensus engine reacts to a get ancestors message from another validator. Functions only return fatal errors.
type GetHandler ¶
type GetHandler interface { // Notify this engine of a request for a container. // // This function can be called by any validator. It is not safe to assume // this message is utilizing a unique requestID. It is also not safe to // assume the requested containerID exists. // // There should never be a situation where a virtuous node sends a Get // request to another virtuous node that does not have the requested // container. // // This engine should respond with a Put message with the same requestID if // the container was locally available. Otherwise, the message can be safely // dropped. Get(ctx context.Context, validatorID ids.NodeID, requestID uint32, containerID ids.ID) error }
GetHandler defines how a consensus engine reacts to get message from another validator. Functions only return fatal errors.
type GetStateSummaryFrontierHandler ¶ added in v1.8.4
type GetStateSummaryFrontierHandler interface { // Notify this engine of a request for the frontier of state summaries. // // The accepted frontier is the last state summary available locally. // // This function can be called by any validator. It is not safe to assume // this message is utilizing a unique requestID. // // This engine should respond with an StateSummaryFrontier message with the // same requestID, and the engine's current state summary frontier. GetStateSummaryFrontier(ctx context.Context, validatorID ids.NodeID, requestID uint32) error }
GetStateSummaryFrontierHandler defines how a consensus engine reacts to a get state summary frontier message from another validator. Functions only return fatal errors.
type Gossiper ¶
type Gossiper interface { // Gossip the provided container throughout the network SendGossip(ctx context.Context, container []byte) }
Gossiper defines how a consensus engine gossips a container on the accepted frontier to other nodes
type HTTPHandler ¶
type HTTPHandler struct { LockOptions LockOption Handler http.Handler }
type InternalHandler ¶
type InternalHandler interface { // Notify this engine of peer changes. validators.Connector // Notify this engine that a registered timeout has fired. Timeout(context.Context) error // Gossip to the network a container on the accepted frontier Gossip(context.Context) error // Halt this engine. // // This function will be called before the environment starts exiting. This // function is special, in that it does not expect the chain's context lock // to be held before calling this function. This function also does not // require the engine to have been started. Halt(context.Context) // Shutdown this engine. // // This function will be called when the environment is exiting. Shutdown(context.Context) error // Notify this engine of a message from the virtual machine. Notify(context.Context, Message) error }
InternalHandler defines how this consensus engine reacts to messages from other components of this validator. Functions only return fatal errors if they occur.
func NewNoOpInternalHandler ¶ added in v1.10.1
func NewNoOpInternalHandler(log logging.Logger) InternalHandler
type LockOption ¶
type LockOption uint32
LockOption allows the vm to specify their lock option based on their endpoint
type Message ¶
type Message uint32
Message is an enum of the message types that vms can send to consensus
const ( // PendingTxs notifies a consensus engine that // its VM has pending transactions // (i.e. it would like to add a new block/vertex to consensus) PendingTxs Message = iota + 1 // StateSyncDone notifies the state syncer engine that the VM has finishing // syncing the requested state summary. StateSyncDone )
type MockSender ¶ added in v1.8.4
type MockSender struct {
// contains filtered or unexported fields
}
MockSender is a mock of Sender interface.
func NewMockSender ¶ added in v1.8.4
func NewMockSender(ctrl *gomock.Controller) *MockSender
NewMockSender creates a new mock instance.
func (*MockSender) Accept ¶ added in v1.8.4
func (m *MockSender) Accept(arg0 *snow.ConsensusContext, arg1 ids.ID, arg2 []byte) error
Accept mocks base method.
func (*MockSender) EXPECT ¶ added in v1.8.4
func (m *MockSender) EXPECT() *MockSenderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockSender) SendAccepted ¶ added in v1.8.4
func (m *MockSender) SendAccepted(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 []ids.ID)
SendAccepted mocks base method.
func (*MockSender) SendAcceptedFrontier ¶ added in v1.8.4
func (m *MockSender) SendAcceptedFrontier(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 []ids.ID)
SendAcceptedFrontier mocks base method.
func (*MockSender) SendAcceptedStateSummary ¶ added in v1.8.4
func (m *MockSender) SendAcceptedStateSummary(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 []ids.ID)
SendAcceptedStateSummary mocks base method.
func (*MockSender) SendAncestors ¶ added in v1.8.4
func (m *MockSender) SendAncestors(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 [][]byte)
SendAncestors mocks base method.
func (*MockSender) SendAppGossip ¶ added in v1.8.4
func (m *MockSender) SendAppGossip(arg0 context.Context, arg1 []byte) error
SendAppGossip mocks base method.
func (*MockSender) SendAppGossipSpecific ¶ added in v1.8.4
func (m *MockSender) SendAppGossipSpecific(arg0 context.Context, arg1 set.Set[ids.NodeID], arg2 []byte) error
SendAppGossipSpecific mocks base method.
func (*MockSender) SendAppRequest ¶ added in v1.8.4
func (m *MockSender) SendAppRequest(arg0 context.Context, arg1 set.Set[ids.NodeID], arg2 uint32, arg3 []byte) error
SendAppRequest mocks base method.
func (*MockSender) SendAppResponse ¶ added in v1.8.4
func (m *MockSender) SendAppResponse(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 []byte) error
SendAppResponse mocks base method.
func (*MockSender) SendChits ¶ added in v1.8.4
func (m *MockSender) SendChits(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3, arg4 []ids.ID)
SendChits mocks base method.
func (*MockSender) SendCrossChainAppRequest ¶ added in v1.9.2
func (m *MockSender) SendCrossChainAppRequest(arg0 context.Context, arg1 ids.ID, arg2 uint32, arg3 []byte) error
SendCrossChainAppRequest mocks base method.
func (*MockSender) SendCrossChainAppResponse ¶ added in v1.9.2
func (m *MockSender) SendCrossChainAppResponse(arg0 context.Context, arg1 ids.ID, arg2 uint32, arg3 []byte) error
SendCrossChainAppResponse mocks base method.
func (*MockSender) SendGetAccepted ¶ added in v1.8.4
func (m *MockSender) SendGetAccepted(arg0 context.Context, arg1 set.Set[ids.NodeID], arg2 uint32, arg3 []ids.ID)
SendGetAccepted mocks base method.
func (*MockSender) SendGetAcceptedFrontier ¶ added in v1.8.4
func (m *MockSender) SendGetAcceptedFrontier(arg0 context.Context, arg1 set.Set[ids.NodeID], arg2 uint32)
SendGetAcceptedFrontier mocks base method.
func (*MockSender) SendGetAcceptedStateSummary ¶ added in v1.8.4
func (m *MockSender) SendGetAcceptedStateSummary(arg0 context.Context, arg1 set.Set[ids.NodeID], arg2 uint32, arg3 []uint64)
SendGetAcceptedStateSummary mocks base method.
func (*MockSender) SendGetAncestors ¶ added in v1.8.4
func (m *MockSender) SendGetAncestors(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 ids.ID)
SendGetAncestors mocks base method.
func (*MockSender) SendGetStateSummaryFrontier ¶ added in v1.8.4
func (m *MockSender) SendGetStateSummaryFrontier(arg0 context.Context, arg1 set.Set[ids.NodeID], arg2 uint32)
SendGetStateSummaryFrontier mocks base method.
func (*MockSender) SendGossip ¶ added in v1.8.4
func (m *MockSender) SendGossip(arg0 context.Context, arg1 []byte)
SendGossip mocks base method.
func (*MockSender) SendPullQuery ¶ added in v1.8.4
func (m *MockSender) SendPullQuery(arg0 context.Context, arg1 set.Set[ids.NodeID], arg2 uint32, arg3 ids.ID)
SendPullQuery mocks base method.
func (*MockSender) SendPushQuery ¶ added in v1.8.4
func (m *MockSender) SendPushQuery(arg0 context.Context, arg1 set.Set[ids.NodeID], arg2 uint32, arg3 []byte)
SendPushQuery mocks base method.
func (*MockSender) SendStateSummaryFrontier ¶ added in v1.8.4
func (m *MockSender) SendStateSummaryFrontier(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 []byte)
SendStateSummaryFrontier mocks base method.
type MockSenderMockRecorder ¶ added in v1.8.4
type MockSenderMockRecorder struct {
// contains filtered or unexported fields
}
MockSenderMockRecorder is the mock recorder for MockSender.
func (*MockSenderMockRecorder) Accept ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) Accept(arg0, arg1, arg2 interface{}) *gomock.Call
Accept indicates an expected call of Accept.
func (*MockSenderMockRecorder) SendAccepted ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendAccepted(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
SendAccepted indicates an expected call of SendAccepted.
func (*MockSenderMockRecorder) SendAcceptedFrontier ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendAcceptedFrontier(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
SendAcceptedFrontier indicates an expected call of SendAcceptedFrontier.
func (*MockSenderMockRecorder) SendAcceptedStateSummary ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendAcceptedStateSummary(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
SendAcceptedStateSummary indicates an expected call of SendAcceptedStateSummary.
func (*MockSenderMockRecorder) SendAncestors ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendAncestors(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
SendAncestors indicates an expected call of SendAncestors.
func (*MockSenderMockRecorder) SendAppGossip ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendAppGossip(arg0, arg1 interface{}) *gomock.Call
SendAppGossip indicates an expected call of SendAppGossip.
func (*MockSenderMockRecorder) SendAppGossipSpecific ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendAppGossipSpecific(arg0, arg1, arg2 interface{}) *gomock.Call
SendAppGossipSpecific indicates an expected call of SendAppGossipSpecific.
func (*MockSenderMockRecorder) SendAppRequest ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendAppRequest(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
SendAppRequest indicates an expected call of SendAppRequest.
func (*MockSenderMockRecorder) SendAppResponse ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendAppResponse(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
SendAppResponse indicates an expected call of SendAppResponse.
func (*MockSenderMockRecorder) SendChits ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendChits(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call
SendChits indicates an expected call of SendChits.
func (*MockSenderMockRecorder) SendCrossChainAppRequest ¶ added in v1.9.2
func (mr *MockSenderMockRecorder) SendCrossChainAppRequest(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
SendCrossChainAppRequest indicates an expected call of SendCrossChainAppRequest.
func (*MockSenderMockRecorder) SendCrossChainAppResponse ¶ added in v1.9.2
func (mr *MockSenderMockRecorder) SendCrossChainAppResponse(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
SendCrossChainAppResponse indicates an expected call of SendCrossChainAppResponse.
func (*MockSenderMockRecorder) SendGet ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendGet(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
SendGet indicates an expected call of SendGet.
func (*MockSenderMockRecorder) SendGetAccepted ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendGetAccepted(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
SendGetAccepted indicates an expected call of SendGetAccepted.
func (*MockSenderMockRecorder) SendGetAcceptedFrontier ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendGetAcceptedFrontier(arg0, arg1, arg2 interface{}) *gomock.Call
SendGetAcceptedFrontier indicates an expected call of SendGetAcceptedFrontier.
func (*MockSenderMockRecorder) SendGetAcceptedStateSummary ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendGetAcceptedStateSummary(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
SendGetAcceptedStateSummary indicates an expected call of SendGetAcceptedStateSummary.
func (*MockSenderMockRecorder) SendGetAncestors ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendGetAncestors(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
SendGetAncestors indicates an expected call of SendGetAncestors.
func (*MockSenderMockRecorder) SendGetStateSummaryFrontier ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendGetStateSummaryFrontier(arg0, arg1, arg2 interface{}) *gomock.Call
SendGetStateSummaryFrontier indicates an expected call of SendGetStateSummaryFrontier.
func (*MockSenderMockRecorder) SendGossip ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendGossip(arg0, arg1 interface{}) *gomock.Call
SendGossip indicates an expected call of SendGossip.
func (*MockSenderMockRecorder) SendPullQuery ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendPullQuery(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
SendPullQuery indicates an expected call of SendPullQuery.
func (*MockSenderMockRecorder) SendPushQuery ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendPushQuery(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
SendPushQuery indicates an expected call of SendPushQuery.
func (*MockSenderMockRecorder) SendPut ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendPut(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
SendPut indicates an expected call of SendPut.
func (*MockSenderMockRecorder) SendStateSummaryFrontier ¶ added in v1.8.4
func (mr *MockSenderMockRecorder) SendStateSummaryFrontier(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
SendStateSummaryFrontier indicates an expected call of SendStateSummaryFrontier.
type NetworkAppHandler ¶ added in v1.9.2
type NetworkAppHandler interface { // Notify this engine of a request for data from [nodeID]. // // The meaning of [request], and what should be sent in response to it, is // application (VM) specific. // // It is not guaranteed that: // * [request] is well-formed/valid. // // This node should typically send an AppResponse to [nodeID] in response to // a valid message using the same request ID before the deadline. However, // the VM may arbitrarily choose to not send a response to this request. AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, request []byte) error // Notify this engine that an AppRequest message it sent to [nodeID] with // request ID [requestID] failed. // // This may be because the request timed out or because the message couldn't // be sent to [nodeID]. // // It is guaranteed that: // * This engine sent a request to [nodeID] with ID [requestID]. // * AppRequestFailed([nodeID], [requestID]) has not already been called. // * AppResponse([nodeID], [requestID]) has not already been called. AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32) error // Notify this engine of a response to the AppRequest message it sent to // [nodeID] with request ID [requestID]. // // The meaning of [response] is application (VM) specifc. // // It is guaranteed that: // * This engine sent a request to [nodeID] with ID [requestID]. // * AppRequestFailed([nodeID], [requestID]) has not already been called. // * AppResponse([nodeID], [requestID]) has not already been called. // // It is not guaranteed that: // * [response] contains the expected response // * [response] is well-formed/valid. // // If [response] is invalid or not the expected response, the VM chooses how // to react. For example, the VM may send another AppRequest, or it may give // up trying to get the requested information. AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error // Notify this engine of a gossip message from [nodeID]. // // The meaning of [msg] is application (VM) specific, and the VM defines how // to react to this message. // // This message is not expected in response to any event, and it does not // need to be responded to. // // A node may gossip the same message multiple times. That is, // AppGossip([nodeID], [msg]) may be called multiple times. AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error }
NetworkAppHandler defines how a consensus engine reacts to app specific messages from the network.
Functions only return fatal errors.
type NetworkAppSender ¶ added in v1.9.2
type NetworkAppSender interface { // Send an application-level request. // A nil return value guarantees that for each nodeID in [nodeIDs], // the VM corresponding to this AppSender eventually receives either: // * An AppResponse from nodeID with ID [requestID] // * An AppRequestFailed from nodeID with ID [requestID] // Exactly one of the above messages will eventually be received per nodeID. // A non-nil error should be considered fatal. SendAppRequest(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, appRequestBytes []byte) error // Send an application-level response to a request. // This response must be in response to an AppRequest that the VM corresponding // to this AppSender received from [nodeID] with ID [requestID]. // A non-nil error should be considered fatal. SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, appResponseBytes []byte) error // Gossip an application-level message. // A non-nil error should be considered fatal. SendAppGossip(ctx context.Context, appGossipBytes []byte) error SendAppGossipSpecific(ctx context.Context, nodeIDs set.Set[ids.NodeID], appGossipBytes []byte) error }
NetworkAppSender sends VM-level messages to nodes in the network.
type PutHandler ¶
type PutHandler interface { // Notify this engine of a container. // // This function can be called by any validator. It is not safe to assume // this message is utilizing a unique requestID. Put( ctx context.Context, validatorID ids.NodeID, requestID uint32, container []byte, ) error // Notify this engine that a get request it issued has failed. // // This function will be called if the engine sent a Get message that is not // anticipated to be responded to. This could be because the recipient of // the message is unknown or if the message request has timed out. // // The validatorID and requestID are assumed to be the same as those sent in // the Get message. GetFailed(ctx context.Context, validatorID ids.NodeID, requestID uint32) error }
PutHandler defines how a consensus engine reacts to put messages from other validators. Functions only return fatal errors.
func NewNoOpPutHandler ¶
func NewNoOpPutHandler(log logging.Logger) PutHandler
type QueryHandler ¶
type QueryHandler interface { // Notify this engine of a request for our preferences. // // This function can be called by any validator. It is not safe to assume // this message is utilizing a unique requestID. However, the validatorID is // assumed to be authenticated. // // If the container or its ancestry is incomplete, this engine is expected // to request the missing containers from the validator. Once the ancestry // is complete, this engine should send this validator the current // preferences in a Chits message. The Chits message should have the same // requestID that was passed in here. PullQuery( ctx context.Context, validatorID ids.NodeID, requestID uint32, containerID ids.ID, ) error // Notify this engine of a request for our preferences. // // This function can be called by any validator. It is not safe to assume // this message is utilizing a unique requestID. // // This function is meant to behave the same way as PullQuery, except the // container is optimistically provided to potentially remove the need for // a series of Get/Put messages. // // If the ancestry of the container is incomplete, this engine is expected // to request the ancestry from the validator. Once the ancestry is // complete, this engine should send this validator the current preferences // in a Chits message. The Chits message should have the same requestID that // was passed in here. PushQuery( ctx context.Context, validatorID ids.NodeID, requestID uint32, container []byte, ) error }
QueryHandler defines how a consensus engine reacts to query messages from other validators. Functions only return fatal errors.
func NewNoOpQueryHandler ¶
func NewNoOpQueryHandler(log logging.Logger) QueryHandler
type QuerySender ¶
type QuerySender interface { // Request from the specified nodes their preferred frontier, given the // existence of the specified container. // This is the same as PullQuery, except that this message includes the body // of the container rather than its ID. SendPushQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, container []byte) // Request from the specified nodes their preferred frontier, given the // existence of the specified container. SendPullQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, containerID ids.ID) // Send chits to the specified node SendChits(ctx context.Context, nodeID ids.NodeID, requestID uint32, votes []ids.ID, accepted []ids.ID) }
QuerySender defines how a consensus engine sends query messages to other nodes.
type Requests ¶
type Requests struct {
// contains filtered or unexported fields
}
Requests tracks pending container messages from a peer.
func (*Requests) Add ¶
Add a request. Assumes that requestIDs are unique. Assumes that containerIDs are only in one request at a time.
func (*Requests) Contains ¶
Contains returns true if there is an outstanding request for the container ID.
func (*Requests) Get ¶ added in v1.8.6
Get the containerID the request is expecting and if the request exists.
func (*Requests) Remove ¶
Remove attempts to abandon a requestID sent to a validator. If the request is currently outstanding, the requested ID will be returned along with true. If the request isn't currently outstanding, false will be returned.
type Sender ¶
type Sender interface { snow.Acceptor StateSummarySender AcceptedStateSummarySender FrontierSender AcceptedSender FetchSender QuerySender Gossiper AppSender }
Sender defines how a consensus engine sends messages and requests to other validators
type SenderTest ¶
type SenderTest struct { T *testing.T CantAccept, CantSendGetStateSummaryFrontier, CantSendStateSummaryFrontier, CantSendGetAcceptedStateSummary, CantSendAcceptedStateSummary, CantSendGetAcceptedFrontier, CantSendAcceptedFrontier, CantSendGetAccepted, CantSendAccepted, CantSendGet, CantSendGetAncestors, CantSendPut, CantSendAncestors, CantSendPullQuery, CantSendPushQuery, CantSendChits, CantSendGossip, CantSendAppRequest, CantSendAppResponse, CantSendAppGossip, CantSendAppGossipSpecific, CantSendCrossChainAppRequest, CantSendCrossChainAppResponse bool AcceptF func(*snow.ConsensusContext, ids.ID, []byte) error SendGetStateSummaryFrontierF func(context.Context, set.Set[ids.NodeID], uint32) SendStateSummaryFrontierF func(context.Context, ids.NodeID, uint32, []byte) SendGetAcceptedStateSummaryF func(context.Context, set.Set[ids.NodeID], uint32, []uint64) SendAcceptedStateSummaryF func(context.Context, ids.NodeID, uint32, []ids.ID) SendGetAcceptedFrontierF func(context.Context, set.Set[ids.NodeID], uint32) SendAcceptedFrontierF func(context.Context, ids.NodeID, uint32, []ids.ID) SendGetAcceptedF func(context.Context, set.Set[ids.NodeID], uint32, []ids.ID) SendAcceptedF func(context.Context, ids.NodeID, uint32, []ids.ID) SendGetF func(context.Context, ids.NodeID, uint32, ids.ID) SendGetAncestorsF func(context.Context, ids.NodeID, uint32, ids.ID) SendPutF func(context.Context, ids.NodeID, uint32, []byte) SendAncestorsF func(context.Context, ids.NodeID, uint32, [][]byte) SendPushQueryF func(context.Context, set.Set[ids.NodeID], uint32, []byte) SendPullQueryF func(context.Context, set.Set[ids.NodeID], uint32, ids.ID) SendChitsF func(context.Context, ids.NodeID, uint32, []ids.ID, []ids.ID) SendGossipF func(context.Context, []byte) SendAppRequestF func(context.Context, set.Set[ids.NodeID], uint32, []byte) error SendAppResponseF func(context.Context, ids.NodeID, uint32, []byte) error SendAppGossipF func(context.Context, []byte) error SendAppGossipSpecificF func(context.Context, set.Set[ids.NodeID], []byte) error SendCrossChainAppRequestF func(context.Context, ids.ID, uint32, []byte) SendCrossChainAppResponseF func(context.Context, ids.ID, uint32, []byte) }
SenderTest is a test sender
func (*SenderTest) Accept ¶ added in v1.8.4
func (s *SenderTest) Accept(ctx *snow.ConsensusContext, containerID ids.ID, container []byte) error
SendGetStateSummaryFrontier calls SendGetStateSummaryFrontierF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) Default ¶
func (s *SenderTest) Default(cant bool)
Default set the default callable value to [cant]
func (*SenderTest) SendAccepted ¶
func (s *SenderTest) SendAccepted(ctx context.Context, validatorID ids.NodeID, requestID uint32, containerIDs []ids.ID)
SendAccepted calls SendAcceptedF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendAcceptedFrontier ¶
func (s *SenderTest) SendAcceptedFrontier(ctx context.Context, validatorID ids.NodeID, requestID uint32, containerIDs []ids.ID)
SendAcceptedFrontier calls SendAcceptedFrontierF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendAcceptedStateSummary ¶ added in v1.8.4
func (s *SenderTest) SendAcceptedStateSummary(ctx context.Context, validatorID ids.NodeID, requestID uint32, summaryIDs []ids.ID)
SendAcceptedStateSummary calls SendAcceptedStateSummaryF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendAncestors ¶
func (s *SenderTest) SendAncestors(ctx context.Context, vdr ids.NodeID, requestID uint32, vtxs [][]byte)
SendAncestors calls SendAncestorsF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendAppGossip ¶
func (s *SenderTest) SendAppGossip(ctx context.Context, appGossipBytes []byte) error
SendAppGossip calls SendAppGossipF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendAppGossipSpecific ¶
func (s *SenderTest) SendAppGossipSpecific(ctx context.Context, nodeIDs set.Set[ids.NodeID], appGossipBytes []byte) error
SendAppGossipSpecific calls SendAppGossipSpecificF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendAppRequest ¶
func (s *SenderTest) SendAppRequest(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, appRequestBytes []byte) error
SendAppRequest calls SendAppRequestF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendAppResponse ¶
func (s *SenderTest) SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, appResponseBytes []byte) error
SendAppResponse calls SendAppResponseF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendChits ¶
func (s *SenderTest) SendChits(ctx context.Context, vdr ids.NodeID, requestID uint32, votes []ids.ID, accepted []ids.ID)
SendChits calls SendChitsF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendCrossChainAppRequest ¶ added in v1.9.2
func (*SenderTest) SendCrossChainAppResponse ¶ added in v1.9.2
func (*SenderTest) SendGet ¶
SendGet calls SendGetF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendGetAccepted ¶
func (s *SenderTest) SendGetAccepted(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, containerIDs []ids.ID)
SendGetAccepted calls SendGetAcceptedF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendGetAcceptedFrontier ¶
func (s *SenderTest) SendGetAcceptedFrontier(ctx context.Context, validatorIDs set.Set[ids.NodeID], requestID uint32)
SendGetAcceptedFrontier calls SendGetAcceptedFrontierF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendGetAcceptedStateSummary ¶ added in v1.8.4
func (s *SenderTest) SendGetAcceptedStateSummary(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, heights []uint64)
SendGetAcceptedStateSummary calls SendGetAcceptedStateSummaryF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendGetAncestors ¶
func (s *SenderTest) SendGetAncestors(ctx context.Context, validatorID ids.NodeID, requestID uint32, vtxID ids.ID)
SendGetAncestors calls SendGetAncestorsF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendGetStateSummaryFrontier ¶ added in v1.8.4
func (s *SenderTest) SendGetStateSummaryFrontier(ctx context.Context, validatorIDs set.Set[ids.NodeID], requestID uint32)
SendGetStateSummaryFrontier calls SendGetStateSummaryFrontierF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendGossip ¶
func (s *SenderTest) SendGossip(ctx context.Context, container []byte)
SendGossip calls SendGossipF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendPullQuery ¶
func (s *SenderTest) SendPullQuery(ctx context.Context, vdrs set.Set[ids.NodeID], requestID uint32, vtxID ids.ID)
SendPullQuery calls SendPullQueryF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendPushQuery ¶
func (s *SenderTest) SendPushQuery(ctx context.Context, vdrs set.Set[ids.NodeID], requestID uint32, vtx []byte)
SendPushQuery calls SendPushQueryF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendPut ¶
SendPut calls SendPutF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
func (*SenderTest) SendStateSummaryFrontier ¶ added in v1.8.4
func (s *SenderTest) SendStateSummaryFrontier(ctx context.Context, validatorID ids.NodeID, requestID uint32, summary []byte)
SendAcceptedFrontier calls SendAcceptedFrontierF if it was initialized. If it wasn't initialized and this function shouldn't be called and testing was initialized, then testing will fail.
type SharedConfig ¶
Shared among common.bootstrapper and snowman/avalanche bootstrapper
type StateSummaryFrontierHandler ¶ added in v1.8.4
type StateSummaryFrontierHandler interface { // Notify this engine of a state summary frontier. // // This function can be called by any validator. It is not safe to assume // this message is in response to a GetStateSummaryFrontier message, is // utilizing a unique requestID, or that the summary bytes are from a valid // state summary. StateSummaryFrontier(ctx context.Context, validatorID ids.NodeID, requestID uint32, summary []byte) error // Notify this engine that a get state summary frontier request it issued // has failed. // // This function will be called if the engine sent a GetStateSummaryFrontier // message that is not anticipated to be responded to. This could be because // the recipient of the message is unknown or if the message request has // timed out. // // The validatorID, and requestID, are assumed to be the same as those sent // in the GetStateSummaryFrontier message. GetStateSummaryFrontierFailed(ctx context.Context, validatorID ids.NodeID, requestID uint32) error }
StateSummaryFrontierHandler defines how a consensus engine reacts to a state summary frontier message from other validators. Functions only return fatal errors.
func NewNoOpStateSummaryFrontierHandler ¶ added in v1.8.4
func NewNoOpStateSummaryFrontierHandler(log logging.Logger) StateSummaryFrontierHandler
type StateSummarySender ¶ added in v1.8.4
type StateSummarySender interface { // SendGetStateSummaryFrontier requests that every node in [nodeIDs] sends a // StateSummaryFrontier message. SendGetStateSummaryFrontier(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32) // SendStateSummaryFrontier responds to a StateSummaryFrontier message with this // engine's current state summary frontier. SendStateSummaryFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32, summary []byte) }
StateSummarySender defines how a consensus engine sends state sync messages to other nodes.
type StateSyncer ¶ added in v1.8.4
type StateSyncer interface { Engine // IsEnabled returns true if the underlying VM wants to perform state sync. // Any returned error will be considered fatal. IsEnabled(context.Context) (bool, error) }
StateSyncer controls the selection and verification of state summaries to drive VM state syncing. It collects the latest state summaries and elicit votes on them, making sure that a qualified majority of nodes support the selected state summary.
func TraceStateSyncer ¶ added in v1.9.2
func TraceStateSyncer(stateSyncer StateSyncer, tracer trace.Tracer) StateSyncer
type TestVM ¶
type TestVM struct { T *testing.T CantInitialize, CantSetState, CantShutdown, CantCreateHandlers, CantCreateStaticHandlers, CantHealthCheck, CantConnected, CantDisconnected, CantVersion, CantAppRequest, CantAppResponse, CantAppGossip, CantAppRequestFailed, CantCrossChainAppRequest, CantCrossChainAppResponse, CantCrossChainAppRequestFailed bool InitializeF func(ctx context.Context, chainCtx *snow.Context, db manager.Manager, genesisBytes []byte, upgradeBytes []byte, configBytes []byte, msgChan chan<- Message, fxs []*Fx, appSender AppSender) error SetStateF func(ctx context.Context, state snow.State) error ShutdownF func(context.Context) error CreateHandlersF func(context.Context) (map[string]*HTTPHandler, error) CreateStaticHandlersF func(context.Context) (map[string]*HTTPHandler, error) ConnectedF func(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error DisconnectedF func(ctx context.Context, nodeID ids.NodeID) error HealthCheckF func(context.Context) (interface{}, error) AppRequestF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, msg []byte) error AppResponseF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, msg []byte) error AppGossipF func(ctx context.Context, nodeID ids.NodeID, msg []byte) error AppRequestFailedF func(ctx context.Context, nodeID ids.NodeID, requestID uint32) error VersionF func(context.Context) (string, error) CrossChainAppRequestF func(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, msg []byte) error CrossChainAppResponseF func(ctx context.Context, chainID ids.ID, requestID uint32, msg []byte) error CrossChainAppRequestFailedF func(ctx context.Context, chainID ids.ID, requestID uint32) error }
TestVM is a test vm
func (*TestVM) AppRequest ¶
func (*TestVM) AppRequestFailed ¶
func (*TestVM) AppResponse ¶
func (*TestVM) CreateHandlers ¶
func (*TestVM) CreateStaticHandlers ¶
func (*TestVM) CrossChainAppRequest ¶ added in v1.9.2
func (*TestVM) CrossChainAppRequestFailed ¶ added in v1.9.2
func (*TestVM) CrossChainAppResponse ¶ added in v1.9.2
func (*TestVM) Disconnected ¶
func (*TestVM) HealthCheck ¶
func (*TestVM) Initialize ¶
type Timer ¶
type Timer interface { // RegisterTimeout specifies how much time to delay the next timeout message // by. If the subnet has been bootstrapped, the timeout will fire // immediately. RegisterTimeout(time.Duration) }
Timer describes the standard interface for specifying a timeout
type TimerTest ¶
TimerTest is a test timer
func (*TimerTest) RegisterTimeout ¶
type VM ¶
type VM interface { AppHandler // Returns nil if the VM is healthy. // Periodically called and reported via the node's Health API. health.Checker // Connector represents a handler that is called on connection connect/disconnect validators.Connector // Initialize this VM. // [chainCtx]: Metadata about this VM. // [chainCtx.networkID]: The ID of the network this VM's chain is // running on. // [chainCtx.chainID]: The unique ID of the chain this VM is running on. // [chainCtx.Log]: Used to log messages // [chainCtx.NodeID]: The unique staker ID of this node. // [chainCtx.Lock]: A Read/Write lock shared by this VM and the // consensus engine that manages this VM. The write // lock is held whenever code in the consensus engine // calls the VM. // [dbManager]: The manager of the database this VM will persist data to. // [genesisBytes]: The byte-encoding of the genesis information of this // VM. The VM uses it to initialize its state. For // example, if this VM were an account-based payments // system, `genesisBytes` would probably contain a genesis // transaction that gives coins to some accounts, and this // transaction would be in the genesis block. // [toEngine]: The channel used to send messages to the consensus engine. // [fxs]: Feature extensions that attach to this VM. Initialize( ctx context.Context, chainCtx *snow.Context, dbManager manager.Manager, genesisBytes []byte, upgradeBytes []byte, configBytes []byte, toEngine chan<- Message, fxs []*Fx, appSender AppSender, ) error // SetState communicates to VM its next state it starts SetState(ctx context.Context, state snow.State) error // Shutdown is called when the node is shutting down. Shutdown(context.Context) error // Version returns the version of the VM. Version(context.Context) (string, error) // Creates the HTTP handlers for custom VM network calls. // // This exposes handlers that the outside world can use to communicate with // a static reference to the VM. Each handler has the path: // [Address of node]/ext/VM/[VM ID]/[extension] // // Returns a mapping from [extension]s to HTTP handlers. // // Each extension can specify how locking is managed for convenience. // // For example, it might make sense to have an extension for creating // genesis bytes this VM can interpret. // // Note: If this method is called, no other method will be called on this VM. // Each registered VM will have a single instance created to handle static // APIs. This instance will be handled separately from instances created to // service an instance of a chain. CreateStaticHandlers(context.Context) (map[string]*HTTPHandler, error) // Creates the HTTP handlers for custom chain network calls. // // This exposes handlers that the outside world can use to communicate with // the chain. Each handler has the path: // [Address of node]/ext/bc/[chain ID]/[extension] // // Returns a mapping from [extension]s to HTTP handlers. // // Each extension can specify how locking is managed for convenience. // // For example, if this VM implements an account-based payments system, // it have an extension called `accounts`, where clients could get // information about their accounts. CreateHandlers(context.Context) (map[string]*HTTPHandler, error) }
VM describes the interface that all consensus VMs must implement
Source Files ¶
- bootstrap_tracker.go
- bootstrapable.go
- bootstrapper.go
- config.go
- engine.go
- fetcher.go
- fx.go
- halter.go
- http_handler.go
- message.go
- mixed_query.go
- mock_sender.go
- no_ops_handlers.go
- requests.go
- sender.go
- state_syncer.go
- test_bootstrap_tracker.go
- test_bootstrapable.go
- test_bootstrapper.go
- test_config.go
- test_engine.go
- test_sender.go
- test_timer.go
- test_vm.go
- timer.go
- traced_bootstrapable_engine.go
- traced_engine.go
- traced_state_syncer.go
- vm.go