Skip to content

Test/vault max balance closes #264 - #291

Merged
greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
ChukwuemekaP1:test/vault-max-balance
Apr 23, 2026
Merged

Test/vault max balance closes #264#291
greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
ChukwuemekaP1:test/vault-max-balance

Conversation

@ChukwuemekaP1

Copy link
Copy Markdown
Contributor

Summary

Added explicit max-balance boundary tests across the Callora contracts to ensure overflow safety. These tests verify that the system fails safely and deterministically when an operation would push a balance beyond the i128::MAX limit.

Changes

Vault Contract

  • Added deposit_max_balance_overflow_panic: Exercises the checked_add logic in deposit() by setting the balance to i128::MAX - 1 and attempting a 2-unit deposit.

Revenue Pool Contract

  • Added batch_distribute_max_balance_overflow_panic: Confirms that calculating the total sum for batch distributions panics safely if it exceeds i128::MAX.

Settlement Contract

  • Added test_pool_balance_overflow_panic: Verifies the global pool cannot overflow.
  • Added test_developer_balance_overflow_panic: Verifies individual developer balances cannot overflow.

Documentation

  • Updated INVARIANTS.md to explicitly define the upper-bound balance behavior (<= i128::MAX).

Verification

  • Unit Tests: All 250+ tests (including the 4 new boundary tests) passed.
  • Linter: cargo clippy passed with no warnings.
  • Build: Successfully compiled callora-vault to WASM release target.
  • Safety: Confirmed that checked_add(...).unwrap() paths correctly trigger transaction reverts on overflow rather than silent wrapping.

closes #264

@drips-wave

drips-wave Bot commented Apr 23, 2026

Copy link
Copy Markdown

@ChukwuemekaP1 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 5b46c77 into CalloraOrg:main Apr 23, 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.

Vault: add explicit max balance test near i128::MAX with checked_add panics

2 participants