Skip to content

Commit

Permalink
fix/#227 remove unused U1 lookup table (#289)
Browse files Browse the repository at this point in the history
Fixes last details of #227. Specifically, removes the unused `U1` lookup
table which appears to have been added to get `assert_bit` working
before `require_zero` was properly functioning.

---------

Co-authored-by: Bryan Gillespie <[email protected]>
Co-authored-by: naure <[email protected]>
  • Loading branch information
3 people authored Sep 27, 2024
1 parent 2916d6e commit 84098ef
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
9 changes: 7 additions & 2 deletions ceno_zkvm/src/chip_handler/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ impl<'a, E: ExtensionField> CircuitBuilder<'a, E> {
Ok(())
}

#[allow(dead_code)]
pub(crate) fn assert_bit<NR, N>(
&mut self,
name_fn: N,
Expand All @@ -253,7 +252,13 @@ impl<'a, E: ExtensionField> CircuitBuilder<'a, E> {
NR: Into<String>,
N: FnOnce() -> NR,
{
self.require_zero(name_fn, expr.clone() * (Expression::ONE - expr))
self.namespace(
|| "assert_bit",
|cb| {
cb.cs
.require_zero(name_fn, expr.clone() * (Expression::ONE - expr))
},
)
}

/// Assert `rom_type(a, b) = c` and that `a, b, c` are all bytes.
Expand Down
1 change: 0 additions & 1 deletion ceno_zkvm/src/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ pub type ChallengeId = u16;
#[derive(Copy, Clone, Debug)]
pub enum ROMType {
U5 = 0, // 2^5 = 32
U1, // TODO: optimize it
U8, // 2^8 = 256
U16, // 2^16 = 65,536
And, // a & b where a, b are bytes
Expand Down
9 changes: 0 additions & 9 deletions ceno_zkvm/src/tables/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ pub use range_circuit::{RangeTable, RangeTableCircuit};

use crate::structs::ROMType;

pub struct U1Table;
impl RangeTable for U1Table {
const ROM_TYPE: ROMType = ROMType::U1;
fn len() -> usize {
1 << 1
}
}
pub type U1TableCircuit<E> = RangeTableCircuit<E, U1Table>;

pub struct U5Table;
impl RangeTable for U5Table {
const ROM_TYPE: ROMType = ROMType::U5;
Expand Down
1 change: 0 additions & 1 deletion ceno_zkvm/src/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ impl LkMultiplicity {
16 => self.increment(ROMType::U16, v),
8 => self.increment(ROMType::U8, v),
5 => self.increment(ROMType::U5, v),
1 => self.increment(ROMType::U1, v),
_ => panic!("Unsupported bit range"),
}
}
Expand Down

0 comments on commit 84098ef

Please sign in to comment.