Skip to content

DOC: Missing documentation for spending_proof validation boundary #2085

@geldbert

Description

@geldbert

Issue Type: Documentation Gap / Potential Security Gap
Component: UTXO Layer (node/utxo_db.py)
Severity: Low (documentation) to Medium (if exploited)

Description:
The spending_proof field in transactions is accepted by the UTXO layer without any validation or parsing. While this is clearly intentional (signature verification happens at the endpoint layer), there's no documentation or code comments explaining this architectural decision.

In PR #2073, the test test_spending_proof_not_verified_in_utxo_layer explicitly documents this behavior with the comment: "The UTXO layer does NOT verify spending proofs — by design. Signature verification is the endpoint layer's responsibility."

Problem:
This architectural boundary is implied but not explicitly specified in the codebase. A future developer might:

  1. Assume the UTXO layer validates proofs and introduce redundant validation
  2. Rely on the UTXO layer for security properties it doesn't provide
  3. Misunderstand where in the stack verification actually happens

Suggested Fix:

  1. Add a comment in UTXODatabase.apply_transaction() at the spending_proof handling line
  2. Consider adding a docstring to the class that explicitly notes: "This module handles UTXO state transitions only. Signature verification is the caller's responsibility."

Impact:
Better developer experience, reduced risk of security assumptions being violated.

References:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions