openvm_circuit/system/memory/merkle/
columns.rs

1use openvm_circuit_primitives::{StructReflection, StructReflectionHelper};
2use openvm_circuit_primitives_derive::AlignedBorrow;
3
4#[derive(Debug, AlignedBorrow, StructReflection)]
5#[repr(C)]
6pub struct MemoryMerkleCols<T, const CHUNK: usize> {
7    // `expand_direction` =  1 corresponds to initial memory state
8    // `expand_direction` = -1 corresponds to final memory state
9    // `expand_direction` =  0 corresponds to irrelevant row (all interactions multiplicity 0)
10    pub expand_direction: T,
11
12    // height_section = 1 indicates that as_label is being expanded
13    // height_section = 0 indicates that address_label is being expanded
14    pub height_section: T,
15    pub parent_height: T,
16    pub parent_height_inv: T,
17    pub is_root: T,
18
19    pub parent_as_label: T,
20    pub parent_address_label: T,
21
22    pub parent_hash: [T; CHUNK],
23    pub left_child_hash: [T; CHUNK],
24    pub right_child_hash: [T; CHUNK],
25
26    // indicate whether `expand_direction` is different from origin
27    // when `expand_direction` != -1, must be 0
28    pub left_direction_different: T,
29    pub right_direction_different: T,
30}
31
32#[derive(Debug, Clone, Copy, AlignedBorrow, StructReflection)]
33#[repr(C)]
34pub struct MemoryMerklePvs<T, const CHUNK: usize> {
35    /// The memory state root before the execution of this segment.
36    pub initial_root: [T; CHUNK],
37    /// The memory state root after the execution of this segment.
38    pub final_root: [T; CHUNK],
39}