-
Notifications
You must be signed in to change notification settings - Fork 788
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
chore: Lazy initialize the KZG struct when running tests #6311
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kevaundray
force-pushed
the
kw/lazy-initialize-kzg
branch
from
August 27, 2024 13:20
d2c63bb
to
c8aec80
Compare
kevaundray
force-pushed
the
kw/lazy-initialize-kzg
branch
from
August 27, 2024 13:23
bd89823
to
e2d00f9
Compare
kevaundray
commented
Aug 27, 2024
kevaundray
added a commit
to kevaundray/lighthouse
that referenced
this pull request
Aug 27, 2024
kevaundray
added a commit
to kevaundray/lighthouse
that referenced
this pull request
Aug 27, 2024
jimmygchen
added
test improvement
Improve tests
ready-for-review
The code is ready for review
labels
Aug 27, 2024
jimmygchen
approved these changes
Aug 28, 2024
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.
Looks good to me! 🎉
jimmygchen
added
ready-for-merge
This PR is ready to merge.
das
Data Availability Sampling
and removed
ready-for-review
The code is ready for review
labels
Aug 28, 2024
@mergify queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 5a96687 |
This was referenced Aug 28, 2024
Merged
AgeManning
pushed a commit
to AgeManning/lighthouse
that referenced
this pull request
Sep 3, 2024
* use LazyLock when initializing KZG struct * update get_kzg to return Arc<KZG> and not a Result<Arc<KZG>> * Revert orthogonal changes to `kzg_verify_cell_kzg_proof_batch` * add back map_err
chong-he
pushed a commit
to chong-he/lighthouse
that referenced
this pull request
Nov 26, 2024
* use LazyLock when initializing KZG struct * update get_kzg to return Arc<KZG> and not a Result<Arc<KZG>> * Revert orthogonal changes to `kzg_verify_cell_kzg_proof_batch` * add back map_err
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
das
Data Availability Sampling
ready-for-merge
This PR is ready to merge.
test improvement
Improve tests
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Addressed
get_kzg creates a new KZG struct each time its called, which can slow down tests since each test case will call get_kzg.
Proposed Changes
This PR uses LazyLock to instantiate it once using LazyLock and then other tests will just take a thread-safe reference to it.
Additional Info
There is another get_kzg that has been defined in kzg_utils -- That only calls get_kzg once, so its not an issue. Longer term, it might make sense to put a get_kzg method with LazyLock in crypto/get_kzg.rs, so that tests all over the workspace can access it. The main issue I see with this, is that the trusted_setup file is not in crypto/kzg.rs, so the solution won't be as clean as what it looks like in the tests modules.