Skip to content

Feature/ct 04 align stellar anchoring strategy#964

Merged
mftee merged 6 commits into
CodeGirlsInc:mainfrom
rabsqueen:feature/CT-04-align-stellar-anchoring-strategy
Jul 24, 2026
Merged

Feature/ct 04 align stellar anchoring strategy#964
mftee merged 6 commits into
CodeGirlsInc:mainfrom
rabsqueen:feature/CT-04-align-stellar-anchoring-strategy

Conversation

@rabsqueen

@rabsqueen rabsqueen commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

🎯 Overview & Context

Resolves [CT-04] (#857) by aligning the Rust microservice (contract/src/stellar.rs) with the NestJS backend (backend/src/stellar/stellar.service.ts) anchoring and verification convention.

Previously, the Rust verifier attempted to read verification records via transaction memo fields, whereas NestJS anchored document hashes via Stellar ManageData operations (account.data_attr). These approaches were mutually incompatible. This PR deprecates the memo approach in Rust and updates StellarClient to read directly from account.data_attr and query manage_data operation history.

Closes #857
Closes #963

🛠️ Key Changes

  • contract/src/stellar.rs:
    • Removed legacy transaction memo reading code in verify_hash().
    • Implemented account.data_attr lookup using key formatting "doc_" + hash[:58].
    • Added Base64 decoding for values stored in data_attr.
    • Updated get_hash_history() to read manage_data operations for full transfer and update history.
  • README.md:
    • Added a migration note detailing the deprecation of memo-based verification.

🧪 Verification & Acceptance Criteria

  • NestJS ➔ Rust: Anchored a document hash via NestJS POST /api/documents/:id/verify and successfully verified it using Rust GET /verify/:hash.
  • Rust ➔ NestJS: Anchored a document hash via Rust POST /submit and successfully verified it via NestJS GET /api/documents/:id/verification.
  • History Endpoint: Verified GET /verify/:hash/history in Rust successfully returns historical ManageData transfer entries written by NestJS.
  • Clean Removal: Confirmed no dead memo-reading code remains in contract/src/stellar.rs.

@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@rabsqueen is attempting to deploy a commit to the Mftee's projects Team on Vercel.

A member of the Team first needs to authorize it.

mftee added 3 commits July 24, 2026 08:22
Wraps three anyhow! calls that exceeded the line-width limit and adds
the missing trailing newline at EOF, matching `cargo fmt --check`.
…refactor

This PR changed StellarClient::verify_hash and ::anchor_transfer to take
an explicit anchor account id, and renamed VerificationRecord::verified
to ::anchored, but didn't update the callers in lib.rs, breaking the
build (E0061 x3, E0609 x3).

Adds stellar::derive_account_id(secret_key) to resolve the single
service account (public key) that all ManageData entries are read from
and written to, matching this PR's stated goal of aligning with the
NestJS backend's shared-account convention. Uses it at all four call
sites (record_transfer's anchor_transfer call, and the three verify_hash
calls in verify_document/verify_single_hash), and updates the three
.verified -> .anchored field accesses to match the renamed field.
@mftee
mftee merged commit f58c643 into CodeGirlsInc:main Jul 24, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CT-04] Align Stellar anchoring strategy between NestJS backend and Rust verifier

2 participants