Skip to content

Commit

Permalink
chore: improve comments for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
enricobottazzi committed Jan 29, 2024
1 parent d6e85c9 commit 95d63fe
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Binary file removed zk_prover/prints/lt-check-layout.png
Binary file not shown.
Binary file removed zk_prover/prints/solvency-layout.png
Binary file not shown.
30 changes: 15 additions & 15 deletions zk_prover/src/chips/range/range_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@ pub struct RangeCheckConfig<const N_BYTES: usize> {
/// Helper chip that verifies that the value witnessed in a given cell lies within a given range defined by N_BYTES.
/// For example, Let's say we want to constraint 0x1f2f3f4f to be within the range N_BYTES=4.
///
/// `z(0) = 0x1f2f3f4f`
/// `z(1) = (0x1f2f3f4f - 0x4f) / 2^8 = 0x1f2f3f`
/// `z(2) = (0x1f2f3f - 0x3f) / 2^8 = 0x1f2f`
/// `z(3) = (0x1f2f - 0x2f) / 2^8 = 0x1f`
/// `z(4) = (0x1f - 0x1f) / 2^8 = 0x00`
/// * `z(0) = 0x1f2f3f4f`
/// * `z(1) = (0x1f2f3f4f - 0x4f) / 2^8 = 0x1f2f3f`
/// * `z(2) = (0x1f2f3f - 0x3f) / 2^8 = 0x1f2f`
/// * `z(3) = (0x1f2f - 0x2f) / 2^8 = 0x1f`
/// * `z(4) = (0x1f - 0x1f) / 2^8 = 0x00`
///
/// | | z |
/// | --- | ---------- |
/// | 0 | 0x1f2f3f4f |
/// | 1 | 0x1f2f3f |
/// | 2 | 0x1f2f |
/// | 3 | 0x1f |
/// | 4 | 0x00 |
/// | | `z` |
/// | ------------ | -------------|
/// | 0 | `0x1f2f3f4f` |
/// | 1 | `0x1f2f3f` |
/// | 2 | `0x1f2f` |
/// | 3 | `0x1f` |
/// | 4 | `0x00` |
///
/// The column z contains the witnessed value to be checked at offset 0
/// At offset i, the column z contains the value z(i+1) = (z(i) - k(i)) / 2^8 (shift right by 8 bits) where k(i) is the i-th decomposition big-endian of `value`
/// At offset i, the column z contains the value `z(i+1) = (z(i) - k(i)) / 2^8` (shift right by 8 bits) where k(i) is the i-th decomposition big-endian of `value`
/// The constraints that are enforced are:
/// - z(i) - 2^8⋅z(i+1) ∈ lookup_u8_table (enabled by lookup_enable_selector at offset [0, N_BYTES - 1])
/// - z(N_BYTES) == 0
/// * `z(i) - 2^8⋅z(i+1) ∈ lookup_u8_table` (enabled by lookup_enable_selector at offset [0, N_BYTES - 1])
/// * `z(N_BYTES) == 0`
#[derive(Debug, Clone)]
pub struct RangeCheckChip<const N_BYTES: usize> {
config: RangeCheckConfig<N_BYTES>,
Expand Down

0 comments on commit 95d63fe

Please sign in to comment.