chore: move rvr files into openvm-circuit to avoid circular dependency#2730
chore: move rvr files into openvm-circuit to avoid circular dependency#2730gdmlcjs wants to merge 6 commits intodevelop-v2.1.0-rvrfrom
Conversation
|
Claude finished @gdmlcjs's task in 1m 52s —— View job Code Review: Move RVR files into openvm-circuit
Overall this is a clean structural migration that correctly breaks the circular dependency between Findings1. #![allow(dead_code)]This suppresses all dead-code warnings for the new module tree. Since this code is behind the 2. Duplicate 3. Constants header function extracted without removing the old one — 4. pub fn new(output_dir, name, tracer_mode, memory_bits, page_bits, chunk_bits, segment_check_insns, public_values_as)Already behind 5. Feature flag dependency surface — 6. Test dev-dependency bloat — 7. 8. pub mod rvr;This makes the entire rvr module publicly accessible from Minor / Nit
SummaryThis PR accomplishes its stated goal of resolving the circular dependency. The code moves are mechanical and correct. The main areas for improvement are reducing the duplicated config-building logic between library and test code, and considering the dev-dependency impact on the core VM crate. None of these are blocking. |
This comment has been minimized.
This comment has been minimized.
|
Claude finished @gdmlcjs's task in 2m 37s —— View job Code Review: Move RVR files into openvm-circuit
This PR correctly breaks the circular dependency between Findings1. Unused _system_config: &SystemConfig,This was already unused in the base branch, but since this PR is refactoring the config-building functions, it's a good time to either remove the parameter or add a 2. 3. fn openvm_compile_constants() -> (u32, u32, u32, u32) {
(
DEFAULT_SEGMENT_CHECK_INSNS as u32,
DEFAULT_PAGE_BITS as u32,
CHUNK.ilog2(),
PUBLIC_VALUES_AS,
)
}This tuple is used both for cache key computation and for constructing 4. Dev-dependency weight on
5. 6. 7. 8. 9. Test migration is mechanical and correct — All test files (algebra, bigint, ecc, keccak, etc.) have identical 2-line changes: 10. Second commit addresses prior review feedback — The Minor / Nit
SummaryClean structural migration that correctly resolves the circular dependency. The code moves are mechanical, the constant parameterization through |
This comment has been minimized.
This comment has been minimized.
|
Claude finished @gdmlcjs's task in 2m 0s —— View job Code Review: Move RVR files into openvm-circuit
This is a well-executed structural migration. The split is clean: Actionable findings1. Dev-dependencies unconditionally compiled for the test binary — The test root file uses [[test]]
name = "rvr_openvm"
required-features = ["rvr"]This would let non-rvr developers avoid the heavy dependency pull. Fix this → 2. _system_config: &SystemConfig,This parameter is unused (prefixed with 3. pub fn constants_header(
_text_start: u32,
memory_bits: u8,
...The 4. The module is Minor observations
SummaryClean migration that correctly resolves the circular dependency. The main actionable item is gating the test binary with |
There was a problem hiding this comment.
i would avoid this whole file and add tests to respective extension crates instead. maybe vm crate can have a small test_utils or similar module that is shared
There was a problem hiding this comment.
I put the test utils inside the rvr directory as a separate crate.
1f5db7c to
f114146
Compare
|
Claude finished @gdmlcjs's task in 2m 56s —— View job Code Review: Move RVR files into openvm-circuit (post-revision)
This revision (6 commits on top of Prior feedback resolution
Architecture (post-revision)The split is now:
Findings1. The compile-time 2. The module is 3. Phantom dispatch refactor is a correctness improvement — The old code had hand-rolled However, the dispatch in 4. Previously 5. Good cleanup: replacing the local 6. Similarly, 7. Test harness design ( The 8. Constants buffer capacity constants —
9. Minor: Changed from SummaryThis revision cleanly addresses all the prior review concerns. The constant duplication is now properly guarded by compile-time assertions. Tests are distributed to their respective extension crates, keeping No blocking issues. The main items for future consideration are: (1) whether |
Note: cells_used metrics omitted because CUDA tracegen does not expose unpadded trace heights. Commit: f114146 |
|
Claude finished @gdmlcjs's task in 1m 57s —— View job Code Review: Move RVR files into openvm-circuit
This PR cleanly resolves the circular dependency between Prior feedback resolution
Findings1. #[cfg(any(feature = "test-utils", feature = "cuda"))]
const _: () = assert!(
ffi::DEFERRAL_DIGEST_SIZE == openvm_stark_sdk::config::baby_bear_poseidon2::DIGEST_SIZE,
);The 2. The module is 3. Previously 4. // TODO: justify this bound (audit max deferral pages per instruction).
pub const DEFERRAL_PAGE_BUF_CAP: usize = 1 << 16;Since C code has no bounds checks on these page buffers, an undersize capacity would be a memory safety issue. The other two buffers ( 5. Phantom dispatch collision risk — if SysPhantom::from_repr(discriminant).is_some()
|| Rv32Phantom::from_repr(discriminant).is_some()
{
return Some(lift_phantom(insn, pc));
}
if let Some(lifted) = extensions.try_lift(insn, pc) {
return Some(lifted);
}Built-in phantom handlers are checked before extensions. If a future extension phantom discriminant collides with a Minor / Nit
SummaryClean, well-executed migration that correctly resolves the circular dependency. All prior review feedback has been thoroughly addressed. The architecture split (thin No blocking issues. Main items for future consideration: (1) making the |
shuklaayush
left a comment
There was a problem hiding this comment.
lgtm. some cleanup that can be handled later
| pub const MEM_BITS: usize = 29; | ||
| pub const CHUNK: usize = 8; | ||
| /// Default, not an invariant; see TODO in `abi_consts.rs`. | ||
| pub const DEFAULT_PAGE_BITS: usize = 6; | ||
| /// Default, not an invariant; see TODO in `abi_consts.rs`. | ||
| pub const DEFAULT_SEGMENT_CHECK_INSNS: u32 = 1000; |
There was a problem hiding this comment.
we should figure out a way to share these later. maybe there should be a common crate somewhere. not an issue for now since we already have too many crates
There was a problem hiding this comment.
fine for now but we should try to minimize these extra crates and try to consolidate the code
Moves the rvr files related to compiling and execution into openvm-circuit. Those rvr files previously depended on openvm-circuit and in order to enable rvr execution through the openvm pipeline, they had to be made a part of openvm-circuit to prevent circular dependencies.
closes INT-7537