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

Commit

Permalink
fix: Add empty row in MPT table to prevent testing panics
Browse files Browse the repository at this point in the history
As pointed by @lispc in
#1024 (comment),
Halo2 currently has a bug which prevents it to render correctly the
errors for an empty region with a `ConstraintError` on it.

An issue has been filled for this so that we can fix it in
privacy-scaling-explorations/halo2#117.

Meanwhile a new tag is not released for Halo2 with a fix, this fix will
temporarily be needed and a reminder to remove it has been created in #1032
  • Loading branch information
CPerezz committed Jan 5, 2023
1 parent 8b597b3 commit 78e3bac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion zkevm-circuits/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,9 @@ impl MptTable {
updates: &MptUpdates,
randomness: Value<F>,
) -> Result<(), Error> {
self.assign(region, 0, &MptUpdateRow([Value::known(F::zero()); 7]))?;
for (offset, row) in updates.table_assignments(randomness).iter().enumerate() {
self.assign(region, offset, row)?;
self.assign(region, offset + 1, row)?;
}
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion zkevm-circuits/src/witness/mpt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub struct MptUpdates(HashMap<Key, MptUpdate>);

/// The field element encoding of an MPT update, which is used by the MptTable
#[derive(Debug, Clone, Copy)]
pub struct MptUpdateRow<F>([F; 7]);
pub struct MptUpdateRow<F>(pub(crate) [F; 7]);

impl MptUpdates {
pub(crate) fn get(&self, row: &Rw) -> Option<MptUpdate> {
Expand Down

0 comments on commit 78e3bac

Please sign in to comment.