prover

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MerkleMinCacheLayer = 0 // Merkle nodes from this layer up will be cached, in addition to the base layer

	LowestMerkleMinMemoryLayer = 1
)

Variables

View Source
var (
	ErrShutdownRequested = errors.New("shutdown requested")
)

Functions

func GenerateProof

func GenerateProof(
	sig *signal.Signal,
	datadir string,
	labelHashFunc func(data []byte) []byte,
	merkleHashFunc func(lChild, rChild []byte) []byte,
	numLeaves uint64,
	securityParam uint8,
	minMemoryLayer uint,
	persist persistFunc,
) (*shared.MerkleProof, error)

GenerateProof computes the PoET DAG, uses Fiat-Shamir to derive a challenge from the Merkle root and generates a Merkle proof using the challenge and the DAG.

func GenerateProofRecovery

func GenerateProofRecovery(
	sig *signal.Signal,
	datadir string,
	labelHashFunc func(data []byte) []byte,
	merkleHashFunc func(lChild, rChild []byte) []byte,
	numLeaves uint64,
	securityParam uint8,
	nextLeafId uint64,
	parkedNodes [][]byte,
	persist persistFunc,
) (*shared.MerkleProof, error)

func GenerateProofWithoutPersistency

func GenerateProofWithoutPersistency(
	datadir string,
	labelHashFunc func(data []byte) []byte,
	merkleHashFunc func(lChild, rChild []byte) []byte,
	numLeaves uint64,
	securityParam uint8,
	minMemoryLayer uint,
) (*shared.MerkleProof, error)

Types

type ReadWriterMetaFactory

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

ReadWriterMetaFactory generates Merkle LayerFactory functions. The functions it creates generate file read-writers starting from the base layer and up to minMemoryLayer-1. From minMemoryLayer and up the functions generate slice read-writers. The MetaFactory tracks the files it creates and removes them when Cleanup() is called.

func NewReadWriterMetaFactory

func NewReadWriterMetaFactory(minMemoryLayer uint, datadir string) *ReadWriterMetaFactory

NewReadWriterMetaFactory returns a new ReadWriterMetaFactory. minMemoryLayer determines the threshold in which lower layers caching is done on-disk, while from this layer up -- in-memory

func (*ReadWriterMetaFactory) Cleanup

func (mf *ReadWriterMetaFactory) Cleanup()

Cleanup removes the files that were created by the LayerFactory functions generated by this MetaFactory.

func (*ReadWriterMetaFactory) GetFactory

func (mf *ReadWriterMetaFactory) GetFactory() cache.LayerFactory

GetFactory creates a Merkle LayerFactory function.

Jump to

Keyboard shortcuts

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