Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
use PACKED_PLACEHOLDER_BITMASK constant instead of raw value (#20)
Browse files Browse the repository at this point in the history
# What ❔

This PR replaces raw values with the PACKED_PLACEHOLDER_BITMASK
constant.

## Why ❔

Improves code quality .

## Checklist

- [x] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [x] Tests for the changes have been added / updated.
- [x] Code has been formatted via `cargo fmt` and checked with `cargo
check`.
  • Loading branch information
robik75 authored Dec 20, 2023
1 parent eb816c1 commit e8f0393
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub fn gpu_prove_from_external_witness_data<
{
let variable_idx = setup.variables_hint[col][row].clone() as usize;
assert_eq!(
variable_idx & (1 << 31),
variable_idx & (PACKED_PLACEHOLDER_BITMASK as usize),
0,
"placeholder found in a public input location"
);
Expand Down
4 changes: 3 additions & 1 deletion src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,11 +747,13 @@ mod zksync {

use super::*;

use crate::cs::PACKED_PLACEHOLDER_BITMASK;
use boojum::cs::implementations::fast_serialization::MemcopySerializable;
use circuit_definitions::{
aux_definitions::witness_oracle::VmWitnessOracle,
circuit_definitions::base_layer::ZkSyncBaseLayerCircuit, ZkSyncDefaultRoundFunction,
};

pub type ZksyncProof = Proof<F, DefaultTreeHasher, GoldilocksExt2>;

const TEST_DATA_ROOT_DIR: &str = "./test_data";
Expand Down Expand Up @@ -1213,7 +1215,7 @@ mod zksync {
)
.expect("gpu setup");
witness.public_inputs_locations = vec![(0, 0)];
gpu_setup.variables_hint[0][0] = 1 << 31;
gpu_setup.variables_hint[0][0] = PACKED_PLACEHOLDER_BITMASK;
let _ = gpu_prove_from_external_witness_data::<
_,
DefaultTranscript,
Expand Down

0 comments on commit e8f0393

Please sign in to comment.