Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the oracle cron service to persist PoRep market deal data in Postgres (via Prisma), add new cron jobs around syncing/settling/terminating deals, and update SLI fetching/attestation plumbing (including new contract integrations and env configuration).
Changes:
- Introduces Prisma schemas/migrations plus runtime Prisma client wiring (including a second “DMOB” Prisma client).
- Adds multiple new cron jobs (deal sync, set deal end epoch, settlement bot, terminate deal, claims-terminated-early) and updates HTTP/manual triggers accordingly.
- Refactors SLI data types and CDP fetching shape; updates on-chain SLI submission logic and wallet role handling.
Reviewed changes
Copilot reviewed 45 out of 47 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/types.ts | Adds/updates domain types for SLIs and PoRep deal tracking. |
| src/services/prisma-service.ts | Adds Prisma client factories (main + DMOB). |
| src/services/filecoin-api-service.ts | Updates imports to new module specifiers. |
| src/services/db-service.ts | Adds DB queries and deal upsert/sync logic via Prisma. |
| src/services/db-dmob-service.ts | Adds DMOB DB query for allocation term aggregation. |
| src/services/cdp-fetch-service.ts | Changes CDP endpoint + response shape handling. |
| src/jobs/terminate-deal-job.ts | New cron job to terminate rails and mark DB state. |
| src/jobs/sync-deal-job.ts | New cron job to sync deals from chain + validate allocations via DMOB. |
| src/jobs/settlement-bot-job.ts | New cron job to settle rails via FilecoinPay. |
| src/jobs/set-sli-job.ts | Updates SLI cron job to use SP registry + new CDP response shape. |
| src/jobs/set-deal-end-epoch-job.ts | New cron job to set deal end epoch + modify rail payment. |
| src/jobs/claims-tracking-job.ts | Removes old claims tracking job implementation. |
| src/jobs/claims-terminated-early-job.ts | New cron job to detect early-terminated claims and report on-chain. |
| src/index.ts | Adds scheduling for new cron jobs and env validation. |
| src/http-server/server.ts | Updates manual trigger endpoints for new/renamed jobs. |
| src/config/env.ts | Expands env config (roles, contracts, new cron intervals). |
| src/blockchain/validator-contract.ts | Adds validator contract interactions (terminate/set end epoch/modify payment). |
| src/blockchain/sp-registry-contract.ts | Adds SP registry contract integration for provider discovery. |
| src/blockchain/sli-oracle-contract.ts | Refactors SLI submission to new data model and wallet role. |
| src/blockchain/sla-allocator-contract.ts | Removes old SLA allocator contract integration. |
| src/blockchain/porep-market.contract.ts | Adds PoRep market contract reads (getDeals/getCompletedDeals). |
| src/blockchain/filecoinpay-contract.ts | Adds FilecoinPay settleRail contract interaction. |
| src/blockchain/client-contract.ts | Refactors client contract calls + introduces wallet account roles. |
| src/blockchain/blockchain-client.ts | Adds wallet-client-per-role caching and account selection. |
| src/blockchain/abis/validator-abi.ts | Adds validator contract ABI. |
| src/blockchain/abis/sp-registry-abi.ts | Updates SP registry ABI entries. |
| src/blockchain/abis/sli-oracle-abi.ts | Updates SLI oracle ABI types/components. |
| src/blockchain/abis/porep-market-abi.ts | Adds PoRep market contract ABI. |
| src/blockchain/abis/filecoinpay-abi.ts | Adds FilecoinPay ABI. |
| src/blockchain/abis/client-abi.ts | Updates client ABI method signature (per-deal allocations). |
| prismaDmob/schema.prisma | Adds DMOB schema model for unified_verified_deal. |
| prismaDmob/prisma.config.ts | Adds Prisma CLI config for DMOB schema. |
| prisma/schema.prisma | Adds oracle DB schema for deals/requirements/terms/history/settlements. |
| prisma/prisma/migrations/migration_lock.toml | Adds Prisma migration lock. |
| prisma/prisma/migrations/20260414102544_init/migration.sql | Initial migration for deal tracking tables. |
| prisma/prisma/migrations/20260414114403_store_deal_allocation_ids/migration.sql | Adds allocationIds column. |
| prisma/prisma/migrations/20260414135045_create_settlement_history/migration.sql | Adds settlement history + deal end epoch flags. |
| prisma/prisma.config.ts | Adds Prisma CLI config (schema/migrations/datasource). |
| package.json | Adds Prisma deps/scripts and adjusts runtime deps. |
| docker-compose.yml | Adds local Postgres service. |
| ci/runner.sh | Adds entrypoint wrapper to derive DATABASE_URL from secret JSON. |
| ci/aws-secret-to-db-url.js | Adds helper to build DATABASE_URL from AWS secret JSON env. |
| Dockerfile | Adds Prisma generate steps + entrypoint runner + truststore bundle. |
| .gitignore | Ignores generated Prisma clients. |
| .env.example | Updates sample env variables (needs alignment with new keys). |
| .README.md | Updates documentation/diagrams for new job flows. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 49 out of 51 changed files in this pull request and generated 10 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
050ce77 to
8dc2285
Compare
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.
No description provided.