Skip to content

Validate campaign milestone target amounts - #32

Merged
ibrahimmosouf-png merged 1 commit into
OrbitChainLabs:mainfrom
Errordog2:codex/milestone-target-validation-12
Jun 20, 2026
Merged

Validate campaign milestone target amounts#32
ibrahimmosouf-png merged 1 commit into
OrbitChainLabs:mainfrom
Errordog2:codex/milestone-target-validation-12

Conversation

@Errordog2

Copy link
Copy Markdown
Contributor

Summary

  • Require milestone targetAmount in the create campaign DTO and validate it as a positive numeric string.
  • Replace the implicit (m.targetAmount ?? 0) as any fallback with a service-level guard that rejects missing, non-numeric, negative, zero, and sub-minimum milestone targets.
  • Add CampaignsService regression coverage for invalid milestone targets and the valid minimum amount path.

Closes #12

Validation

  • npm test -- campaigns.service.spec.ts passed (7 tests).
  • npm run build passed.
  • git diff --check -- src/campaigns/dto/create-campaign.dto.ts src/campaigns/campaigns.service.ts src/campaigns/campaigns.service.spec.ts passed.
  • Sensitive scan of changed files returned no account/payment/private-key markers.

Notes

  • Ran npm install; Prisma client generation completed successfully. Existing npm audit findings are dependency-tree issues outside this validation fix.

Copy link
Copy Markdown
Contributor

Clean validation — the regex + min threshold cover the Soroban precision edge case nicely. Thanks for tightening this up ✅

@Errordog2

Copy link
Copy Markdown
Contributor Author

Thanks for merging. Is there any additional GrantFox/reward tracking step needed from my side for #12?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MEDIUM] — createCampaign accepts milestones with targetAmount = 0 via implicit as any coercion, silently producing inert milestones

2 participants