Skip to content

test(vault): max_deduct boundary coverage (#152)#221

Merged
greatest0fallt1me merged 6 commits intoCalloraOrg:mainfrom
Sam-Rytech:test/vault-max-deduct-boundary
Mar 31, 2026
Merged

test(vault): max_deduct boundary coverage (#152)#221
greatest0fallt1me merged 6 commits intoCalloraOrg:mainfrom
Sam-Rytech:test/vault-max-deduct-boundary

Conversation

@Sam-Rytech
Copy link
Copy Markdown
Contributor

Summary

Adds 5 boundary tests for max_deduct in contracts/vault/src/test.rs covering all requirements from #152.

Tests added

  • deduct_equal_to_max_deduct_succeeds — single deduct exactly at the cap passes
  • deduct_above_max_deduct_panics — single deduct one unit above cap is rejected
  • deduct_default_cap_is_i128_max — unset max_deduct defaults to i128::MAX; large deduct succeeds
  • batch_deduct_each_item_constrained_by_max_deduct — three batch items each at the cap all pass
  • batch_deduct_one_item_above_max_deduct_panics — one oversized item in a batch is rejected

Test output

125 passed; 0 failed — finished in 2.24s

Security notes

  • Each batch item is independently checked against max_deduct, aligning with backend metering batch constraints
  • Default cap (i128::MAX) is verified to be the fallback when max_deduct is unset at init

Closes #152

- Audited all privileged entrypoints in vault, revenue_pool, and settlement
- Added negative require_auth tests to each crate's test.rs
- Fixed pre-existing setup_contract missing third_party in settlement tests
- Documented intentional exceptions: settlement::init and vault::require_owner
- Updated SECURITY.md with audit findings and cross-references
- All 180 tests pass

Closes CalloraOrg#160
- Audited all privileged entrypoints in vault, revenue_pool, and settlement
- Added negative require_auth tests to each crate's test.rs
- Fixed pre-existing setup_contract missing third_party in settlement tests
- Documented intentional exceptions: settlement::init and vault::require_owner
- Updated SECURITY.md with audit findings and cross-references
- All 180 tests pass

Closes CalloraOrg#160
- Audited all privileged entrypoints in vault, revenue_pool, and settlement
- Added negative require_auth tests to each crate's test.rs
- Fixed pre-existing setup_contract missing third_party in settlement tests
- Documented intentional exceptions: settlement::init and vault::require_owner
- Updated SECURITY.md with audit findings and cross-references
- All 180 tests pass

Closes CalloraOrg#160
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 30, 2026

@Sam-Rytech 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

@greatest0fallt1me greatest0fallt1me merged commit 4860b74 into CalloraOrg:main Mar 31, 2026
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.

Vault: max_deduct boundary tests (equal, above, default cap)

2 participants