This repository has been archived by the owner on Jul 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 857
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
copy-fix-terminate: enforce secure termination of the copy circuit (#…
…1568) ### Description This PR fixes two soundness issues in the Copy circuit. 1. There are a number of checks at the end of an event when is_last=1. However, there are no guarantees that this last row exists. The last event may not be checked fully. 2. The constraints may query cells of the "last two rows", whose content is not constrained. For example, booleans are not necessarily booleans there. ### Type of change - [x] Bug fix (non-breaking change which fixes an issue) ### Content This is a backport from Scroll, see more details here: scroll-tech#649. Quoting: The new constraint constrain_must_terminate guarantees that: - a "last row" is eventually reached so that final checks happen, - and every row of an event can safely query rotations 1 and 2. Now to witness generation. There must be two additional rows that are enabled so their content is verified, but not used because they touch disabled rows. See UNUSED_ROWS. Note that there was already a sanity check that no constraints query reserved rows with the error `active on an unusable row - missing selector?`. Rows can be reserved for blinding, or beyond max_rows, or simply to avoid wrap around back to the first row. This check was satisfied by adding two disabled rows (see assign_padding_row(…)). However, this alone was not sound. ### How Has This Been Tested? cargo test --release -p zkevm-circuits -p zkevm-circuits -- copy Co-authored-by: Aurélien Nicolas <info@nau.re>
- Loading branch information
Showing
3 changed files
with
67 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters