Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Witness generation for block machines connected via permutations #1075

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

georgwiese
Copy link
Collaborator

@georgwiese georgwiese commented Feb 20, 2024

Fixes #1074

This PR introduces the following changes:

  • Changes to machine detection so that block machines that are connected via permutations are also detected. This is a bit tricky, because it's not as obvious which column is the latch column, as it's not necessarily used in the RHS permutation selector expression.
  • In Processor::process_outer_query(), we make sure that the selectors in the latch row are set to 1. This does nothing if the selector is a fixed column, but if it is a witness column, it would be set to 1.
  • For the dummy block, we need to make sure that the selectors are set to 0. Furthermore, other cells in the block might depend on the selector value (see [Prototype] Machines communicating through shared memory #1071 for a working example). We do this by:
    • Setting all selectors to 0 in the latch row
    • Running the full block processor to determine other cells which depend on the selector value
    • As before, we fill unknown cells with values of the first real block

@georgwiese georgwiese changed the base branch from main to no-default-block February 21, 2024 08:47
@georgwiese georgwiese force-pushed the no-default-block branch 2 times, most recently from 1c5c0c9 to fdfdc79 Compare February 21, 2024 09:58
Base automatically changed from no-default-block to main February 21, 2024 13:09
@georgwiese georgwiese force-pushed the block-machine-permutation branch 2 times, most recently from ed61d06 to 7d58195 Compare February 22, 2024 14:36
@georgwiese georgwiese changed the base branch from main to dont-log-errors February 22, 2024 14:37
Base automatically changed from dont-log-errors to main February 23, 2024 11:37
Comment on lines +208 to +215
.map(|s| {
current_rows
.evaluate(s)
.ok()
.and_then(|affine_expression| affine_expression.constant_value())
.ok_or(EvalError::Generic("Selector is not 1!".to_string()))
})
.unwrap_or(Ok(T::one()))?;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns a panic into an error. This happens in the block_lookup_or_permutation test:

  • A block is computed by a permutation using selector2
  • A loop is detected
  • When checking the next identity using selector1, process_link() on the last row. But selector1 is unknown at this point.
  • The error is caught by the loop detection code and the executor reverts to the normal solving algorithm.

@georgwiese georgwiese changed the title [WIP] Witness generation for block machines connected via permutations Witness generation for block machines connected via permutations Feb 23, 2024
@georgwiese georgwiese marked this pull request as ready for review February 23, 2024 16:37
@chriseth chriseth added this pull request to the merge queue Feb 29, 2024
Merged via the queue into main with commit 2a04e6a Feb 29, 2024
5 checks passed
@chriseth chriseth deleted the block-machine-permutation branch February 29, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Witness generation for machines being connected via permutations
2 participants