-
Notifications
You must be signed in to change notification settings - Fork 174
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
polls, voting, staking: Enhance voting consensus rules to allow for changeable magnitude weight factor and enhance CBR #2781
Open
jamescowens
wants to merge
20
commits into
gridcoin-community:development
Choose a base branch
from
jamescowens:enhance_voting_consensus_rules
base: development
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.
Conversation
This file contains 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
jamescowens
force-pushed
the
enhance_voting_consensus_rules
branch
6 times, most recently
from
October 27, 2024 18:16
5c128f3
to
47a2ba2
Compare
jamescowens
force-pushed
the
enhance_voting_consensus_rules
branch
from
November 3, 2024 00:52
47a2ba2
to
3c6a501
Compare
This commit adds DefaultConstantBlockReward ConstantBlockRewardFloor ConstantBlockRewardCeiling DefaultMagnitudeUnit DefaultMagnitudeWeightFactor to consensus parameters.
Extends the fraction class with a FromString method to support parsing of a string representation of a fraction (i.e. "1/4") into a formal fraction object.
This new method provides the ability to find the last version of a key that exists with a timestamp prior to or equal to the provided timestamp.
This refactors GetConstantBlockReward to use the blockchain consensus paramters, removes the lookback limitation for block v13+ to correspond with the removal of the contract lookback window for protocol entries, and corrects the behavior of the lookup if the input index is not at pIndexBest.
This fixes a compile error on ambiguous method with WIN32/64
This separates out the calculation of network weight from nBits contained in GetActiveNetworkWeight and extends it with two forms (overloads).
GetMagnitudeWeightFactor should return zero if index argument is a nullptr.
jamescowens
force-pushed
the
enhance_voting_consensus_rules
branch
from
December 15, 2024 23:46
3c6a501
to
ca935a3
Compare
The magnitude unit has been fixed at 1/4 since Fern. This commit allows the magnitude unit to be changed via a protocol entry for block V13+.
jamescowens
force-pushed
the
enhance_voting_consensus_rules
branch
from
December 16, 2024 06:26
3f9c7a0
to
6c47db9
Compare
The contract version for V13+ is 3 and the legacy handler is not supposed to be used.
This establishes an upper clamp on the magnitude unit. Currently set at 5.
Also implement 256 bit integer arithmetic in ComputeMRCFee() as an overflow fallback.
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.
This is the PR for the work to enhance the polls/voting consensus rules:
This implements gridcoin-community/Gridcoin-Tasks#268.
For documentation purposes I am going to describe the changes introduced here. Note that all of these changes have been implemented in such a way as to be completely consensus compatible with the existing network rules prior to the V13 mandatory, which means that this PR can be merged prior to the setting of the mandatory height for V13.
Implementation of changeable magnitude unit and magnitude weight factor
Prior to this PR, the magnitude unit has been hard-coded to 1/4 and the magnitude weight factor has been hard-coded to 100/567. This has been true since the Fern mandatory rules went into effect. We needed a way to both increase the amount of paid crunching rewards (the research emission), and also change the weight ratio used to convert magnitude of a voter into weight units for the voting in balance + magnitude polls. This PR provides both:
Enhanced CBR
The CBR code has been enhanced for V13+ to more reliably allow for changing the constant block reward via protocol entry (administrative contract) with the key name "blockreward1". The current value is 10 GRC.
New blockchain consensus parameters to support/control the above
The following blockchain consensus parameters have been implemented and are active as of the V13 mandatory. the floor and ceiling parameters act as clamps.
Other corrections/additions
This PR has been tested on testnet and then mainnet for consensus compatibility prior to V13 mandatory, and comprehensively tested in a three node isolated testnet network post V13 mandatory, with several changes in the above protocols. Sync from genesis has also been conducted in all three cases.