-
Notifications
You must be signed in to change notification settings - Fork 575
chore: audit databus - small cleanups and tests coverage #16703
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
Conversation
| w_value = index.get_value(); | ||
| value.assert_equal(calldata_array[index]); | ||
| if (!has_valid_witness_assignments) { | ||
| index.is_zero(); |
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.
Do we actually need to do this? This if is only reached when mocking. We were already checking that the index value is zero with the copy constraint. But if it's only in mock cases, do we need to assert it's zero in circuit? I think the change I made causes issues because the mock would have an extra gate, so probably vk generation will be wrong
ledwards2225
left a comment
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.
LG!
| if (has_valid_witness_assignments) { | ||
| // If witness are assigned, we use the correct value for w | ||
| w_value = index.get_value(); | ||
|
|
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.
much better! can you update the comment to say why this is done?
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.
there's a comment inside the if. but will add some extra explanation
| * @brief An expository test demonstrating the functionality of the databus in a small use case when the entries are | ||
| * constant witnesses | ||
| */ | ||
| TEST(Databus, ConstantEntryAccess) |
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.
what happens if the read indices are constant witnesses?
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.
handled in another test. I chucked both cases for the indices in the same test.
| * @brief An expository test demonstrating the functionality of the databus in a small use case where the indices are | ||
| * constant and/or unnormalized | ||
| */ | ||
| TEST(Databus, ConstantAndUnnormalizedIndices) |
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.
ah!
…6703) a small PR doing the following as a part of the `databus` audit - added tests to check the handling of constant or unnormalized indexes - removed some ugliness with dangling witnesses and replaced them with `set_variable` - some minor cleanups
…6703) a small PR doing the following as a part of the `databus` audit - added tests to check the handling of constant or unnormalized indexes - removed some ugliness with dangling witnesses and replaced them with `set_variable` - some minor cleanups
a small PR doing the following as a part of the
databusauditset_variable