config

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultDataDirName = "data"

	DefaultComputeBatchSize = 1 << 20

	MinBitsPerLabel = 1
	MaxBitsPerLabel = 256
	BitsPerLabel    = 8 * 16

	KiB = 1024
	MiB = 1024 * KiB
	GiB = 1024 * MiB
)
View Source
const (
	// Use the full dataset. AKA "Fast mode".
	PowFastMode = postrs.PowFastMode
	// Allocate memory in large pages.
	PowLargePages = postrs.PowLargePages
	// Use JIT compilation support.
	PowJIT = postrs.PowJIT
	// When combined with FLAG_JIT, the JIT pages are never writable and executable at the same time.
	PowSecure = postrs.PowSecure
	// Use hardware accelerated AES.
	PowHardAES = postrs.PowHardAES
	// Optimize Argon2 for CPUs with the SSSE3 instruction set.
	PowArgon2SSSE3 = postrs.PowArgon2SSSE3
	// Optimize Argon2 for CPUs with the SSSE3 instruction set.
	PowArgon2AVX2 = postrs.PowArgon2AVX2
	// Optimize Argon2 for CPUs without the AVX2 or SSSE3 instruction sets.
	PowArgon2 = postrs.PowArgon2
)
View Source
const BestProviderID = -1

BestProviderID can be used for selecting the most performant provider based on a short benchmarking session.

Variables

View Source
var DefaultDataDir string

Functions

func Validate

func Validate(cfg Config, opts InitOpts) error

Types

type Config

type Config struct {
	MinNumUnits   uint32
	MaxNumUnits   uint32
	LabelsPerUnit uint64

	K1 uint32 // K1 specifies the difficulty for a label to be a candidate for a proof.
	K2 uint32 // K2 is the number of labels below the required difficulty required for a proof.
	K3 uint32 // K3 is the size of the subset of proof indices that is validated.

	// FIXME: remove support for the old scrypt-based PoW
	K2PowDifficulty uint64
	PowDifficulty   [32]byte
}

func DefaultConfig

func DefaultConfig() Config

type InitOpts

type InitOpts struct {
	DataDir     string
	NumUnits    uint32
	MaxFileSize uint64
	ProviderID  int
	Throttle    bool
	Scrypt      ScryptParams
	// ComputeBatchSize must be greater than 0
	ComputeBatchSize uint64
}

func DefaultInitOpts

func DefaultInitOpts() InitOpts

type PowFlags added in v0.7.0

type PowFlags = postrs.PowFlags

func DefaultProvingPowFlags added in v0.7.0

func DefaultProvingPowFlags() PowFlags

func DefaultVerifyingPowFlags added in v0.7.0

func DefaultVerifyingPowFlags() PowFlags

func RecommendedPowFlags added in v0.7.0

func RecommendedPowFlags() PowFlags

type ScryptParams added in v0.5.1

type ScryptParams struct {
	N, R, P uint
}

func DefaultLabelParams added in v0.5.1

func DefaultLabelParams() ScryptParams

func DefaultPowParams added in v0.5.1

func DefaultPowParams() ScryptParams

func (*ScryptParams) Validate added in v0.5.1

func (p *ScryptParams) Validate() error

Jump to

Keyboard shortcuts

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