test

package
v0.10.1-consensus-desr... Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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) (*mock2.GenericNode, *network.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) (*mock2.GenericNode, *network.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) (*network.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

Types

This section is empty.

Jump to

Keyboard shortcuts

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