Skip to content

Commit

Permalink
chore: feature gate hard coded buses for testing only (#1088)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanpwang authored Dec 16, 2024
1 parent 03f7f6d commit 351e068
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
17 changes: 7 additions & 10 deletions crates/vm/src/arch/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,19 @@ use openvm_poseidon2_air::poseidon2::Poseidon2Config;
use openvm_stark_backend::{p3_field::PrimeField32, ChipUsageGetter};
use serde::{de::DeserializeOwned, Deserialize, Serialize};

// TODO[jpw]: re-exporting hardcoded bus constants for tests. Import paths should be
// updated directly but it changes many files.
#[cfg(any(test, feature = "test-utils"))]
pub use super::testing::{
BITWISE_OP_LOOKUP_BUS, BYTE_XOR_BUS, EXECUTION_BUS, MEMORY_BUS, MEMORY_MERKLE_BUS,
POSEIDON2_DIRECT_BUS, RANGE_TUPLE_CHECKER_BUS, READ_INSTRUCTION_BUS,
};
use super::{
AnyEnum, InstructionExecutor, SystemComplex, SystemExecutor, SystemPeriphery, VmChipComplex,
VmInventoryError, PUBLIC_VALUES_AIR_ID,
};
use crate::system::memory::BOUNDARY_AIR_OFFSET;

pub const EXECUTION_BUS: usize = 0;
pub const MEMORY_BUS: usize = 1;
pub const POSEIDON2_DIRECT_BUS: usize = 6;
pub const READ_INSTRUCTION_BUS: usize = 8;
pub const BITWISE_OP_LOOKUP_BUS: usize = 9;
pub const BYTE_XOR_BUS: usize = 10;
//pub const BYTE_XOR_BUS: XorBus = XorBus(8);
pub const RANGE_TUPLE_CHECKER_BUS: usize = 11;
pub const MEMORY_MERKLE_BUS: usize = 12;

const DEFAULT_MAX_SEGMENT_LEN: usize = (1 << 22) - 100;
// sbox is decomposed to have this max degree for Poseidon2. We set to 3 so quotient_degree = 2
// allows log_blowup = 1
Expand Down
11 changes: 10 additions & 1 deletion crates/vm/src/arch/testing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use rand::{rngs::StdRng, RngCore, SeedableRng};
use tracing::Level;

use crate::{
arch::{ExecutionState, MemoryConfig, EXECUTION_BUS, MEMORY_BUS, READ_INSTRUCTION_BUS},
arch::{ExecutionState, MemoryConfig},
system::{
memory::{offline_checker::MemoryBus, MemoryController},
program::ProgramBus,
Expand All @@ -43,6 +43,15 @@ pub use test_adapter::TestAdapterChip;
use super::{ExecutionBus, InstructionExecutor};
use crate::system::{memory::MemoryControllerRef, poseidon2::Poseidon2Chip};

pub const EXECUTION_BUS: usize = 0;
pub const MEMORY_BUS: usize = 1;
pub const POSEIDON2_DIRECT_BUS: usize = 6;
pub const READ_INSTRUCTION_BUS: usize = 8;
pub const BITWISE_OP_LOOKUP_BUS: usize = 9;
pub const BYTE_XOR_BUS: usize = 10;
pub const RANGE_TUPLE_CHECKER_BUS: usize = 11;
pub const MEMORY_MERKLE_BUS: usize = 12;

const RANGE_CHECKER_BUS: usize = 4;

#[derive(Debug)]
Expand Down

0 comments on commit 351e068

Please sign in to comment.