Review report

core: PR #36122

Provider refusals

write_verifier: Provider declined the request because of a cybersecurity restriction. Experiments remain incomplete; static verification can continue.

1 major finding · 3 minor findings · 2 suggestions

Findings

Link

[major] · Witness-v2 spends are standard on networks where CISA is inactive

On mainnet, testnet, and signet, this build relays and mines BIP460 spends and its wallet can receive to v2 outputs, while consensus still treats those outputs as anyone-can-spend.

Location: src/policy/policy.h:133 (head).

Details and suggested fix

The change adds SCRIPT_VERIFY_WITNESS_V2 to the MANDATORY and STANDARD script flags unconditionally, and Solver classifies OP_2 <32 bytes> as WITNESS_V2_CISA rather than WITNESS_UNKNOWN. Consequently, ValidateInputsStandardness no longer rejects these inputs, and VerifyWitnessProgram validates them under STANDARD flags instead of reaching DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM.

Consensus adds the flag only when DEPLOYMENT_CISA is active. Only regtest configures that deployment as ALWAYS_ACTIVE; other chains retain the default NEVER_ACTIVE. Thus, on mainnet, testnet, and signet, this build admits BIP460-conforming v2 spends to its mempool and block templates, while block validation accepts any v2 spend, including one with an empty witness.

cisa() reports OutputType::BECH32M, so a wallet on those networks can use it as a bech32m receive or change descriptor. Funds received there are in outputs that consensus does not protect. This conflicts with the description's statement that activation is regtest-only. Gate v2 standardness on deployment state, as Taproot did before activation with taproot_active in AreInputsStandard, and reject v2 inputs in ValidateInputsStandardness unless DEPLOYMENT_CISA is active for the next block. Consider also refusing active cisa() descriptors while deployment is inactive.


Link

[minor] · PSBT completion accepts unverified CISA aggregate witnesses

PSBT RPCs can report complete=true and extract a transaction that the mempool rejects; consensus and mempool checks still prevent the invalid spend from being accepted.

Location: src/psbt.cpp:938 (head).

Details and suggested fix

For a witness-v2 key-path witness with a CISA marker, VerifyWitnessProgram returns success without checking a signature. The aggregate is checked only by VerifyCISATransaction, which PSBTInputSignedAndVerified does not call. As a result, any final_script_witness that passes per-input VerifyScript counts as verified. This includes a single empty element for a fullagg member without a final input, or a 32-byte member plus a 65-byte final element with the marker but a bogus aggregate.

SignPSBTInput returns early for these witnesses, FinalizeCISAInputs treats a finalized member as closing its group, and FinalizePSBT only requires aggregated inputs to have a final witness. Thus walletprocesspsbt, descriptorprocesspsbt, finalizepsbt, and analyzepsbt can report the PSBT complete or final and extract a transaction that mempool validation rejects with a CISA group or verification error. At base, these v2 inputs failed the per-input check under STANDARD flags.

This requires final witnesses that this node's FinalizeCISAInputs did not build; for example, another participant can supply them through combinepsbt. The behavior is established, but no concrete production trigger or affected caller was identified. SignTransaction already runs VerifyCISATransaction after the per-input checks. Run the same transaction-level check on the assembled transaction wherever PSBT completeness is determined.


Link

[minor] · descriptorprocesspsbt cannot retain fullagg secret nonces

The RPC advertises fullagg but cannot complete that signing flow; in debug builds, the first call aborts the node when Assume fails.

Location: src/rpc/rawtransaction.cpp:2157 (head).

Details and suggested fix

descriptorprocesspsbt signs using a local FlatSigningProvider whose cisa_secnonces is null. With cisa_mode="fullagg", SignTaproot calls MakeCISANonce, which passes the secret nonce to SetCISASecNonce. That function hits Assume(cisa_secnonces) and returns without storing it, though the public nonce is still returned and written to the PSBT.

