Documentation
¶
Index ¶
- Constants
- func GenerateDeterministicK(processID types.ProcessID, nValidVoters int) *big.Int
- func GenerateDeterministicSeed(processID types.ProcessID, index int) int64
- type AggregatorCacheData
- type AggregatorTestResults
- type CacheFiles
- type CacheableData
- type CircuitCache
- func (c *CircuitCache) Exists(cacheKey string) bool
- func (c *CircuitCache) GenerateCacheKey(circuitType string, processID types.ProcessID, params ...any) string
- func (c *CircuitCache) LoadData(cacheKey string, data CacheableData, requireProvingKey bool) error
- func (c *CircuitCache) SaveData(cacheKey string, data CacheableData) error
- type DeterministicGenerator
- type VoteVerifierCacheData
- type VoteVerifierTestResults
Constants ¶
const AggregatorCacheKeyVersion = "poseidon-v1"
AggregatorCacheKeyVersion forces cache refresh when aggregator hash semantics change.
Variables ¶
This section is empty.
Functions ¶
func GenerateDeterministicK ¶
GenerateDeterministicK creates a deterministic big.Int value based on ProcessID and parameters This ensures consistent K generation for cryptographic operations
Types ¶
type AggregatorCacheData ¶
type AggregatorCacheData struct {
Proof groth16.Proof
VerifyingKey groth16.VerifyingKey
ProvingKey groth16.ProvingKey
ConstraintSystem constraint.ConstraintSystem
Witness witness.Witness
Inputs AggregatorTestResults
}
AggregatorCacheData holds cached aggregator circuit data
func (*AggregatorCacheData) ReadFromCache ¶
func (d *AggregatorCacheData) ReadFromCache(cacheDir, cacheKey string, requireProvingKey bool) error
ReadFromCache implements CacheableData interface for AggregatorCacheData
func (*AggregatorCacheData) WriteToCache ¶
func (d *AggregatorCacheData) WriteToCache(cacheDir, cacheKey string) error
WriteToCache implements CacheableData interface for AggregatorCacheData
type AggregatorTestResults ¶
type AggregatorTestResults struct {
InputsHash *big.Int
Process circuits.Process[*big.Int]
Votes []state.Vote
}
AggregatorTestResults struct includes relevant data after AggregatorCircuit inputs generation
type CacheFiles ¶
CacheFiles manages file paths for cache entries
func (CacheFiles) Exists ¶
func (cf CacheFiles) Exists(extensions ...string) bool
Exists checks if files with any of the given extensions exist
func (CacheFiles) Path ¶
func (cf CacheFiles) Path(extension string) string
Path returns the full path for a file with the given extension
type CacheableData ¶
type CacheableData interface {
WriteToCache(cacheDir, cacheKey string) error
ReadFromCache(cacheDir, cacheKey string, requireProvingKey bool) error
}
CacheableData defines the interface for data that can be cached
type CircuitCache ¶
type CircuitCache struct {
BaseDir string
}
CircuitCache manages caching for circuit test data
func NewCircuitCache ¶
func NewCircuitCache() (*CircuitCache, error)
NewCircuitCache creates a new circuit cache instance
func (*CircuitCache) Exists ¶
func (c *CircuitCache) Exists(cacheKey string) bool
Exists checks if cached data exists for the given key
func (*CircuitCache) GenerateCacheKey ¶
func (c *CircuitCache) GenerateCacheKey(circuitType string, processID types.ProcessID, params ...any) string
GenerateCacheKey creates a deterministic cache key based on circuit type and parameters
func (*CircuitCache) LoadData ¶
func (c *CircuitCache) LoadData(cacheKey string, data CacheableData, requireProvingKey bool) error
LoadData loads cacheable data from the cache
func (*CircuitCache) SaveData ¶
func (c *CircuitCache) SaveData(cacheKey string, data CacheableData) error
SaveData saves cacheable data to the cache
type DeterministicGenerator ¶
DeterministicGenerator provides deterministic value generation based on ProcessID
func NewDeterministicGenerator ¶
func NewDeterministicGenerator(processID types.ProcessID) *DeterministicGenerator
NewDeterministicGenerator creates a new deterministic generator
func (*DeterministicGenerator) BigInt ¶
func (dg *DeterministicGenerator) BigInt(nValidVoters int) *big.Int
BigInt creates a deterministic big.Int value based on ProcessID and parameters
func (*DeterministicGenerator) Seed ¶
func (dg *DeterministicGenerator) Seed(index int) int64
Seed creates a deterministic seed based on ProcessID and index
type VoteVerifierCacheData ¶
type VoteVerifierCacheData struct {
ProvingKey groth16.ProvingKey
VerifyingKey groth16.VerifyingKey
ConstraintSystem constraint.ConstraintSystem
Witness []witness.Witness
Inputs VoteVerifierTestResults
}
VoteVerifierCacheData holds cached vote verifier circuit data
func (*VoteVerifierCacheData) ReadFromCache ¶
func (d *VoteVerifierCacheData) ReadFromCache(cacheDir, cacheKey string, requireProvingKey bool) error
ReadFromCache implements CacheableData interface for VoteVerifierCacheData
func (*VoteVerifierCacheData) WriteToCache ¶
func (d *VoteVerifierCacheData) WriteToCache(cacheDir, cacheKey string) error
WriteToCache implements CacheableData interface for VoteVerifierCacheData
type VoteVerifierTestResults ¶
type VoteVerifierTestResults struct {
InputsHashes []*big.Int
EncryptionPubKey circuits.EncryptionKey[*big.Int]
Addresses []*big.Int
Weights []*big.Int
ProcessID *big.Int
CensusOrigin types.CensusOrigin
CensusRoot *big.Int
Ballots []elgamal.Ballot
VoteIDs []types.HexBytes
}
VoteVerifierTestResults struct includes relevant data after VerifyVoteCircuit inputs generation