feat: add full-rate and trickle SP testing tiers - #682
Conversation
There was a problem hiding this comment.
Pull request overview
Implements provider testing tiering to reduce wallet-spend exposure from newly registered/ephemeral storage providers by running only “full-rate” providers at configured rates and throttling all other eligible providers to a fixed “trickle” rate per network.
Changes:
- Adds per-network “expected approved” allowlists (IDs + addresses) and a shared
isFullRateTierhelper to classify providers into full-rate vs trickle tiers. - Applies tier-specific scheduling and dataset targeting (deals + dataset creation rates, min dataset targets), and restricts dataset lifecycle checks to full-rate providers (including stale-schedule cleanup and runtime re-eligibility checks).
- Updates configuration loading/validation, docs, and examples to describe and support the new tiering knobs.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/environment-variables.md | Documents tiering behavior and adds expected-approved env vars. |
| apps/backend/.env.example | Adds example expected-approved vars and tiering notes. |
| apps/backend/src/config/constants.ts | Introduces fixed trickleTierRates constants. |
| apps/backend/src/config/env.schema.ts | Adds env validation for expected-approved lists. |
| apps/backend/src/config/loader.ts | Loads expected-approved ID/address lists into per-network config. |
| apps/backend/src/config/network-fields.ts | Registers expected-approved vars as per-network + chain-specific. |
| apps/backend/src/config/types.ts | Extends network config types with expected-approved sets. |
| apps/backend/src/common/sp-tier.ts | Adds helper to classify providers into full-rate tier. |
| apps/backend/src/providers/repositories/storage-provider.repository.ts | Extends active-provider projection to include isApproved for tiering. |
| apps/backend/src/providers/repositories/storage-provider.repository.spec.ts | Updates repository tests for new projection shape. |
| apps/backend/src/jobs/repositories/job-schedule.repository.ts | Adds deletion helper for per-address schedules (used to clear stale lifecycle schedules after downgrades). |
| apps/backend/src/jobs/jobs.service.ts | Applies tiering to scheduling + dataset targets; gates lifecycle schedules and re-checks tier at job execution. |
| apps/backend/src/jobs/jobs.service.spec.ts | Updates and adds tests for lifecycle scheduling behavior under tiering. |
| apps/backend/src/deal/deal.service.ts | Applies tier-specific min-dataset target to deal dataset selection. |
| apps/backend/src/deal/deal.service.spec.ts | Updates tests for the new minDataSets parameter path. |
| apps/backend/src/wallet-sdk/wallet-sdk.service.spec.ts | Updates base network config test fixtures for expected-approved fields. |
Suppressed comments (2)
apps/backend/src/jobs/jobs.service.spec.ts:1543
- The
findActiveAddressesrepository contract includesproviderId, andensureScheduleRowspasses it intoisSpBlocked(...)/ tiering. This test mock omitsproviderId, which can hide regressions in ID-based blocklisting and diverges from the runtime shape.
providerRegistryRepositoryMock.findActiveAddresses.mockResolvedValueOnce([{ address: "0xaaa", isApproved: true }]);
apps/backend/src/jobs/jobs.service.spec.ts:1569
- The
findActiveAddressesrepository contract includesproviderId, andensureScheduleRowspasses it intoisSpBlocked(...)/ tiering. This test mock omitsproviderId, which can hide regressions in ID-based blocklisting and diverges from the runtime shape.
providerRegistryRepositoryMock.findActiveAddresses.mockResolvedValueOnce([{ address: "0xaaa", isApproved: false }]);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
SgtPooki
left a comment
There was a problem hiding this comment.
in general lgtm, but I left a few comments
|
I'll merge this after https://github.com/FilOzone/infra/pull/367 |
Part of #681
Summary
USE_ONLY_APPROVED_PROVIDERSremain the outer provider-eligibility gate. when enabled, expected-approved provider lists do not admit unapproved providers.Out of scope