utils

package
v0.15.3-patch.6 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: AGPL-3.0 Imports: 26 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerBlockFixture added in v0.15.4

func ContainerBlockFixture(parent *flow.Header, results []*flow.ExecutionResult) (*flow.Block, []*flow.ExecutionReceipt)

ContainerBlockFixture builds and returns a block that contains an execution receipt for the input result.

func NewResultApprovalHasher

func NewResultApprovalHasher() hash.Hasher

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

Types

type CompleteExecutionReceipt added in v0.15.4

type CompleteExecutionReceipt struct {
	ContainerBlock *flow.Block // block that contains execution receipt of reference block

	// TODO: this is a temporary field to support finder engine logic
	// It should be removed once we replace finder engine.
	Receipts     []*flow.ExecutionReceipt // copy of execution receipts in container block
	ReceiptsData []*ExecutionReceiptData  // execution receipts data of the container block
}

CompleteExecutionReceipt is a test helper struct that represents a container block accompanied with all data required to verify its execution receipts. TODO update this as needed based on execution requirements

func CompleteExecutionReceiptChainFixture added in v0.15.4

func CompleteExecutionReceiptChainFixture(t *testing.T, root *flow.Header, count int, opts ...CompleteExecutionReceiptBuilderOpt) []*CompleteExecutionReceipt

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

It returns a slice of complete execution receipt fixtures that contains a container block as well as all data to verify its contained receipts.

func CompleteExecutionReceiptFixture added in v0.15.4

func CompleteExecutionReceiptFixture(t *testing.T, chunks int, chain flow.Chain, root *flow.Header) *CompleteExecutionReceipt

CompleteExecutionReceiptFixture returns complete execution receipt with an execution receipt referencing the block collections.

chunks determines the number of chunks inside each receipt. The output is an execution result with chunks+1 chunks, where the last chunk accounts for the system chunk. TODO: remove this function once new verification architecture is in place.

func LightExecutionResultFixture

func LightExecutionResultFixture(chunkCount int) *CompleteExecutionReceipt

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. TODO: remove this once new architecture of verification node is in place.

type CompleteExecutionReceiptBuilder added in v0.15.4

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

CompleteExecutionReceiptBuilder is a test helper struct that specifies the parameters to build a CompleteExecutionReceipt.

type CompleteExecutionReceiptBuilderOpt added in v0.15.4

type CompleteExecutionReceiptBuilderOpt func(builder *CompleteExecutionReceiptBuilder)

func WithChain added in v0.15.4

func WithChunks added in v0.15.4

func WithChunks(count int) CompleteExecutionReceiptBuilderOpt

func WithCopies added in v0.15.4

func WithCopies(count int) CompleteExecutionReceiptBuilderOpt

func WithResults added in v0.15.4

func WithResults(count int) CompleteExecutionReceiptBuilderOpt

type ExecutionReceiptData added in v0.15.4

type ExecutionReceiptData struct {
	ReferenceBlock *flow.Block // block that execution receipt refers to
	Collections    []*flow.Collection
	ChunkDataPacks []*flow.ChunkDataPack
	SpockSecrets   [][]byte
}

ExecutionReceiptData is a test helper struct that represents all data required to verify the result of an execution receipt.

func ExecutionResultFixture added in v0.15.4

func ExecutionResultFixture(t *testing.T, chunkCount int, chain flow.Chain, refBlkHeader *flow.Header) (*flow.ExecutionResult,
	*ExecutionReceiptData)

ExecutionResultFixture is a test helper that returns an execution result for the reference block header as well as the execution receipt data for that result.

func ExecutionResultFromParentBlockFixture added in v0.15.4

func ExecutionResultFromParentBlockFixture(t *testing.T, parent *flow.Header, builder *CompleteExecutionReceiptBuilder) (*flow.ExecutionResult,
	*ExecutionReceiptData)

ExecutionResultFromParentBlockFixture is a test helper that creates a child (reference) block from the parent, as well as an execution for it.

func ExecutionResultsFromParentBlockFixture added in v0.15.4

func ExecutionResultsFromParentBlockFixture(t *testing.T, parent *flow.Header, builder *CompleteExecutionReceiptBuilder) ([]*flow.ExecutionResult,
	[]*ExecutionReceiptData, *flow.Header)

ExecutionResultsFromParentBlockFixture creates a chain of results from a parent block.

By default each result refers to a distinct reference block, and it extends the block chain after generating each result (i.e., for the next result).

Each result may appear in more than one receipt depending on the builder parameters.

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