fix(framework): count pq_auth_sig in multisign fee and reverify checks

BL
4mo ago
+387-9

What does this PR do

Fixes three places where PQ multisig (pq_auth_sig) was not accounted for alongside ECDSA signatures, even though the existing permission/weight validation already treats the two as contributing independently to the same threshold:

  • Manager.consumeMultiSignFee only checked getSignatureCount() > 1, so PQ-only and hybrid ECDSA+PQ multisig transactions escaped the multisign fee entirely.
  • Manager.isSameSig (used by getVerifyTxs to skip re-verifying transactions already verified in the pending pool) compared only the ECDSA signature list. Since txId hashes raw_data only, a block transaction with a substituted pq_auth_sig but the same txId could be wrongly marked verified=true and skip real signature validation in processTransaction — a signature-verification bypass.
  • Wallet.getTransactionApprovedList built the approved list from ECDSA signatures only, missing the pq_auth_sig branch already present in its sibling TransactionUtil.getTransactionSignWeight, so PQ signers never showed up in the approval status response.

Why required

These are correctness/security gaps introduced when PQ multisig support (pq_auth_sig) was added: the fee, re-verification optimization, and approval-status reporting paths weren't updated to match the combined ECDSA+PQ signature semantics used everywhere else (e.g. TransactionCapsule.validateSignature, TransactionUtil.getTransactionSignWeight).

Tests

  • ManagerTest: consumeMultiSignFeePqOnlyCharged, consumeMultiSignFeeHybridCharged, consumeMultiSignFeeSingleEcdsaNotCharged, consumeMultiSignFeeSinglePqNotCharged, getVerifyTxsPqAuthSigContentDifferRequiresReverify, getVerifyTxsPqAuthSigCountDifferRequiresReverify, getVerifyTxsPqAuthSigIdenticalSkipsReverify
  • WalletTest: testApprovedListPqOnlySigner, testApprovedListHybridEcdsaAndPq, testApprovedListPqNotActivated
  • All three suites pass locally (ManagerTest 42/42, WalletTest 51/51 with 1 pre-existing unrelated skip, ProposalUtilTest 5/5).

Follow up

None.

Extra details

Also wraps two pre-existing >100-character lines in ProposalUtilTest (unrelated to this fix) to keep checkstyleTest passing.


Summary by cubic

Count pq_auth_sig with ECDSA for multisign fee, re-verify checks, and approved lists. Fixes a verification bypass and makes PQ-only and hybrid multisig work as expected.

  • Bug Fixes

    • Multi-sign fee: charge when total signatures (ECDSA + PQ) > 1 in Manager.consumeMultiSignFee.
    • Re-verify: Manager.isSameSig also checks PQ signature count and content to avoid skipping verification when txId matches but pq_auth_sig differs.
    • Approved list: Wallet.getTransactionApprovedList merges ECDSA and PQ signers and rejects pq_auth_sig when no PQ scheme is activated.
  • Refactors

    • Tests: made Manager.isSameSig @VisibleForTesting and added focused unit tests; consolidated getVerifyTxs PQ cases into a helper and hardened the inactive-PQ test by disabling all PQ schemes and asserting the global gate.

Summary by CodeRabbit

  • New Features

    • Added support for post-quantum cryptographic signatures in transactions alongside traditional signature types.
  • Bug Fixes

    • Fixed multi-signature fee calculation to properly account for both cryptographic signature types.
    • Improved transaction signature matching for mixed-signature scenarios.
  • Tests

    • Added comprehensive test coverage for post-quantum signature validation, including single post-quantum, hybrid, and activation verification scenarios.