Feat/admin oracle backend#814
Merged
Merged
Conversation
…rmat - Implement request logging middleware with human-readable format for dev - JSON format for production log aggregation - Mask sensitive request bodies for /api/oracle/submit and /api/admin paths - Log method, path, status code, response time, and IP address
…tes() and resolveDispute() - Add GET /api/admin/disputes endpoint returning open disputes - JOINs with markets and oracle_reports tables, sorted by raised_at DESC - Add POST /api/admin/resolve-dispute/:market_id endpoint - Validates final_outcome (fighter_a, fighter_b, draw, no_contest) - Calls OracleService.raiseDispute() to broadcast on-chain - Updates Dispute.status to 'resolved' with final_outcome - Both endpoints require admin JWT authentication
…olution - Implement raiseDispute() to broadcast dispute on-chain - Retrieves market contract address by match_id - Calls StellarService.invokeContract() with raise_dispute operation - Saves OracleReport to DB with oracle_address = 'admin' - Returns tx_hash for dispute transaction
- Mock StellarService.invokeContract() for contract calls - Test successful submitFightResult() flow - Test external API failure handling in pollFightResults() - Test HMAC validation in verifyOracleReport() - Test auto-resolution job with market processing - Test error cases: missing market, invalid signatures, whitelist rejection
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.
Implements 4 backend features for the BOXMEOUT oracle and admin system:
Request Logging Middleware ([BACKEND] Add request logging with Morgan or Pino #762) - Structured HTTP request logging with human-readable format for development and JSON format for production log aggregation. Sensitive paths like
/api/oracle/submitand/api/adminhave request bodies masked.Admin Disputes Endpoint ([BACKEND] Implement AdminController::listDisputes() #760) -
GET /api/admin/disputesreturns all open disputes with market and oracle report details, joined from disputes, markets, and oracle_reports tables, sorted by raised_at DESC.Dispute Resolution Endpoint ([BACKEND] Implement AdminController::resolveDispute() #761) -
POST /api/admin/resolve-dispute/:market_idallows admins to override oracle results with a final_outcome. Validates outcome, calls OracleService.raiseDispute() to broadcast on-chain, and updates dispute status to 'resolved'.OracleService.raiseDispute() ([BACKEND] Implement AdminController::resolveDispute() #761) - New service method to broadcast dispute resolution on-chain, retrieves market contract address, invokes raise_dispute operation, and persists OracleReport to DB.
OracleService Unit Tests ([BACKEND] Write unit tests for OracleService #763) - Comprehensive test suite covering:
Testing
Closes #760
Closes #761
Closes #762
Closes #763