Skip to content

fix: distribute split dust by largest remainder - #31

Merged
chonilius merged 1 commit into
MergeFi:mainfrom
bingmokaka:fair-largest-remainder-splits
Jul 17, 2026
Merged

fix: distribute split dust by largest remainder#31
chonilius merged 1 commit into
MergeFi:mainfrom
bingmokaka:fair-largest-remainder-splits

Conversation

@bingmokaka

Copy link
Copy Markdown
Contributor

Summary

  • replace the last-recipient dust assignment in escrow and milestone compute_split with largest-remainder allocation
  • preserve the no-stranded-dust invariant while removing the previous position-dependent windfall
  • document the rounding behavior, dust upper bound, and stable tie-breaking in the README
  • add regression tests for a split where the old algorithm would have paid the final recipient extra dust

Testing

  • rustup run stable-x86_64-pc-windows-gnu cargo check -p mergefi-escrow -p mergefi-milestones --target wasm32v1-none

I also attempted host tests with both MSVC and GNU Rust toolchains on this Windows machine. They did not complete because the local environment lacks MSVC SDK libs for the MSVC linker and then hit a Windows cdylib export ordinal linker issue under GNU. The contract code type-checks for the wasm target, and the PR includes focused unit tests for the changed behavior.

Fixes #6

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

@bingmokaka is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

@chonilius
chonilius merged commit 1d7c1ca into MergeFi:main Jul 17, 2026
2 of 3 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.

Audit and formally characterize integer-division dust/remainder behavior in compute_split

2 participants