Feat/signers send failed txs to miner#6964
Feat/signers send failed txs to miner#6964brice-stacks merged 19 commits intostacks-network:developfrom
Conversation
Signed-off-by: Jacinta Ferrant <236437600+jacinta-stacks@users.noreply.github.com>
Signed-off-by: Jacinta Ferrant <236437600+jacinta-stacks@users.noreply.github.com>
Signed-off-by: Jacinta Ferrant <236437600+jacinta-stacks@users.noreply.github.com>
…st for failed_tx functionality Signed-off-by: Jacinta Ferrant <236437600+jacinta-stacks@users.noreply.github.com>
…s produced successfully Signed-off-by: Jacinta Ferrant <236437600+jacinta-stacks@users.noreply.github.com>
Signed-off-by: Jacinta Ferrant <236437600+jacinta-stacks@users.noreply.github.com>
Signed-off-by: Jacinta Ferrant <236437600+jacinta-stacks@users.noreply.github.com>
… into feat/signers-send-failed-txs-to-miner
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #6964 +/- ##
===========================================
- Coverage 68.63% 64.93% -3.71%
===========================================
Files 412 412
Lines 219013 219145 +132
Branches 338 338
===========================================
- Hits 150330 142306 -8024
- Misses 68683 76839 +8156
... and 269 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
brice-stacks
left a comment
There was a problem hiding this comment.
Looks good. Two minor comments and one concern remaining.
… into feat/signers-send-failed-txs-to-miner
Signed-off-by: Jacinta Ferrant <236437600+jacinta-stacks@users.noreply.github.com>
Signed-off-by: Jacinta Ferrant <236437600+jacinta-stacks@users.noreply.github.com>
… into feat/signers-send-failed-txs-to-miner
… into feat/signers-send-failed-txs-to-miner
5f6b6e9 to
57f9342
Compare
Signed-off-by: Jacinta Ferrant <236437600+jacinta-stacks@users.noreply.github.com>
57f9342 to
86e9a85
Compare
|
I resolved the merge conflicts in this one. It would be nice to get this released soon. |
Coverage Report for CI Build 24350271522Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage decreased (-0.02%) to 85.697%Details
Uncovered Changes
Coverage Regressions1814 previously-covered lines in 61 files lost coverage.
Coverage Stats
💛 - Coveralls |
benjamin-stacks
left a comment
There was a problem hiding this comment.
LGTM. I left various notes that I'd like to see addressed, but nothing that would block merging this PR, I'm happy to open follow-up PRs instead.
jcnelson
left a comment
There was a problem hiding this comment.
Unless I'm missing something, I think that, as written, there's a denial-of-service bug in this PR. If an attacker discovers a problematic transaction, they can iteratively spam the mempool with many high-fee variations of it and force chronic, repeated block rejections, and thereby stall the chain. The fix would be for the miner to try the proposal again with the exactly the same transactions as before, minus the problematic ones and their dependents (i.e. without querying the mempool). You could do this by setting the replay_transactions slice passed into NakamotoBlockBuilder::build_nakamoto_block(). In this PR, it appears that the miner recovers from a signer-rejected transaction by rebuilding a block from the mempool (instead of the already implicitly-approved remaining transactions), which allows the attacker to reliably slip in novel problematic transactions.
Is that really something that's coming from this PR? Wouldn't that work just as well today? |
The status quo is that, if the signer determines that a block is invalid due to a problematic transaction, the miner would attempt to naively produce new blocks which could contain the same problematic transaction over and over. This behavior leads to a chain stall which can only be fixed if the miner refrains from including the problematic transaction. This PR tries to fix this by making it so the miner node drops the signer-rejected problematic transactions from the mempool. This tactic isn't robust enough because the same problematic transaction could get re-inserted into the mempool on mempool sync or rebroadcast, leading to the status quo behavior. Also, if there is a large influx of problematic transactions, the current approach will still lead to a chain stall, since on re-attempt the miner will have a good attacker-controlled chance of picking a novel rejected transaction. To fully address this, we need to do two things:
|
|
Right, and those are valid points, but they are points that weren't introduced by this PR. This PR fixes one specific thing that it set out to fix: If there is a discrepancy between what the miner considers valid and what the signers consider valid (for whatever reason), that'll currently cause an unconditional stall because the miner doesn't know why the block was rejected, and thus re-proposes it over and over again. With this change, the miner has a chance to rectify things, because it now knows the reason for the rejection. So there are stalls that might happen with the status quo but will not happen with this change. On the other hand, unless I'm completely misunderstanding you, there are no stalls that happen with this change that would not have happened before this change. If that's the case, this PR is a clear net positive. And it has previously had approvals from three different people (including yourself). All I'm saying is that we should merge it, and if we want to improve things even further, we can create a follow-up ticket and a new PR. That way, we have the initial benefit of this PR right now, and the new PR is easier to review. |
|
I would agree with @benjamin-stacks's response above. I don't see how this creates any new problems, only that it doesn't solve all potential problems. |
946825b
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Closes #6659
Closes #6660
failed_txidfield to block validation reject responses and signer rejection messages, allowing signers to report which specific transaction caused a block proposal to fail validationBadTransactionrejections exclude the tx until the next successful block production (transient failures like deadline exceeded), while the newProblematicTransactionreject code permanently blacklists the tx from the mempool (genuinely broken txs like parse errors, Clarity crashes, etc.). I could also change it to be banned for just the tenure or something if that is too harsh a punishment. I am not 100% sure if ProcessingFailure is transitory or indicates a bigger problem...but I treat those as only temporary failures.failed_txid