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

Add emergencyPeriod and feeBurnPct to chainparams #1597

Merged
merged 4 commits into from
Nov 25, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ class CMainParams : public CChainParams {
consensus.props.voc.approvalThreshold = 66670000; // vote pass with over 66.67% majority
consensus.props.quorum = COIN / 100; // 1% of the masternodes must vote
consensus.props.votingPeriod = 130000; // tally votes every 130K blocks
consensus.props.emergencyPeriod = 8640;
consensus.props.feeBurnPct = COIN / 2;

consensus.nonUtxoBlockSubsidies.emplace(CommunityAccountType::IncentiveFunding, 45 * COIN / 200); // 45 DFI of 200 per block (rate normalized to (COIN == 100%))
consensus.nonUtxoBlockSubsidies.emplace(CommunityAccountType::AnchorReward, COIN /10 / 200); // 0.1 DFI of 200 per block
Expand Down Expand Up @@ -451,6 +453,9 @@ class CTestNetParams : public CChainParams {
consensus.props.voc.approvalThreshold = 66670000; // vote pass with over 66.67% majority
consensus.props.quorum = COIN / 100; // 1% of the masternodes must vote
consensus.props.votingPeriod = 70000; // tally votes every 70K blocks
consensus.props.emergencyPeriod = 8640;
consensus.props.feeBurnPct = COIN / 2;


consensus.nonUtxoBlockSubsidies.emplace(CommunityAccountType::IncentiveFunding, 45 * COIN / 200); // 45 DFI @ 200 per block (rate normalized to (COIN == 100%))
consensus.nonUtxoBlockSubsidies.emplace(CommunityAccountType::AnchorReward, COIN/10 / 200); // 0.1 DFI @ 200 per block
Expand Down Expand Up @@ -655,6 +660,8 @@ class CDevNetParams : public CChainParams {
consensus.props.voc.approvalThreshold = 66670000; // vote pass with over 66.67% majority
consensus.props.quorum = COIN / 100; // 1% of the masternodes must vote
consensus.props.votingPeriod = 100; // tally votes every 1K blocks
consensus.props.emergencyPeriod = 50;
consensus.props.feeBurnPct = COIN / 2;

consensus.nonUtxoBlockSubsidies.emplace(CommunityAccountType::IncentiveFunding, 45 * COIN / 200); // 45 DFI @ 200 per block (rate normalized to (COIN == 100%))
consensus.nonUtxoBlockSubsidies.emplace(CommunityAccountType::AnchorReward, COIN/10 / 200); // 0.1 DFI @ 200 per block
Expand Down Expand Up @@ -851,6 +858,8 @@ class CRegTestParams : public CChainParams {
consensus.props.voc.approvalThreshold = 66670000; // vote pass with over 66.67% majority
consensus.props.quorum = COIN / 100; // 1% of the masternodes must vote
consensus.props.votingPeriod = 70; // tally votes every 70 blocks
consensus.props.emergencyPeriod = 50;
consensus.props.feeBurnPct = COIN / 2;

consensus.vaultCreationFee = 1 * COIN;

Expand Down
2 changes: 2 additions & 0 deletions src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ struct Params {
CAmount approvalThreshold;
} cfp, brp, voc;
uint32_t votingPeriod;
uint32_t emergencyPeriod;
CAmount quorum;
CAmount feeBurnPct;
};
CPropsParams props;

Expand Down
4 changes: 2 additions & 2 deletions src/masternodes/masternodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ uint32_t CCustomCSView::GetEmergencyPeriodFromAttributes(const CPropType &type)
assert(attributes);

CDataStructureV0 VOCKey{AttributeTypes::Governance, GovernanceIDs::Proposals, GovernanceKeys::VOCEmergencyPeriod};
return attributes->GetValue(VOCKey, uint32_t{8640});
return attributes->GetValue(VOCKey, Params().GetConsensus().props.emergencyPeriod);
}

CAmount CCustomCSView::GetApprovalThresholdFromAttributes(const CPropType &type) const {
Expand Down Expand Up @@ -1344,5 +1344,5 @@ CAmount CCustomCSView::GetFeeBurnPctFromAttributes() const {

CDataStructureV0 feeBurnPctKey{AttributeTypes::Governance, GovernanceIDs::Proposals, GovernanceKeys::FeeBurnPct};

return attributes->GetValue(feeBurnPctKey, COIN / 2);
return attributes->GetValue(feeBurnPctKey, Params().GetConsensus().props.feeBurnPct);
}
2 changes: 1 addition & 1 deletion src/masternodes/rpc_proposals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ UniValue getgovproposal(const JSONRPCRequest& request)
ret.pushKV("contextHash", prop->contextHash);
ret.pushKV("type", CPropTypeToString(type));
if (valid && votes >= approvalThreshold) {
ret.pushKV("status", "Approved");
ret.pushKV("status", "Completed");
} else {
ret.pushKV("status", "Rejected");
}
Expand Down
4 changes: 2 additions & 2 deletions test/functional/feature_on_chain_government.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def run_test(self):
assert_equal(result["title"], title)
assert_equal(result["context"], context)
assert_equal(result["type"], "VoteOfConfidence")
assert_equal(result["status"], "Approved")
assert_equal(result["status"], "Completed")
assert_equal(result["votes"], "75.00 of 66.67%")
assert_equal(result["contextHash"], "")
assert_equal(result["currentCycle"], 1)
Expand Down Expand Up @@ -490,7 +490,7 @@ def run_test(self):
assert_equal(result["title"], title)
assert_equal(result["context"], context)
assert_equal(result["type"], "VoteOfConfidence")
assert_equal(result["status"], "Approved")
assert_equal(result["status"], "Completed")
assert_equal(result["votes"], "50.00 of 49.99%")
assert_equal(result["contextHash"], "")
assert_equal(result["currentCycle"], 1)
Expand Down