Skip to content

Cache successful P2MR transaction-signature checks (consensus-adjacent implementation, no rule change) #153

Closed

Description

@kiwidream

Please describe the feature you'd like to see added.
Add successful PQC transaction-signature verification to the bounded signature cache.

Is your feature related to a problem, if so please describe it.
At 70fea84f5becfb57463247af09790df5ddd424f8, sigcache.h:72 overrides ECDSA/Schnorr verification only. interpreter.cpp:2001 sends PQC checks directly to the verifier. The policy and consensus admission passes therefore repeat successful PQC checks on an ordinary first admission without a full-script-cache hit. Production impact is unmeasured.

Describe the solution you'd like
Cache successful (sighash, public key, signature) checks under a distinct PQC domain with existing store/consume and memory-limit behavior. Preserve both passes, script semantics and validation-weight charges. Scope this to transaction signatures.

Describe any alternatives you've considered
Skipping an admission pass or sharing full-script entries across flags would remove existing validation distinctions and should not be part of this change.

Acceptance
Instrument actual admission to demonstrate cache reuse. Require cached/uncached equivalence for valid and invalid vectors, changed inputs, failed verification, eviction, cache consumption and memory limits. Failures are never cached. A primitive benchmark alone is insufficient.

Consensus implications
No intended validity change or activation. Implementation requires consensus-focused review of cache keys and behavioral equivalence before landing.

Please leave any additional context
Open/closed inventory search found no duplicate. #45/#46 cover wallet counters; #103/#108 header caching; #104/#107 build controls. Evidence is static source review; no node experiment or performance claim accompanies this request.

Activity

  1. added
    enhancement
    on Sep 15, 2026
  2. self-assigned this
    on Sep 15, 2026
  3. kiwidream commented on Sep 23, 2026

    @kiwidream
    MemberAuthor

    Delivered by #162, merged into 1.x.x as a6442d28f9017b9dd09406233b64d23113124eeb. Merges into a non-default branch do not fire closing keywords, so this is closed by hand.

    Acceptance, mapped to the tests that prove each point:

    • Actual admission is instrumented and shows reuse: txvalidationcache_tests/pqc_policy_consensus_reuse drives the real ProcessTransaction and asserts the ordered cache events plus a backend verification counter (one miss and one verified insert in the policy pass, a hit in the consensus pass).
    • Cached and uncached outcomes are equal for valid and invalid vectors, including error codes and remaining validation weight: pqc_sigcache_tests/failures_never_populate and warm_cache_preserves_p2mr_errors_and_weight over the P2MR witness-vector corpus.
    • Changed inputs miss: key_components_and_domain (component swaps, first, middle and last byte flips, collisions attempted in the ECDSA and Schnorr domains).
    • Failed verification, and failures are never cached: failures_never_populate; at admission, a spend with one flipped signature bit is rejected on the first and on a repeated submission with one primitive verification each and no cache entry; the concurrent case shows an invalid tuple never hits.
    • Eviction and memory limits: shared_budget_and_eviction (shared bound with Schnorr entries, minimum allocation, evicted entries re-verify).
    • Cache consumption: store_consume_and_reclamation, plus zero backend verifications on warm store and warm consume hits.
    • Scope: data_signatures_bypass_the_cache shows OP_CHECKDATASIGPQC never consults or fills the cache.
    • A primitive benchmark alone is not the evidence: the admission test is; the benchmark times the two-pass pattern only.

    Mutation evidence: inserting a failed verification, re-verifying on a hit and removing the verification each fail both pqc_sigcache_tests and pqc_policy_consensus_reuse.

    Not covered: package admission, block-connection consumption end to end, and concurrency under the real script-check queue (the concurrent test uses plain threads at the checker seam). No consensus rule, validity or activation change.

  4. djh58 commented on Oct 29, 2026

    @djh58
    Member

    Related review finding: #259 covers the cases this successful-transaction-signature cache does not: OP_CHECKDATASIGPQC bypasses the cache and failed verifications are never cached, so a replayable invalid data-signature witness can still force repeated full verifies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions