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

DAO Extension #530

Open
wants to merge 31 commits into
base: master
from

Conversation

Projects
2 participants
@aguycalled
Copy link
Member

commented Jun 14, 2019

This PR includes a serie of Deployment Proposals as described in https://www.reddit.com/r/NavCoin/comments/bs4pvn/proposal_for_the_extension_of_the_community_fund/:

  • Adds support for abstain votes. (Version Bit 19) - includes functional test

  • Enables voting state cache, reducing the amount of votes which need to be broadcasted down to 1 per address per voting cycle. (Version Bit 22) - does not include functional test

  • Enables DAO consultations. (Version Bit 23) - does not include functional test

  • Enables modification of consensus parameters through DAO consultations. (Version Bit 25) - does not include functional test

  • Includes UI to manage the new DAO features.

Abstain votes

Abstain votes will be added to the yes and no votes from proposals and payment requests to calculate the minimum quorum.

Consultations can also receive abstentions as votes.

New op codes and voting

Op codes

Name
OP_ABSTAIN 0xc7
OP_REMOVE 0xc8
OP_DAO 0xc9
OP_ANSWER 0xca
OP_CONSULTATION 0xcb

Voting

The following assumes the deployment of the voting state cache has been accepted in the network.

Proposal and payment request voting

Script Description
OP_RETURN OP_CFUND OP_PROP OP_YES HASH Inserts a yes vote for the proposal HASH in the state cache
OP_RETURN OP_CFUND OP_PROP OP_NO HASH Inserts a no vote for the proposal HASH in the state cache
OP_RETURN OP_CFUND OP_PROP OP_ABSTAIN HASH Inserts an abstain vote for the proposal HASH in the state cache
OP_RETURN OP_CFUND OP_PROP OP_REMOVE HASH Remove the vote stored for the proposal HASH in the state cache
OP_RETURN OP_CFUND OP_PREQ OP_YES HASH Inserts a yes vote for the payment request HASH in the state cache
OP_RETURN OP_CFUND OP_PREQ OP_NO HASH Inserts a no vote for the payment request HASH in the state cache
OP_RETURN OP_CFUND OP_PREQ OP_ABSTAIN HASH Inserts an abstain vote for the payment request HASH in the state cache
OP_RETURN OP_CFUND OP_PREQ OP_REMOVE HASH Remove the vote stored for the payment request HASH in the state cache

Consultation support and voting

Script Description
OP_RETURN OP_DAO OP_YES HASH Insert a support vote for the range consultation or answer HASH in the state cache
OP_RETURN OP_DAO OP_REMOVE HASH Remove the support stored for the range consultation or answer HASH in the state cache
OP_RETURN OP_DAO OP_CONSULTATION OP_ANSWER HASH Inserts a yes vote for the consultation answer HASH
OP_RETURN OP_DAO OP_CONSULTATION OP_ANSWER HASH VALUE Inserts a vote with value VALUE for the range consultation HASH
OP_RETURN OP_DAO OP_CONSULTATION OP_ABSTAIN HASH Inserts an abstain vote for the range consultation or answer HASH in the state cache
OP_RETURN OP_DAO OP_CONSULTATION OP_REMOVE HASH Remove the vote stored for the range consultation or answer HASH in the store cache

Consultations

Consultations are permission-less open questions submitted to the network.

Once consultations are created they must gather a minimal support (defined by consensus parameter CONSENSUS_PARAM_CONSULTATION_MIN_SUPPORT=1.5% for range consultations and by CONSENSUS_PARAM_CONSULTATION_ANSWER_MIN_SUPPORT=1.5% for the rest of consultations) in a minimum of 2 answers if a normal consultation or 1 answer if the consultation is about a consensus parameter. Range consultations do not have this requirement. Instead, range consultations must receive support themselves.

In order to give enough time to a large number of stakers to add new answers to consultations, a consultation will never pass until the cycle defined by CONSENSUS_PARAM_CONSULTATION_MIN_CYCLES=2 is over. Consultations will be in a looking for support phase for a maximum of CONSENSUS_PARAM_CONSULTATION_MAX_SUPPORT_CYCLES=4 cycles, and the voting phase will last a fixed amount of CONSENSUS_PARAM_CONSULTATION_MAX_VOTING_CYCLES=4 cycles. An exception will be consultations about consensus parameters, which could end earlier whenever one of the answers have a minimum of 75% affirmative votes at the end of a voting cycle. Between the looking for support and voting phases, there will exist a reflection phase with a lenght of CONSENSUS_PARAM_CONSULTATION_REFLECTION_LENGTH=1 cycle.

