Skip to content

Large balance deduct#100

Merged
greatest0fallt1me merged 31 commits intoCalloraOrg:mainfrom
clintjeff2:large-balance-deduct
Feb 26, 2026
Merged

Large balance deduct#100
greatest0fallt1me merged 31 commits intoCalloraOrg:mainfrom
clintjeff2:large-balance-deduct

Conversation

@clintjeff2
Copy link
Contributor

test: large balance and large deduct

Summary

Adds unit tests that exercise vault arithmetic at the boundaries of i128 to ensure no overflow or underflow occurs with large numbers.

Changes

  • contracts/vault/src/test.rs — 7 new test cases under the "large balance and large deduct" section:
Test What it covers
large_balance_init_and_deduct Init with i128::MAX / 2, deduct i128::MAX / 4, assert remaining
large_balance_deduct_entire_balance Init with i128::MAX, deduct full amount, assert zero
large_balance_sequential_deducts Init with 1e18, two sequential deducts draining to zero
large_batch_deduct_correctness Batch deduct three equal large chunks, verify remainder
deposit_overflow_panics Init near i128::MAX, attempt deposit that would overflow — expects failure
large_deduct_exceeding_balance_fails Deduct more than a large balance — expects failure, balance unchanged

How it was tested

All tests pass locally:

cargo test --package callora-vault

###TEST Proof
Screenshot from 2026-02-26 04-53-30

###Build Proof
Screenshot from 2026-02-26 04-44-38

Checklist

  • Tests pass with cargo test
  • No new warnings
  • Covers overflow and underflow edge cases
  • Follows existing test style and conventions

Closes #32

@greatest0fallt1me greatest0fallt1me merged commit a133048 into CalloraOrg:main Feb 26, 2026
0 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.

Add Unit Test: Large Balance and Large Deduct

2 participants