Skip to content

Commit 5fcf0b4

Browse files
claude[bot]github-actions[bot]jonathanpwangshuklaayush
committed
chore: rename PUBLIC_VALUES_AIR_ID to MEMORY_AIRS_START_IDX (#2482)
## Summary - Renames the constant `PUBLIC_VALUES_AIR_ID` to `MEMORY_AIRS_START_IDX` across 8 files - Removes old unused `BOUNDARY_AIR_ID` - Updates the doc comment to reflect the constant's current purpose as the boundary AIR index - The `PublicValuesChip` was removed in #2480, making the old name misleading Follows up on review comment in #2480. Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Jonathan Wang <jonathanpwang@users.noreply.github.com> Co-authored-by: Jonathan Wang <31040440+jonathanpwang@users.noreply.github.com> Co-authored-by: Ayush Shukla <shuklaayush@users.noreply.github.com> Co-authored-by: Ayush Shukla <ayush@axiom.xyz>
1 parent 9ac474e commit 5fcf0b4

File tree

8 files changed

+22
-25
lines changed

8 files changed

+22
-25
lines changed

crates/sdk/src/keygen/dummy.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use openvm_circuit::{
88
},
99
ContinuationVmProof, Executor, MatrixRecordArena, MeteredExecutor,
1010
PreflightExecutionOutput, PreflightExecutor, SingleSegmentVmProver, SystemConfig,
11-
VirtualMachine, VirtualMachineError, VmBuilder, VmExecutionConfig, PUBLIC_VALUES_AIR_ID,
11+
VirtualMachine, VirtualMachineError, VmBuilder, VmExecutionConfig,
1212
},
1313
system::program::trace::VmCommittedExe,
1414
utils::next_power_of_two_or_zero,
@@ -65,7 +65,6 @@ pub(super) fn compute_root_proof_heights(
6565
// The following is the same as impl SingleSegmentVmProver for VmLocalProver except we stop
6666
// after tracegen:
6767
let mut trace_heights = NATIVE_MAX_TRACE_HEIGHTS.to_vec();
68-
trace_heights[PUBLIC_VALUES_AIR_ID] = num_public_values as u32;
6968
let state = root_vm.create_initial_state(&root_committed_exe.exe, root_input.write());
7069
let cached_program_trace = root_vm.transport_committed_exe_to_device(root_committed_exe);
7170
root_vm.load_program(cached_program_trace);

crates/sdk/src/keygen/perm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl AirIdPermutation {
2121
}
2222
#[cfg(feature = "evm-prove")]
2323
pub fn get_special_air_ids(&self) -> SpecialAirIds {
24-
use openvm_circuit::arch::{CONNECTOR_AIR_ID, PROGRAM_AIR_ID, PUBLIC_VALUES_AIR_ID};
24+
use openvm_circuit::arch::{BOUNDARY_AIR_ID, CONNECTOR_AIR_ID, PROGRAM_AIR_ID};
2525

2626
let perm_len = self.perm.len();
2727
let mut ret = SpecialAirIds {
@@ -34,7 +34,7 @@ impl AirIdPermutation {
3434
ret.program_air_id = i;
3535
} else if air_id == CONNECTOR_AIR_ID {
3636
ret.connector_air_id = i;
37-
} else if air_id == PUBLIC_VALUES_AIR_ID {
37+
} else if air_id == BOUNDARY_AIR_ID {
3838
ret.public_values_air_id = i;
3939
}
4040
}

crates/sdk/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ use openvm_circuit::{
2323
hasher::{poseidon2::vm_poseidon2_hasher, Hasher},
2424
instructions::exe::VmExe,
2525
Executor, InitFileGenerator, MeteredExecutor, PreflightExecutor, VirtualMachineError,
26-
VmBuilder, VmExecutionConfig, VmExecutor, VmVerificationError, CONNECTOR_AIR_ID,
27-
PROGRAM_AIR_ID, PROGRAM_CACHED_TRACE_INDEX, PUBLIC_VALUES_AIR_ID,
26+
VmBuilder, VmExecutionConfig, VmExecutor, VmVerificationError, BOUNDARY_AIR_ID,
27+
CONNECTOR_AIR_ID, PROGRAM_AIR_ID, PROGRAM_CACHED_TRACE_INDEX,
2828
},
2929
system::{
3030
memory::{
@@ -705,9 +705,9 @@ where
705705
air_id: CONNECTOR_AIR_ID,
706706
}
707707
.into());
708-
} else if proof.inner.per_air[2].air_id != PUBLIC_VALUES_AIR_ID {
708+
} else if proof.inner.per_air[2].air_id != BOUNDARY_AIR_ID {
709709
return Err(VmVerificationError::SystemAirMissing {
710-
air_id: PUBLIC_VALUES_AIR_ID,
710+
air_id: BOUNDARY_AIR_ID,
711711
}
712712
.into());
713713
}

crates/vm/src/arch/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use openvm_stark_backend::{
1616
};
1717
use serde::{de::DeserializeOwned, Deserialize, Serialize};
1818

19-
use super::{AnyEnum, VmChipComplex, CONNECTOR_AIR_ID, PROGRAM_AIR_ID, PUBLIC_VALUES_AIR_ID};
19+
use super::{AnyEnum, VmChipComplex, BOUNDARY_AIR_ID, CONNECTOR_AIR_ID, PROGRAM_AIR_ID};
2020
use crate::{
2121
arch::{
2222
execution_mode::metered::segment_ctx::SegmentationConfig, AirInventory, AirInventoryError,
@@ -342,7 +342,7 @@ impl SystemConfig {
342342

343343
/// Returns the AIR ID of the memory boundary AIR. Panic if the boundary AIR is not enabled.
344344
pub fn memory_boundary_air_id(&self) -> usize {
345-
PUBLIC_VALUES_AIR_ID
345+
BOUNDARY_AIR_ID
346346
}
347347

348348
/// Returns the AIR ID of the memory merkle AIR. Returns None if continuations are not enabled.

crates/vm/src/arch/extensions.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,13 @@ pub const PROGRAM_AIR_ID: usize = 0;
4444
/// ProgramAir is the first AIR so its cached trace should be the first main trace.
4545
pub const PROGRAM_CACHED_TRACE_INDEX: usize = 0;
4646
pub const CONNECTOR_AIR_ID: usize = 1;
47-
/// If PublicValuesAir is **enabled**, its AIR ID is 2. PublicValuesAir is always disabled when
48-
/// continuations is enabled.
49-
pub const PUBLIC_VALUES_AIR_ID: usize = 2;
50-
/// AIR ID of the Memory Boundary AIR.
51-
pub const BOUNDARY_AIR_ID: usize = PUBLIC_VALUES_AIR_ID + 1 + BOUNDARY_AIR_OFFSET;
47+
/// Starting AIR index of memory AIRs in the VM circuit.
48+
pub const MEMORY_AIRS_START_IDX: usize = 2;
49+
/// AIR index of the boundary AIR in the VM circuit.
50+
pub const BOUNDARY_AIR_ID: usize = MEMORY_AIRS_START_IDX + BOUNDARY_AIR_OFFSET;
5251
/// If VM has continuations enabled, all AIRs of MemoryController are added after ConnectorChip.
5352
/// Merkle AIR commits start/final memory states.
54-
pub const MERKLE_AIR_ID: usize = CONNECTOR_AIR_ID + 1 + MERKLE_AIR_OFFSET;
53+
pub const MERKLE_AIR_ID: usize = MEMORY_AIRS_START_IDX + MERKLE_AIR_OFFSET;
5554

5655
pub type ExecutorId = u32;
5756

crates/vm/src/arch/vm.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ use super::{
5454
ExecutorInventory, ExecutorInventoryError, MemoryConfig, MeteredExecutor, PreflightExecutor,
5555
StaticProgramError, SystemConfig, VmBuilder, VmChipComplex, VmCircuitConfig, VmExecState,
5656
VmExecutionConfig, VmState, CONNECTOR_AIR_ID, MERKLE_AIR_ID, PROGRAM_AIR_ID,
57-
PROGRAM_CACHED_TRACE_INDEX, PUBLIC_VALUES_AIR_ID,
57+
PROGRAM_CACHED_TRACE_INDEX,
5858
};
5959
use crate::{
6060
arch::{deferral::DeferralState, DEFAULT_RNG_SEED},
@@ -1232,8 +1232,7 @@ where
12321232
let vm = &mut self.vm;
12331233
let exe = &self.exe;
12341234
assert!(!vm.config().as_ref().continuation_enabled);
1235-
let mut trace_heights = trace_heights.to_vec();
1236-
trace_heights[PUBLIC_VALUES_AIR_ID] = vm.config().as_ref().num_public_values as u32;
1235+
let trace_heights = trace_heights.to_vec();
12371236
let state = self.state.take().expect("State should always be present");
12381237
let num_custom_pvs = state.custom_pvs.len();
12391238
let (proof, final_memory) = vm.prove(&mut self.interpreter, state, None, &trace_heights)?;

crates/vm/src/system/cuda/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ impl SystemChipComplex<DenseRecordArena, GpuBackend> for SystemChipInventoryGPU
130130

131131
#[cfg(feature = "metrics")]
132132
fn finalize_trace_heights(&self, heights: &mut [usize]) {
133-
use crate::system::{cuda::boundary::BoundaryFields, PUBLIC_VALUES_AIR_ID};
133+
use crate::{arch::BOUNDARY_AIR_ID, system::cuda::boundary::BoundaryFields};
134134

135-
let boundary_idx = PUBLIC_VALUES_AIR_ID;
135+
let boundary_idx = BOUNDARY_AIR_ID;
136136
let mut access_adapter_offset = boundary_idx + 1;
137137
match self.memory_inventory.boundary.fields {
138138
BoundaryFields::Volatile(_) => {

crates/vm/src/system/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::{
2727
ChipInventoryError, DenseRecordArena, ExecutionBridge, ExecutionBus, ExecutionState,
2828
ExecutorInventory, ExecutorInventoryError, MatrixRecordArena, PhantomSubExecutor,
2929
RowMajorMatrixArena, SystemConfig, VmBuilder, VmChipComplex, VmCircuitConfig,
30-
VmExecutionConfig, VmField, CONNECTOR_AIR_ID, PROGRAM_AIR_ID, PUBLIC_VALUES_AIR_ID,
30+
VmExecutionConfig, VmField, CONNECTOR_AIR_ID, MEMORY_AIRS_START_IDX, PROGRAM_AIR_ID,
3131
},
3232
system::{
3333
connector::VmConnectorChip,
@@ -431,9 +431,9 @@ where
431431

432432
#[cfg(feature = "metrics")]
433433
fn finalize_trace_heights(&self, heights: &mut [usize]) {
434-
use crate::system::memory::interface::MemoryInterface;
434+
use crate::{arch::BOUNDARY_AIR_ID, system::memory::interface::MemoryInterface};
435435

436-
let boundary_idx = PUBLIC_VALUES_AIR_ID;
436+
let boundary_idx = BOUNDARY_AIR_ID;
437437
let mut access_adapter_offset = boundary_idx + 1;
438438
match &self.memory_controller.interface_chip {
439439
MemoryInterface::Volatile { boundary_chip } => {
@@ -541,6 +541,6 @@ where
541541
);
542542
assert_eq!(heights[CONNECTOR_AIR_ID], 2);
543543
self.memory_controller
544-
.set_override_trace_heights(&heights[PUBLIC_VALUES_AIR_ID..]);
544+
.set_override_trace_heights(&heights[MEMORY_AIRS_START_IDX..]);
545545
}
546546
}

0 commit comments

Comments
 (0)