chunks

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2020 License: AGPL-3.0 Imports: 16 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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) *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)

VerifySystemChunk 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 PublicAssignment

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

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

func NewPublicAssignment

func NewPublicAssignment(alpha int) (*PublicAssignment, error)

NewPublicAssignment generates and returns an instance of the Public Chunk Assignment algorithm ids is the list of verifier nodes' identities chunks is the list of chunks aimed to assign rng is an instance of a random generator alpha is the number of assigned verifier nodes to each chunk

func (*PublicAssignment) Assign

func (p *PublicAssignment) Assign(identities flow.IdentityList, chunks flow.ChunkList, rng random.Rand) (*chunkmodels.Assignment, error)

Assign receives identity list of verifier nodes, chunk lists and a random generator it returns a chunk assignment

func (*PublicAssignment) Size

func (p *PublicAssignment) Size() uint

Size returns number of assignments

type VirtualMachine

type VirtualMachine interface {
	Run(fvm.Context, fvm.Procedure, state.Ledger) error
}

Jump to

Keyboard shortcuts

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