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 ¶
var Artifacts = circuits.NewCircuitArtifacts( "aggregator", params.AggregatorCurve, []backend.ProverOption{ stdgroth16.GetNativeProverOptions(params.StateTransitionCurve.ScalarField(), params.AggregatorCurve.ScalarField()), }, []backend.VerifierOption{ stdgroth16.GetNativeVerifierOptions(params.StateTransitionCurve.ScalarField(), params.AggregatorCurve.ScalarField()), }, &circuits.Artifact{ RemoteURL: config.AggregatorCircuitURL, Hash: types.HexStringToHexBytesMustUnmarshal(config.AggregatorCircuitHash), }, &circuits.Artifact{ RemoteURL: config.AggregatorProvingKeyURL, Hash: types.HexStringToHexBytesMustUnmarshal(config.AggregatorProvingKeyHash), }, &circuits.Artifact{ RemoteURL: config.AggregatorVerificationKeyURL, Hash: types.HexStringToHexBytesMustUnmarshal(config.AggregatorVerificationKeyHash), }, )
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) 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.
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