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

instantsend: Implement Spork 2 Mempool Signing signalling #4024

Merged
merged 12 commits into from
Mar 8, 2021

Conversation

PastaPastaPasta
Copy link
Member

@PastaPastaPasta PastaPastaPasta commented Mar 2, 2021

This PR implements a new Spork, SPORK_24_INSTANTSEND_SIGNING_ENABLED

Previously, the Dash network has seen InstantSend fail under extremely high load. These IS failures have resulted in diminished or non-operational chainlocks. We have worked to heavily optimize IS creation and propagation with the implementation of Concentrated Recovery as well as just pure optimization, however even with that, so much CPU can only do so much. It is likely that in order to massively scale InstantSend masternodes will need to upgrade their hardware. However, with current average usage, it makes almost no sense for masternodes to upgrade, as current hardware easily handles average load.

To mitigate these InstantSend failures further, there are a number of improvements we should investigate.

  1. Implementation of Dynamic Fees based on mempool usage
  2. Implementation of Dynamic Fees based on transaction throughput
  3. Implementation of Dynamic Fees based on average InstantSend Lock creation time

There are also some future optimizations to look into (I haven't thought TOO much about these options so 🤷 )
4. Implementation of Input Lock batch creation & / or InstantSend Lock batch creation
5. Implementation of Input Lock batch propagation

I propose that even in the case that IS becomes overloaded, potentially in a sustained attack lasting a week or more, ChainLocks should remain operational. In order to achieve this, I propose that InstantSend be disabled in the case of InstantSend failures resulting in diminished or non-operational ChainLocks.

We could achieve this currently by simply disabling Spork 2, however I think that this has a couple of problems. After we disable spork 2, transactions that had previously been locked will no longer retain the protections of instantsend. Additionally, normal miners will no longer only include "safe" transactions. By introducing this Spork24, we can first disable spork24, at this point MNs will stop creating new input locks or instantsend locks for transactions only in mempool (however we keep creating islocks for transactions included in a block such that that block can be CLed ASAP). Once no transactions on the network are ISlocked, then Spork 2 can safely be disabled. At this point, miners can include any valid transactions (not just "safe" txes), and those blocks will be CLed.

LMK if you think of a better way to achieve this, it may be possible to just modify the behavior of Spork2, but I think this approach may be safer.

EDIT: Changed to using spork2 value 1 instead of spork 24 as indicating no mempool signing

Signed-off-by: pasta <pasta@dashboost.org>
This spork tells masternodes to refuse to lock transactions in mempool. Only transactions included in a block should be retroactively signed.

Signed-off-by: pasta <pasta@dashboost.org>

add spork defenition

Signed-off-by: pasta <pasta@dashboost.org>
…lmq/*`

Signed-off-by: pasta <pasta@dashboost.org>
Signed-off-by: pasta <pasta@dashboost.org>
… usage

Signed-off-by: pasta <pasta@dashboost.org>
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting idea 👍

PastaPastaPasta and others added 3 commits March 3, 2021 17:54
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Signed-off-by: pasta <pasta@dashboost.org>
@PastaPastaPasta PastaPastaPasta changed the title Implement Spork 24 for InstantSend Signing Implement Spork 2 InstantSend Signing signaling Mar 4, 2021
@PastaPastaPasta
Copy link
Member Author

See latest

Signed-off-by: pasta <pasta@dashboost.org>
Copy link

@xdustinface xdustinface left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments below + PR descriptions needs some update (spork24 removal) now.

@@ -422,7 +439,7 @@ bool CInstantSendManager::ProcessTx(const CTransaction& tx, bool allowReSigning,
if (quorumSigningManager->GetVoteForId(llmqType, id, otherTxHash)) {
if (otherTxHash != tx.GetHash()) {
LogPrintf("CInstantSendManager::%s -- txid=%s: input %s is conflicting with previous vote for tx %s\n", __func__,
tx.GetHash().ToString(), in.prevout.ToStringShort(), otherTxHash.ToString());
tx.GetHash().ToString(), in.prevout.ToStringShort(), otherTxHash.ToString());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are this one and the other two whitespace changes below intentionally?

Copy link

@xdustinface xdustinface left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, thoughts about IsInstantSendSigningEnabled -> IsInstantSendMempoolSigningEnabled?

PastaPastaPasta and others added 3 commits March 6, 2021 17:25
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
@UdjinM6 UdjinM6 added this to the 17 milestone Mar 7, 2021
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably avoid making whitespace changes but it's not a big deal imo and everything else LGTM, so

utACK

Copy link

@xdustinface xdustinface left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK with the same opinion about the whitespace stuff + note that the PR description is still mentioning the dropped spork.

@UdjinM6 UdjinM6 changed the title Implement Spork 2 InstantSend Signing signaling instantsend: Implement Spork 2 Mempool Signing signalling Mar 8, 2021
@UdjinM6 UdjinM6 merged commit 6da3d5c into dashpay:develop Mar 8, 2021
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Mar 13, 2022
* instantsend: refactor input locking into it's own method

Signed-off-by: pasta <pasta@dashboost.org>

* instantsend: introduce spork 24 `SPORK_24_INSTANTSEND_SIGNING_ENABLED`

This spork tells masternodes to refuse to lock transactions in mempool. Only transactions included in a block should be retroactively signed.

Signed-off-by: pasta <pasta@dashboost.org>

add spork defenition

Signed-off-by: pasta <pasta@dashboost.org>

* instantsend: refactor `sed -i 's/allowReSigning/fRetroactive/g' src/llmq/*`

Signed-off-by: pasta <pasta@dashboost.org>

* instantsend: adjust comments

Signed-off-by: pasta <pasta@dashboost.org>

* instantsend/tests: implement Spork 24 support in tests, and test it's usage

Signed-off-by: pasta <pasta@dashboost.org>

* fix feature_llmq_is_retroactive.py

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>

* drop Spork 24 and use Spork 2 value 1 as being no mempool signing

Signed-off-by: pasta <pasta@dashboost.org>

* fix spork check

Signed-off-by: pasta <pasta@dashboost.org>

* Fix tests

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* Change comment

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

* IsInstantSendSigningEnabled -> IsInstantSendMempoolSigningEnabled

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants