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

Option::unwrap() crash for byte@prove in Perspective #186

Open
DavePearce opened this issue Jun 10, 2024 · 1 comment
Open

Option::unwrap() crash for byte@prove in Perspective #186

DavePearce opened this issue Jun 10, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@DavePearce
Copy link
Collaborator

DavePearce commented Jun 10, 2024

(see also #185)

Minimal test for reproduction:

(module test)
(defcolumns (P1 :binary@prove) (P2 :binary@prove))
(defperspective p1 P1 ((A :byte@prove)))
(defperspective p2 P2 ((B :byte@prove)))
(defconstraint c1 (:perspective p1) (eq! A 10))

Then the command corset wizard-iop test.lisp gives:

thread 'main' panicked at src/exporters/wizardiop.rs:51:44:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Observe that, if say B is marked only :byte then we get this output:

test__A_xor_B := build.RegisterCommit("test.A_xor_B", build.Settings.Traces.Test)
test__P1 := build.RegisterCommit("test.P1", build.Settings.Traces.Test)
test__P2 := build.RegisterCommit("test.P2", build.Settings.Traces.Test)

build.Range("test_a_arbitrary", test__A_xor_B, 256)
build.GlobalConstraint("test.P1-binarity", test__P1.AsVariable().Mul(symbolic.NewConstant("1").Sub(test__P1.AsVariable())))
build.GlobalConstraint("test.P2-binarity", test__P2.AsVariable().Mul(symbolic.NewConstant("1").Sub(test__P2.AsVariable())))
build.GlobalConstraint("test.c1", test__P1.AsVariable().Mul(test__A_xor_B.AsVariable().Sub(symbolic.NewConstant("10"))))

Curious, though its presumably arising because its trying to create two occurrences of build.Range("test_a_arbitrary", test__A_xor_B, 256)

@DavePearce DavePearce added the bug Something isn't working label Jun 10, 2024
@delehef
Copy link
Contributor

delehef commented Jun 10, 2024

though its presumably arising because its trying to create two occurrences of build.Range("test_a_arbitrary", test__A_xor_B, 256)

That's because it's currently iterating over columns, whereas it should iterate over registers :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants