[HackerOne-2332566] Update the target threshold #2410
Merged
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.
Motivation
This PR updates the condition of
is_coinbase_target_reached
tois_coinbase_threshold_reached
, by adjusting the requiredcumulative_proof_target
required to reset thecumulative_proof_target
to 0 and "initializing a new bucket".Previously we were comparing the
cumulative_proof_target
with a dynamically changingcoinbase_target
as the requirement, now the change comparescumulative_proof_target
with acoinbase_threshold
.This threshold is currently set to
coinbase_target / 2
.This change addresses 2 problems:
Addresses edge-case where some blocks would not have coinbase rewards despite having solutions.
cumulative_proof_target
could be greater than (or close enough to) thelatest_coinbase_target
at the end of a block due to the dynamic target adjustments. This effectively nullified the next block's coinbase rewards, no matter how many solutions were included.Smooths out the distribution of rewards given per solution.
cumulative_proof_target
is reset to 0 before submitting to receive a larger pro-rata distribution of rewards. This would cause spikes in when solutions (particularly solutions with large targets) would enter the network.cumulative_proof_target
more frequently, while retaining the same total payout potential with thecoinbase_target
pro-rata, there is less incentive to time the broadcast of solutions.Implications:
Fixes https://github.com/AleoHQ/snarkVM/issues/2323