-
Notifications
You must be signed in to change notification settings - Fork 315
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
refactor(storage-proofs): make base and expansion parents compile time constants #791
Conversation
6eae31a
to
67a249a
Compare
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.
Personally, I think these should still be public parameters. Just because we want to make them constants as a compile-time optimization doesn't mean that has to change. I would rather see them remain public parameters with a run-time check that the compiled constants agree with the public parameters.
In general, I'm okay with these optimizations, but it would be better to make them in a way which preserves the flexible structure of the proofs, wherever possible. Doing as I suggest here would make clear that making these global constants is an optimization. This will allow public parameters to retain their status as the the sole source of theoretically adjustable parameters to the proof construction.
+1 to that, not very impactful to my work but i usually reduce the |
This will not be possible if we want to get the performance improvements in from r2 (except for changing the compile time constants). What @porcuquine is suggesting, simply enforces recording the values in the circuits |
At least that is how I understand the comment. Anything else is not really possible, if we want to get the improved hashing and use arrays. |
@dignifiedquire Not just in the circuits, but as public parameters for the proofs generally, including circuits. @schomatis Your use case could perhaps be accomplished by creating a compile-time feature flag for reduced/fast parameters in development mode. |
@porcuquine I disagree with that, this makes dev life harder, without providing real benefits.
…On 27. Aug 2019, 00:45 +0200, porcuquine ***@***.***>, wrote:
@dignifiedquire Not just in the circuits, but as public parameters for the proofs generally, including circuits.
@schomatis Your use case could perhaps be accomplished by creating a compile-time feature flag for reduced/fast parameters in development mode.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I don't think having well-defined public parameters distinct from constants in the code is 'without real benefits'. How does this make devs life harder? |
understood, then +1 to this |
@porcuquine we need to be able to write things like To make sure we can change things we should have a second set of constants for tests and debugging, which can be switched to by using a feature flag. |
@dignifiedquire I understand what you are trying to accomplish and why. I accept that this may be the easiest way to do so for now, also. I don't agree that retaining the public parameters as such would be 'just for show', though. I believe that these parameters have semantic meaning at the protocol level, and that they should not be changed as the side effect of an optimization we want to perform. Having well-defined parameters will help with connecting implementation, specification, and ubercalc. It's also not clear to me that we need to remove the parameters from the circuits. This makes them much less useful as proof-construction building blocks or as reference implementations. Retaining the existing parameter structure would make it easier to retain them and make this a smaller change set. Do you believe that converting to constants in the circuits provides a significant performance benefit when synthesizing them? Because it does come at a price. |
alright, I talked with @porcuquine about this and we have come to the following agreement:
|
@dignifiedquire ok, sounds good |
130352d
to
1deaebf
Compare
Can the default values of the rust-fil-proofs/filecoin-proofs/examples/zigzag.rs Lines 407 to 419 in d07e03a
|
@schomatis yup, np |
f48a876
to
6a794d3
Compare
813fc86
to
dc8cf84
Compare
The requested changes are out of date with the PR (but the requested changes have been made)
@@ -84,6 +85,11 @@ impl<'a, H: Hasher> Circuit<Bls12> for ZigZagCircuit<'a, Bls12, H> { | |||
let graph = &self.public_params.graph; | |||
let layer_challenges = &self.public_params.layer_challenges; | |||
|
|||
if !cfg!(feature = "allow-small-degree") { | |||
assert_eq!(graph.base_graph().degree(), BASE_DEGREE); |
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 should validate this in the base graph as well
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.
@dignifiedquire ok, I added degree validation to ZigZagBucketGraph
's and BucketGraph
's constructors and changed all the places in the tests where BucketGraph
was being instantiated with a degree not equal to BASE_DEGREE
.
f46e32a
to
c12390a
Compare
5c3eb94
to
fa695fb
Compare
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.
lgtm,
This is the first step to pulling in optimizations from r2.
Important changes:
allow-small-degree
which allows graphs to be constructed with base and expansion degrees smaller than 5 and 8 respectively. This feature is enabled in the CI for the ignoredstorage-proofs
tests.