Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
cpubot committed Feb 22, 2024
1 parent 981a1b5 commit 2fac505
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
4 changes: 3 additions & 1 deletion common/src/prover_state/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ use proof_gen::types::AllRecursiveCircuits;
use crate::parsing::{parse_range, RangeParseError};

/// Number of tables defined in plonky2.
pub const NUM_TABLES: usize = 7;
///
/// TODO: This should be made public in the evm_arithmetization crate.
pub(crate) const NUM_TABLES: usize = 7;

/// New type wrapper for [`Range`] that implements [`FromStr`] and [`Display`].
///
Expand Down
20 changes: 11 additions & 9 deletions common/src/prover_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
//! [`set_prover_state_from_config`] function.
use std::sync::OnceLock;

use evm_arithmetization::{
fixed_recursive_verifier::RecursiveCircuitsForTableSize, proof::AllProof, prover::prove,
AllStark, StarkConfig,
};
use evm_arithmetization::{proof::AllProof, prover::prove, AllStark, StarkConfig};
use plonky2::{
field::goldilocks_field::GoldilocksField, plonk::config::PoseidonGoldilocksConfig,
util::timing::TimingTree,
Expand All @@ -39,6 +36,13 @@ pub(crate) type Config = PoseidonGoldilocksConfig;
pub(crate) type Field = GoldilocksField;
pub(crate) const SIZE: usize = 2;

pub(crate) type RecursiveCircuitsForTableSize =
evm_arithmetization::fixed_recursive_verifier::RecursiveCircuitsForTableSize<
Field,
Config,
SIZE,
>;

/// The global prover state.
///
/// It is specified as a `OnceLock` for the following reasons:
Expand Down Expand Up @@ -117,15 +121,13 @@ impl ProverStateManager {
/// Using this information, for each circuit, a tuple is returned,
/// containing:
/// 1. The loaded table circuit at the specified size.
/// 2. An offset indicating the distance of the specified size relative to
/// the configured range used to pre-process the circuits.
#[allow(clippy::type_complexity)]
/// 2. An offset indicating the position of the specified size within the
/// configured range used when pre-generating the circuits.
fn load_table_circuits(
&self,
config: &StarkConfig,
all_proof: &AllProof<Field, Config, SIZE>,
) -> anyhow::Result<[(RecursiveCircuitsForTableSize<Field, Config, SIZE>, u8); NUM_TABLES]>
{
) -> anyhow::Result<[(RecursiveCircuitsForTableSize, u8); NUM_TABLES]> {
let degrees = all_proof.degree_bits(config);

/// Given a recursive circuit index (e.g., Arithmetic / 0), return a
Expand Down
8 changes: 3 additions & 5 deletions common/src/prover_state/persistence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use std::{
path::Path,
};

use evm_arithmetization::fixed_recursive_verifier::RecursiveCircuitsForTableSize;
use plonky2::util::serialization::{
Buffer, DefaultGateSerializer, DefaultGeneratorSerializer, IoError,
};
Expand All @@ -14,7 +13,7 @@ use thiserror::Error;

use super::{
circuit::{Circuit, CircuitConfig},
Config, Field, SIZE,
Config, RecursiveCircuitsForTableSize, SIZE,
};

const PROVER_STATE_FILE_PREFIX: &str = "./prover_state";
Expand Down Expand Up @@ -154,7 +153,7 @@ impl DiskResource for MonolithicProverResource {
pub(crate) struct RecursiveCircuitResource;

impl DiskResource for RecursiveCircuitResource {
type Resource = RecursiveCircuitsForTableSize<Field, Config, SIZE>;
type Resource = RecursiveCircuitsForTableSize;
type Error = IoError;
type PathConstrutor = (Circuit, usize);

Expand All @@ -179,8 +178,7 @@ impl DiskResource for RecursiveCircuitResource {

fn deserialize(
bytes: &[u8],
) -> Result<RecursiveCircuitsForTableSize<Field, Config, SIZE>, DiskResourceError<Self::Error>>
{
) -> Result<RecursiveCircuitsForTableSize, DiskResourceError<Self::Error>> {
let (gate_serializer, witness_serializer) = get_serializers();
let mut buffer = Buffer::new(bytes);
RecursiveCircuitsForTableSize::from_buffer(
Expand Down

0 comments on commit 2fac505

Please sign in to comment.