test

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChunkWithIndex added in v0.15.0

func ChunkWithIndex(blockID flow.Identifier, index int) *flow.Chunk

func CreateExecutionResult added in v0.15.0

func CreateExecutionResult(blockID flow.Identifier, options ...func(result *flow.ExecutionResult, assignments *chunks.Assignment)) (*flow.ExecutionResult, *chunks.Assignment)

func ExtendStateWithFinalizedBlocks added in v0.15.4

func ExtendStateWithFinalizedBlocks(t *testing.T, completeExecutionReceipts []*utils.CompleteExecutionReceipt, state protocol.MutableState) []*flow.Block

ExtendStateWithFinalizedBlocks is a test helper to extend the execution state and return the list of blocks. It receives a list of complete execution receipt fixtures in the form of (R1,1 <- R1,2 <- ... <- C1) <- (R2,1 <- R2,2 <- ... <- C2) <- ..... Where R and C are the reference and container blocks. Reference blocks contain guarantees, and container blocks contain execution receipt for their preceding reference blocks, e.g., C1 contains receipts for R1,1, R1,2, etc. Note: for sake of simplicity we do not include guarantees in the container blocks for now.

func FromChunkID added in v0.15.0

func FromChunkID(chunkID flow.Identifier) flow.ChunkDataPack

func MockChunkAssignmentFixture added in v0.15.4

func MockChunkAssignmentFixture(chunkAssigner *mock.ChunkAssigner,
	verIds flow.IdentityList,
	completeERs []*utils.CompleteExecutionReceipt,
	isAssigned ChunkAssignerFunc) flow.IdentifierList

MockChunkAssignmentFixture is a test helper that mocks a chunk assigner for a set of verification nodes for the execution results in the given complete execution receipts, and based on the given chunk assigner function.

It returns the list of chunk locator ids assigned to the input verification nodes. All verification nodes are assigned the same chunks.

func SetupMockConsensusNode

func SetupMockConsensusNode(t *testing.T,
	hub *stub.Hub,
	conIdentity *flow.Identity,
	verIdentities flow.IdentityList,
	othersIdentity flow.IdentityList,
	completeER *utils.CompleteExecutionReceipt,
	chainID flow.ChainID) (*enginemock.GenericNode, *mocknetwork.Engine, *sync.WaitGroup)

SetupMockConsensusNode creates and returns a mock consensus node (conIdentity) and its registered engine in the network (hub). It mocks the process method of the consensus engine to receive a message from a certain verification node (verIdentity) evaluates whether it is a result approval about an assigned chunk to that verifier node.

func SetupMockExeNode

func SetupMockExeNode(t *testing.T,
	hub *stub.Hub,
	exeIdentity *flow.Identity,
	verIdentities flow.IdentityList,
	othersIdentity flow.IdentityList,
	chainID flow.ChainID,
	completeER *utils.CompleteExecutionReceipt) (*enginemock.GenericNode, *mocknetwork.Engine)

SetupMockExeNode creates and returns an execution node and its registered engine in the network (hub) it mocks the process method of execution node that on receiving a chunk data pack request from a certain verifier node (verIdentity) about a chunk that is assigned to it, replies the chunk back data pack back to the node. Otherwise, if the request is not a chunk data pack request, or if the requested chunk data pack is not about an assigned chunk to the verifier node (verIdentity), it fails the test.

func VerificationHappyPath

func VerificationHappyPath(t *testing.T,
	verNodeCount int,
	chunkNum int,
	verCollector module.VerificationMetrics,
	mempoolCollector module.MempoolMetrics)

VerificationHappyPath runs `verNodeCount`-many verification nodes and checks that concurrently received execution receipts with the same result part that by each verification node results in: - the selection of the assigned chunks by the ingest engine - request of the associated chunk data pack to the assigned chunks - formation of a complete verifiable chunk by the ingest engine for each assigned chunk - submitting a verifiable chunk locally to the verify engine by the ingest engine - dropping the ingestion of the ERs that share the same result once the verifiable chunk is submitted to verify engine - broadcast of a matching result approval to consensus nodes for each assigned chunk

func WithAssignee added in v0.15.0

func WithAssignee(assignee flow.Identifier) func(flow.Identifier, uint64, *chunks.Assignment) *flow.Chunk

func WithChunks added in v0.15.0

func WithChunks(setAssignees ...func(flow.Identifier, uint64, *chunks.Assignment) *flow.Chunk) func(*flow.ExecutionResult, *chunks.Assignment)

Types

type ChunkAssignerFunc added in v0.15.4

type ChunkAssignerFunc func(chunkIndex uint64, chunks int) bool

Jump to

Keyboard shortcuts

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