ddo: clamp term-max via schedule.Duration; reject legacy price flags#666
Merged
parkan merged 4 commits intoApr 23, 2026
Merged
Conversation
- runDDOSchedule: when schedule.Duration is non-zero, lower the local DDOSchedulingConfig.TermMax. The daemon --ddo-term-max remains the ceiling; a schedule-level duration can only shorten the term. The daemon config struct is copied per call, so this is scoped to the current run. - CreateHandler: reject --price-per-gb-epoch / --price-per-gb / --price-per-deal for DDO schedules. DDO payment comes from the SP's on-chain registered price via EnsurePayments; those flags were silently ignored before, which made it easy to misconfigure.
Collaborator
Code reviewFound 1 issue:
singularity/handler/deal/schedule/update.go Lines 110 to 124 in 4af1b01 For reference, the create-time guard this is meant to mirror: singularity/handler/deal/schedule/create.go Lines 232 to 241 in 4af1b01 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
mirrors the create-time guard added in this PR. without it a user could create a clean DDO schedule, then PATCH it with --price-per-* and the write would land silently -- reintroducing the same 'i think i overrode the SP price' failure mode the create-time check prevents. uses the existing effectiveDealType machinery so a market->DDO switch in the same PATCH is caught too. zero-valued price updates remain a no-op (the request type uses pointers, so a real zero is harmless).
anjor
approved these changes
Apr 23, 2026
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
Two small DDO-scheduling fixes that came up running a test SP end-to-end on calibnet.
1. Schedule-level `Duration` now influences DDO `TermMax`
Today `runDDOSchedule` uses `d.ddoSchedulingConfig.TermMax` as-is -- every DDO allocation submits with the daemon's configured term max, regardless of the schedule's `--duration`. This means an operator can't run a daemon with a permissive ceiling (e.g. 5y) while scheduling individual preparations at shorter terms.
Change: if `schedule.Duration` is non-zero, the local per-run `DDOSchedulingConfig` copy lowers `TermMax` to match. The daemon's `--ddo-term-max` still acts as a hard ceiling -- a longer schedule Duration cannot raise it. The daemon's `TermMin` is unchanged; if Duration falls below it, `Validate()` rejects the run (existing behaviour).
2. DDO schedules reject legacy price flags
The `--price-per-gb-epoch`, `--price-per-gb`, and `--price-per-deal` flags are meaningful only for the legacy boost/market path. For DDO, payment amounts come from the SP's on-chain registered price in the DDO contract (`EnsurePayments` reads it and deposits USDFC accordingly). Silently accepting these flags for DDO led to me assuming I could override the SP's price at schedule-create time, which I couldn't -- and there's no log line that says so.
Change: `CreateHandler` returns `ErrInvalidParameter` when any of the three price flags are non-zero on a DDO schedule.
Test plan