Skip to content

Add comprehensive invariant tests for withdraw_fees (#646) - #853

Open
devcarole wants to merge 656 commits into
leojay-net:mainfrom
devcarole:646-withdraw-fees-invariant-tests
Open

Add comprehensive invariant tests for withdraw_fees (#646)#853
devcarole wants to merge 656 commits into
leojay-net:mainfrom
devcarole:646-withdraw-fees-invariant-tests

Conversation

@devcarole

Copy link
Copy Markdown
  • Add 13 invariant tests covering authorization, state consistency, balance conservation
  • Tests for large values, event emission, idempotency, overflow protection
  • Fix pre-existing compilation errors (duplicate tests, missing error variant, borrow issues)
  • All tests pass successfully

iammrjude and others added 30 commits March 29, 2026 01:23
Integrate jsPDF and autotable for PDF generation
Add “Export as PDF” action in transaction history sidebar
Format transactions into a structured table (date, type, amount, token, ID)
Include wallet address and export timestamp in footer
Generate dynamic filenames (stellar-bridge-history-.pdf)

Closes leojay-net#293
…timization

feat: optimize chat interface for mobile viewports
bakarezainab and others added 28 commits March 30, 2026 11:17
fixed the replace deprecated stroopsToXlm export in stroops
…2-463

fix: admin type safety, refactor, and styling guidelines (closes leojay-net#460
…-integration-with-network-queue

add-toastprovider
…ntax, and refactor toastStore for type safety
…et#613, leojay-net#614, leojay-net#617, leojay-net#619

- Issue leojay-net#613: Add invariant tests for deposit function
  * Test balance increases correctly
  * Test user deposited tracking
  * Test total deposited increases
  * Test receipt issued events
  * Test multiple deposits same user
  * Test deposit event emission

- Issue leojay-net#614: Add invariant tests for set_operator function
  * Test operator activation/deactivation
  * Test operator list consistency
  * Test event emission
  * Test idempotent activation/deactivation
  * Test operator cap enforcement

- Issue leojay-net#617: Add edge case validation tests for withdraw_fees
  * Test zero amount rejection
  * Test negative amount rejection
  * Test exact amount withdrawal
  * Test exceeds accrued amount
  * Test no fees accrued
  * Test multiple withdrawals
  * Test event emission

- Issue leojay-net#619: Add edge case validation tests for request_withdrawal
  * Test zero amount rejection
  * Test negative amount rejection
  * Test exceeds net deposited
  * Test exact deposited amount
  * Test liabilities update
  * Test event emission
  * Test denied address blocking
  * Test multiple requests same user
  * Test risk tier tracking
- Changed assertion from req_id > 0 to req_id >= 0 since request IDs can start at 0
- All 29 new invariant and edge case tests now pass
Use an isomorphic layout effect to resolve flag state immediately after hydration while keeping SSR-safe initial state, and add a hydration regression test for useFeatureFlag.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add Soroban proptest coverage for request_withdrawal success and rejection paths, including queue/liability invariants and non-positive amount validation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ydration-usefeatureflag-680

fix(frontend): resolve hydration mismatch risk in useFeatureFlag
…ithdrawal-invariants-636

test(contract): add Soroban invariant tests for request_withdrawal
…-614-617-619-contract-tests

Feat/issues 613 614 617 619 contract tests
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…eak-replay-docs-677-701

fix: resolve AdminGuard leak and improve replay-protection docs
- Add 13 invariant tests covering authorization, state consistency, balance conservation
- Tests for large values, event emission, idempotency, overflow protection
- Fix pre-existing compilation errors (duplicate tests, missing error variant, borrow issues)
- All tests pass successfully
@devcarole

Copy link
Copy Markdown
Author

Add Comprehensive Invariant Tests for withdraw_fees (#646)

Summary

This PR adds 13 rigorous invariant tests for the withdraw_fees function to boost test coverage and ensure robust automated testing of critical paths.

Changes

  • 13 new invariant tests covering:

    • Authorization validation (admin-only access)
    • Contract initialization checks
    • Fee vault balance consistency
    • Balance conservation (contract + recipient totals)
    • Multi-token fee vault isolation
    • Large value handling (i128 edge cases)
    • Event emission validation (FeeWithdrawnEvent)
    • Idempotency (multiple identical withdrawals)
    • Pause state behavior (documents that pause is not checked)
    • Overflow protection
    • User balance isolation
    • Sequential consistency
    • Empty fee vault handling
  • Fixed pre-existing compilation errors:

    • Removed duplicate circuit breaker test functions
    • Fixed Error::InvariantViolationError::InternalError
    • Fixed borrow of moved value by cloning user address

Test Results

All 13 tests pass successfully:

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.