Merge pull request #1116 from topos-protocol/recursive_ranges

Remove need for matching start ranges
This commit is contained in:
Nicholas Ward 2023-07-14 09:32:24 -07:00 committed by GitHub
commit 4893a86001
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -6,6 +6,7 @@ use hashbrown::HashMap;
use itertools::{zip_eq, Itertools};
use plonky2::field::extension::Extendable;
use plonky2::fri::FriParams;
use plonky2::gates::constant::ConstantGate;
use plonky2::gates::noop::NoopGate;
use plonky2::hash::hash_types::RichField;
use plonky2::iop::challenger::RecursiveChallenger;
@ -491,6 +492,11 @@ where
// public inputs for cyclic verification, even though they'll be ignored.
let cyclic_vk = builder.add_verifier_data_public_inputs();
builder.add_gate(
ConstantGate::new(inner_common_data[0].config.num_constants),
vec![],
);
RootCircuitData {
circuit: builder.build::<C>(),
proof_with_pis: recursive_proofs,

View File

@ -97,7 +97,7 @@ fn test_empty_txn_list() -> anyhow::Result<()> {
let all_circuits = AllRecursiveCircuits::<F, C, D>::new(
&all_stark,
&[9..18, 9..15, 9..15, 9..10, 9..12, 9..18], // Minimal ranges to prove an empty list
&[16..17, 14..15, 14..15, 9..10, 12..13, 18..19], // Minimal ranges to prove an empty list
&config,
);

View File

@ -26,6 +26,10 @@ pub struct ConstantGate {
}
impl ConstantGate {
pub fn new(num_consts: usize) -> Self {
Self { num_consts }
}
pub fn const_input(&self, i: usize) -> usize {
debug_assert!(i < self.num_consts);
i