Test/create contract bounds#373
Open
alexitsejames-cpu wants to merge 3 commits into
Open
Conversation
Add wired tests for every input-validation guard in create_contract: - InvalidParticipant when client == freelancer - EmptyMilestones when milestone_amounts is empty - TooManyMilestones when len > MAX_MILESTONES (11 milestones) - boundary success when len == MAX_MILESTONES (exactly 10) - InvalidMilestoneAmount for zero and negative amounts - PotentialOverflow when safe_add_amounts overflows i128 - InvalidMilestoneAmount when total > MAX_TOTAL_ESCROW_STROOPS - ordering assertion count guard fires before amount guard Tests live in contracts/escrow/src/test/create_contract_bounds.rs and are wired via mod.rs. The orphaned test_bounds.rs and milestone_schedule.rs are left untouched. Closes Talenttrust#329
- Add create_contract_bounds.rs wired into test/mod.rs
- Covers all 7 guards in execution order:
1. InvalidParticipant (client == freelancer)
2. EmptyMilestones (empty vec)
3. TooManyMilestones (len > MAX_MILESTONES = 10)
4. boundary success (len == MAX_MILESTONES accepted)
5. InvalidMilestoneAmount (zero or negative amount)
6. PotentialOverflow (safe_add_amounts overflow on i128)
7. InvalidMilestoneAmount (total > MAX_TOTAL_ESCROW_STROOPS)
- Guard ordering test: count check fires before amount check
- Update docs/escrow/milestone-validation.md with guard table and test map
Closes Talenttrust#329
|
@alexitsejames-cpu 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added create_contract_bounds.rs with 11 tests covering every input guard in create_contract — same-participant rejection, empty milestones, milestone count boundary (exactly 10 passes, 11 fails), zero/negative amounts, i128 overflow via safe_add_amounts, and total exceeding MAX_TOTAL_ESCROW_STROOPS. Also verified guard ordering: count check fires before amount check. Updated milestone-validation.md to reflect the actual implemented guards and map each one to its test.
closed #329