Review report

core: PR #35888

1 minor finding · 1 suggestion

Findings

Link

[minor] · Oversized test-chain transactions can abort Debug builds during relay

A peer can trigger the abort only on a test chain with relaxed, non-default mempool policy in a Debug build; release builds drop the message, and no production trigger was identified.

Location: src/net.cpp:4169 (head).

Details and suggested fix

On a test chain configured with -acceptnonstdtxn=1 and -limitclustersize raised to about 1,100 kvB, the mempool can accept a valid transaction whose witness serialization exceeds 4,000,000 bytes, such as a key-path spend with a large Taproot annex. Both options are DEBUG_ONLY. With nonstandard transaction checks disabled, and because CheckTransaction limits only non-witness size, such a transaction can be admitted. A peer can relay it: V2 permits a short-ID tx message with up to 4,000,012 payload bytes, while V1 stops at 4,000,000. After the node announces the transaction, a witness GETDATA request builds a TX message larger than MAX_PROTOCOL_MESSAGE_LENGTH. The new Assume(msg.IsWithinLimits()) then aborts a Debug build; before this change, the message was queued. This differs from the locally admitted oversized transactions described in the commit message: a peer with a spendable test-chain input and sufficient relay fee can trigger the failure. Enforce the payload limit before admitting or announcing the transaction, including the V2 short-ID case, or retain the check as a non-aborting drop. No existing test or deployment using this configuration was identified, so practical impact is unconfirmed.


Optional improvements

Link

[suggestion] · Outbound limits test does not assert that oversized messages trigger Assume

Replacing the Assume with a silent drop would still pass the test, leaving the intended Debug and fuzz diagnostic uncovered.

Location: src/test/net_tests.cpp:1407 (head).

Details and suggested fix

The test enables test_only_CheckFailuresAreExceptionsNotAborts, but checks reject only if an exception is caught. If PushMessage() silently returns for an oversized type or payload, queued stays unchanged and the queue-size check still passes. Thus replacing Assume(msg.IsWithinLimits()) with a plain if would leave the test passing, even though the Assume is intended to expose invalid internal callers. Track whether NonFatalCheckError was caught and assert threw == (reject && G_ABORT_ON_FAILED_ASSUME), as util_check_tests.cpp does for Assume. Keep the queue-size checks to cover release-mode dropping.


Coverage details