Skip to content

secp256k1: Decouple precomputation generation.#2886

Merged
davecgh merged 1 commit intodecred:masterfrom
davecgh:secp256k1_decouple_genprecomps
Mar 3, 2022
Merged

secp256k1: Decouple precomputation generation.#2886
davecgh merged 1 commit intodecred:masterfrom
davecgh:secp256k1_decouple_genprecomps

Conversation

@davecgh
Copy link
Copy Markdown
Member

@davecgh davecgh commented Feb 23, 2022

This requires #2884 and is rebased on #2885.

The current code that generates the various pre-computed values is conditionally exported via a build tag that is only set when the code generation is invoked. That approach was originally necessary because it relied on access to unexported code to perform the calculations, however, now that the package has evolved, the exported API now provides all of the necessary tools.

Consequently, this decouples the code related to generating pre-computed values as follows:

  • Move the code into the main package that is invoked by go generate
  • Updates the generation code to decouple it from the package internals
  • Removes the no longer necessary genstatics.go file
  • Removes the gensecp256k1 build tag that is no longer necessary

@davecgh davecgh added this to the 1.8.0 milestone Feb 23, 2022
Copy link
Copy Markdown
Member

@matheusd matheusd left a comment

Choose a reason for hiding this comment

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

Verified generation is unchanged.

Copy link
Copy Markdown
Member

@rstaudt2 rstaudt2 left a comment

Choose a reason for hiding this comment

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

Looks good, confirmed that the generation is unchanged. I noticed that the copyright year in dcrec/secp256k1/curve.go could be updated as well.

@davecgh davecgh force-pushed the secp256k1_decouple_genprecomps branch from cfab97f to fafc851 Compare March 2, 2022 04:11
@davecgh
Copy link
Copy Markdown
Member Author

davecgh commented Mar 2, 2022

Looks good, confirmed that the generation is unchanged. I noticed that the copyright year in dcrec/secp256k1/curve.go could be updated as well.

Good call. Updated copyright year.

The current code that generates the various pre-computed values is
conditionally exported via a build tag that is only set when the code
generation is invoked.  That approach was originally necessary because
it relied on access to unexported code to perform the calculations,
however, now that the package has evolved, the exported API now provides
all of the necessary tools.

Consequently, this decouples the code related to generating pre-computed
values as follows:

- Move the code into the main package that is invoked by go generate
- Updates the generation code to decouple it from the package internals
- Removes the no longer necessary genstatics.go file
- Removes the gensecp256k1 build tag that is no longer necessary
@davecgh davecgh force-pushed the secp256k1_decouple_genprecomps branch from fafc851 to 18e28d3 Compare March 2, 2022 16:50
@davecgh davecgh merged commit 18e28d3 into decred:master Mar 3, 2022
@davecgh davecgh deleted the secp256k1_decouple_genprecomps branch March 3, 2022 08:45
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.

5 participants