[Validation] [Masternode] [Test] SDMN (Shield Deterministic Masternodes) #2876
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.
The aim of this PR is adding the possibility to create Shield Deterministic Masternodes:
Note: a masternode is shielded if the collateral is pointing to a shielded note (Rewards are still normal utxos)
Validation rules:
shieldCollateral
which contains the necessary info to prove the ownership and unspendness of the collateral;vchSig
must be left empty since the proof of ownership is already contained in the new field.RPC changes:
protx_register
andprotx_register_prepare
now take as third parameter the booleantransparent
which isTrue
for normal masternodes andFalse
for shielded masternodes;sig
inprotx_register_submit
is now optional (since it is required ONLY for transparent masternodes and not for shielded one);Proof of Validity:
As collateral the masternode creator must provide a sapling nullifier
nf
(so peers can check thatnf
is unspent) and he also must provide a "proof" which is basically a fake transaction in which they de-shield the note (10000 shield PIVS -> 10000 transparent PIVS). From this proof peers can check that the creator has the authority to spend the collateral and the value of the note is the required one.shieldCollateral
Functional tests:
Governance and Vote system:
We currently map masternodes to their vote to a given proposal through their collateral outpoint, which is stored inside a
CTxIn
, see classesCBudgetVote
andCFinalizedBudgetVote
(I guess due to retro compatibility with an older system).This map cannot be built for SDMNs since their (shield) collateral is private!
To overcome this problem I decided that this map will be done not with the collateral of the masternode but with the hash of the
ProRegTx
(which is enough since it uniquely identify a deterministic masternode). However to keep things compatible with the current system, we have still to provide a full outpoint to store a vote, so we can just pick a defaultnIn = 0
, the full outpoint then becomes:Coutpoint(ProRegTxHash, 0)
For future PRs:
Other special txs
ProUpServTx
,ProUpRegTx
andProUpRevTx
will be added in a future PR since they are not mandatory: A user can get rid of his masternode simply by spending the SDMN collateral.