Skip to content

test(cascade): add property-based tests for split graphs and fund conservation - #29

Open
NePreby wants to merge 1 commit into
Flow-Pulse:mainfrom
NePreby:test/property-tests-cascade-payouts-conservation
Open

NePreby wants to merge 1 commit into
Flow-Pulse:mainfrom
NePreby:test/property-tests-cascade-payouts-conservation

Conversation

@NePreby

@NePreby NePreby commented Nov 9, 2026

Copy link
Copy Markdown

Summary

Fixes #16.

Overview of Property-Based Testing Suite

Added randomized property-based tests using proptest (contracts/cascade_splitter/Cargo.toml dev-dependencies) to verify that CascadeSplitter strictly preserves total funds and bounds recursion depth under all graph configurations.

Key Invariants Verified

  1. Conservation of Funds:
    • Under arbitrary randomized multi-node split graphs with random basis point allocations, fractional divisions, and integer truncation dust, sum(payouts.amount) == amount identically.
    • Verified that on-chain token balances transferred across all nodes in the split graph equal amount without leakage.
  2. Strict Depth Bounding (<= 3):
    • Verified that for all payouts emitted across multi-hop trees and cyclic paths, payout.depth <= MAX_DEPTH (3).
    • Deep linear cascade test (A -> B -> C -> D -> E -> F with 100% weights) verifies that execution stops strictly at depth 3 with D credited, never touching E or F.
  3. Termination on Cyclic Topologies:
    • Evaluated 2-node mutual loops (A <-> B), 3-node loops (A -> B -> C -> A), and random cyclic multigraphs, verifying deterministic termination within the maximum recursion depth.
  4. Execution Performance:
    • Configured test cases run in a few seconds, comfortably within CI's 30s limit.

Payout Details

  • Network: TRX Tron (TRC20)
  • Address: TMqmJjRgVS21NL2eFtfyHciTxvE4BqGmEv

This branch has not been deployed

No deployments
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.

Property-based tests: cascade payouts always sum to amount

1 participant