From 3b83c3a98c6739dc16f5bdb16d409b3b83d73cbd Mon Sep 17 00:00:00 2001 From: Ray Gao Date: Wed, 21 Jan 2026 20:07:33 -0500 Subject: [PATCH] add optional sumcheck flag --- crates/sdk/src/config/global.rs | 2 +- .../native/circuit/src/extension/mod.rs | 32 +++++++++++-------- extensions/native/circuit/src/lib.rs | 4 +-- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/crates/sdk/src/config/global.rs b/crates/sdk/src/config/global.rs index 9699b1ed34..5d0bde01ce 100644 --- a/crates/sdk/src/config/global.rs +++ b/crates/sdk/src/config/global.rs @@ -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; diff --git a/extensions/native/circuit/src/extension/mod.rs b/extensions/native/circuit/src/extension/mod.rs index 9f3e2035ad..3ca8cff302 100644 --- a/extensions/native/circuit/src/extension/mod.rs +++ b/extensions/native/circuit/src/extension/mod.rs @@ -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 { @@ -175,12 +175,14 @@ impl VmExecutionExtension 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), @@ -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(()) } } @@ -293,7 +297,7 @@ where { fn extend_prover( &self, - _: &Native, + ext_config: &Native, inventory: &mut ChipInventory>, ) -> Result<(), ChipInventoryError> { let range_checker = inventory.range_checker()?.clone(); @@ -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(()) } diff --git a/extensions/native/circuit/src/lib.rs b/extensions/native/circuit/src/lib.rs index ce257c9c22..2693eaae12 100644 --- a/extensions/native/circuit/src/lib.rs +++ b/extensions/native/circuit/src/lib.rs @@ -44,7 +44,7 @@ mod loadstore; mod poseidon2; mod sumcheck; -mod extension; +pub mod extension; pub use extension::*; pub use field_extension::EXT_DEG; @@ -173,7 +173,7 @@ impl Default for Rv32WithKernelsConfig { rv32i: Rv32I, rv32m: Rv32M::default(), io: Rv32Io, - native: Native, + native: Native(false), castf: CastFExtension, } }