Consultations are created through the creation of a transaction with version 6, pay at least a fee of CONSENSUS_PARAM_CONSULTATION_MIN_FEE=100NAV and a JSON object in the strDZeel parameter with the following structure:

{ "v": version bits of the consultation,
 "q": question of the consultation,
 "m": if the consultation version indicates this is a range consultation, sets the lower bound of the range,
 "n": if the consultation version indicates this is a range consultation, sets the higher bound of the range, otherwise, sets the maximum amount of answers a staker can vote in the same block for a consultation,
 "a": an array of strings containing candidates to answers
}

The version bits are:

Bit Dec Desc Comment
0 1 Base
1 2 Answer is numeric and a range between m and n
2 4 Stakers can propose more answers Allows a to be empty, otherwise it must have 2 elements
3 8 Consultation is about a consensus parameter m is used to refer to the id of the consensus parameter, n must be 1 and a can be empty.

Consultations are identified by the hash of the transaction where it was created.

Stakers can submit during the looking for support phase proposals for different answers for every consultation which is set up as such through the creation of a transaction with version 7 and a JSON object in the strDZeel parameter with the following structure:

{
 "v": version bits of the answer, in this implementation only version 1 exists,
 "h": the hash of the parent consultation,
 "a": the proposed answer
}

Answers are identified by the hash of the concatenation of the transaction hash where it was created and the string of the answer.

answer.hash = Hash(tx.hash || strDZeel.a)

New RPC commands

createconsultation

Creates a DAO consultation

Syntax:
createconsultation Question max of simultaneous answers
createconsultation Question lower bound higher bound range bool
Create a normal consultation
createconsultation "Should we all dance together?" 1
Create a range consultation
createconsultation "What will be NavCoin price in USD at the end of the year?" 1 5 true

proposeanswer

Creates a proposal for a consultation answer.

Syntax:
proposeanswer hash answer
Propose an answer
proposeanswer d95ea23a22b723dbdf0d095d8e9998fab0576daf8cb9dd48c14f3bbd3df10f2f "Yes"

support

Signals support for a specific answer or consultation.

Syntax:
support hash bool
Support an answer
support d95ea23a22b723dbdf0d095d8e9998fab0576daf8cb9dd48c14f3bbd3df10f2f true
support d95ea23a22b723dbdf0d095d8e9998fab0576daf8cb9dd48c14f3bbd3df10f2f false

consultationvote

Sets the vote for a range consultation or answer.

Syntax:
consultationvote hash yes|value|abs|remove (value)
Vote yes for an answer
consultationvote d95ea23a22b723dbdf0d095d8e9998fab0576daf8cb9dd48c14f3bbd3df10f2f yes
Vote a value for a range consultation
consultationvote d95ea23a22b723dbdf0d095d8e9998fab0576daf8cb9dd48c14f3bbd3df10f2f value 10000
Vote abstain for a consultation
consultationvote d95ea23a22b723dbdf0d095d8e9998fab0576daf8cb9dd48c14f3bbd3df10f2f abs
Remove a vote
consultationvote d95ea23a22b723dbdf0d095d8e9998fab0576daf8cb9dd48c14f3bbd3df10f2f remove

consultationvotelist

Shows the list of votes for consultations

Syntax:
consultationvotelist

supportlist

Shows the list of support votes.

Syntax:
supportlist

getconsultation

Shows details of a consultation

Syntax:
getconsultation hash
getconsultation d95ea23a22b723dbdf0d095d8e9998fab0576daf8cb9dd48c14f3bbd3df10f2f

listconsultations

Shows the list of consultations. Possible filters: not_enough_answers, waiting_for_support, reflection, voting and finished

Syntax:
listconsultations filters
listconsultations waiting_for_support finished

getconsultationanswer

Shows details of a consultation

Syntax:
getconsultationanswer hash
getconsultationanswer d95ea23a22b723dbdf0d095d8e9998fab0576daf8cb9dd48c14f3bbd3df10f2f

getconsensusparameters

Shows a detailed list of the consensus parameters which can be defined by the DAO.

Syntax:
getconsensusparameters

proposeconsensuschange

Creates a proposal to change the value of one of the consensus parameters.

Syntax:
proposeconsensuschange parameter id value
proposeconsensuschange 10 10000

