Add proptest for revenue#605
Open
gloskull wants to merge 2 commits into
Open
Conversation
…tribution test: add proptest for revenue_pool batch distribution invariants
Author
|
Done with this issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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