-
Notifications
You must be signed in to change notification settings - Fork 0
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
remove var usage in lock header #29
Conversation
@@ -101,13 +103,13 @@ template FirstStringMatch(dataLen, maxKeyLen) { | |||
stringMatch[idx] = IsEqualArray(maxKeyLen); | |||
stringMatch[idx].in[0] <== key; | |||
for (var key_idx = 0 ; key_idx < maxKeyLen ; key_idx++) { | |||
isFirstMatchAndInsideBound[idx * maxKeyLen + key_idx] <== (1 - matched) * (1 - isKeyOutOfBounds[key_idx]); | |||
isFirstMatchAndInsideBound[idx * maxKeyLen + key_idx] <== (1 - isMatched[idx]) * (1 - isKeyOutOfBounds[key_idx]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@0xJepsen circom doesn't like updating a signal using an already updating var
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very strange
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so counter intuitive but honestly amazing that it works and reduces size by so much.
Okay i don't want to merge this without running CI and rebuilding the right artifacts. But i do think we should build artifacts with these new perf gains asap. |
LFG, we spin green to win |
closes #30
reduces r1cs file size for
http_lock_header
circuit from 1.93G to 43MB by removing var usage inFirstStringMatch
template.Note: this doesn't happen with all
vars
, as can be noted here, only happening for iteratingvar
accessed again in a separate signal/var.