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

Bitwise chip: failure to satisfy input_2 byte decomposition constraint #130

Open
morganthomas opened this issue Mar 26, 2024 · 0 comments
Open
Assignees

Comments

@morganthomas
Copy link
Collaborator

morganthomas commented Mar 26, 2024

On several examples in the Valida LLVM compiler test suite, the trace fails to satisfy a particular constraint of the Bitwise chip, in alu_u32/src/bitwise/stark.rs:

builder.assert_eq(local.input_2[i], byte_2.clone());

For example, the following C file results in the failure in question when compiled by the Valida LLVM compiler:

int main() {
  int v1 = 4;
  int v2 = 5;
  int result = v1 >= v2;
  if (result) {
    while (1) {
    }
  }

  return 0;
}

This file compiles into the following assembly code:

IMM32 -8, 0, 0, 0, 0
JAL -4, 258, 0, 1, 1
IMM32 -8, 0, 0, 0, 14
JAL -10, 90, -14, 1, 1
STOP 0, 0, 0, 0, 0
JALV -4, 4, c, 0, 0
IMM32 -14, 0, 0, 0, 0
ADD32 -4, -14, 0, 0, 1
IMM32 -18, 0, 0, 0, 4
ADD32 -8, -18, 0, 0, 1
IMM32 -1c, 0, 0, 0, 5
ADD32 -c, -1c, 0, 0, 1
ADD32 -20, -8, 0, 0, 1
ADD32 -24, -c, 0, 0, 1
LTE32 -28, -24, -20, 0, 0
AND32 -2c, -28, 1, 0, 1
ADD32 -10, -2c, 0, 0, 1
ADD32 -30, -10, 0, 0, 1
BEQ 210, -30, 0, 0, 1
BEQ 1e0, 4, 4, 0, 0
BEQ 1f8, 4, 4, 0, 0
BEQ 1f8, 4, 4, 0, 0
IMM32 -34, 0, 0, 0, 0
ADD32 8, -34, 0, 0, 1
JALV -4, 4, c, 0, 0
IMM32 4, 0, 0, 0, 0
JALV 0, -4, -8, 0, 0

The following is the result of trying to prove an execution of this program:

Proof successful
thread 'main' panicked at /home/morgan/code/lita/issue/completeness/valida/basic/src/lib.rs:54:10:
Failed to verify constraints on chip 10: OodEvaluationMismatch

When the mentioned constraint is commented out, then proving succeeds and results in a verifiable proof of execution for this example.

Produce a minimal example which exhibits the issue. Fix the issue. Add a regression test to the test suite which verifies the proof of an execution of a minimal example which exhibits the issue.

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

No branches or pull requests

2 participants