Repository navigation
Description
Description updated on 2026-11-10 to consolidate #259 and #332 here. The original description is kept unchanged at the end.
Problem
A P2MR spend whose PQC (SLH-DSA) signature is invalid costs the receiving node a full signature verification before the transaction is rejected. This holds for transaction signatures (OP_CHECKSIGPQC) and for data signatures (OP_CHECKDATASIGPQC, OP_CHECKDATASIGADDPQC).
- Cost. About 1.7–2.2 ms per failed verification of a ~3.75 KB witness, or about 0.5 µs of message-handler and
cs_maintime per witness byte (Review finding: OP_CHECKDATASIGPQC failures bypass the PQC signature cache #259, script: cache verified P2MR data-signature checks (v1.0.1) #265). Thetxhandler insrc/net_processing.cpptakescs_mainbeforeProcessTransaction, and the mempool script checks (MemPoolAccept::PolicyScriptChecksinsrc/validation.cpp) run inline on the message-handler thread. - Repeats. The failing script does not consume the spent output, so the same spend can be resubmitted in mutated transactions (Review finding: OP_CHECKDATASIGPQC failures bypass the PQC signature cache #259). Each mutated copy has a new wtxid, so the reject filter does not stop it, and each copy is verified again in full.
- Not cached. The signature cache stores verified successes only (
CachingTransactionSignatureChecker::VerifyPQCSignatureandVerifyPQCDataSignatureinsrc/script/sigcache.cpp). - No peer penalty. A transaction failure never leads to disconnection or discouragement ("Tx failures never trigger disconnections/bans" in
CheckInputScripts,src/validation.cpp; there is no transactionMisbehavingcall insrc/net_processing.cpp). This behaviour is inherited from Bitcoin Core 30.
At about 0.5 µs per witness byte, a peer sending about 2 MB/s of such witness data can keep the message-handler thread and cs_main busy, which delays block and transaction processing for every other peer.
Already fixed
- script: cache successful P2MR PQC signature checks #162 caches verified P2MR transaction signatures.
- script: cache verified P2MR data-signature checks (v1.0.1) #265 caches verified
OP_CHECKDATASIGPQCandOP_CHECKDATASIGADDPQCdata signatures in a separate cache domain. A valid data signature resubmitted in mutated transactions now costs one verification instead of one per resubmission.
Neither change caches failures, so neither lowers the cost of invalid signatures. The original description below says #265 added a failure cache. It did not, and byte-identical resubmissions were already stopped by the wtxid reject filter (#332).
Open scope
Bound the validation time that one peer can make the node spend on transactions that are rejected, in particular transactions with invalid PQC signatures on either signature path. The target is 1.x.x. The 1.1.0 branch does not have #265 yet (#310).
Proposed direction
- Measure the time spent validating each transaction received from a peer that is rejected for a reason in the transaction itself (a script or signature failure, or a consensus or standardness failure), and charge it to that peer. This includes transactions from
txmessages, orphan reconsideration and package evaluation. - Charge measured time rather than a count of failures, so the budget follows the actual work whichever check failed.
- Give each peer a budget that refills over time. While a peer is over its budget, stop validating its transactions until the budget has refilled, instead of disconnecting or discouraging it. That keeps peers that run a different policy version connected.
- Keep
nobanand manually added peers exempt, as for other misbehaviour handling. - Report the per-peer figures in
getpeerinfo.
Caching failures is not enough on its own:
- As script: cache verified P2MR data-signature checks (v1.0.1) #265 records, distinct invalid signatures can be derived freely. A cache of failed checks keyed on the exact signature bytes would only stop exact repeats.
- A cache keyed without the signature bytes, for example on the message and key only, would also reject a later valid signature for the same message and key, so it cannot be used.
Related
- Review finding: OP_CHECKDATASIGPQC failures bypass the PQC signature cache #259 (closed): the original report. script: cache verified P2MR data-signature checks (v1.0.1) #265 fixed its valid data-signature replay. Its invalid-signature scenario is tracked here.
- Review finding: #259's invalid-signature cost is not mitigated, and #275 misdescribes #265 #332 (closed as a duplicate of this issue): noted that Review finding: OP_CHECKDATASIGPQC failures bypass the PQC signature cache #259's invalid-signature scenario was still open and that this issue misdescribed script: cache verified P2MR data-signature checks (v1.0.1) #265.
- release: prepare v1.0.1 #181: the v1.0.1 release notes list uncached failed PQC signature checks as a known limitation.
Original description (2026-11-02)
Follow-up to #259. The failure cache added with #265 helps only byte-identical resubmissions. It does not lower the rate at which a peer can have the node run full PQC verifications that fail.
In the measured case, each failure costs about 1.7 ms of cs_main time per ~3.75 KB of witness. A transaction-level failure carries no peer penalty (validation.cpp:2252; no transaction Misbehaving in net_processing.cpp).
Bounding that needs local policy, such as per-peer accounting of failed PQC verification time in mempool acceptance, with throttling or disconnection past a budget. This is a design decision for the maintainers, so no code is attached.
Activity
kiwidream commentedon Nov 10, 2026
Updated the description to consolidate #259 and #332 here. It now corrects what #265 does (it caches verified successes only), states the open scope and adds a proposed direction. The original text is kept at the end of the description. #332 is closed as a duplicate of this issue.
net: budget per-peer time spent validating rejected transactions (#386)
net: request transactions held back by the validation budget later, a…
net: budget per-peer time spent validating rejected transactions (#386)
net: request transactions held back by the validation budget later, a…
kiwidream commentedon Nov 12, 2026
Fixed on
1.x.xby #386 (993521799e), with its follow-ups #422 (2f2ad3e7cd) and #425 (a7a70660ad), which ship in v1.0.1. What the "Open scope" asked for is in:txmessages, orphan reconsideration and packages) and charges that time to the peer.nobanpermission and manual connections are exempt.getpeerinforeportsfailed_tx_validation_time,tx_validation_throttledandtx_dropped_while_throttled.Tests:
tx_validation_budget_tests,peerman_tests/tx_validation_budget_*andp2p_tx_validation_budget.py. The deferred review findings stay open in #401.Closing by hand, because a merge into
1.x.xdoes not close issues automatically.