Skip to content

Commit 9802829

Browse files
committed
fix: add more constraints to the cpu chip
1 parent 70fa8b5 commit 9802829

File tree

7 files changed

+11
-8
lines changed

7 files changed

+11
-8
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@v4
20-
- uses: dtolnay/rust-toolchain@stable
20+
- uses: dtolnay/rust-toolchain@nightly
2121
with:
2222
components: rustfmt
2323
- run: cargo fmt --all -- --check

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2023 felicityin
3+
Copyright (c) 2025 felicityin
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> This repo is inspired by [SP1](https://github.com/succinctlabs/sp1) and [zkMIPS](https://github.com/zkMIPS/zkMIPS).
44
5-
zkvm-brainfuck is a ZK-VM for the Brainfuck language.
5+
zkvm-brainfuck is a ZK-VM for the Brainfuck language, built on [Plonky3](https://github.com/Plonky3/Plonky3).
66

77
- Designed as a register machine instead of a stack machine with RAM.
88
- Compared to SP1, this system employs a single shard and produces only core proofs.

crates/core/machine/src/alu/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ use crate::utils::{next_power_of_two, zeroed_f_vec};
1919
/// The number of main trace columns for `AddSubChip`.
2020
pub const NUM_ADD_SUB_COLS: usize = size_of::<AddSubCols<u8>>();
2121

22+
#[derive(Default)]
23+
pub struct AddSubChip;
24+
2225
/// The column layout for the chip.
2326
#[derive(AlignedBorrow, Default, Clone, Copy)]
2427
#[repr(C)]
@@ -190,9 +193,6 @@ where
190193
}
191194
}
192195

193-
#[derive(Default)]
194-
pub struct AddSubChip;
195-
196196
#[cfg(test)]
197197
mod tests {
198198
use p3_koala_bear::KoalaBear;

crates/core/machine/src/cpu/air.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ where
5757
builder.assert_bool(local.is_memory_instr);
5858
builder.assert_bool(local.is_io);
5959
builder.assert_bool(local.is_mv_immutable);
60+
builder.assert_bool(local.mv_accessed);
61+
builder.assert_bool(local.next_mv_accessed);
6062
}
6163
}
6264

crates/core/machine/src/utils/prove.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ where
3636
// Setup the runtime.
3737
let mut runtime = Executor::new(program, input);
3838

39+
// Execute the program to collect trace events.
3940
runtime.run().map_err(BfCoreProverError::ExecutionError)?;
4041

4142
// Prove the program.

crates/derive/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ pub fn machine_air_derive(input: TokenStream) -> TokenStream {
266266

267267
let mut new_generics = generics.clone();
268268
let where_clause = new_generics.make_where_clause();
269-
if eval_trait_bound.is_some() {
270-
let predicate: WherePredicate = syn::parse_str(&eval_trait_bound.unwrap()).unwrap();
269+
if let Some(eval_trait_bound) = eval_trait_bound {
270+
let predicate: WherePredicate = syn::parse_str(&eval_trait_bound).unwrap();
271271
where_clause.predicates.push(predicate);
272272
}
273273

0 commit comments

Comments
 (0)