Skip to content

Make partial refund unit rounding partition-safe - #210

Merged
Obiajulu-gif merged 1 commit into
Chainmove:mainfrom
prissca:agent/issue-166-refund-rounding
Aug 18, 2026
Merged

Make partial refund unit rounding partition-safe#210
Obiajulu-gif merged 1 commit into
Chainmove:mainfrom
prissca:agent/issue-166-refund-rounding

Conversation

@prissca

@prissca prissca commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

What changed

  • persist an immutable refund basis for each position funding epoch
  • calculate every partial refund from cumulative refunded principal against that basis
  • reset the basis only when new funding changes the combined position
  • explicitly reject refunds below the current unit granularity and clear basis state on terminal refunds
  • add one-shot versus partitioned and dust-regression tests

Why

Independent per-call rounding could let call partitioning influence retained units. Cumulative refund accounting makes the final entitlement depend only on total refunded principal.

Validation

  • Rust sources parse successfully with rustfmt
  • contract tests could not link on this machine because the MSVC link.exe build tool is not installed

Closes #166

@prissca
prissca marked this pull request as ready for review August 18, 2026 12:42
@prissca

prissca commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the contribution! Merging this now as part of a maintainer PR sweep.

@Obiajulu-gif
Obiajulu-gif merged commit 021407c into Chainmove:main Aug 18, 2026
1 of 2 checks passed
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.

[HARD][SOROBAN ACCOUNTING] Prevent partial-refund rounding from preserving excess units

2 participants