In release builds, a later call cannot retrieve the secret nonce with GetCISASecNonce, so the RPC cannot produce a partial signature and the full-aggregation session must start over. In debug builds, ABORT_ON_FAILED_ASSUME makes the first call abort the node. The functional test exercises this RPC only with halfagg. Either reject fullagg in this stateless RPC or make MakeCISANonce refuse to publish a public nonce when the provider cannot store its secret.


Link

[minor] · Fullagg signing uses unresolved group sighash values

With an explicit non-default sighash, a signer can consume its nonce on a partial signature that finalization later rejects, forcing the session to restart.

Location: src/psbt.cpp:765 (head).

Details and suggested fix

SignPSBTInput writes the requested sighash only to the input currently being signed, then builds the fullagg group from every member's stored sighash_type; an absent field counts as DEFAULT. CreateCISAFullAggPartialSig hashes each member's message using that snapshot, and CreateFullAggPartialSig invalidates the secret nonce. DescriptorScriptPubKeyMan::FillPSBT processes inputs one at a time.

For example, consider two fullagg inputs with reserved pubnonces from reservecisanonce and no sighash fields. With sighashtype="ALL", signing input 0 uses messages [ALL, DEFAULT]. Input 1 is then set to ALL, and its signature uses [ALL, ALL]. FinalizeCISAInputs rebuilds the messages from the final fields, so AggregateFullAggSigs rejects input 0's partial signature. Retrying does not help because SignTaproot returns early when a partial signature already exists; fresh nonces are required. This occurs every time in a wallet whose only descriptor is cisa(). In wallets with several descriptor managers, it depends on iteration order because other managers also set the fields.

Resolve and write the effective sighash for every fullagg member before producing any partial signature, or refuse to sign while any member's sighash is unresolved. Add a reserved-nonce test that requests ALL explicitly. No checked-in test or workflow combines full aggregation with a non-default sighash, so how often this occurs in practice is unconfirmed.


Optional improvements

Link

[suggestion] · Aggregate signatures are verified serially in one check-queue job

Large aggregation groups lose parallel script verification and may increase worst-case block connection time, but the effect has not been measured.

Location: src/validation.cpp:2134 (head).

Details and suggested fix

CheckInputScripts queues one CISACheck per transaction, and CCheckQueue runs each check on one worker thread. Marked inputs do no signature work in their per-input checks, so all aggregate verification occurs in that job. Its cost grows linearly with group size on one thread: secp256k1_schnorrsig_aggverify performs two variable-base point multiplications per member, and secp256k1_fullagg_verify calls ecmult_multi_var without scratch space, despite a TODO for this.

Group size is bounded only by weight. A halfagg member is roughly 198 WU, so a miner-built block could hold one transaction with around 20,000 members, requiring about 40,000 serial point multiplications. A Taproot key-path block of the same weight spreads about 17,000 Schnorr verifications across script threads. These are operation counts, not measurements.

Does BIP460 intend serial per-transaction verification? A benchmark comparing a maximum-weight single-group block with a Taproot block would show whether latency matters. If it does, consider splitting large groups into partial sums across the check queue, using Strauss or Pippenger multi-exponentiation with scratch space, or bounding group size or charging a validation budget in the BIP.


Link

[suggestion] · Mempool acceptance verifies each aggregate signature twice

The aggregate check has no cache, so ConsensusScriptChecks repeats it for every accepted aggregated transaction, unlike per-input Schnorr checks.

Location: src/validation.cpp:2133 (head).

Details and suggested fix

PolicyScriptChecks calls CheckInputScripts with STANDARD flags, which include WITNESS_V2, so CISACheck runs. Per-input Schnorr checks populate the signature cache during this pass.

When CISA is active at the tip, ConsensusScriptChecks calls CheckInputScripts again with the tip flags. The script-execution cache misses because the flags differ and the policy pass stores nothing, so CISACheck runs again. VerifyCISATransaction does not consult the signature cache, so aggregate verification runs twice under cs_main and the mempool lock. Block validation is unaffected because it hits the script-execution cache for transactions already in the mempool.

Cache successful aggregate verification to avoid the duplicate work while retaining the tip-flags safety check. For example, store it in the signature cache under a hash of the group's pubkeys, messages, and aggregate signature.


Coverage details