Module chip_traits

Module chip_traits 

Source
Expand description

Backend abstraction traits for circuit construction.

Each trait mirrors one concrete chip used by the static verifier: GateInstGateChip (plus raw Context cell operations), BabyBearInstBabyBearChip, BabyBearExt4InstBabyBearExt4Chip, TranscriptInstTranscriptChip, and Poseidon2Inst ↔ the Poseidon2 digest hashing helpers. PopulateInputs is the exception: it groups the witness-loading methods used by load_proof_wire and inherits only from ChipBase.

Circuit-construction code is generic over a single backend object B bounded by the traits it needs, e.g. B: TranscriptInst + GateInst. All chip traits inherit their associated types from ChipBase, so B::F (the wire/value representation abstracting AssignedValue<Fr>) is unambiguous and never needs to be repeated per-trait in bounds. Backends own their circuit-building context (e.g. a &mut halo2_base::Context<Fr> for the halo2 backend, or an IR builder).

Trait methods never inspect B::F values on the host; all nondeterminism (witness loading, inversions, decompositions) lives inside backend implementations.

Traits§

BabyBearExt4Inst
BabyBear quartic-extension operations mirroring BabyBearExt4Chip.
BabyBearInst
BabyBear base-field operations mirroring BabyBearChip.
ChipBase
Associated types shared by all chip traits.
GateInst
Raw Fr-cell operations mirroring GateChip and direct Context usage.
PopulateInputs
Witness-loading operations needed to populate proof input wires (see stages::full_pipeline::load_proof_wire).
Poseidon2Inst
Poseidon2 digest hashing/compression mirroring the helpers in hash::poseidon2.
TranscriptInst
Stateful Fiat–Shamir transcript mirroring TranscriptChip.