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
|
|
@ -14,7 +14,7 @@ use crate::{
|
|||
mainpod::{
|
||||
calculate_id, extract_merkle_proofs, layout_statements,
|
||||
process_private_statements_operations, process_public_statements_operations, Operation,
|
||||
Statement,
|
||||
OperationAux, Statement,
|
||||
},
|
||||
mock::emptypod::MockEmptyPod,
|
||||
primitives::merkletree::MerkleClaimAndProof,
|
||||
|
|
@ -172,14 +172,15 @@ impl MockMainPod {
|
|||
|
||||
pub fn new(params: &Params, inputs: MainPodInputs) -> Result<Self> {
|
||||
let (statements, public_statements) = layout_statements(params, true, &inputs)?;
|
||||
let mut aux_list = vec![OperationAux::None; params.max_priv_statements()];
|
||||
// Extract Merkle proofs and pad.
|
||||
let merkle_proofs = extract_merkle_proofs(params, inputs.operations, inputs.statements)?;
|
||||
let merkle_proofs =
|
||||
extract_merkle_proofs(params, &mut aux_list, inputs.operations, inputs.statements)?;
|
||||
|
||||
let operations = process_private_statements_operations(
|
||||
params,
|
||||
&statements,
|
||||
&merkle_proofs,
|
||||
None,
|
||||
&aux_list,
|
||||
inputs.operations,
|
||||
)?;
|
||||
let operations = process_public_statements_operations(params, &statements, operations)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue