aggregator

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

aggregator package contains the Gnark circuit defiinition that aggregates some votes and proves the validity of the aggregation. The circuit checks every single verification proof generating a single proof for the whole aggregation. It also checks that the number of valid votes and that the hash of the witnesses is the expected.

Index

Constants

This section is empty.

Variables

Artifacts contains the circuit artifacts for the aggregator circuit, which includes the proving and verification keys.

Functions

func Compile added in v0.0.2

func Compile(voteVerifierCCS constraint.ConstraintSystem, voteVerifierVK groth16.VerifyingKey) (constraint.ConstraintSystem, error)

Compile compiles the Aggregator circuit definition from the inner vote verifier CCS and verifying key.

Types

type AggregatorCircuit

type AggregatorCircuit struct {
	VotersCount     frontend.Variable                      `gnark:",public"`
	BatchHash       emulated.Element[sw_bn254.ScalarField] `gnark:",public"`
	BallotHashes    [params.VotesPerBatch]emulated.Element[sw_bn254.ScalarField]
	Proofs          [params.VotesPerBatch]groth16.Proof[sw_bls12377.G1Affine, sw_bls12377.G2Affine]
	VerificationKey groth16.VerifyingKey[sw_bls12377.G1Affine, sw_bls12377.G2Affine, sw_bls12377.GT] `gnark:"-"`
}

func (*AggregatorCircuit) Define

func (c *AggregatorCircuit) Define(api frontend.API) error

func (*AggregatorCircuit) FillWithDummy

func (assignment *AggregatorCircuit) FillWithDummy(fromIdx int, dummyProof groth16.Proof) error

FillWithDummy fills the aggregator assignment with dummy proofs and witnesses compiled for the main constraint.ConstraintSystem provided and the proving key. It generates dummy proofs using the inner verification key provided. It starts to fill from the index provided. Returns an error if something fails.

func (*AggregatorCircuit) VoteMask added in v0.0.6

func (c *AggregatorCircuit) VoteMask(api frontend.API) []frontend.Variable

VoteMask returns the latch-based mask for real vote slots.

type AggregatorInputs

type AggregatorInputs struct {
	Proofs                 [params.VotesPerBatch]stdgroth16.Proof[sw_bls12377.G1Affine, sw_bls12377.G2Affine]
	ProofsInputHash        [params.VotesPerBatch]emulated.Element[sw_bn254.ScalarField]
	AggBallots             []*storage.AggregatorBallot
	VerifiedBallots        []*storage.VerifiedBallot
	ProcessedKeys          [][]byte
	ProofsInputsHashInputs []*big.Int
}

func (*AggregatorInputs) InputsHash

func (ai *AggregatorInputs) InputsHash() (*big.Int, error)

InputsHash hashes all subhashes and returns the final hash

Jump to

Keyboard shortcuts

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