Documentation ¶
Overview ¶
Package vertex is a generated GoMock package.
Index ¶
- type Builder
- type DAGVM
- type Heap
- type LinearizableVM
- type LinearizableVMWithEngine
- type Manager
- type MockLinearizableVM
- func (m *MockLinearizableVM) AppGossip(arg0 context.Context, arg1 ids.NodeID, arg2 []byte) error
- func (m *MockLinearizableVM) AppRequest(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 time.Time, ...) error
- func (m *MockLinearizableVM) AppRequestFailed(arg0 context.Context, arg1 ids.NodeID, arg2 uint32) error
- func (m *MockLinearizableVM) AppResponse(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 []byte) error
- func (m *MockLinearizableVM) BuildBlock(arg0 context.Context) (snowman.Block, error)
- func (m *MockLinearizableVM) Connected(arg0 context.Context, arg1 ids.NodeID, arg2 *version.Application) error
- func (m *MockLinearizableVM) CreateHandlers(arg0 context.Context) (map[string]http.Handler, error)
- func (m *MockLinearizableVM) CreateStaticHandlers(arg0 context.Context) (map[string]http.Handler, error)
- func (m *MockLinearizableVM) CrossChainAppRequest(arg0 context.Context, arg1 ids.ID, arg2 uint32, arg3 time.Time, arg4 []byte) error
- func (m *MockLinearizableVM) CrossChainAppRequestFailed(arg0 context.Context, arg1 ids.ID, arg2 uint32) error
- func (m *MockLinearizableVM) CrossChainAppResponse(arg0 context.Context, arg1 ids.ID, arg2 uint32, arg3 []byte) error
- func (m *MockLinearizableVM) Disconnected(arg0 context.Context, arg1 ids.NodeID) error
- func (m *MockLinearizableVM) EXPECT() *MockLinearizableVMMockRecorder
- func (m *MockLinearizableVM) GetBlock(arg0 context.Context, arg1 ids.ID) (snowman.Block, error)
- func (m *MockLinearizableVM) GetBlockIDAtHeight(arg0 context.Context, arg1 uint64) (ids.ID, error)
- func (m *MockLinearizableVM) HealthCheck(arg0 context.Context) (interface{}, error)
- func (m *MockLinearizableVM) Initialize(arg0 context.Context, arg1 *snow.Context, arg2 manager.Manager, ...) error
- func (m *MockLinearizableVM) LastAccepted(arg0 context.Context) (ids.ID, error)
- func (m *MockLinearizableVM) Linearize(arg0 context.Context, arg1 ids.ID) error
- func (m *MockLinearizableVM) ParseBlock(arg0 context.Context, arg1 []byte) (snowman.Block, error)
- func (m *MockLinearizableVM) ParseTx(arg0 context.Context, arg1 []byte) (snowstorm.Tx, error)
- func (m *MockLinearizableVM) SetPreference(arg0 context.Context, arg1 ids.ID) error
- func (m *MockLinearizableVM) SetState(arg0 context.Context, arg1 snow.State) error
- func (m *MockLinearizableVM) Shutdown(arg0 context.Context) error
- func (m *MockLinearizableVM) VerifyHeightIndex(arg0 context.Context) error
- func (m *MockLinearizableVM) Version(arg0 context.Context) (string, error)
- type MockLinearizableVMMockRecorder
- func (mr *MockLinearizableVMMockRecorder) AppGossip(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) AppRequest(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) AppRequestFailed(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) AppResponse(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) BuildBlock(arg0 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) Connected(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) CreateHandlers(arg0 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) CreateStaticHandlers(arg0 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) CrossChainAppRequest(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) CrossChainAppRequestFailed(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) CrossChainAppResponse(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) Disconnected(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) GetBlock(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) GetBlockIDAtHeight(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) HealthCheck(arg0 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) Initialize(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) LastAccepted(arg0 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) Linearize(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) ParseBlock(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) ParseTx(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) SetPreference(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) SetState(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) Shutdown(arg0 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) VerifyHeightIndex(arg0 interface{}) *gomock.Call
- func (mr *MockLinearizableVMMockRecorder) Version(arg0 interface{}) *gomock.Call
- type Parser
- type StatelessVertex
- type Storage
- type TestBuilder
- type TestManager
- type TestParser
- type TestStorage
- type TestVM
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface { // Build a new stop vertex from the parents BuildStopVtx(ctx context.Context, parentIDs []ids.ID) (avalanche.Vertex, error) }
Builder builds a vertex given a set of parentIDs and transactions.
type DAGVM ¶
type DAGVM interface { block.ChainVM // Convert a stream of bytes to a transaction or return an error ParseTx(ctx context.Context, txBytes []byte) (snowstorm.Tx, error) }
DAGVM defines the minimum functionality that an avalanche VM must implement
type Heap ¶
type Heap interface { // Empty the heap. Clear() // Add the provided vertex to the heap. Vertices are de-duplicated, returns // true if the vertex was added, false if it was dropped. Push(avalanche.Vertex) bool // Remove the top vertex. Assumes that there is at least one element. Pop() avalanche.Vertex // Returns if a vertex with the provided ID is currently in the heap. Contains(ids.ID) bool // Returns the number of vertices in the heap. Len() int }
Heap defines the functionality of a heap of vertices with unique VertexIDs ordered by height
type LinearizableVM ¶ added in v1.9.12
type LinearizableVM interface { DAGVM // Linearize is called after [Initialize] and after the DAG has been // finalized. After Linearize is called: // // - PendingTxs will never be called again // - GetTx will never be called again // - ParseTx may still be called // - All the block based functions of the [block.ChainVM] must work as // expected. // // Linearize is part of the VM initialization, and will be called at most // once per VM instantiation. This means that Linearize should be called // every time the chain restarts after the DAG has finalized. Linearize(ctx context.Context, stopVertexID ids.ID) error }
type LinearizableVMWithEngine ¶ added in v1.9.12
type LinearizableVMWithEngine interface { DAGVM // Linearize is called after [Initialize] and after the DAG has been // finalized. After Linearize is called: // // - PendingTxs will never be called again // - GetTx will never be called again // - ParseTx may still be called // - All the block based functions of the [block.ChainVM] must work as // expected. // // Linearize is part of the VM initialization, and will be called at most // once per VM instantiation. This means that Linearize should be called // every time the chain restarts after the DAG has finalized. Linearize( ctx context.Context, stopVertexID ids.ID, toEngine chan<- common.Message, ) error }
type Manager ¶
Manager defines all the vertex related functionality that is required by the consensus engine.
type MockLinearizableVM ¶ added in v1.9.12
type MockLinearizableVM struct {
// contains filtered or unexported fields
}
MockLinearizableVM is a mock of LinearizableVM interface.
func NewMockLinearizableVM ¶ added in v1.9.12
func NewMockLinearizableVM(ctrl *gomock.Controller) *MockLinearizableVM
NewMockLinearizableVM creates a new mock instance.
func (*MockLinearizableVM) AppRequest ¶ added in v1.9.12
func (m *MockLinearizableVM) AppRequest(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 time.Time, arg4 []byte) error
AppRequest mocks base method.
func (*MockLinearizableVM) AppRequestFailed ¶ added in v1.9.12
func (m *MockLinearizableVM) AppRequestFailed(arg0 context.Context, arg1 ids.NodeID, arg2 uint32) error
AppRequestFailed mocks base method.
func (*MockLinearizableVM) AppResponse ¶ added in v1.9.12
func (m *MockLinearizableVM) AppResponse(arg0 context.Context, arg1 ids.NodeID, arg2 uint32, arg3 []byte) error
AppResponse mocks base method.
func (*MockLinearizableVM) BuildBlock ¶ added in v1.9.12
BuildBlock mocks base method.
func (*MockLinearizableVM) Connected ¶ added in v1.9.12
func (m *MockLinearizableVM) Connected(arg0 context.Context, arg1 ids.NodeID, arg2 *version.Application) error
Connected mocks base method.
func (*MockLinearizableVM) CreateHandlers ¶ added in v1.9.12
CreateHandlers mocks base method.
func (*MockLinearizableVM) CreateStaticHandlers ¶ added in v1.9.12
func (m *MockLinearizableVM) CreateStaticHandlers(arg0 context.Context) (map[string]http.Handler, error)
CreateStaticHandlers mocks base method.
func (*MockLinearizableVM) CrossChainAppRequest ¶ added in v1.9.12
func (m *MockLinearizableVM) CrossChainAppRequest(arg0 context.Context, arg1 ids.ID, arg2 uint32, arg3 time.Time, arg4 []byte) error
CrossChainAppRequest mocks base method.
func (*MockLinearizableVM) CrossChainAppRequestFailed ¶ added in v1.9.12
func (m *MockLinearizableVM) CrossChainAppRequestFailed(arg0 context.Context, arg1 ids.ID, arg2 uint32) error
CrossChainAppRequestFailed mocks base method.
func (*MockLinearizableVM) CrossChainAppResponse ¶ added in v1.9.12
func (m *MockLinearizableVM) CrossChainAppResponse(arg0 context.Context, arg1 ids.ID, arg2 uint32, arg3 []byte) error
CrossChainAppResponse mocks base method.
func (*MockLinearizableVM) Disconnected ¶ added in v1.9.12
Disconnected mocks base method.
func (*MockLinearizableVM) EXPECT ¶ added in v1.9.12
func (m *MockLinearizableVM) EXPECT() *MockLinearizableVMMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockLinearizableVM) GetBlockIDAtHeight ¶ added in v1.10.9
GetBlockIDAtHeight mocks base method.
func (*MockLinearizableVM) HealthCheck ¶ added in v1.9.12
func (m *MockLinearizableVM) HealthCheck(arg0 context.Context) (interface{}, error)
HealthCheck mocks base method.
func (*MockLinearizableVM) Initialize ¶ added in v1.9.12
func (m *MockLinearizableVM) Initialize(arg0 context.Context, arg1 *snow.Context, arg2 manager.Manager, arg3, arg4, arg5 []byte, arg6 chan<- common.Message, arg7 []*common.Fx, arg8 common.AppSender) error
Initialize mocks base method.
func (*MockLinearizableVM) LastAccepted ¶ added in v1.9.12
LastAccepted mocks base method.
func (*MockLinearizableVM) ParseBlock ¶ added in v1.9.12
ParseBlock mocks base method.
func (*MockLinearizableVM) SetPreference ¶ added in v1.9.12
SetPreference mocks base method.
func (*MockLinearizableVM) Shutdown ¶ added in v1.9.12
func (m *MockLinearizableVM) Shutdown(arg0 context.Context) error
Shutdown mocks base method.
func (*MockLinearizableVM) VerifyHeightIndex ¶ added in v1.10.9
func (m *MockLinearizableVM) VerifyHeightIndex(arg0 context.Context) error
VerifyHeightIndex mocks base method.
type MockLinearizableVMMockRecorder ¶ added in v1.9.12
type MockLinearizableVMMockRecorder struct {
// contains filtered or unexported fields
}
MockLinearizableVMMockRecorder is the mock recorder for MockLinearizableVM.
func (*MockLinearizableVMMockRecorder) AppGossip ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) AppGossip(arg0, arg1, arg2 interface{}) *gomock.Call
AppGossip indicates an expected call of AppGossip.
func (*MockLinearizableVMMockRecorder) AppRequest ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) AppRequest(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call
AppRequest indicates an expected call of AppRequest.
func (*MockLinearizableVMMockRecorder) AppRequestFailed ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) AppRequestFailed(arg0, arg1, arg2 interface{}) *gomock.Call
AppRequestFailed indicates an expected call of AppRequestFailed.
func (*MockLinearizableVMMockRecorder) AppResponse ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) AppResponse(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
AppResponse indicates an expected call of AppResponse.
func (*MockLinearizableVMMockRecorder) BuildBlock ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) BuildBlock(arg0 interface{}) *gomock.Call
BuildBlock indicates an expected call of BuildBlock.
func (*MockLinearizableVMMockRecorder) Connected ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) Connected(arg0, arg1, arg2 interface{}) *gomock.Call
Connected indicates an expected call of Connected.
func (*MockLinearizableVMMockRecorder) CreateHandlers ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) CreateHandlers(arg0 interface{}) *gomock.Call
CreateHandlers indicates an expected call of CreateHandlers.
func (*MockLinearizableVMMockRecorder) CreateStaticHandlers ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) CreateStaticHandlers(arg0 interface{}) *gomock.Call
CreateStaticHandlers indicates an expected call of CreateStaticHandlers.
func (*MockLinearizableVMMockRecorder) CrossChainAppRequest ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) CrossChainAppRequest(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call
CrossChainAppRequest indicates an expected call of CrossChainAppRequest.
func (*MockLinearizableVMMockRecorder) CrossChainAppRequestFailed ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) CrossChainAppRequestFailed(arg0, arg1, arg2 interface{}) *gomock.Call
CrossChainAppRequestFailed indicates an expected call of CrossChainAppRequestFailed.
func (*MockLinearizableVMMockRecorder) CrossChainAppResponse ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) CrossChainAppResponse(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
CrossChainAppResponse indicates an expected call of CrossChainAppResponse.
func (*MockLinearizableVMMockRecorder) Disconnected ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) Disconnected(arg0, arg1 interface{}) *gomock.Call
Disconnected indicates an expected call of Disconnected.
func (*MockLinearizableVMMockRecorder) GetBlock ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) GetBlock(arg0, arg1 interface{}) *gomock.Call
GetBlock indicates an expected call of GetBlock.
func (*MockLinearizableVMMockRecorder) GetBlockIDAtHeight ¶ added in v1.10.9
func (mr *MockLinearizableVMMockRecorder) GetBlockIDAtHeight(arg0, arg1 interface{}) *gomock.Call
GetBlockIDAtHeight indicates an expected call of GetBlockIDAtHeight.
func (*MockLinearizableVMMockRecorder) HealthCheck ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) HealthCheck(arg0 interface{}) *gomock.Call
HealthCheck indicates an expected call of HealthCheck.
func (*MockLinearizableVMMockRecorder) Initialize ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) Initialize(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 interface{}) *gomock.Call
Initialize indicates an expected call of Initialize.
func (*MockLinearizableVMMockRecorder) LastAccepted ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) LastAccepted(arg0 interface{}) *gomock.Call
LastAccepted indicates an expected call of LastAccepted.
func (*MockLinearizableVMMockRecorder) Linearize ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) Linearize(arg0, arg1 interface{}) *gomock.Call
Linearize indicates an expected call of Linearize.
func (*MockLinearizableVMMockRecorder) ParseBlock ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) ParseBlock(arg0, arg1 interface{}) *gomock.Call
ParseBlock indicates an expected call of ParseBlock.
func (*MockLinearizableVMMockRecorder) ParseTx ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) ParseTx(arg0, arg1 interface{}) *gomock.Call
ParseTx indicates an expected call of ParseTx.
func (*MockLinearizableVMMockRecorder) SetPreference ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) SetPreference(arg0, arg1 interface{}) *gomock.Call
SetPreference indicates an expected call of SetPreference.
func (*MockLinearizableVMMockRecorder) SetState ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) SetState(arg0, arg1 interface{}) *gomock.Call
SetState indicates an expected call of SetState.
func (*MockLinearizableVMMockRecorder) Shutdown ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) Shutdown(arg0 interface{}) *gomock.Call
Shutdown indicates an expected call of Shutdown.
func (*MockLinearizableVMMockRecorder) VerifyHeightIndex ¶ added in v1.10.9
func (mr *MockLinearizableVMMockRecorder) VerifyHeightIndex(arg0 interface{}) *gomock.Call
VerifyHeightIndex indicates an expected call of VerifyHeightIndex.
func (*MockLinearizableVMMockRecorder) Version ¶ added in v1.9.12
func (mr *MockLinearizableVMMockRecorder) Version(arg0 interface{}) *gomock.Call
Version indicates an expected call of Version.
type Parser ¶
type Parser interface { // Parse a vertex from a slice of bytes ParseVtx(ctx context.Context, vertex []byte) (avalanche.Vertex, error) }
Parser parses bytes into a vertex.
type StatelessVertex ¶
type StatelessVertex interface { verify.Verifiable ID() ids.ID Bytes() []byte Version() uint16 ChainID() ids.ID StopVertex() bool Height() uint64 Epoch() uint32 ParentIDs() []ids.ID Txs() [][]byte }
func Build ¶
func Build( chainID ids.ID, height uint64, parentIDs []ids.ID, txs [][]byte, ) (StatelessVertex, error)
Build a new stateless vertex from the contents of a vertex
func BuildStopVertex ¶
Build a new stateless vertex from the contents of a vertex
func Parse ¶
func Parse(bytes []byte) (StatelessVertex, error)
Parse parses the provided vertex bytes into a stateless vertex
type Storage ¶
type Storage interface { // Get a vertex by its hash from storage. GetVtx(ctx context.Context, vtxID ids.ID) (avalanche.Vertex, error) // Edge returns a list of accepted vertex IDs with no accepted children. Edge(ctx context.Context) (vtxIDs []ids.ID) // Returns "true" if accepted frontier ("Edge") is stop vertex. StopVertexAccepted(ctx context.Context) (bool, error) }
Storage defines the persistent storage that is required by the consensus engine.
type TestBuilder ¶
type TestBuilder struct { T *testing.T CantBuildVtx bool BuildStopVtxF func(ctx context.Context, parentIDs []ids.ID) (avalanche.Vertex, error) }
func (*TestBuilder) BuildStopVtx ¶
func (*TestBuilder) Default ¶
func (b *TestBuilder) Default(cant bool)
type TestManager ¶
type TestManager struct { TestBuilder TestParser TestStorage }
func NewTestManager ¶
func NewTestManager(t *testing.T) *TestManager
func (*TestManager) Default ¶
func (m *TestManager) Default(cant bool)
type TestParser ¶
type TestParser struct { T *testing.T CantParseVtx bool ParseVtxF func(context.Context, []byte) (avalanche.Vertex, error) }
func (*TestParser) Default ¶
func (p *TestParser) Default(cant bool)
type TestStorage ¶
type TestStorage struct { T *testing.T CantGetVtx, CantEdge, CantStopVertexAccepted bool GetVtxF func(context.Context, ids.ID) (avalanche.Vertex, error) EdgeF func(context.Context) []ids.ID StopVertexAcceptedF func(context.Context) (bool, error) }
func (*TestStorage) Default ¶
func (s *TestStorage) Default(cant bool)
func (*TestStorage) StopVertexAccepted ¶ added in v1.8.4
func (s *TestStorage) StopVertexAccepted(ctx context.Context) (bool, error)