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

polls, voting, staking: Enhance voting consensus rules to allow for changeable magnitude weight factor and enhance CBR #2781

Draft
wants to merge 17 commits into
base: development
Choose a base branch
from

Conversation

jamescowens
Copy link
Member

This is a tracking PR for the work to enhance the polls/voting consensus rules to allow for different magnitude weight factor that assigns weight to magnitude for the purposes of vote weight of individual votes and AVW. This PR also refactors the GetBlockReward function to properly work with revised CBR values in the protocol registry and expands the clamp to anticipate a larger upper end value for CBR in the future.

This is work that will enable parts of gridcoin-community/Gridcoin-Tasks#268.

@jamescowens jamescowens self-assigned this Oct 24, 2024
@jamescowens jamescowens added this to the Natasha milestone Oct 24, 2024
@jamescowens jamescowens force-pushed the enhance_voting_consensus_rules branch 6 times, most recently from 5c128f3 to 47a2ba2 Compare October 27, 2024 18:16
@jamescowens jamescowens force-pushed the enhance_voting_consensus_rules branch from 47a2ba2 to 3c6a501 Compare November 3, 2024 00:52
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 jamescowens force-pushed the enhance_voting_consensus_rules branch from 3c6a501 to ca935a3 Compare December 15, 2024 23:46
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 jamescowens force-pushed the enhance_voting_consensus_rules branch from 3f9c7a0 to 6c47db9 Compare December 16, 2024 06:26
The contract version for V13+ is 3 and the legacy handler is not supposed
to be used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant