mirror of
https://github.com/pezkuwichain/pezkuwi-fellows.git
synced 2026-05-31 16:21:03 +00:00
deploy: 85ca3ff275
This commit is contained in:
@@ -241,23 +241,23 @@
|
||||
<h3 id="an-aside"><a class="header" href="#an-aside">An Aside</a></h3>
|
||||
<p>One may ask, could a voter not just undelegate, vote, then delegate again? Could this just be built into the user interface? Unfortunately, this does not work due to the need to clear their votes before redelegation. In practice the voter would undelegate, vote, wait until the referendum is closed, hope that there's no other referenda they would like to vote on, then redelegate. At best it's a temporally extended friction. At worst the voter goes unrepresented in voting for the duration of the vote clearing period.</p>
|
||||
<h2 id="stakeholders"><a class="header" href="#stakeholders">Stakeholders</a></h2>
|
||||
<p><code>Runtime developers</code>: If runtime developers are relying on the previous assumptions for their <a href="https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/conviction-voting/src/lib.rs#L159">VotingHooks</a> implementations, they will need to rethink their approach. In addition, a runtime migration is needed. Lastly, it is a serious change in governance that requires some consideration beyond the technical. </p>
|
||||
<p><code>Runtime developers</code>: If runtime developers are relying on the previous assumptions for their <a href="https://github.com/paritytech/polkadot-sdk/blob/939fc198daaf5e8ae319419f112dacbc1ea7aefe/substrate/frame/conviction-voting/src/lib.rs#L159">VotingHooks</a> implementations, they will need to rethink their approach. In addition, a runtime migration is needed. Lastly, it is a serious change in governance that requires some consideration beyond the technical. </p>
|
||||
<p><code>App developers</code>: Apps like Subsquare and Polkassembly would need to update their user interface logic. They will also need to handle the new error.</p>
|
||||
<p><code>Users</code>: We will want users to be aware of the new functionality, though not required.</p>
|
||||
<p><code>Technical Writers</code>: This change will require rewrites of documentation and tutorials. </p>
|
||||
<h2 id="explanation"><a class="header" href="#explanation">Explanation</a></h2>
|
||||
<h3 id="new-data--runtime-logic"><a class="header" href="#new-data--runtime-logic">New Data & Runtime Logic</a></h3>
|
||||
<p>The <a href="https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/conviction-voting/src/vote.rs#L225">Voting Enum</a> is first collapsed, as there's no longer a distinction between the variants. Then a <code>(poll index -> retracted votes count)</code> data item would be added to the user's voting data stored in <a href="https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/conviction-voting/src/lib.rs#L165">VotingFor</a>. This would keep track of the per poll balance that has been clawed back from the user by those delegating to them.</p>
|
||||
<p>The <a href="https://github.com/paritytech/polkadot-sdk/blob/939fc198daaf5e8ae319419f112dacbc1ea7aefe/substrate/frame/conviction-voting/src/vote.rs#L256-L264">Voting Enum</a>, which currently holds the user's vote data, would first be collapsed and it's underlying fields consolidated, as there would no longer be a distinction between the enum's variants. A <code>(poll index -> retracted votes count)</code> field would then be added to the resulting structure - It's role to keep track of the per poll balance that has been clawed back from the user by those delegating to them. See <a href="https://github.com/PolkadotDom/polkadot-sdk/blob/f9af95133534c18dfde990cb9d775c325c2c6ebf/substrate/frame/conviction-voting/src/vote.rs#L227-L244">here</a> for a potential implementation.</p>
|
||||
<p>The implementation must allow for the <code>(poll index -> retracted votes)</code> data to exist even if the user does not currently have a vote for that poll. A simple example that highlights the necessity is as follows: A delegator votes first, then the delegate does. If the delegator is not allowed to create the retracted votes data on the delegate, the tally count would be corrupted when the delegate votes.</p>
|
||||
<p>It follows then that the delegator must also handle clean up of that data when their vote is removed. Otherwise, the delegate has no immediate monetary incentive to clean the retracted votes state.</p>
|
||||
<p>All changes to pallet-conviction-voting's STF would follow those simple changes. For example, when a user votes standard, the final amount added to the poll's tally will be <code>balance + (amount delegated to user - retracted votes)</code>. Then, if they are delegating, it will update their delegate's vote data with the newly retracted votes.</p>
|
||||
<p>It follows then that the delegator must also handle clean up of that data when their vote is removed. Otherwise, the delegate has no immediate monetary incentive to clean the retracted vote's state.</p>
|
||||
<p>All changes to pallet-conviction-voting's STF would follow those simple changes. For example, when a user votes standard, the final amount added to the poll's tally would be <code>balance + (amount delegated to user - retracted votes)</code>. Then, if they are delegating, it will update their delegate's vote data with the newly retracted votes.</p>
|
||||
<p>The retracted amount is always the full delegated amount. For example, if Alice delegates 10 UNITS to Bob and then votes with 5 UNITS, the full 10 UNITS is still added as a clawback to Bob for that poll. This is both for simplicity and to ensure we don't make unnecessary assumptions about what Alice wants.</p>
|
||||
<p>Because you need to add the clawback, a delegator's vote can affect a delegate's voting data. If a delegator's vote or delegation makes the delegate's voting data exceed <a href="https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/conviction-voting/src/vote.rs#L206-L216">MaxVotes</a>, the transaction will fail. In practice, this means this new system is somewhere between the old and the ideal. However, this will incentivize delegates to stay on top of voting data clearance. And given our current referenda rates and MaxVotes set to <a href="https://github.com/polkadot-fellows/runtimes/blob/main/relay/polkadot/src/governance/mod.rs#L43">512</a>, it would be difficult to hit this limit.</p>
|
||||
<p>Because you need to add the clawback, a delegator's vote can affect a delegate's voting data. If a delegator's vote or delegation makes the delegate's voting data exceed <a href="https://github.com/paritytech/polkadot-sdk/blob/939fc198daaf5e8ae319419f112dacbc1ea7aefe/substrate/frame/conviction-voting/src/lib.rs#L138">MaxVotes</a>, the transaction will fail. In practice, this means this new system is somewhere between the old and the ideal. However, this will incentivize delegates to stay on top of voting data clearance. And given our current referenda rates and MaxVotes set to <a href="https://github.com/polkadot-fellows/runtimes/blob/34ecb949660704ccf139a06afb075c6a729b1295/relay/polkadot/src/governance/mod.rs#L43">512</a>, it would be difficult to hit this limit.</p>
|
||||
<p>A new error is to be introduced that signals MaxVotes was reached specifically for the delegate's voting data.</p>
|
||||
<h3 id="locked-balance"><a class="header" href="#locked-balance">Locked Balance</a></h3>
|
||||
<p>A user's locked balance will be the greater of the delegation lock and the voting lock.</p>
|
||||
<h3 id="migrations"><a class="header" href="#migrations">Migrations</a></h3>
|
||||
<p>A runtime migration is necessary, though simple considering voting and delegation are currently separate.</p>
|
||||
<p>A runtime migration is necessary, though simple considering voting and delegation are currently separate. It would iterate over the <a href="https://github.com/paritytech/polkadot-sdk/blob/939fc198daaf5e8ae319419f112dacbc1ea7aefe/substrate/frame/conviction-voting/src/lib.rs#L165">VotingFor</a> storage item and convert the <a href="https://github.com/paritytech/polkadot-sdk/blob/939fc198daaf5e8ae319419f112dacbc1ea7aefe/substrate/frame/conviction-voting/src/vote.rs#L256-L264">old vote data structure</a> to the <a href="https://github.com/PolkadotDom/polkadot-sdk/blob/dom/vote-while-delegating/substrate/frame/conviction-voting/src/vote.rs#L227-L243">new structure</a>.</p>
|
||||
<h2 id="drawbacks"><a class="header" href="#drawbacks">Drawbacks</a></h2>
|
||||
<p>There are two potential drawbacks to this system -</p>
|
||||
<h3 id="an-unbounded-rate-of-change-of-the-voter-preferences-function"><a class="header" href="#an-unbounded-rate-of-change-of-the-voter-preferences-function">An unbounded rate of change of the voter preferences function</a></h3>
|
||||
@@ -275,7 +275,7 @@
|
||||
<p>Runtime developers will need to add the migration and ensure their hooks still work.</p>
|
||||
<p>App developers will need to update their user interfaces to accommodate the new functionality. They will need to handle the new error as well.</p>
|
||||
<h2 id="prior-art-and-references"><a class="header" href="#prior-art-and-references">Prior Art and References</a></h2>
|
||||
<p>A current WIP implementation can be found <a href="https://github.com/PolkadotDom/polkadot-sdk/tree/dom/vote-while-delegating/substrate/frame/conviction-voting/src">here</a>. While WIP, it is STF complete & heavily commented for ease of understanding.</p>
|
||||
<p>A current implementation can be found <a href="https://github.com/paritytech/polkadot-sdk/pull/9026">here</a>.</p>
|
||||
<h2 id="unresolved-questions"><a class="header" href="#unresolved-questions">Unresolved Questions</a></h2>
|
||||
<p>None</p>
|
||||
<h2 id="future-directions-and-related-material"><a class="header" href="#future-directions-and-related-material">Future Directions and Related Material</a></h2>
|
||||
|
||||
Reference in New Issue
Block a user