test

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: AGPL-3.0 Imports: 26 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 FromChunkID added in v0.15.0

func FromChunkID(chunkID flow.Identifier) flow.ChunkDataPack

func IsAssigned

func IsAssigned(index uint64, chunkNum int) bool

IsAssigned is a helper function that returns true for the even indices in [0, chunkNum-1] It also returns true if the index corresponds to the system chunk.

func SetupMockConsensusNode

func SetupMockConsensusNode(t *testing.T,
	hub *stub.Hub,
	conIdentity *flow.Identity,
	verIdentities flow.IdentityList,
	othersIdentity flow.IdentityList,
	completeER utils.CompleteExecutionResult,
	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.CompleteExecutionResult) (*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 SetupMockVerifierEng

func SetupMockVerifierEng(t testing.TB,
	vChunks []*verification.VerifiableChunkData,
	completeER *utils.CompleteExecutionResult) (*mocknetwork.Engine, *sync.WaitGroup)

SetupMockVerifierEng sets up a mock verifier engine that asserts the followings: - that a set of chunks are delivered to it. - that each chunk is delivered exactly once SetupMockVerifierEng returns the mock engine and a wait group that unblocks when all ERs are received.

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

This section is empty.

Jump to

Keyboard shortcuts

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