chunks

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: AGPL-3.0 Imports: 24 Imported by: 3

Documentation

Index

Constants

View Source
const DefaultChunkAssignmentAlpha = 3

DefaultChunkAssignmentAlpha is the default number of verifiers that should be assigned to each chunk.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChunkAssigner added in v0.14.0

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

ChunkAssigner implements an instance of the Public Chunk Assignment algorithm for assigning chunks to verifier nodes in a deterministic but unpredictable manner. It implements the ChunkAssigner interface.

func NewChunkAssigner added in v0.14.0

func NewChunkAssigner(alpha uint, protocolState protocol.State) (*ChunkAssigner, error)

NewChunkAssigner generates and returns an instance of the Public Chunk Assignment algorithm. Parameter alpha is the number of verifiers that should be assigned to each chunk.

func (*ChunkAssigner) Assign added in v0.14.0

func (p *ChunkAssigner) Assign(result *flow.ExecutionResult, blockID flow.Identifier) (*chunkmodels.Assignment, error)

Assign generates the assignment error returns:

  • NoValidChildBlockError indicates that no valid child block is known (which contains the block's source of randomness)
  • unexpected errors should be considered symptoms of internal bugs

func (*ChunkAssigner) Size added in v0.14.0

func (p *ChunkAssigner) Size() uint

Size returns number of assignments

type ChunkVerifier

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

ChunkVerifier is a verifier based on the current definitions of the flow network

func NewChunkVerifier

func NewChunkVerifier(vm VirtualMachine, vmCtx fvm.Context, logger zerolog.Logger) *ChunkVerifier

NewChunkVerifier creates a chunk verifier containing a flow virtual machine

func (*ChunkVerifier) SystemChunkVerify

func (fcv *ChunkVerifier) SystemChunkVerify(vc *verification.VerifiableChunkData) ([]byte, chmodels.ChunkFault, error)

SystemChunkVerify verifies a given VerifiableChunk corresponding to a system chunk. by executing it and checking the final state commitment It returns a Spock Secret as a byte array, verification fault of the chunk, and an error. Note: SystemChunkVerify should only be executed on system chunks. It returns an error if it is invoked on non-system chunks.

func (*ChunkVerifier) Verify

Verify verifies a given VerifiableChunk corresponding to a non-system chunk. by executing it and checking the final state commitment It returns a Spock Secret as a byte array, verification fault of the chunk, and an error. Note: Verify should only be executed on non-system chunks. It returns an error if it is invoked on system chunks.

type VirtualMachine

type VirtualMachine interface {
	Run(fvm.Context, fvm.Procedure, state.View, *programs.Programs) error
}

Jump to

Keyboard shortcuts

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