Skip to content

Fix 'Can only multiply linear terms' error#6

Closed
vezenovm wants to merge 3 commits intomv/squeezefrom
mv/fix-xor-ops
Closed

Fix 'Can only multiply linear terms' error#6
vezenovm wants to merge 3 commits intomv/squeezefrom
mv/fix-xor-ops

Conversation

@vezenovm
Copy link
Copy Markdown
Collaborator

@vezenovm vezenovm commented Nov 10, 2022

So after a little more debugging it looks like we only compute the XOR directly during ACIR generation when the bit size is 1. If either the left hand side or the right hand side of the XOR op is found to be non-linear we fail with this error. Otherwise, we simply generate witnesses for the respective expressions and result to create an XOR gate. This XOR gate is then later solved by the PartialWitnessGenerator which uses our noir_field methods and fills in the witnesses.

To show a quick fix, I simply changed all the arrays from using u1 values to using u2 values. Perhaps with this change, as well as the heavy number of additional constraints from working with bit arrays, it may be worth it to consider switching to using u64s sooner rather than later. However, rather than making large changes it may be worth it to just merge this up, test further with the current code, and make sure it correct. Then can worry about optimizing the algorithm later.

I was not able to generate a successful proof yet with these changes, but I can compile the circuit. I am building off of this PR.

@TomAFrench
Copy link
Copy Markdown
Owner

Thanks for hunting down the cause of this error. I'm going to close this PR for the reasons mentioned in #4

@TomAFrench TomAFrench closed this Nov 10, 2022
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.

2 participants