Skip to content

Add proptest for revenue#605

Open
gloskull wants to merge 2 commits into
CalloraOrg:mainfrom
gloskull:add-proptest-for-revenue
Open

Add proptest for revenue#605
gloskull wants to merge 2 commits into
CalloraOrg:mainfrom
gloskull:add-proptest-for-revenue

Conversation

@gloskull

Copy link
Copy Markdown

Motivation
Add a focused property test to assert that batch_distribute preserves the total minted amount and the per-recipient balance deltas across randomized batches up to MAX_BATCH_SIZE.
Ensure the revenue-pool test suite and lints remain clean when exercising Soroban test utilities.
Description
Added an integration proptest at contracts/revenue_pool/tests/proptest_batch.rs that generates random payment vectors (up to MAX_BATCH_SIZE), mints the exact total to the pool, calls try_batch_distribute, and asserts total conservation and exact per-recipient deltas.
Declared a testutils feature in contracts/revenue_pool/Cargo.toml and added a feature-gated import for the Soroban TTL test utility in src/lib.rs so tests and clippy recognize the test-only APIs.
Tightened existing property/invariant helpers in src/test_proptest.rs and src/test_invariant.rs to avoid duplicate-recipient batches during randomized batch construction and to keep receive_payment as event-only for virtual scheduled accounting.
Minor formatting/lint cleanups to test assertions and event snapshot code in src/events.rs and src/test_error_codes.rs, and removed a brittle direct-event assertion from src/test.rs in favor of stronger observable checks.
Testing
Ran cargo test -p callora-revenue-pool which executed the full revenue-pool unit test suite and the new integration proptest; all tests passed (92 unit tests and the proptest integration passed in the final run).
Ran cargo fmt --check --package callora-revenue-pool and cargo clippy -p callora-revenue-pool --tests -- -D warnings, and both completed with no failures after the adjustments.
The new proptest uses ProptestConfig::with_cases(256) and the test executed successfully during the test run.
Closes #559

gloskull added 2 commits June 28, 2026 23:48
…tribution

test: add proptest for revenue_pool batch distribution invariants
@gloskull

Copy link
Copy Markdown
Author

Done with this issue.
Please merge and give and high review.
Please if there are any more tasks, assign them to me, i'd make sure to get them done quickly and submit my PR's in under 5 hours

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 proptest for revenue_pool batch distribution invariants

1 participant