Skip to content

feat(splitExecutor): validate recipient ratios sum to 1.0 before execution (#778) - #816

Open
ZacLou wants to merge 1 commit into
Stellar-split:mainfrom
ZacLou:feat/split-executor-ratio-validation-778
Open

feat(splitExecutor): validate recipient ratios sum to 1.0 before execution (#778)#816
ZacLou wants to merge 1 commit into
Stellar-split:mainfrom
ZacLou:feat/split-executor-ratio-validation-778

Conversation

@ZacLou

@ZacLou ZacLou commented Sep 5, 2026

Copy link
Copy Markdown

Adds ratio-sum validation to splitExecutor so malformed splits fail fast with a clear error instead of producing silent over- or under-payments.

Changes

  • New field: SplitRecipient.ratio?: number — optional share ratio (0.0–1.0).
  • New constant: SPLIT_RATIO_TOLERANCE = 1e-9 (exported).
  • New error: SplitRatioSumError thrown when provided ratios do not sum to 1.0 within tolerance.
  • Backwards compatible: when no ratios are provided, validation is skipped entirely.
  • Tests: test/splitExecutor.test.ts covers exact sum, under-sum, over-sum, floating-point tolerance, and error property assertions.

Closes #778

…ution (Stellar-split#778)

- Add optional  field to  interface
- Introduce  (1e-9) exported constant
- Throw  with actual sum when ratios don't total 1.0
- Skip validation when no ratios are provided (backwards compatible)
- Add unit tests for exact sum, under-sum, over-sum, and tolerance edge cases

Closes Stellar-split#778
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.

Validate that split amounts sum to exactly 100% before execution in splitExecutor

1 participant