prover

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package prover implements the core proving functionality of PoET implementation.

Index

Constants

View Source
const (
	// MerkleMinCacheLayer set the min layer in which all layers above will be cached, in addition to the base layer.
	MerkleMinCacheLayer = 0

	// LowestMerkleMinMemoryLayer set the lowest-allowed layer in which all layers above will be cached in-memory.
	LowestMerkleMinMemoryLayer = 1
)

Variables

This section is empty.

Functions

func GenerateProof

func GenerateProof(
	ctx context.Context,
	leavesCounter prometheus.Counter,
	treeCfg TreeConfig,
	labelHashFunc func(data []byte) []byte,
	merkleHashFunc merkle.HashFunc,
	deadline time.Time,
	securityParam uint8,
	persist persistFunc,
) (uint64, *shared.MerkleProof, error)

GenerateProof generates the Proof of Sequential Work. It stops when the given deadline is reached.

func GenerateProofRecovery

func GenerateProofRecovery(
	ctx context.Context,
	leavesCounter prometheus.Counter,
	treeCfg TreeConfig,
	labelHashFunc func(data []byte) []byte,
	merkleHashFunc merkle.HashFunc,
	deadline time.Time,
	securityParam uint8,
	nextLeafID uint64,
	persist persistFunc,
) (uint64, *shared.MerkleProof, error)

GenerateProofRecovery recovers proof generation, from a given 'nextLeafID'.

func GenerateProofWithoutPersistency

func GenerateProofWithoutPersistency(
	ctx context.Context,
	treeCfg TreeConfig,
	labelHashFunc func(data []byte) []byte,
	merkleHashFunc merkle.HashFunc,
	deadline time.Time,
	securityParam uint8,
) (uint64, *shared.MerkleProof, error)

GenerateProofWithoutPersistency calls GenerateProof with disabled persistency functionality. Tree recovery will not be possible. Meant to be used for testing purposes only. It doesn't expose metrics too.

func GetLayerFactory added in v0.9.4

func GetLayerFactory(minMemoryLayer uint, datadir string, fileWriterBufSize uint) cache.LayerFactory

GetLayerFactory creates a merkle LayerFactory. The minMemoryLayer determines the threshold below which layers are saved on-disk, while layers equal and above - in-memory.

Types

type TreeConfig added in v0.6.1

type TreeConfig struct {
	MinMemoryLayer    uint
	Datadir           string
	FileWriterBufSize uint
}

Jump to

Keyboard shortcuts

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