Skip to content

Commit 4ac232a

Browse files
authored
feat: scaffold Memory component (#99)
1 parent 76bda39 commit 4ac232a

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

crates/brainfuck_prover/src/components/memory/component.rs

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,46 @@
1-
use stwo_prover::core::{channel::Channel, fields::qm31::SecureField};
1+
use super::table::MemoryElements;
2+
use crate::components::MemoryClaim;
3+
use stwo_prover::{
4+
constraint_framework::{EvalAtRow, FrameworkComponent, FrameworkEval},
5+
core::{channel::Channel, fields::qm31::SecureField},
6+
};
7+
8+
pub type MemoryComponent = FrameworkComponent<MemoryEval>;
9+
10+
#[allow(dead_code)]
11+
pub struct MemoryEval {
12+
log_size: u32,
13+
memory_lookup_elements: MemoryElements,
14+
claimed_sum: SecureField,
15+
}
16+
17+
impl MemoryEval {
18+
pub const fn new(
19+
claim: &MemoryClaim,
20+
memory_lookup_elements: MemoryElements,
21+
interaction_claim: &InteractionClaim,
22+
) -> Self {
23+
Self {
24+
log_size: claim.log_size,
25+
memory_lookup_elements,
26+
claimed_sum: interaction_claim.claimed_sum,
27+
}
28+
}
29+
}
30+
31+
impl FrameworkEval for MemoryEval {
32+
fn log_size(&self) -> u32 {
33+
self.log_size
34+
}
35+
36+
fn max_constraint_log_degree_bound(&self) -> u32 {
37+
self.log_size + 1
38+
}
39+
40+
fn evaluate<E: EvalAtRow>(&self, mut _eval: E) -> E {
41+
todo!()
42+
}
43+
}
244

345
/// The claim of the interaction phase 2 (with the logUp protocol).
446
///

0 commit comments

Comments
 (0)