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

[HackerOne-2332566] Unify target calculations #2412

Merged
merged 4 commits into from
Apr 2, 2024

Conversation

raychu86
Copy link
Contributor

Motivation

This PR unifies the target calculations in both Ledger::construct_block_template and Block::verify_solutions into a singular to_next_targets helper method. Previously the two implementations were disjoint and could lead to differences in expected value. The unified helper method reduces the possibility of error and makes it easier to update if there are changes in the future.

Test Plan

The use of a helper method also allows us to test the expected behavior outside the monolith of block production. Tests have been added to check that the expected values based on hitting/missing the target threshold are correct.

This PR is based on and merges into https://github.com/AleoHQ/snarkVM/pull/2410.

Base automatically changed from update/is-coinbase-target-is-met to mainnet-staging April 2, 2024 16:29
@howardwu howardwu merged commit 925b3ca into mainnet-staging Apr 2, 2024
80 checks passed
@howardwu howardwu deleted the unify-target-calculations branch April 2, 2024 16:29
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.

2 participants