Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/sdk/src/config/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ impl SdkVmConfig {
let io = config.io.map(|_| Rv32Io);
let keccak = config.keccak.map(|_| Keccak256);
let sha256 = config.sha256.map(|_| Sha256);
let native = config.native.map(|_| Native);
let native = config.native.map(|_| Native(false));
let castf = config.castf.map(|_| CastFExtension);
let rv32m = config.rv32m;
let bigint = config.bigint;
Expand Down
32 changes: 19 additions & 13 deletions extensions/native/circuit/src/extension/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ cfg_if::cfg_if! {
// ============ VmExtension Implementations ============

#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize)]
pub struct Native;
pub struct Native(pub bool); // Encloses an indicator for whether NativeSumcheckAIR is present

#[derive(Clone, From, AnyEnum, Executor, MeteredExecutor, PreflightExecutor)]
pub enum NativeExecutor<F: Field> {
Expand Down Expand Up @@ -175,12 +175,14 @@ impl<F: PrimeField32> VmExecutionExtension<F> for Native {
],
)?;

let tower_verify = NativeSumcheckExecutor::new();
inventory.add_executor(
tower_verify,
[SumcheckOpcode::SUMCHECK_LAYER_EVAL.global_opcode()],
)?;

if self.0 {
let tower_verify = NativeSumcheckExecutor::new();
inventory.add_executor(
tower_verify,
[SumcheckOpcode::SUMCHECK_LAYER_EVAL.global_opcode()],
)?;
}

inventory.add_phantom_sub_executor(
NativeHintInputSubEx,
PhantomDiscriminant(NativePhantom::HintInput as u16),
Expand Down Expand Up @@ -274,9 +276,11 @@ where
);
inventory.add_air(verify_batch);

let tower_evaluate = NativeSumcheckAir::new(exec_bridge, memory_bridge);
inventory.add_air(tower_evaluate);

if self.0 {
let tower_evaluate = NativeSumcheckAir::new(exec_bridge, memory_bridge);
inventory.add_air(tower_evaluate);
}

Ok(())
}
}
Expand All @@ -293,7 +297,7 @@ where
{
fn extend_prover(
&self,
_: &Native,
ext_config: &Native,
inventory: &mut ChipInventory<SC, RA, CpuBackend<SC>>,
) -> Result<(), ChipInventoryError> {
let range_checker = inventory.range_checker()?.clone();
Expand Down Expand Up @@ -357,8 +361,10 @@ where
);
inventory.add_executor_chip(poseidon2);

let tower_verify = NativeSumcheckChip::new(NativeSumcheckFiller::new(), mem_helper.clone());
inventory.add_executor_chip(tower_verify);
if ext_config.0 {
let tower_verify = NativeSumcheckChip::new(NativeSumcheckFiller::new(), mem_helper.clone());
inventory.add_executor_chip(tower_verify);
}

Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions extensions/native/circuit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ mod loadstore;
mod poseidon2;
mod sumcheck;

mod extension;
pub mod extension;
pub use extension::*;
pub use field_extension::EXT_DEG;

Expand Down Expand Up @@ -173,7 +173,7 @@ impl Default for Rv32WithKernelsConfig {
rv32i: Rv32I,
rv32m: Rv32M::default(),
io: Rv32Io,
native: Native,
native: Native(false),
castf: CastFExtension,
}
}
Expand Down