Consensus parameters

Id Name  Desc  Type Default value
0 CONSENSUS_PARAM_VOTING_CYCLE_LENGTH Length in blocks of a voting cycle NUMBER 20160
1 CONSENSUS_PARAM_CONSULTATION_MIN_SUPPORT Minimum of support needed for starting a consultation PERCENT 150
2 CONSENSUS_PARAM_CONSULTATION_MIN_CYCLES Earliest cycle when a consultation can get in confirmation phase NUMBER 2
3 CONSENSUS_PARAM_CONSULTATION_MAX_VOTING_CYCLES Length in cycles for consultation votings NUMBER 4
4 CONSENSUS_PARAM_CONSULTATION_MAX_SUPPORT_CYCLES Maximum of voting cycles for a consultation to gain support NUMBER 4
5 CONSENSUS_PARAM_CONSULTATION_REFLECTION_LENGTH Length in cycles for the reflection phase of consultations NUMBER 1
6 CONSENSUS_PARAM_CONSULTATION_MIN_FEE Minimum fee to submit a consultation NAV 1000000000
7 CONSENSUS_PARAM_CONSULTATION_ANSWER_MIN_SUPPORT Minimum of support needed for a consultation answer proposal PERCENT 150
8 CONSENSUS_PARAM_CONSULTATION_ANSWER_MIN_FEE Minimum fee to submit a consultation answer proposal NAV 10000000000
9 CONSENSUS_PARAM_PROPOSAL_MIN_QUORUM Minimum of quorum for fund proposal votings PERCENT 5000
10 CONSENSUS_PARAM_PROPOSAL_MIN_ACCEPT Minimum of positive votes for a fund proposal to be accepted PERCENT 7000
11 CONSENSUS_PARAM_PROPOSAL_MIN_REJECT Minimum of negative votes for a fund proposal to be rejected PERCENT 7000
12 CONSENSUS_PARAM_PROPOSAL_MIN_FEE Minimum fee to submit a fund proposal NAV 5000000000
13 CONSENSUS_PARAM_PROPOSAL_MAX_VOTING_CYCLES Maximum of voting cycles for fund proposal votings NUMBER 6
14 CONSENSUS_PARAM_PAYMENT_REQUEST_MIN_QUORUM Minimum of quorum for payment request votings PERCENT 5000
15 CONSENSUS_PARAM_PAYMENT_REQUEST_MIN_ACCEPT Minimum of positive votes for a payment request to be accepted PERCENT 7000
16 CONSENSUS_PARAM_PAYMENT_REQUEST_MIN_REJECT Minimum of negative votes for a payment request to be rejected PERCENT 7000
17 CONSENSUS_PARAM_PAYMENT_REQUEST_MIN_FEE Minimum fee to submit a payment request NAV 0
18 CONSENSUS_PARAM_PAYMENT_REQUEST_MAX_VOTING_CYCLES Maximum of voting cycles for fund proposal votings NUMBER 8
19 CONSENSUS_PARAM_FUND_SPREAD_ACCUMULATION Frequency of the fund accumulation transaction NUMBER 500
20 CONSENSUS_PARAM_FUND_AMOUNT_PER_BLOCK Amount contributed to the fund per block NAV 50000000
21 CONSENSUS_PARAM_STAKING_STATIC_REWARD Staking reward per block NAV 200000000
22 CONSENSUS_PARAM_NAVNS_FEE Yearly fee for registering a name in NavNS NAV 10000000000

Type of parameters

  • NUMBER. This is a normal numeric parameter.
  • PERCENT. This is percentage and is expressed in cents. 0,5% is written 50. 90% is written 9000.
  • NAV. This is a NAV amount and is expressed in Navoshis. 1 NAV has 100000000 Navoshis.

@proletesseract proletesseract added this to In Progress in NavCoin Core Jun 29, 2019

aguycalled added some commits Jul 21, 2019

aguycalled added some commits Jul 23, 2019

@mxaddict

This comment has been minimized.

Copy link
Contributor

commented Jul 23, 2019

@aguycalled I tried a gitian and cross compile build of this branch and I ran into a similar issue that I did with my #557 branch.

I've since solved the issue (Making modifications to how the qt.mk is built)

You might wanna take a look at how I did it to get this branch to build in gitian and in travis-ci.

@mxaddict

This comment has been minimized.

Copy link
Contributor

commented Jul 23, 2019

More specifically I think the changes are in this commit: 194ef50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.