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

New BLS12 hash function M1 #376

Merged
merged 10 commits into from
Aug 30, 2022
Merged

New BLS12 hash function M1 #376

merged 10 commits into from
Aug 30, 2022

Conversation

Dimitri-Koshelev
Copy link
Contributor

@Dimitri-Koshelev Dimitri-Koshelev commented Feb 28, 2022

Milestone Delivery Checklist

Link to the application pull request: w3f/Grants-Program#825
Amendment: w3f/Grants-Program#966

@alxs alxs self-assigned this Feb 28, 2022
Copy link
Contributor

@alxs alxs left a comment

Choose a reason for hiding this comment

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

Thanks for the delivery @dishport, that was quick! Could you please:

  • List all the deliverables you included in the application.
  • Submit an amendment, i.e. a PR to update the original file, adding a payment address.
  • Submit an invoice.
  • Provide the documentation on the hash function in a readable format. There are hacks to render formulas in GitHub markdown, otherwise feel free to link to a HackMD.
  • Also provide some documentation on the implementation.
  • Deliver unit tests as per your application.

Let me know if you have any questions.

@Dimitri-Koshelev
Copy link
Contributor Author

@alxs, I added the necessary information except for the payment address and invoice. Could I fill these data after the milestone is accepted by evaluators?

@alxs
Copy link
Contributor

alxs commented Mar 1, 2022

As you wish. Could you refer to the last 3 points in my last comment?

@Dimitri-Koshelev
Copy link
Contributor Author

Dimitri-Koshelev commented Mar 1, 2022

Please answer the following questions or give some remarks. This is my first milestone delivery, so excuse me for my stupidity.

Provide the documentation on the hash function in a readable format.

I added the link to my published article. Is it regarded as a documentation of a readable format?

There are hacks to render formulas in GitHub markdown, otherwise feel free to link to a HackMD.

I don't understand what it is.

Also provide some documentation on the implementation.

What is the difference between this and the first point? I provided inline documentation on the implementation. Is it sufficient ?

Deliver unit tests as per your application.

My application doesn't contain units, because the implementation is compact.

@alxs
Copy link
Contributor

alxs commented Mar 1, 2022

Of course @dishport, no worries. Documentation in a readable format means anyone who opens your project will know what it's about. You can add a README file to your repository with some information about it like you have your .doc file now. That file however shouldn't be on GitHub since it needs to be downloaded first in order to be read.

The markdown version GitHub uses doesn't render math formulas by default, which is why I was suggesting you create some documentation on HackMD and link to it from your README.

Keep in mind your article is behind a paywall, so you shouldn't assume everyone has access to it.

Don't worry about the difference between documentation on the hash function and the implementation.

@burdges will review your code. I leave it up to him to decide whether unit tests are needed or not.

@alxs alxs requested a review from burdges March 1, 2022 14:31
@Dimitri-Koshelev
Copy link
Contributor Author

Keep in mind your article is behind a paywall, so you shouldn't assume everyone has access to it.

I included the link to free eprint version, where all math formulas have already been clearly explained.

@alxs
Copy link
Contributor

alxs commented Mar 2, 2022

@dishport and yet anyone who finds your repository will have no idea what it contains. The only person who will see the link you just added is me, but we're trying to make your delivery accessible to the open-source community. Again, please refer to my last message.

Also could you please move the delivery file to its proper location in the deliveries folder?

@drskalman
Copy link
Contributor

@alxs I'll review this. could point me to the code. I can't somehow find it easily.

@alxs
Copy link
Contributor

alxs commented Mar 2, 2022

Great. Here's the repository and this is @dishport's delivery file.

Copy link
Collaborator

@Noc2 Noc2 left a comment

Choose a reason for hiding this comment

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

@Dimitri-Koshelev
Copy link
Contributor Author

@Noc2, I added.

@drskalman drskalman self-requested a review March 9, 2022 20:41
@alxs
Copy link
Contributor

alxs commented Mar 18, 2022

Hey @dishport, @drskalman just submitted his evaluation of your delivery here. Could you please address his comments and get back to him when you're done? You can keep the conversation on this PR. Let us know if you have any questions.

@ashlink11 ashlink11 self-assigned this Mar 24, 2022
@alxs alxs removed their assignment Mar 24, 2022
Noc2 added a commit that referenced this pull request Apr 29, 2022
@Noc2
Copy link
Collaborator

Noc2 commented Apr 29, 2022

@dishport and @drskalman It’s usually easier to keep the conversation on the PR of the original delivery. Sorry that I replied to the other PRs myself. Maybe we should just continue here. (#398 (review))

@alxs alxs added the on hold label May 24, 2022
@drskalman
Copy link
Contributor

@dishport could you please commit your changes to the test and push it to your repo? I'll take it from there. Thanks a lot.

@Dimitri-Koshelev
Copy link
Contributor Author

@dishport could you please commit your changes to the test and push it to your repo? I'll take it from there. Thanks a lot.

@drskalman, you can find the changed code on the link https://disk.yandex.ru/d/RuqWxbUx_qrhWw
I don't want to push this code to my GitHub repo, because this is a draft, not the original version.

@drskalman
Copy link
Contributor

drskalman commented Aug 9, 2022

I see what went wrong.

You shouldn't really use global variables. It renders the code unreusable (as it did for me): https://softwareengineering.stackexchange.com/questions/148108/why-is-global-state-so-evil

I moved the tests to their own unit test class so they don't interfere with the global state. I also add @noglobal decorators to prevent the use of global variables in your functions:

w3f-grants-archive/Indifferentiable-hashing-to-ordinary-elliptic-curves-of-j-0-with-the-cost-of-one-exponentiation@ba93ab2

Please modify the code so it passes the tests without the use of global variables. You could make a pull request to our repo if you wish not to modify your own, so I can verify the code successfully passes the test or review and comment on the pr.

Thanks a lot.

@Dimitri-Koshelev
Copy link
Contributor Author

I moved the tests to their own unit test class so they don't interfere with the global state. I also add @noglobal decorators to prevent the use of global variables in your functions:

w3f-grants-archive/Indifferentiable-hashing-to-ordinary-elliptic-curves-of-j-0-with-the-cost-of-one-exponentiation@ba93ab2

Please modify the code so it passes the tests without the use of global variables.

@drskalman, thank you for your work. However, I don't understand what exactly I have to write, because I don't know how to use unittest. Why don't you finish testing yourself if you started doing it? The use of professional testing tools is not included in Milestone 1 according to the new grant proposal. Thorough testing (in Rust) was moved to Milestone 2.

@drskalman
Copy link
Contributor

The test are for me to evaluate your code and see if the delivery does what is supposed to do. I moved them out, in case you find them confusing.

What you need to do, is not to use global variables. I moved every thing global in your original submission to main function.

Could you please edit this code so it runs without error and without using global variables:

https://github.com/w3f-grants-archive/Indifferentiable-hashing-to-ordinary-elliptic-curves-of-j-0-with-the-cost-of-one-exponentiation/blob/no-test-prohibt-global-vars/Indifferentiable%20hashing%20with%20the%20cost%20of%20one%20exponentiation.sage

For example, it currently results in this error:

...
  File "~/Indifferentiable-hashing-to-ordinary-elliptic-curves-of-j-0-with-the-cost-of-one-exponentiation/Indifferentiable hashing with the cost of one exponentiation.sage.py", line 212, in H
    t1,t2 = eta(s)

  File "~/Indifferentiable-hashing-to-ordinary-elliptic-curves-of-j-0-with-the-cost-of-one-exponentiation/Indifferentiable hashing with the cost of one exponentiation.sage.py", line 204, in eta
    return Fq(hash0), Fq(hash1)
NameError: name 'Fq' is not defined

If you want to use Fq in eta function you need to provide it as a parameter (like s) not as a global variable. (otherwise your code doesn't pass the tests as you saw).

Thanks!

@Dimitri-Koshelev
Copy link
Contributor Author

@drskalman, I edited the code. Please find it on the link https://disk.yandex.ru/d/es_kKJbm0bssGA

@ashlink11
Copy link
Contributor

@dishport Thank you for editing the code. I haven't had a look yet, but I agree with @drskalman strongly about the global variables point. Much of the point of Rust is memory safety and much of the paradigm of memory safety is ownership and I think global variables should be used exceedingly sparingly in the spirit of ownership. Thanks!

@drskalman
Copy link
Contributor

@drskalman, I edited the code. Please find it on the link https://disk.yandex.ru/d/es_kKJbm0bssGA

Thanks! could you make a pull request against my branch so I don't need to re-read the whole thing, get a diff and be able to comment on it? thank you very much.

@Dimitri-Koshelev
Copy link
Contributor Author

Thanks! could you make a pull request against my branch so I don't need to re-read the whole thing, get a diff and be able to comment on it? thank you very much.

@drskalman, I made:
w3f-grants-archive/Indifferentiable-hashing-to-ordinary-elliptic-curves-of-j-0-with-the-cost-of-one-exponentiation@4eb3d50

alxs pushed a commit that referenced this pull request Aug 30, 2022
* re-evaluate new bls hash function milestone 1

* fix link to test result section

* Set status to Accepted

Co-authored-by: lucasvanmol <[email protected]>
@alxs alxs changed the title New BLS12 hash function New BLS12 hash function M1 Aug 30, 2022
@alxs
Copy link
Contributor

alxs commented Aug 30, 2022

Hey @dishport, @drskalman just updated his evaluation and accepted your delivery. Thank you for your patience during the delivery process and @drskalman for taking care of the evaluation. I'm happy to approve it from my side as well.

@dishport when you're ready, feel free to submit the next milestone by opening a new pull request.

@alxs alxs merged commit 64b9d38 into w3f:master Aug 30, 2022
@github-actions
Copy link

Congratulations on completing the first milestone of this grant! As part of the Grants Program, we want to help grant recipients acknowledge their grants publicly. To that end, we’ve created a badge for projects that successfully deliver their first milestone. Note that it must only be used within the context of the delivered work, so please do not display it on your team or project's homepage unless accompanied by a short description of the grant.

Furthermore, you're now welcome to announce the grant publicly. Please remember to observe the foundation’s guidelines in doing so. In case you haven't done so yet, you may also reach out to [email protected] for feedback on your announcement and cross-promotion.

Thank you for your contribution and good luck with the remaining milestones, if any! As usual, please let us know if you run into any delays by leaving a comment on the application PR, or directly submitting an amendment.

@alxs
Copy link
Contributor

alxs commented Aug 30, 2022

@dishport could you please fill in the invoice form and let me know when you've done so?

@Dimitri-Koshelev
Copy link
Contributor Author

Dimitri-Koshelev commented Aug 30, 2022

@dishport could you please fill in the invoice form and let me know when you've done so?

@alxs, in which cryptocurrency can you pay ? What about stablecoins ?

@dishport when you're ready, feel free to submit the next milestone by opening a new pull request.

I submitted the next milestone: #556. Did I do it right?

@alxs
Copy link
Contributor

alxs commented Aug 31, 2022

We can currently make payments in Bitcoin, USDT (on Kusama or Ethereum) or USDC/DAI (Ethereuem).

I remember you didn't include a payment address in your application, so you'll need to do that first. Please add the address you want to be paid to and specify the currency here. You'll need to create a new pull request.

I'll get back to you on the new delivery there.

@Dimitri-Koshelev
Copy link
Contributor Author

I remember you didn't include a payment address in your application, so you'll need to do that first. Please add the address you want to be paid to and specify the currency here. You'll need to create a new pull request.

@alxs, I'm not sure if I'm doing everything right. By means of a new pull request I created this page: w3f/Grants-Program#1157. You can find my payment address and chosen currency on the page https://github.com/dishport/Grants-Program/blob/patch-1/applications/new_bls12_hash_function.md.

I generated a new payment address. Can W3F pay a small amount of money for the first time? Just to make sure everything is working properly.

@alxs
Copy link
Contributor

alxs commented Aug 31, 2022

That's great, thank you. I will let the finance team know that you've requested a test transaction first.

Could you please submit an invoice that meets the requirement specified in the invoice form? Please read the instructions carefully. Please also specify your payment address and the currency (USDC). You can generate an invoice using an online tool like https://invoice-generator.com/.

@Dimitri-Koshelev
Copy link
Contributor Author

That's great, thank you. I will let the finance team know that you've requested a test transaction first.

Thank you!

Could you please submit an invoice that meets the requirement specified in the invoice form? Please read the instructions carefully. Please also specify your payment address and the currency (USDC). You can generate an invoice using an online tool like https://invoice-generator.com/.

I already submitted the pdf file containing the following text:

Project name: Implementation of the new hash function to BLS12 curves
Milestone/delivery number/name: Milestone 1 — An implementation in Sage
Payment address: 0x050240CB2f5F7f7aA8AA10a5A9AE36c784AEdE49
Currency: ERC20 USDC
Amount: 10,000 USD
Name: Dmitrii Koshelev
Address: 27 B boulevard Jourdan, app. 317, Paris, France

Is this normal or do I have to necessarily use an online tool ?

@alxs
Copy link
Contributor

alxs commented Aug 31, 2022

The file you submitted does not meet the requirements. Please use the online tool and follow the instructions in the form.

@Dimitri-Koshelev
Copy link
Contributor Author

Dimitri-Koshelev commented Sep 1, 2022

The file you submitted does not meet the requirements. Please use the online tool and follow the instructions in the form.

@alxs, please look at the pdf file: https://disk.yandex.ru/i/ImD7-nXn5ghhmA
Does it satisfy the requirements ?

Did you inform the finance team that I wish a test transaction first ?

@alxs
Copy link
Contributor

alxs commented Sep 2, 2022

That should be fine, thank you. You can submit a similar invoice for milestone 2 through the invoice form.

I've let the team know. Please allow for up to two weeks of processing time until the payment is made.

@RouvenP
Copy link

RouvenP commented Sep 9, 2022

hi @dishport we sent a test transaction of 10 USDC. Could you confirm receipt?

@Dimitri-Koshelev
Copy link
Contributor Author

hi @dishport we sent a test transaction of 10 USDC. Could you confirm receipt?

Hi @RouvenP. Yes, I received 10 USDC.

@RouvenP
Copy link

RouvenP commented Sep 12, 2022

thanks for confirming @dishport. We transferred the remainder.

@Dimitri-Koshelev
Copy link
Contributor Author

Dimitri-Koshelev commented Sep 12, 2022

thanks for confirming @dishport. We transferred the remainder.

Thank you, @RouvenP. In addition, could I obtain some document from your side to confirm the origin of my money ? Perhaps such a document will be required if I decide to declare income to a tax authority.

@RouvenP
Copy link

RouvenP commented Sep 19, 2022

hi @dishport apologies for the late reply. I think that should be possible. Would you have a template for that?

@Dimitri-Koshelev
Copy link
Contributor Author

hi @dishport apologies for the late reply. I think that should be possible. Would you have a template for that?

@RouvenP, no, I don't have.

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.

6 participants