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

Implement dynamic activation thresholds #3692

Merged
merged 8 commits into from Sep 12, 2020
Merged

Conversation

UdjinM6
Copy link

@UdjinM6 UdjinM6 commented Sep 8, 2020

This implements dynamic BIP9-like activation threshold and applies it to Block Reward Reallocation proposal.

Motivation: in Dash we used to use lower thresholds (80% vs 95% in BTC) to activate upgrades via BIP9-like mechanism for quite some time. While it's preferable to have as much of the network hashrate to signal update readiness as possible this can result in quite lengthy upgrades sometimes when one large non-upgraded entity would stale the whole progress. Simply lowering thresholds even further can result in network upgrades being too fast which can cause some chaos potentially. This PR implements dynamic thresholds which drop from some initial level to a minimally acceptable level over time at an increasing rate.

For regtest params it looks like this:
Screenshot 2020-09-08 at 13 22 24

(based on #3691 atm)

@UdjinM6 UdjinM6 added this to the 16 milestone Sep 8, 2020
Copy link

@xdustinface xdustinface left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the two comments + What about extending the tests to verify either each threshold decrease period or at least the last before 60%, 60% and one after?

src/chainparams.cpp Show resolved Hide resolved
test/functional/feature_block_reward_reallocation.py Outdated Show resolved Hide resolved
@UdjinM6 UdjinM6 force-pushed the dynthresholds branch 2 times, most recently from 77bd404 to dae4a19 Compare September 10, 2020 16:23
@xdustinface
Copy link

ACK, Looks good to me 👍

Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, code looks good, tests pass, ran locally

@@ -74,7 +74,7 @@ def signal(self, num_blocks, expected_lockin):
assert_equal(get_bip9_status(self.nodes[0], 'realloc')['status'], 'started')

def threshold(self, attempt):
threshold_calc = 400 - attempt * attempt;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOL :P :trollface:

@UdjinM6 UdjinM6 merged commit ab8347e into dashpay:develop Sep 12, 2020
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 12, 2020
* Implement dynamic activation thresholds

* fix

* Revert unrelated changes

* Clarify switching to/staying in LOCKED_IN state

* Fix signal function to work correctly with num_blocks=0

* Add simplified threshold calculation and use it in tests

* Check that thresholds are decreasing, reach the min level and stay there

* Drop `;`
@UdjinM6 UdjinM6 deleted the dynthresholds branch November 26, 2020 13:26
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Mar 11, 2022
* Implement dynamic activation thresholds

* fix

* Revert unrelated changes

* Clarify switching to/staying in LOCKED_IN state

* Fix signal function to work correctly with num_blocks=0

* Add simplified threshold calculation and use it in tests

* Check that thresholds are decreasing, reach the min level and stay there

* Drop `;`
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.

None yet

4 participants