-
Notifications
You must be signed in to change notification settings - Fork 130
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
Deterministic tests #349
Deterministic tests #349
Conversation
57e333a
to
9ea833d
Compare
9ea833d
to
b245fba
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #349 +/- ##
==========================================
- Coverage 82.09% 82.06% -0.03%
==========================================
Files 83 84 +1
Lines 17228 17243 +15
==========================================
+ Hits 14143 14151 +8
- Misses 3085 3092 +7 ☔ View full report in Codecov by Sentry. |
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.
I am not sure about the change in the PCS. Particularly, the addition of a rng parameter in new
.
Seems like IPA doesn't use it and KZG keeps using OsRng.
I wonder if there is a cleaner way to get deterministic params for the tests. What do you think about leaving new
as is, and adding a function that generates some fixed kzg parameters for testing?
…into feat/deterministic1
Sure, a good option, there's the |
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.
Overall looks good to me! Left a few comments to discuss.
cost-estimator = ["halo2_frontend/cost-estimator"] | ||
derive_serde = ["halo2curves/derive_serde", "halo2_frontend/derive_serde", "halo2_backend/derive_serde"] | ||
vector-tests = [] |
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.
We need to make sure this feature is enabled on test in the CI (this way we can detect the PRs that change the proof output). Is this the case?
If not, maybe we can add vector-tests
as a default feature?
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.
I think that this can be removed at all now, just keeping not(coverage)
, let's me check again.
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.
@ed255 the main point here is that results can differ when turning some features (like circuit-params
), so we want a feature that is only activated when we test it with --all-features
. I keep it as is.
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.
I see, but then we're not testing this in the CI. We're only testing these sets of features:
batch,dev-graph,gadget-traces
batch,dev-graph,gadget-traces,test-dev-graph,thread-safe-region,sanity-checks,circuit-params
I think we should have a job in the CI that runs the tests with vector-tests
enabled.
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.
Another option is to change the "all features" in CI to --all-features instead "--features batch,dev-graph,gadget-traces,test-dev-graph,thread-safe-region,sanity-checks,circuit-params". Not sure, testing with --all-features
is more straighforward that specifying them manually if there's no conflicting options.
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.
Just a small nit. LGTM!
halo2_proofs/tests/serialization.rs
Outdated
@@ -170,7 +173,7 @@ fn test_serialization() { | |||
&pk, | |||
&[circuit], | |||
instances.as_slice(), | |||
OsRng, | |||
test_rng(), |
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.
should we have &mut rng
here instead of re-initializing with test_rng()
?
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.
Just a cosmetic thing, IMO.
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, that's my point! It's not the same thing, the function call resets the rng, not sure if it is important though.
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.
So, you say that if some random in the protocol is the same that tau (SRS's one) could lead to some kind of weakness in tests?
Edit: I would say "cosmetic" in the sense that does adds/removes any property from the test.
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.
I would say that "cosmetically" passing rng
(or &mut rng
) fits better as it's the same pattern used in the other tests.
c8d0398
to
3c60786
Compare
b2f305d
to
9f1e7d4
Compare
9f1e7d4
to
d4cf60b
Compare
@ed255 recheck again plz. Happened that with multithreading we get different results with OsX and Linux, so I limited the number of threads and fixed the CI. |
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.
Just a small suggestion for the documentation of test_result
but otherwise LGTM!
Co-authored-by: Eduard S. <[email protected]>
heap-profiling
feature (that is activated with --all-features)vector-tests
, note that the main idea here is that this feature is activated via--all-features
so the vector tests are specific to--all-features