Skip to content

Feat/admin oracle backend#814

Merged
GoSTEAN merged 4 commits into
Netwalls:mainfrom
maugauwi-hash:feat/admin-oracle-backend
May 28, 2026
Merged

Feat/admin oracle backend#814
GoSTEAN merged 4 commits into
Netwalls:mainfrom
maugauwi-hash:feat/admin-oracle-backend

Conversation

@maugauwi-hash
Copy link
Copy Markdown
Contributor

Implements 4 backend features for the BOXMEOUT oracle and admin system:

  1. 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/submit and /api/admin have request bodies masked.

  2. Admin Disputes Endpoint ([BACKEND] Implement AdminController::listDisputes() #760) - GET /api/admin/disputes returns all open disputes with market and oracle report details, joined from disputes, markets, and oracle_reports tables, sorted by raised_at DESC.

  3. Dispute Resolution Endpoint ([BACKEND] Implement AdminController::resolveDispute() #761) - POST /api/admin/resolve-dispute/:market_id allows admins to override oracle results with a final_outcome. Validates outcome, calls OracleService.raiseDispute() to broadcast on-chain, and updates dispute status to 'resolved'.

  4. 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.

  5. OracleService Unit Tests ([BACKEND] Write unit tests for OracleService #763) - Comprehensive test suite covering:

    • Successful submitFightResult() flow with mocked StellarService
    • External API failure handling in pollFightResults()
    • HMAC/Ed25519 signature validation in verifyOracleReport()
    • Oracle whitelist rejection
    • Error cases (missing market, invalid signatures)

Testing

  • Unit tests added for OracleService covering all acceptance criteria
  • Tests mock StellarService.invokeContract() for contract interactions
  • Tests verify signature validation, whitelist checks, and error handling
  • All tests use Jest with proper setup/teardown of environment variables

Closes #760
Closes #761
Closes #762
Closes #763

…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
@GoSTEAN GoSTEAN merged commit 5a7d461 into Netwalls:main May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants