Skip to content

fix: implement real Soroban entitlement reads and cache freshness - #60

Merged
barry01-hash merged 6 commits into
Eduvault-stellar:mainfrom
dev-king-001:main
Jul 28, 2026
Merged

fix: implement real Soroban entitlement reads and cache freshness#60
barry01-hash merged 6 commits into
Eduvault-stellar:mainfrom
dev-king-001:main

Conversation

@dev-king-001

Copy link
Copy Markdown
Contributor

fix: implement real Soroban entitlement reads and cache freshness

What was done

  • Replaced the stubbed buildHasEntitlementXdr and decodeBoolean methods in src/lib/entitlement.js with functional @stellar/stellar-sdk implementations.
  • Implemented a cache freshness policy for entitlement_cache with a 5-minute positive TTL and 1-minute negative TTL.
  • Added a PENDING_REQS Promise Map to coalesce overlapping verification requests and prevent RPC spikes.
  • Updated unit tests in tests/backend/entitlement.test.mjs to accurately test the resilient fail-open fallback and TTL mechanics.

Why it was done

  • The system was previously simulating transactions with empty/stubbed XDR and blindly guessing the result from base64 strings.
  • Cached entitlements had no freshness policy, resulting in stale data being trusted indefinitely.
  • The lack of concurrency controls could lead to "thundering herd" issues where multiple simultaneous requests would hit the chain RPC identically if the cache was missing or expired.

How it was verified

  • Automated tests (npm run test:backend) passed successfully validating the positive/negative TTL limits, fail-open stale-cache behavior, and fallback mechanisms when the RPC is unavailable.

Closes #5

@barry01-hash

Copy link
Copy Markdown
Contributor

@dev-king-001 fix ci cd error before i will merge

@barry01-hash

Copy link
Copy Markdown
Contributor

Please resolve conflicts

@barry01-hash
barry01-hash merged commit c086e66 into Eduvault-stellar:main Jul 28, 2026
2 of 8 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.

[Stellar] Implement real Soroban entitlement reads and cache freshness policy

3 participants