Skip to content

[735] Contracts: Add invariant suite for total assets to total shares consistency#797

Open
broda-spendy wants to merge 6 commits into
Junirezz:mainfrom
broda-spendy:fix/735-contracts-add-invariant-suite-for-total-assets-to-total-shares-consistency
Open

[735] Contracts: Add invariant suite for total assets to total shares consistency#797
broda-spendy wants to merge 6 commits into
Junirezz:mainfrom
broda-spendy:fix/735-contracts-add-invariant-suite-for-total-assets-to-total-shares-consistency

Conversation

@broda-spendy

Copy link
Copy Markdown

Summary

  • Add invariant_tests.rs with centralized assert_vault_invariants() and assert_accounting_unchanged() helpers
  • Add scenario tests for deposit, withdraw, invest, divest, and rebalance flows ensuring total shares / accounting assets stay consistent
  • Fix contract compilation blockers on main (DataKey enum limit, governance storage key, whitelist double-auth) and repair broken guard integration tests

Closes #735

Test plan

  • cargo fmt --all
  • cargo test -p vault --lib invariant_suite
  • cargo test --all-features --workspace (from contracts/)
  • cargo clippy --all-targets --all-features -- -D warnings

Closes Junirezz#735

Introduce centralized invariant helpers and scenario tests covering deposit,
withdraw, invest, divest, and rebalance flows. Consolidate DataKey variants to
stay within Soroban limits, fix governance storage, whitelist double-auth, and
repair broken integration tests so the contract crate compiles and tests run.

Co-authored-by: Cursor <cursoragent@cursor.com>
@drips-wave

drips-wave Bot commented Jun 24, 2026

Copy link
Copy Markdown

@broda-spendy 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

shimonenator and others added 5 commits June 24, 2026 16:13
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Harden divest and queue processing against partial strategy liquidity, allow disabling admin param throttling in tests, and rewrite queue tests to seed entries directly.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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.

Contracts: Add invariant suite for total assets to total shares consistency

2 participants