Add table multiplexer (and use it for container, custom pred & PublicKeyOf ops) (#376)
- Extend the `Flattenable` trait to include a `size` method that returns the number of `Target`s the type requires. This is used in the table to figure out the max length of an array that must fit all entry types. - Move the circuit methods to precalculate hash states and do hashes started from a precomputed state to a new module - Introduce `MuxTableTarget` which allows easy multiplexing of tables where each sub-table may have entries of different lengths. The table access is done via hashing + unhashing automatically (via use of a generator) - Use the `MuxTableTarget` to access merkle tree claims and custom predicate verification, which where previously in different tables and accessed with independent random accesses each - Move the public key derivation for the PublicKeyOf operation check to the same multiplexed table. Now we can choose how many of those operations a circuit supports. Resolve https://github.com/0xPARC/pod2/issues/357 Resolve https://github.com/0xPARC/pod2/issues/361
This commit is contained in:
parent
0305a4de19
commit
bcaef6c47a
11 changed files with 843 additions and 524 deletions
|
|
@ -19,7 +19,7 @@ use serde::{de, ser, Deserialize, Serialize};
|
|||
|
||||
use crate::backends::plonky2::{
|
||||
basetypes::{CircuitData, CommonCircuitData, VerifierCircuitData, C, D, F},
|
||||
circuits::{common::LtMaskGenerator, utils::DebugGenerator},
|
||||
circuits::{common::LtMaskGenerator, mux_table::TableGetGenerator, utils::DebugGenerator},
|
||||
primitives::ec::{
|
||||
bits::ConditionalZeroGenerator,
|
||||
curve::PointSquareRootGenerator,
|
||||
|
|
@ -92,7 +92,6 @@ use plonky2::{
|
|||
#[derive(Debug)]
|
||||
pub(crate) struct Pod2GeneratorSerializer {}
|
||||
|
||||
// TODO: Add pod2 custom generators
|
||||
impl WitnessGeneratorSerializer<F, D> for Pod2GeneratorSerializer {
|
||||
impl_generator_serializer! {
|
||||
Pod2GeneratorSerializer,
|
||||
|
|
@ -130,7 +129,8 @@ impl WitnessGeneratorSerializer<F, D> for Pod2GeneratorSerializer {
|
|||
RecursiveGenerator<1, NNFMulSimple<5, QuinticExtension<F>>>,
|
||||
RecursiveGenerator<D, ECAddHomogOffset>,
|
||||
RecursiveGenerator<1, ECAddHomogOffset>,
|
||||
ComparisonGenerator<F, D>
|
||||
ComparisonGenerator<F, D>,
|
||||
TableGetGenerator
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue