Skip to content

Fix #148 #149 #152 #153: milestones dust test at scale, release-with-logs build target, and Contribution timestamps - #225

Merged
chonilius merged 1 commit into
MergeFi:mainfrom
chizzy192:fix/issues-148-149-152-153
Aug 28, 2026
Merged

Fix #148 #149 #152 #153: milestones dust test at scale, release-with-logs build target, and Contribution timestamps#225
chonilius merged 1 commit into
MergeFi:mainfrom
chizzy192:fix/issues-148-149-152-153

Conversation

@chizzy192

Copy link
Copy Markdown
Contributor

Summary

This PR resolves four related issues across the contracts workspace under a single branch.


Fix #148milestones::refund_remaining_budget's dust distribution is only tested at n=3 contributors, never at the MAX_SPONSORS=20 boundary

Problem: refund_remaining_budget in milestones used the largest-remainder tie-breaking distribution logic, but was only tested with 3 contributors. It had no test at or near the MAX_SPONSORS = 20 scale with colliding remainders like escrow's test_large_split_distributes_dust_by_largest_remainder.

Fix: Added test_large_refund_distributes_dust_by_largest_remainder in contracts/milestones/src/test.rs, exercising exactly 20 sponsors (MAX_SPONSORS = 20 boundary) with alternating amounts (160 and 170) resulting in identical remainders across 15 sponsors. The test cross-checks the contract's refund payout against an independent O(n²) reference implementation with address tie-breaking and verifies no dust is stranded in the contract.


Fix #149 — Cargo.toml's [profile.release-with-logs] is defined but never referenced anywhere

Problem: Cargo.toml defined [profile.release-with-logs], but it was never referenced in the Makefile or documentation.

Fix:

  • Added build-logs target to Makefile (cargo build --target wasm32v1-none --profile release-with-logs) and added it to .PHONY.
  • Documented make build-logs and direct cargo build --profile release-with-logs usage in README.md as a debugging aid for investigating issues that only reproduce under release optimizations while retaining debug assertions and logs.

Fix #152escrow::Contribution has no timestamp field, unlike maintenance-pool::Deposit

Problem: contracts/escrow/src/types.rs's Contribution { sponsor, amount } was missing a timestamp field, unlike maintenance-pool::Deposit { sponsor, amount, timestamp }.

Fix:

  • Added timestamp: u64 to escrow::Contribution.
  • Populated timestamp: env.ledger().timestamp() in fund() (index 0) and in contribute() (both for new contributions and updating on top-ups).
  • Updated contracts/escrow/src/test.rs to assert contribution timestamps and verified top-up updates timestamp.
  • Updated docs/escrow-crowdfunding-design.md.

Fix #153milestones::Contribution has no timestamp field, same gap as escrow's

Problem: contracts/milestones/src/types.rs's Contribution { sponsor, amount } was also missing a timestamp field.

Fix:

  • Added timestamp: u64 to milestones::Contribution.
  • Populated timestamp: env.ledger().timestamp() in create_milestone() and in contribute() (both new contributions and top-ups).
  • Updated contracts/milestones/src/test.rs to assert contribution timestamps and verified top-up updates timestamp.
  • Updated docs/milestones-crowdfunding-design.md.

Verification

  • cargo test --workspace passes (99 tests: 50 escrow + 22 maintenance pool + 27 milestones).
  • cargo fmt --check passes cleanly.
  • cargo clippy --workspace --all-targets -- -D warnings passes with 0 warnings.
  • cargo build --target wasm32v1-none --release and cargo build --target wasm32v1-none --profile release-with-logs build cleanly.

Closes #148
Closes #149
Closes #152
Closes #153

…test, release-with-logs build target, and Contribution timestamps
@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@chizzy192 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@chonilius
chonilius merged commit 0a50719 into MergeFi:main Aug 28, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment