question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

By @Bhargavasomu from: https://github.com/ethereum/py_ecc/issues/24#issuecomment-442701351

The following things come to my mind.

  • The classes FQ, FQP, FQ2 and FQ12 need not be reinitialized every time as they are not dependent on the type of curve or extension. So probably we could have these created in field_elements.py and we could use them everywhere (bn128, optimized_bn128, bls, optimized_bls).
  • We could also have a general class BaseCurve, and then maybe every curve (bn128_curve, optimized_bn128_curve, …) could inherit this and make the changes specific to the inherited class.
  • We should probably move the constants into a seperate file (constants.py)
  • We should also remove the assert statements which are not part of any function, but are part of the script in general, as shown https://github.com/ethereum/py_ecc/blob/067a40261ad39526f6aa8bd69def7d6982993d13/py_ecc/bn128/bn128_pairing.py#L74-L83
  • Also the type hinting should be further generalized wherever possible (in terms of removing redundant types; like Optimized_FQPoint2D could be replaced by FQPoint2D). Similary the type hinting should be carried out for the bs12_381 and optimized_bs12_381 submodules.

Also the only difference I see in all the curves is

  • Difference in the constants such as b, b2, b12, G2, G12
  • Difference in the twist function

@vbuterin are my facts right or am I missing anything. @pipermerriam is the above design ok?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
pipermerriamcommented, Dec 6, 2018

@Bhargavasomu I’ve submitted a request to have a bounty attached to this.

0reactions
gitcoinbotcommented, Sep 23, 2019

Issue Status: 1. Open 2. Cancelled


The funding of 250.0 DAI (250.0 USD @ $1.0/DAI) attached to this issue has been cancelled by the bounty submitter

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incomplete Library Class - Refactoring.Guru
The only solution to the problem—changing the library—is often impossible since the library is read-only. Reasons for the Problem. The author of the...
Read more >
The New Refactoring Library 🏛️ - by Luca Rossi
The New Refactoring Library 🏛️. Discover the best collection of online resources to level up your engineering game. Luca Rossi.
Read more >
Refactoring Code With the Standard Library - YouTube
John Reesehttps://2018.pycon-au.org/talks/45063- refactoring -code-with-the-standard- library /What if you could refactor your entire code base, ...
Read more >
AST-based fragmental source code refactoring toolkit for Python
Refactor. PyPI version Documentation Try It. Simple, hassle-free, dependency-free, AST based fragmental source code refactoring and transformation toolkit.
Read more >
Angular Libraries : Refactor Existing Components into a ...
When we read Angular's documentation on refactoring components into libraries, we find that it's shor... Tagged with angular, typescript.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found