feat(stats): add GET /stats/transparency and POST /stats/verify endpoints#909
Open
Danielobito009 wants to merge 1 commit into
Open
Conversation
…ints (crackedstudio#834) - Add GET /stats/transparency returning platform stats, oracle public key, draws completed, and recent audit log - Add POST /stats/verify for Ed25519 VRF proof verification - Add GET /transparency paginated audit log with raffle_id filter - Cache /stats/transparency 60s via MetadataRedisService - Cache /stats/verify 60s with unique key per pubkey/requestId/proof/seed - Cache /transparency 60s via CacheService.wrap() - Never return 500 on verify — always { valid: false, reason } - Graceful cache degradation when Redis unavailable - Add 77 tests across 3 files: - 21 controller tests (transparency + verify + platform) - 28 service tests (getTransparencyStats + verifyDraw) - 28 indexer transparency controller tests - Register StatsModule in AppModule - Register TransparencyController in ApiModule Closes crackedstudio#834
|
@Alu-card19 is attempting to deploy a commit to the otaiki1's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Issue #834 — GET /stats/transparency and POST /stats/verify
endpoints for on-chain proof verification, plus paginated audit log
via GET /transparency.
Endpoints Implemented
GET /stats/transparency
Returns platform aggregate stats with oracle key and recent audit log.
Response:
{ "date": "2026-06-27", "total_raffles": 100, "total_tickets": 5000, "total_volume_xlm": "250000000000", "unique_participants": 1000, "prizes_distributed_xlm": "50000000000", "oracle_public_key": "0xabcd1234", "draws_completed": 1, "recent_audit_log": [...] }POST /stats/verify
Verifies Ed25519 VRF proof signature. Always returns 200.
Response:
{ "valid": true } // or { "valid": false, "reason": "Invalid proof signature" }GET /transparency?limit=20&offset=0&raffle_id=X
Returns paginated audit log entries from Supabase.
Response:
{ "entries": [...], "total": 50 }Files Changed
stats.controller.ts— 2 new endpointsstats.service.ts— getTransparencyStats(), verifyDraw()transparency.controller.ts— paginated audit logstats.module.ts— module registrationapi.module.ts— transparency controller registrationCache Implementation
stats:transparency:60stats:verify:{pubkey}:{requestId}:{proof}:{seed}transparency:{limit}:{offset}:{raffle_id?}Test Coverage (77 tests)
Error Handling
{ valid: false, reason }{ entries: [], total: 0 }Acceptance Criteria
/stats/verifyreturns{ verified: false }for invalid tx hashCloses #834