Skip to content

[HARD][SOROBAN ACCOUNTING] Use deterministic fair rounding when allocating pool units #170

Description

@Obiajulu-gif

Summary

Non-final investments receive floor(amount * total_units / target_amount), while the final funder receives every accumulated remainder. This makes allocation dependent on transaction order and can transfer rounding value to the last participant.

Repository evidence

  • contracts/chainmove-pool/src/lib.rs floors proportional units in allocate_units.
  • When new_total == target_amount, the function assigns total_units - funded_units to the final investment.

Scope

  • Specify a deterministic rounding/remainder policy that preserves total units without favoring transaction order.
  • Persist any remainder state required by that policy.
  • Expose allocation evidence in events or receipts.

Acceptance criteria

  • Equal economic inputs produce allocations within the documented rounding bound regardless of ordering.
  • Allocated units never exceed the cap and sum exactly at full funding.
  • No positive valid investment silently receives zero units without a documented minimum.

Tests

  • Permutation/property tests across many investment orders and awkward ratios.
  • Boundary tests near zero, full funding, and integer limits.

Non-goals

  • Changing target amounts, asset custody, or investor eligibility.

Activity

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

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions