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] Update the target threshold #2410

Merged
merged 3 commits into from
Apr 2, 2024

Conversation

raychu86
Copy link
Contributor

@raychu86 raychu86 commented Mar 25, 2024

Motivation

This PR updates the condition of is_coinbase_target_reached to is_coinbase_threshold_reached, by adjusting the required cumulative_proof_target required to reset the cumulative_proof_target to 0 and "initializing a new bucket".

Previously we were comparing the cumulative_proof_target with a dynamically changing coinbase_target as the requirement, now the change compares cumulative_proof_target with a coinbase_threshold.

This threshold is currently set to coinbase_target / 2.

This change addresses 2 problems:

  1. Addresses edge-case where some blocks would not have coinbase rewards despite having solutions.

    • Previous model would have cases where the cumulative_proof_target could be greater than (or close enough to) the latest_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.
  2. Smooths out the distribution of rewards given per solution.

    • Previously, provers would be incentivized to hold their solutions until the 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.
    • Because we now reset the cumulative_proof_target more frequently, while retaining the same total payout potential with the coinbase_target pro-rata, there is less incentive to time the broadcast of solutions.

Implications:

  • Previously we were adjusting the coinbase target based on how long it took to reach the latest coinbase target. But now the change will be adjusting the coinbase target based on how long it takes to reach the latest coinbase threshold.

Fixes https://github.com/AleoHQ/snarkVM/issues/2323

@raychu86 raychu86 force-pushed the update/is-coinbase-target-is-met branch from 919bf43 to b4dd9ae Compare March 27, 2024 15:49
@howardwu howardwu merged commit abc7b50 into mainnet-staging Apr 2, 2024
80 checks passed
@howardwu howardwu deleted the update/is-coinbase-target-is-met 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.

[Bug] There is a block where all solution rewards are 0, which is unreasonable
2 participants