Documentation ¶
Overview ¶
Package common is a generated GoMock package.
Index ¶
- Variables
- type AcceptedFrontierHandler
- type AcceptedHandler
- type AcceptedSender
- type AcceptedStateSummaryHandler
- type AcceptedStateSummarySender
- type AllGetsServer
- type AncestorsHandler
- type AppError
- type AppGossipHandler
- type AppHandler
- type AppRequestHandler
- type AppResponseHandler
- type AppSender
- type BootstrapTracker
- type BootstrapTrackerTest
- type BootstrapableEngine
- type BootstrapperTest
- type ChitsHandler
- type CrossChainAppHandler
- type CrossChainAppRequestHandler
- type CrossChainAppResponseHandler
- 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, containerID ids.ID) 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, appErr *AppError) 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, preferredID ids.ID, ...) 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, appErr *AppError) 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, ...) 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) 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 FakeSender
- func (f FakeSender) SendAppError(_ context.Context, _ ids.NodeID, _ uint32, errorCode int32, ...) error
- func (f FakeSender) SendAppGossip(_ context.Context, bytes []byte, _ int, _ int, _ int) error
- func (f FakeSender) SendAppGossipSpecific(_ context.Context, _ set.Set[ids.NodeID], bytes []byte) error
- func (f FakeSender) SendAppRequest(_ context.Context, _ set.Set[ids.NodeID], _ uint32, bytes []byte) error
- func (f FakeSender) SendAppResponse(_ context.Context, _ ids.NodeID, _ uint32, bytes []byte) error
- func (f FakeSender) SendCrossChainAppError(_ context.Context, _ ids.ID, _ uint32, errorCode int32, errorMessage string) error
- func (f FakeSender) SendCrossChainAppRequest(_ context.Context, _ ids.ID, _ uint32, bytes []byte) error
- func (f FakeSender) SendCrossChainAppResponse(_ context.Context, _ ids.ID, _ uint32, bytes []byte) error
- type FetchSender
- type FrontierSender
- type Fx
- type GetAcceptedFrontierHandler
- type GetAcceptedHandler
- type GetAcceptedStateSummaryHandler
- type GetAncestorsHandler
- type GetHandler
- type GetStateSummaryFrontierHandler
- type Gossiper
- type Haltable
- type Halter
- type Handler
- type InternalHandler
- type Message
- type MockSender
- func (m *MockSender) Accept(ctx *snow.ConsensusContext, containerID ids.ID, container []byte) error
- func (m *MockSender) EXPECT() *MockSenderMockRecorder
- func (m *MockSender) SendAccepted(ctx context.Context, nodeID ids.NodeID, requestID uint32, ...)
- func (m *MockSender) SendAcceptedFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID)
- func (m *MockSender) SendAcceptedStateSummary(ctx context.Context, nodeID ids.NodeID, requestID uint32, summaryIDs []ids.ID)
- func (m *MockSender) SendAncestors(ctx context.Context, nodeID ids.NodeID, requestID uint32, containers [][]byte)
- func (m *MockSender) SendAppError(ctx context.Context, nodeID ids.NodeID, requestID uint32, errorCode int32, ...) error
- func (m *MockSender) SendAppGossip(ctx context.Context, appGossipBytes []byte, ...) error
- func (m *MockSender) SendAppGossipSpecific(ctx context.Context, nodeIDs set.Set[ids.NodeID], appGossipBytes []byte) error
- func (m *MockSender) SendAppRequest(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, ...) error
- func (m *MockSender) SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, ...) error
- func (m *MockSender) SendChits(ctx context.Context, nodeID ids.NodeID, requestID uint32, ...)
- func (m *MockSender) SendCrossChainAppError(ctx context.Context, chainID ids.ID, requestID uint32, errorCode int32, ...) error
- func (m *MockSender) SendCrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, appRequestBytes []byte) error
- func (m *MockSender) SendCrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, appResponseBytes []byte) error
- func (m *MockSender) SendGet(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID)
- func (m *MockSender) SendGetAccepted(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, ...)
- func (m *MockSender) SendGetAcceptedFrontier(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32)
- func (m *MockSender) SendGetAcceptedStateSummary(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, ...)
- func (m *MockSender) SendGetAncestors(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID)
- func (m *MockSender) SendGetStateSummaryFrontier(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32)
- func (m *MockSender) SendGossip(ctx context.Context, container []byte)
- func (m *MockSender) SendPullQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, ...)
- func (m *MockSender) SendPushQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, ...)
- func (m *MockSender) SendPut(ctx context.Context, nodeID ids.NodeID, requestID uint32, container []byte)
- func (m *MockSender) SendStateSummaryFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32, summary []byte)
- type MockSenderMockRecorder
- func (mr *MockSenderMockRecorder) Accept(ctx, containerID, container any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendAccepted(ctx, nodeID, requestID, containerIDs any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendAcceptedFrontier(ctx, nodeID, requestID, containerID any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendAcceptedStateSummary(ctx, nodeID, requestID, summaryIDs any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendAncestors(ctx, nodeID, requestID, containers any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendAppError(ctx, nodeID, requestID, errorCode, errorMessage any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendAppGossip(ctx, appGossipBytes, numValidators, numNonValidators, numPeers any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendAppGossipSpecific(ctx, nodeIDs, appGossipBytes any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendAppRequest(ctx, nodeIDs, requestID, appRequestBytes any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendAppResponse(ctx, nodeID, requestID, appResponseBytes any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendChits(ctx, nodeID, requestID, preferredID, preferredIDAtHeight, acceptedID any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendCrossChainAppError(ctx, chainID, requestID, errorCode, errorMessage any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendCrossChainAppRequest(ctx, chainID, requestID, appRequestBytes any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendCrossChainAppResponse(ctx, chainID, requestID, appResponseBytes any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendGet(ctx, nodeID, requestID, containerID any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendGetAccepted(ctx, nodeIDs, requestID, containerIDs any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendGetAcceptedFrontier(ctx, nodeIDs, requestID any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendGetAcceptedStateSummary(ctx, nodeIDs, requestID, heights any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendGetAncestors(ctx, nodeID, requestID, containerID any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendGetStateSummaryFrontier(ctx, nodeIDs, requestID any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendGossip(ctx, container any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendPullQuery(ctx, nodeIDs, requestID, containerID, requestedHeight any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendPushQuery(ctx, nodeIDs, requestID, container, requestedHeight any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendPut(ctx, nodeID, requestID, container any) *gomock.Call
- func (mr *MockSenderMockRecorder) SendStateSummaryFrontier(ctx, nodeID, requestID, summary any) *gomock.Call
- type NetworkAppHandler
- type NetworkAppSender
- type PutHandler
- type QueryHandler
- type QuerySender
- type Request
- 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, containers [][]byte)
- func (s *SenderTest) SendAppError(ctx context.Context, nodeID ids.NodeID, requestID uint32, code int32, ...) error
- func (s *SenderTest) SendAppGossip(ctx context.Context, appGossipBytes []byte, numValidators int, ...) 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, preferredID ids.ID, ...)
- func (s *SenderTest) SendCrossChainAppError(ctx context.Context, chainID ids.ID, requestID uint32, errorCode int32, ...) error
- 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, containerID 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, ...)
- 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, ...)
- func (s *SenderTest) SendPushQuery(ctx context.Context, vdrs set.Set[ids.NodeID], requestID uint32, ...)
- func (s *SenderTest) SendPut(ctx context.Context, vdr ids.NodeID, requestID uint32, container []byte)
- func (s *SenderTest) SendStateSummaryFrontier(ctx context.Context, validatorID ids.NodeID, requestID uint32, summary []byte)
- 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, appErr *AppError) 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]http.Handler, 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, appErr *AppError) 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 database.Database, ...) 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 ¶
This section is empty.
Variables ¶
var ( // ErrUndefined indicates an undefined error ErrUndefined = &AppError{ Code: 0, Message: "undefined", } // ErrTimeout is used to signal a response timeout ErrTimeout = &AppError{ Code: -1, Message: "timed out", } )
Functions ¶
This section is empty.
Types ¶
type AcceptedFrontierHandler ¶
type AcceptedFrontierHandler interface { // Notify this engine of the response to a previously sent // GetAcceptedFrontier message with the same requestID. AcceptedFrontier( ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID, ) error // Notify this engine that a GetAcceptedFrontier request it issued has // failed. // // This function will be called if a GetAcceptedFrontier message with // nodeID and requestID was previously sent by this engine and will not // receive a response. GetAcceptedFrontierFailed( ctx context.Context, nodeID ids.NodeID, requestID uint32, ) error }
func NewNoOpAcceptedFrontierHandler ¶
func NewNoOpAcceptedFrontierHandler(log logging.Logger) AcceptedFrontierHandler
type AcceptedHandler ¶
type AcceptedHandler interface { // Notify this engine of the response to a previously sent GetAccepted // message with the same requestID. // // It is not guaranteed that the containerIDs are a subset of the // containerIDs provided in the request. Accepted( ctx context.Context, nodeID ids.NodeID, requestID uint32, containerIDs set.Set[ids.ID], ) error // Notify this engine that a GetAccepted request it issued has failed. // // This function will be called if a GetAccepted message with nodeID and // requestID was previously sent by this engine and will not receive a // response. GetAcceptedFailed( ctx context.Context, nodeID ids.NodeID, requestID uint32, ) error }
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 ¶
type AcceptedStateSummaryHandler interface { // Notify this engine of the response to a previously sent // GetAcceptedStateSummary message with the same requestID. // // It is not guaranteed that the summaryIDs have heights corresponding to // the heights in the request. AcceptedStateSummary( ctx context.Context, nodeID ids.NodeID, requestID uint32, summaryIDs set.Set[ids.ID], ) error // Notify this engine that a GetAcceptedStateSummary request it issued has // failed. // // This function will be called if a GetAcceptedStateSummary message with // nodeID and requestID was previously sent by this engine and will not // receive a response. GetAcceptedStateSummaryFailed( ctx context.Context, nodeID ids.NodeID, requestID uint32, ) error }
func NewNoOpAcceptedStateSummaryHandler ¶
func NewNoOpAcceptedStateSummaryHandler(log logging.Logger) AcceptedStateSummaryHandler
type AcceptedStateSummarySender ¶
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 the response to a previously sent GetAncestors // message with the same requestID. // // It is expected, but not guaranteed, that the first element in containers // should be the container referenced in the request and that the rest of // the containers should be referenced by a prior container in the list. Ancestors( ctx context.Context, nodeID ids.NodeID, requestID uint32, containers [][]byte, ) error // Notify this engine that a GetAncestors request it issued has failed. // // This function will be called if a GetAncestors message with nodeID and // requestID was previously sent by this engine and will not receive a // response. GetAncestorsFailed( ctx context.Context, nodeID ids.NodeID, requestID uint32, ) error }
func NewNoOpAncestorsHandler ¶
func NewNoOpAncestorsHandler(log logging.Logger) AncestorsHandler
type AppError ¶
type AppError struct { // Code is application-defined and should be used for error matching Code int32 // Message is a human-readable error message Message string }
AppError is an application-defined error
type AppGossipHandler ¶
type AppGossipHandler interface { // 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. AppGossip( ctx context.Context, nodeID ids.NodeID, msg []byte, ) error }
type AppHandler ¶
type AppHandler interface { NetworkAppHandler CrossChainAppHandler }
func NewNoOpAppHandler ¶
func NewNoOpAppHandler(log logging.Logger) AppHandler
type AppRequestHandler ¶
type AppRequestHandler interface { // Notify this engine of a request for an AppResponse with the same // requestID. // // 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 or valid. // // This function can be called by any node at any time. AppRequest( ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, request []byte, ) error }
type AppResponseHandler ¶
type AppResponseHandler interface { // Notify this engine of the response to a previously sent AppRequest with // the same requestID. // // The meaning of response is application (VM) specifc. // // It is not guaranteed that response is well-formed or valid. AppResponse( ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte, ) error // Notify this engine that an AppRequest it issued has failed. // // This function will be called if an AppRequest message with nodeID and // requestID was previously sent by this engine and will not receive a // response. AppRequestFailed( ctx context.Context, nodeID ids.NodeID, requestID uint32, appErr *AppError, ) error }
type AppSender ¶
type AppSender interface { NetworkAppSender CrossChainAppSender }
AppSender sends application (VM) level messages. See also common.AppHandler.
type BootstrapTracker ¶
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 ¶
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 ¶
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 ¶
func (s *BootstrapTrackerTest) Default(cant bool)
Default set the default callable value to [cant]
func (*BootstrapTrackerTest) IsBootstrapped ¶
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 ¶
func (s *BootstrapTrackerTest) OnBootstrapCompleted() chan struct{}
type BootstrapableEngine ¶
type BootstrapableEngine interface { Engine // Clear removes all containers to be processed upon bootstrapping Clear(ctx context.Context) error }
func TraceBootstrapableEngine ¶
func TraceBootstrapableEngine(bootstrapableEngine BootstrapableEngine, tracer trace.Tracer) BootstrapableEngine
type BootstrapperTest ¶
type BootstrapperTest struct { EngineTest CantClear bool ClearF func(ctx context.Context) error }
func (*BootstrapperTest) Default ¶
func (b *BootstrapperTest) Default(cant bool)
type ChitsHandler ¶
type ChitsHandler interface { // Notify this engine of the response to a previously sent PullQuery or // PushQuery message with the same requestID. // // It is expected, but not guaranteed, that preferredID transitively // references preferredIDAtHeight and acceptedID. Chits( ctx context.Context, nodeID ids.NodeID, requestID uint32, preferredID ids.ID, preferredIDAtHeight ids.ID, acceptedID ids.ID, ) error // Notify this engine that a Query request it issued has failed. // // This function will be called if a PullQuery or PushQuery message with // nodeID and requestID was previously sent by this engine and will not // receive a response. QueryFailed( ctx context.Context, nodeID ids.NodeID, requestID uint32, ) error }
func NewNoOpChitsHandler ¶
func NewNoOpChitsHandler(log logging.Logger) ChitsHandler
type CrossChainAppHandler ¶
type CrossChainAppHandler interface { CrossChainAppRequestHandler CrossChainAppResponseHandler }
type CrossChainAppRequestHandler ¶
type CrossChainAppRequestHandler interface { // Notify this engine of a request for a CrossChainAppResponse with the same // requestID. // // 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. CrossChainAppRequest( ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, request []byte, ) error }
type CrossChainAppResponseHandler ¶
type CrossChainAppResponseHandler interface { // Notify this engine of the response to a previously sent // CrossChainAppRequest with the same requestID. // // The meaning of response is application (VM) specifc. // // 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. CrossChainAppResponse( ctx context.Context, chainID ids.ID, requestID uint32, response []byte, ) error // Notify this engine that a CrossChainAppRequest it issued has failed. // // This function will be called if a CrossChainAppRequest message with // nodeID and requestID was previously sent by this engine and will not // receive a response. CrossChainAppRequestFailed( ctx context.Context, chainID ids.ID, requestID uint32, appErr *AppError, ) error }
type CrossChainAppSender ¶
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]. 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]. SendCrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, appResponseBytes []byte) error // SendCrossChainAppError sends an application-level error to a CrossChainAppRequest SendCrossChainAppError(ctx context.Context, chainID ids.ID, requestID uint32, errorCode int32, errorMessage string) 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 }
Engine describes the standard interface of a consensus engine.
All nodeIDs are assumed to be authenticated.
A consensus engine may recover after returning an error, but it isn't required.
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 func(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) error PullQueryF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID, requestedHeight uint64) error PutF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, container []byte) error PushQueryF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, container []byte, requestedHeight uint64) error AncestorsF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, containers [][]byte) error AcceptedFrontierF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) error GetAcceptedF, AcceptedF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, preferredIDs set.Set[ids.ID]) error ChitsF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, preferredID ids.ID, preferredIDAtHeight ids.ID, acceptedID 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, appErr *AppError) 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 set.Set[uint64]) error AcceptedStateSummaryF func(ctx context.Context, nodeID ids.NodeID, requestID uint32, summaryIDs set.Set[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, appErr *AppError) error }
EngineTest is a test engine
func (*EngineTest) AcceptedFrontier ¶
func (*EngineTest) AcceptedStateSummary ¶
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 ¶
func (*EngineTest) CrossChainAppRequestFailed ¶
func (*EngineTest) CrossChainAppResponse ¶
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 ¶
func (*EngineTest) GetAcceptedStateSummaryFailed ¶
func (*EngineTest) GetAncestors ¶
func (*EngineTest) GetAncestorsFailed ¶
func (*EngineTest) GetStateSummaryFrontier ¶
func (*EngineTest) GetStateSummaryFrontierFailed ¶
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 ¶
type FakeSender ¶
type FakeSender struct {
SentAppRequest, SentAppResponse,
SentAppGossip, SentAppGossipSpecific,
SentCrossChainAppRequest, SentCrossChainAppResponse chan []byte
SentAppError, SentCrossChainAppError chan *AppError
}
FakeSender is used for testing
func (FakeSender) SendAppError ¶
func (FakeSender) SendAppGossip ¶
func (FakeSender) SendAppGossipSpecific ¶
func (FakeSender) SendAppRequest ¶
func (FakeSender) SendAppResponse ¶
func (FakeSender) SendCrossChainAppError ¶
func (FakeSender) SendCrossChainAppRequest ¶
func (FakeSender) SendCrossChainAppResponse ¶
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, containerID 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 an AcceptedFrontier message with the // same requestID and the ID of the most recently accepted container. // // This function can be called by any node at any time. GetAcceptedFrontier( ctx context.Context, nodeID ids.NodeID, requestID uint32, ) error }
type GetAcceptedHandler ¶
type GetAcceptedHandler interface { // Notify this engine of a request for an Accepted message with the same // requestID and the subset of containerIDs that this node has accepted. // // This function can be called by any node at any time. GetAccepted( ctx context.Context, nodeID ids.NodeID, requestID uint32, containerIDs set.Set[ids.ID], ) error }
type GetAcceptedStateSummaryHandler ¶
type GetAcceptedStateSummaryHandler interface { // Notify this engine of a request for an AcceptedStateSummary message with // the same requestID and the state summary IDs at the requested heights. // If this node doesn't have access to a state summary ID at a requested // height, that height should be ignored. // // This function can be called by any node at any time. GetAcceptedStateSummary( ctx context.Context, nodeID ids.NodeID, requestID uint32, heights set.Set[uint64], ) error }
type GetAncestorsHandler ¶
type GetAncestorsHandler interface { // Notify this engine of a request for an Ancestors message with the same // requestID, containerID, and some of its ancestors on a best effort basis. // // This function can be called by any node at any time. GetAncestors( ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID, ) error }
type GetHandler ¶
type GetHandler interface { // Notify this engine of a request for a Put message with the same requestID // and the container whose ID is containerID. // // This function can be called by any node at any time. Get( ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID, ) error }
type GetStateSummaryFrontierHandler ¶
type GetStateSummaryFrontierHandler interface { // Notify this engine of a request for a StateSummaryFrontier message with // the same requestID and the engine's most recently accepted state summary. // // This function can be called by any node at any time. GetStateSummaryFrontier( ctx context.Context, nodeID ids.NodeID, requestID uint32, ) error }
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 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 }
func NewNoOpInternalHandler ¶
func NewNoOpInternalHandler(log logging.Logger) InternalHandler
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. // // The consensus engine must eventually call BuildBlock at least once after // receiving this message. If the consensus engine receives multiple // PendingTxs messages between calls to BuildBlock, the engine may only call // BuildBlock once. PendingTxs Message = iota + 1 // StateSyncDone notifies the state syncer engine that the VM has finishing // syncing the requested state summary. StateSyncDone )
type MockSender ¶
type MockSender struct {
// contains filtered or unexported fields
}
MockSender is a mock of Sender interface.
func NewMockSender ¶
func NewMockSender(ctrl *gomock.Controller) *MockSender
NewMockSender creates a new mock instance.
func (*MockSender) Accept ¶
func (m *MockSender) Accept(ctx *snow.ConsensusContext, containerID ids.ID, container []byte) error
Accept mocks base method.
func (*MockSender) EXPECT ¶
func (m *MockSender) EXPECT() *MockSenderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockSender) SendAccepted ¶
func (m *MockSender) SendAccepted(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerIDs []ids.ID)
SendAccepted mocks base method.
func (*MockSender) SendAcceptedFrontier ¶
func (m *MockSender) SendAcceptedFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID)
SendAcceptedFrontier mocks base method.
func (*MockSender) SendAcceptedStateSummary ¶
func (m *MockSender) SendAcceptedStateSummary(ctx context.Context, nodeID ids.NodeID, requestID uint32, summaryIDs []ids.ID)
SendAcceptedStateSummary mocks base method.
func (*MockSender) SendAncestors ¶
func (m *MockSender) SendAncestors(ctx context.Context, nodeID ids.NodeID, requestID uint32, containers [][]byte)
SendAncestors mocks base method.
func (*MockSender) SendAppError ¶
func (m *MockSender) SendAppError(ctx context.Context, nodeID ids.NodeID, requestID uint32, errorCode int32, errorMessage string) error
SendAppError mocks base method.
func (*MockSender) SendAppGossip ¶
func (m *MockSender) SendAppGossip(ctx context.Context, appGossipBytes []byte, numValidators, numNonValidators, numPeers int) error
SendAppGossip mocks base method.
func (*MockSender) SendAppGossipSpecific ¶
func (m *MockSender) SendAppGossipSpecific(ctx context.Context, nodeIDs set.Set[ids.NodeID], appGossipBytes []byte) error
SendAppGossipSpecific mocks base method.
func (*MockSender) SendAppRequest ¶
func (m *MockSender) SendAppRequest(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, appRequestBytes []byte) error
SendAppRequest mocks base method.
func (*MockSender) SendAppResponse ¶
func (m *MockSender) SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, appResponseBytes []byte) error
SendAppResponse mocks base method.
func (*MockSender) SendChits ¶
func (m *MockSender) SendChits(ctx context.Context, nodeID ids.NodeID, requestID uint32, preferredID, preferredIDAtHeight, acceptedID ids.ID)
SendChits mocks base method.
func (*MockSender) SendCrossChainAppError ¶
func (m *MockSender) SendCrossChainAppError(ctx context.Context, chainID ids.ID, requestID uint32, errorCode int32, errorMessage string) error
SendCrossChainAppError mocks base method.
func (*MockSender) SendCrossChainAppRequest ¶
func (m *MockSender) SendCrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, appRequestBytes []byte) error
SendCrossChainAppRequest mocks base method.
func (*MockSender) SendCrossChainAppResponse ¶
func (m *MockSender) SendCrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, appResponseBytes []byte) error
SendCrossChainAppResponse mocks base method.
func (*MockSender) SendGet ¶
func (m *MockSender) SendGet(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID)
SendGet mocks base method.
func (*MockSender) SendGetAccepted ¶
func (m *MockSender) SendGetAccepted(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, containerIDs []ids.ID)
SendGetAccepted mocks base method.
func (*MockSender) SendGetAcceptedFrontier ¶
func (m *MockSender) SendGetAcceptedFrontier(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32)
SendGetAcceptedFrontier mocks base method.
func (*MockSender) SendGetAcceptedStateSummary ¶
func (m *MockSender) SendGetAcceptedStateSummary(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, heights []uint64)
SendGetAcceptedStateSummary mocks base method.
func (*MockSender) SendGetAncestors ¶
func (m *MockSender) SendGetAncestors(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID)
SendGetAncestors mocks base method.
func (*MockSender) SendGetStateSummaryFrontier ¶
func (m *MockSender) SendGetStateSummaryFrontier(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32)
SendGetStateSummaryFrontier mocks base method.
func (*MockSender) SendGossip ¶
func (m *MockSender) SendGossip(ctx context.Context, container []byte)
SendGossip mocks base method.
func (*MockSender) SendPullQuery ¶
func (m *MockSender) SendPullQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, containerID ids.ID, requestedHeight uint64)
SendPullQuery mocks base method.
func (*MockSender) SendPushQuery ¶
func (m *MockSender) SendPushQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, container []byte, requestedHeight uint64)
SendPushQuery mocks base method.
func (*MockSender) SendPut ¶
func (m *MockSender) SendPut(ctx context.Context, nodeID ids.NodeID, requestID uint32, container []byte)
SendPut mocks base method.
func (*MockSender) SendStateSummaryFrontier ¶
func (m *MockSender) SendStateSummaryFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32, summary []byte)
SendStateSummaryFrontier mocks base method.
type MockSenderMockRecorder ¶
type MockSenderMockRecorder struct {
// contains filtered or unexported fields
}
MockSenderMockRecorder is the mock recorder for MockSender.
func (*MockSenderMockRecorder) Accept ¶
func (mr *MockSenderMockRecorder) Accept(ctx, containerID, container any) *gomock.Call
Accept indicates an expected call of Accept.
func (*MockSenderMockRecorder) SendAccepted ¶
func (mr *MockSenderMockRecorder) SendAccepted(ctx, nodeID, requestID, containerIDs any) *gomock.Call
SendAccepted indicates an expected call of SendAccepted.
func (*MockSenderMockRecorder) SendAcceptedFrontier ¶
func (mr *MockSenderMockRecorder) SendAcceptedFrontier(ctx, nodeID, requestID, containerID any) *gomock.Call
SendAcceptedFrontier indicates an expected call of SendAcceptedFrontier.
func (*MockSenderMockRecorder) SendAcceptedStateSummary ¶
func (mr *MockSenderMockRecorder) SendAcceptedStateSummary(ctx, nodeID, requestID, summaryIDs any) *gomock.Call
SendAcceptedStateSummary indicates an expected call of SendAcceptedStateSummary.
func (*MockSenderMockRecorder) SendAncestors ¶
func (mr *MockSenderMockRecorder) SendAncestors(ctx, nodeID, requestID, containers any) *gomock.Call
SendAncestors indicates an expected call of SendAncestors.
func (*MockSenderMockRecorder) SendAppError ¶
func (mr *MockSenderMockRecorder) SendAppError(ctx, nodeID, requestID, errorCode, errorMessage any) *gomock.Call
SendAppError indicates an expected call of SendAppError.
func (*MockSenderMockRecorder) SendAppGossip ¶
func (mr *MockSenderMockRecorder) SendAppGossip(ctx, appGossipBytes, numValidators, numNonValidators, numPeers any) *gomock.Call
SendAppGossip indicates an expected call of SendAppGossip.
func (*MockSenderMockRecorder) SendAppGossipSpecific ¶
func (mr *MockSenderMockRecorder) SendAppGossipSpecific(ctx, nodeIDs, appGossipBytes any) *gomock.Call
SendAppGossipSpecific indicates an expected call of SendAppGossipSpecific.
func (*MockSenderMockRecorder) SendAppRequest ¶
func (mr *MockSenderMockRecorder) SendAppRequest(ctx, nodeIDs, requestID, appRequestBytes any) *gomock.Call
SendAppRequest indicates an expected call of SendAppRequest.
func (*MockSenderMockRecorder) SendAppResponse ¶
func (mr *MockSenderMockRecorder) SendAppResponse(ctx, nodeID, requestID, appResponseBytes any) *gomock.Call
SendAppResponse indicates an expected call of SendAppResponse.
func (*MockSenderMockRecorder) SendChits ¶
func (mr *MockSenderMockRecorder) SendChits(ctx, nodeID, requestID, preferredID, preferredIDAtHeight, acceptedID any) *gomock.Call
SendChits indicates an expected call of SendChits.
func (*MockSenderMockRecorder) SendCrossChainAppError ¶
func (mr *MockSenderMockRecorder) SendCrossChainAppError(ctx, chainID, requestID, errorCode, errorMessage any) *gomock.Call
SendCrossChainAppError indicates an expected call of SendCrossChainAppError.
func (*MockSenderMockRecorder) SendCrossChainAppRequest ¶
func (mr *MockSenderMockRecorder) SendCrossChainAppRequest(ctx, chainID, requestID, appRequestBytes any) *gomock.Call
SendCrossChainAppRequest indicates an expected call of SendCrossChainAppRequest.
func (*MockSenderMockRecorder) SendCrossChainAppResponse ¶
func (mr *MockSenderMockRecorder) SendCrossChainAppResponse(ctx, chainID, requestID, appResponseBytes any) *gomock.Call
SendCrossChainAppResponse indicates an expected call of SendCrossChainAppResponse.
func (*MockSenderMockRecorder) SendGet ¶
func (mr *MockSenderMockRecorder) SendGet(ctx, nodeID, requestID, containerID any) *gomock.Call
SendGet indicates an expected call of SendGet.
func (*MockSenderMockRecorder) SendGetAccepted ¶
func (mr *MockSenderMockRecorder) SendGetAccepted(ctx, nodeIDs, requestID, containerIDs any) *gomock.Call
SendGetAccepted indicates an expected call of SendGetAccepted.
func (*MockSenderMockRecorder) SendGetAcceptedFrontier ¶
func (mr *MockSenderMockRecorder) SendGetAcceptedFrontier(ctx, nodeIDs, requestID any) *gomock.Call
SendGetAcceptedFrontier indicates an expected call of SendGetAcceptedFrontier.
func (*MockSenderMockRecorder) SendGetAcceptedStateSummary ¶
func (mr *MockSenderMockRecorder) SendGetAcceptedStateSummary(ctx, nodeIDs, requestID, heights any) *gomock.Call
SendGetAcceptedStateSummary indicates an expected call of SendGetAcceptedStateSummary.
func (*MockSenderMockRecorder) SendGetAncestors ¶
func (mr *MockSenderMockRecorder) SendGetAncestors(ctx, nodeID, requestID, containerID any) *gomock.Call
SendGetAncestors indicates an expected call of SendGetAncestors.
func (*MockSenderMockRecorder) SendGetStateSummaryFrontier ¶
func (mr *MockSenderMockRecorder) SendGetStateSummaryFrontier(ctx, nodeIDs, requestID any) *gomock.Call
SendGetStateSummaryFrontier indicates an expected call of SendGetStateSummaryFrontier.
func (*MockSenderMockRecorder) SendGossip ¶
func (mr *MockSenderMockRecorder) SendGossip(ctx, container any) *gomock.Call
SendGossip indicates an expected call of SendGossip.
func (*MockSenderMockRecorder) SendPullQuery ¶
func (mr *MockSenderMockRecorder) SendPullQuery(ctx, nodeIDs, requestID, containerID, requestedHeight any) *gomock.Call
SendPullQuery indicates an expected call of SendPullQuery.
func (*MockSenderMockRecorder) SendPushQuery ¶
func (mr *MockSenderMockRecorder) SendPushQuery(ctx, nodeIDs, requestID, container, requestedHeight any) *gomock.Call
SendPushQuery indicates an expected call of SendPushQuery.
func (*MockSenderMockRecorder) SendPut ¶
func (mr *MockSenderMockRecorder) SendPut(ctx, nodeID, requestID, container any) *gomock.Call
SendPut indicates an expected call of SendPut.
func (*MockSenderMockRecorder) SendStateSummaryFrontier ¶
func (mr *MockSenderMockRecorder) SendStateSummaryFrontier(ctx, nodeID, requestID, summary any) *gomock.Call
SendStateSummaryFrontier indicates an expected call of SendStateSummaryFrontier.
type NetworkAppHandler ¶
type NetworkAppHandler interface { AppRequestHandler AppResponseHandler AppGossipHandler }
type NetworkAppSender ¶
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. 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]. SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, appResponseBytes []byte) error // SendAppError sends an application-level error to an AppRequest SendAppError(ctx context.Context, nodeID ids.NodeID, requestID uint32, errorCode int32, errorMessage string) error // Gossip an application-level message. SendAppGossip( ctx context.Context, appGossipBytes []byte, numValidators int, numNonValidators int, numPeers int, ) 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 either the response to a previously sent Get // message with the same requestID or an unsolicited container if the // requestID is MaxUint32. // // It is not guaranteed that container can be parsed or issued. Put( ctx context.Context, nodeID ids.NodeID, requestID uint32, container []byte, ) error // Notify this engine that a Get request it issued has failed. // // This function will be called if a Get message with nodeID and requestID // was previously sent by this engine and will not receive a response. GetFailed( ctx context.Context, nodeID ids.NodeID, requestID uint32, ) error }
func NewNoOpPutHandler ¶
func NewNoOpPutHandler(log logging.Logger) PutHandler
type QueryHandler ¶
type QueryHandler interface { // Notify this engine of a request for a Chits message with the same // requestID. // // If the provided containerID is not processing, the engine is expected to // respond with the node's current preferences before attempting to issue // it. // // This function can be called by any node at any time. PullQuery( ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID, requestedHeight uint64, ) error // Notify this engine of a request for a Chits message with the same // requestID. // // If the provided container is not processing, the engine is expected to // respond with the node's current preferences before attempting to issue // it. // // It is not guaranteed that container can be parsed or issued. // // This function can be called by any node at any time. PushQuery( ctx context.Context, nodeID ids.NodeID, requestID uint32, container []byte, requestedHeight uint64, ) error }
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, requestedHeight uint64, ) // 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, requestedHeight uint64, ) // Send chits to the specified node SendChits( ctx context.Context, nodeID ids.NodeID, requestID uint32, preferredID ids.ID, preferredIDAtHeight ids.ID, acceptedID ids.ID, ) }
QuerySender defines how a consensus engine sends query messages to other nodes.
type Request ¶
func (Request) MarshalText ¶
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.
Messages can be categorized as either: requests, responses, or gossip. Gossip messages do not include requestIDs, because no response is expected from the peer. However, both requests and responses include requestIDs.
It is expected that each [nodeID + requestID + expected response type] that is outstanding at any given time is unique.
As an example, it is valid to send `Get(nodeA, request0)` and `PullQuery(nodeA, request0)` because they have different expected response types, `Put` and `Chits`.
Additionally, after having sent `Get(nodeA, request0)` and receiving either `Put(nodeA, request0)` or `GetFailed(nodeA, request0)`, it is valid to resend `Get(nodeA, request0)`. Because the initial `Get` request is no longer outstanding.
This means that requestIDs can be reused. In practice, requests always have a reasonable maximum timeout, so it is generally safe to assume that by the time the requestID space has been exhausted, the beginning of the requestID space is free of conflicts.
type SenderTest ¶
type SenderTest struct { T require.TestingT CantAccept, CantSendGetStateSummaryFrontier, CantSendStateSummaryFrontier, CantSendGetAcceptedStateSummary, CantSendAcceptedStateSummary, CantSendGetAcceptedFrontier, CantSendAcceptedFrontier, CantSendGetAccepted, CantSendAccepted, CantSendGet, CantSendGetAncestors, CantSendPut, CantSendAncestors, CantSendPullQuery, CantSendPushQuery, CantSendChits, CantSendGossip, CantSendAppRequest, CantSendAppResponse, CantSendAppError, CantSendAppGossip, CantSendAppGossipSpecific, CantSendCrossChainAppRequest, CantSendCrossChainAppResponse, CantSendCrossChainAppError 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, uint64) SendPullQueryF func(context.Context, set.Set[ids.NodeID], uint32, ids.ID, uint64) SendChitsF func(context.Context, ids.NodeID, uint32, ids.ID, 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 SendAppErrorF func(context.Context, ids.NodeID, uint32, int32, string) error SendAppGossipF func(context.Context, []byte, int, int, int) 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) SendCrossChainAppErrorF func(context.Context, ids.ID, uint32, int32, string) }
SenderTest is a test sender
func (*SenderTest) Accept ¶
func (s *SenderTest) Accept(ctx *snow.ConsensusContext, containerID ids.ID, container []byte) error
Accept calls AcceptF 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, containerID 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 ¶
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, containers [][]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) SendAppError ¶
func (s *SenderTest) SendAppError(ctx context.Context, nodeID ids.NodeID, requestID uint32, code int32, message string) error
SendAppError calls SendAppErrorF 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, numValidators int, numNonValidators int, numPeers int, ) 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, preferredID ids.ID, preferredIDAtHeight ids.ID, acceptedID 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) SendCrossChainAppError ¶
func (s *SenderTest) SendCrossChainAppError(ctx context.Context, chainID ids.ID, requestID uint32, errorCode int32, errorMessage string) error
SendCrossChainAppError calls SendCrossChainAppErrorF 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 ¶
func (s *SenderTest) SendCrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, appRequestBytes []byte) error
SendCrossChainAppRequest calls SendCrossChainAppRequestF 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) SendCrossChainAppResponse ¶
func (s *SenderTest) SendCrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, appResponseBytes []byte) error
SendCrossChainAppResponse calls SendCrossChainAppResponseF 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) SendGet ¶
func (s *SenderTest) SendGet(ctx context.Context, vdr ids.NodeID, requestID uint32, containerID ids.ID)
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 ¶
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, containerID 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 ¶
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, containerID ids.ID, requestedHeight uint64)
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, container []byte, requestedHeight uint64)
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 ¶
func (s *SenderTest) SendPut(ctx context.Context, vdr ids.NodeID, requestID uint32, container []byte)
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 ¶
func (s *SenderTest) SendStateSummaryFrontier(ctx context.Context, validatorID ids.NodeID, requestID uint32, summary []byte)
SendStateSummaryFrontier calls SendStateSummaryFrontierF 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 StateSummaryFrontierHandler ¶
type StateSummaryFrontierHandler interface { // Notify this engine of the response to a previously sent // GetStateSummaryFrontier message with the same requestID. // // It is not guaranteed that the summary bytes are from a valid state // summary. StateSummaryFrontier( ctx context.Context, nodeID ids.NodeID, requestID uint32, summary []byte, ) error // Notify this engine that a GetStateSummaryFrontier request it issued has // failed. // // This function will be called if a GetStateSummaryFrontier message with // nodeID and requestID was previously sent by this engine and will not // receive a response. GetStateSummaryFrontierFailed( ctx context.Context, nodeID ids.NodeID, requestID uint32, ) error }
func NewNoOpStateSummaryFrontierHandler ¶
func NewNoOpStateSummaryFrontierHandler(log logging.Logger) StateSummaryFrontierHandler
type StateSummarySender ¶
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 ¶
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 ¶
func TraceStateSyncer(stateSyncer StateSyncer, tracer trace.Tracer) StateSyncer
type TestVM ¶
type TestVM struct { T *testing.T CantInitialize, CantSetState, CantShutdown, CantCreateHandlers, CantHealthCheck, CantConnected, CantDisconnected, CantVersion, CantAppRequest, CantAppResponse, CantAppGossip, CantAppRequestFailed, CantCrossChainAppRequest, CantCrossChainAppResponse, CantCrossChainAppRequestFailed bool InitializeF func(ctx context.Context, chainCtx *snow.Context, db database.Database, 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]http.Handler, 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, appErr *AppError) 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, appErr *AppError) error }
TestVM is a test vm
func (*TestVM) AppRequest ¶
func (*TestVM) AppRequestFailed ¶
func (*TestVM) AppResponse ¶
func (*TestVM) CreateHandlers ¶
func (*TestVM) CrossChainAppRequest ¶
func (*TestVM) CrossChainAppRequestFailed ¶
func (*TestVM) CrossChainAppResponse ¶
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, db database.Database, 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 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. // // 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]http.Handler, error) }
VM describes the interface that all consensus VMs must implement
Source Files ¶
- bootstrap_tracker.go
- bootstrapable.go
- engine.go
- error.go
- fx.go
- halter.go
- message.go
- mock_sender.go
- no_ops_handlers.go
- request.go
- sender.go
- state_syncer.go
- test_bootstrap_tracker.go
- test_bootstrapper.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