Skip to content

[CT-22] Build OwnershipChainValidator #554

@mftee

Description

@mftee

Problem

The transfer history for a document is stored in Redis but its integrity is never verified. A gap in the ownership chain (where to_owner of one transfer does not match from_owner of the next) would go undetected, allowing fraudulent transfer insertions.

Proposed Solution

Create an OwnershipChainValidator inside contract/module/ownership-chain/ that verifies the continuity of a document's transfer history.

Acceptance Criteria

  • validate_chain(document_hash: &str, cache: &CacheBackend) async function fetches all TransferRecords for the hash and checks continuity
  • A chain is valid if each record's from_owner matches the previous record's to_owner
  • Returns a ValidationResult enum: Valid, Invalid { gap_at_index: usize, expected_owner: String, found_owner: String }, or Empty (no transfers recorded)
  • GET /module/chain/:document_hash endpoint returns the validation result as JSON
  • Unit tests cover: empty history, single transfer, valid two-step chain, gap at index 1, and gap at last transfer
  • Implementation files live inside contract/module/ownership-chain/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions