Skip to content
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

pass configurable window_size to jubjub #783

Merged
merged 1 commit into from
Aug 7, 2019

Conversation

sidke
Copy link
Contributor

@sidke sidke commented Aug 5, 2019

What's in this PR?

  • loads a new setting in from the environment or configuration
  • uses the new window size setting when instantiating JubjubBls12

resolves #736

porcuquine
porcuquine previously approved these changes Aug 5, 2019
Copy link
Collaborator

@porcuquine porcuquine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I have one comment which is not blocking for this PR, but is important for benchmarks in general. It might be better if addressed here and now. So consider semi-blocking, pending @laser's call either way.

.unwrap()
.pedersen_hash_exp_window_size;
let jubjub_params = JubjubBls12::new_with_window_size(window_size);
let jubjub_params2 = JubjubBls12::new_with_window_size(window_size);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's weird that we need to do this, and I suspect it skews our view of memory consumption in such a benchmark (cc: @laser).

Context reminder: the larger the window size, the faster the hash but the (exponentially) larger the cache. Allocating two instances of Jubjub parameters will allocate double the cache. If we don't account for that, we might make bad judgments about the optimal window size. Can we make sure this issue is accounted for when providing memory-consumption stats for micro-benchmarks?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not measure memory consumption for micro benchmarks at all. They are neither written in a way that makes sense, nor are we set up for that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not measure memory consumption for micro benchmarks at all.

That is correct.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it's a non-issue, thanks.

@sidke sidke force-pushed the features/configurable-window-size branch 2 times, most recently from c015159 to d82de5a Compare August 5, 2019 23:16
dignifiedquire
dignifiedquire previously approved these changes Aug 6, 2019
Copy link
Contributor

@dignifiedquire dignifiedquire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works, but would like to see a little less duplicated code

let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);

let cases = [(32, 689), (64, 1376)];

for (bytes, constraints) in &cases {
let mut cs = TestConstraintSystem::<Bls12>::new();
let data: Vec<u8> = (0..*bytes).map(|_| rng.gen()).collect();
let params = &JubjubBls12::new();
let params = &JubjubBls12::new_with_window_size(window_size);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of having the settings code + the new_with_window_size how about a single method in storage-proofs like new_jubjub_bls12_current_window_size, that does the work for us?

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.

Make Pedersen hash window_size configurable
4 participants