Skip to content

Commit

Permalink
chore: add crate prefix to type_ids
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanpwang committed Nov 14, 2023
1 parent 70d6d8a commit 8e4fbc9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion halo2-base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ During `synthesize()`, the advice values of all `Context`s are concatenated into

For parallel witness generation, multiple `Context`s are created for each parallel operation. After parallel witness generation, these `Context`'s are combined to form a single "virtual column" as above. Note that while the witness generation can be multi-threaded, the ordering of the contents in each `Context`, and the order of the `Context`s themselves, must be deterministic.

**Warning:** If you create your own `Context` in a new virtual region not provided by our libraries, you must ensure that the `type_id: &str` of the context is a globally unique identifier for the virtual region, distinct from the other `type_id` strings used to identify other virtual regions. In the future we will introduce a macro to check this uniqueness at compile time.
**Warning:** If you create your own `Context` in a new virtual region not provided by our libraries, you must ensure that the `type_id: &str` of the context is a globally unique identifier for the virtual region, distinct from the other `type_id` strings used to identify other virtual regions. We suggest that you either include your crate name as a prefix in the `type_id` or use [`module_path!`](std::module_path) to generate a prefix.
In the future we will introduce a macro to check this uniqueness at compile time.

### [**AssignedValue**](./src/lib.rs):

Expand Down
6 changes: 3 additions & 3 deletions halo2-base/src/gates/flex_gate/threads/single_phase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ impl<F: ScalarField> SinglePhaseCoreManager<F> {
/// A distinct tag for this particular type of virtual manager, which is different for each phase.
pub fn type_of(&self) -> &'static str {
match self.phase {
0 => "SinglePhaseCoreManager: FirstPhase",
1 => "SinglePhaseCoreManager: SecondPhase",
2 => "SinglePhaseCoreManager: ThirdPhase",
0 => "halo2-base:SinglePhaseCoreManager:FirstPhase",
1 => "halo2-base:SinglePhaseCoreManager:SecondPhase",
2 => "halo2-base:SinglePhaseCoreManager:ThirdPhase",
_ => panic!("Unsupported phase"),
}
}
Expand Down
3 changes: 2 additions & 1 deletion halo2-base/src/virtual_region/copy_constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ impl<F: Field + Ord> CopyConstraintManager<F> {
}

fn load_external_cell_impl(&mut self, cell: Option<Cell>) -> ContextCell {
let context_cell = ContextCell::new("External Raw Halo2 Cell", 0, self.external_cell_count);
let context_cell =
ContextCell::new("halo2-base:External Raw Halo2 Cell", 0, self.external_cell_count);
self.external_cell_count += 1;
if let Some(cell) = cell {
self.assigned_advices.insert(context_cell, cell);
Expand Down

0 comments on commit 8e4fbc9

Please sign in to comment.