-
Notifications
You must be signed in to change notification settings - Fork 6
clean up fishhash code organization #26
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
Open
Leon1777
wants to merge
13
commits into
karlsen-network:master
Choose a base branch
from
Leon1777:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or 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
- used a fallback before but we want to strictly enforce only header version 2, now it will panic rather than being silently accepted with fallback - this should still never happen because we enforce only v1 and v2 after forkactivation in pre_ghostdag_validation
- replace separate lazy_static LIGHT_CACHE and OnceLock FULL_DATASET with single OnceLock<FishHashContext> - renamed get_dataset_item to lookup - added back comments which were removed in the previous commit - fn lookup now does the build full dataset check once
- moved keccak, keccak_in_place, fnv1 and fnv1_512 out of PowFishHash (utility functions outside impl blocks, we previously had it like this) - add some comments to lookup - improved the readability of prebuild_dataset and export the core work logic to build_dataset_segment - lints
- remove FISHHASH_FULL_DATASET AtomicBool global from pow_hashers (avoids global state) - add Arc<FishHashContext> - single dataset shared via Arc::clone() across all consensus components - split fn lookup into lookup and init_context for better readability - moved build_light_cache and calculate_dataset_item_1024 out of impl PowFishHash because they are standalone functions - renamed prebuild_dataset to prebuild_full_dataset - made seed raw [u8; 32] and passed seed parameter to build_light_cache (in scenario that it needs to be changed in the future) - moved struct def to it's impl blocks - create FishHashContext struct - reorganize hash types - slight refactor on fishhash arg describtion - log total pp level validation time
never used, khashv1 uses PowB3Hash
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
119905e
thread
Arc<FishHashContext>through consensus stackFISHHASH_FULL_DATASETAtomicBool global frompow_hashers(avoids global state)Arc<FishHashContext>Arc::clone()across all consensus components