utils

package
v0.15.1-patch.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: AGPL-3.0 Imports: 23 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewResultApprovalHasher

func NewResultApprovalHasher() hash.Hasher

NewResultApprovalHasher generates and returns a hasher for signing and verification of result approvals

Types

type CompleteExecutionResult

type CompleteExecutionResult struct {
	ContainerBlock *flow.Block // block that contains execution receipt of reference block
	ReferenceBlock *flow.Block // block that execution receipt refers to
	Receipt        *flow.ExecutionReceipt
	Collections    []*flow.Collection
	ChunkDataPacks []*flow.ChunkDataPack
	SpockSecrets   [][]byte
}

CompleteExecutionResult represents an execution result that is ready to be verified. It contains all execution result and all resources required to verify it. TODO update this as needed based on execution requirements

func CompleteExecutionResultChainFixture added in v0.15.1

func CompleteExecutionResultChainFixture(t *testing.T, root *flow.Header, count int) []*CompleteExecutionResult

CompleteExecutionResultChainFixture is a test fixture that creates a chain of blocks of size `count`. The chain is in the form of root <- R1 <- C1 <- R2 <- C2 <- ... In this chain Ri refers to reference blocks that contain guarantees. Ci refers to a container block that contains an execution receipt for its preceding reference block Ri. e.g., C1 contains an execution receipt for R1, C2 contains a receipt for R2, etc. For sake of simplicity and test, container blocks (i.e., Cis) do not contain any guarantee.

It returns a slice of CompleteExecutionResult fixtures that contains a pair of (Ri <- Ci).

func CompleteExecutionResultFixture

func CompleteExecutionResultFixture(t *testing.T, chunkCount int, chain flow.Chain, root *flow.Header) CompleteExecutionResult

CompleteExecutionResultFixture returns complete execution result with an execution receipt referencing the block/collections. chunkCount determines the number of chunks inside each receipt. The output is an execution result with `chunkCount`+1 chunks, where the last chunk accounts for the system chunk.

func LightExecutionResultFixture

func LightExecutionResultFixture(chunkCount int) CompleteExecutionResult

LightExecutionResultFixture returns a light mocked version of execution result with an execution receipt referencing the block/collections. In the light version of execution result, everything is wired properly, but with the minimum viable content provided. This version is basically used for profiling.

type MockAssigner

type MockAssigner struct {
	// contains filtered or unexported fields
}

MockAssigner ...

func NewMockAssigner

func NewMockAssigner(id flow.Identifier, f func(index uint64) bool) *MockAssigner

NewMockAssigner ...

func (*MockAssigner) Assign

func (m *MockAssigner) Assign(result *flow.ExecutionResult, blockID flow.Identifier) (*chmodel.Assignment, error)

Assign assigns all input chunks to the verifier node

Jump to

Keyboard shortcuts

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