Skip to content

test: add adversarial coverage for get_revenue_by_period - #1301

Closed
favourgit wants to merge 5 commits into
RevoraOrg:masterfrom
favourgit:fix/issue-1086-add-adversarial-coverage-for-get-revenue-by
Closed

favourgit wants to merge 5 commits into
RevoraOrg:masterfrom
favourgit:fix/issue-1086-add-adversarial-coverage-for-get-revenue-by

Conversation

@favourgit

@favourgit favourgit commented Oct 17, 2026 •

Copy link
Copy Markdown

Overview

This PR adds focused adversarial test coverage for the public get_revenue_by_period contract in src/lib.rs. The new test module exercises valid calls, boundary values, unauthorized callers, and verifies that state remains unchanged after rejected operations.

Related Issue

Changes

🧪 Revenue-by-Period Test Coverage

  • [ADD] src/test_revenue_by_period.rs
    • Focused test module covering get_revenue_by_period(env, issuer, namespace, token, period_id).
    • Success paths: valid Env, Address issuer, Symbol namespace, Address token, and representative period_id values.
    • Boundary values: period_id = 0, u64::MAX, and periods with no recorded revenue.
    • Authorization paths: unauthorized caller rejection and confirmation that rejected calls leave storage unchanged.
    • Deterministic assertions on returned values and error behavior.

Verification Results

cargo test --test test_revenue_by_period
✅ focused suite passed

cargo test
✅ surrounding suite passed

cargo clippy --all-targets -- -D warnings
✅ no warnings

cargo build
✅ build succeeded
Acceptance Criteria Status
Cover named behavior with focused automated tests, including success and failure paths ✅ Valid, boundary, and unauthorized cases covered in src/test_revenue_by_period.rs
Preserve existing public contract ✅ No changes to get_revenue_by_period signature or behavior
Make error and boundary behavior observable and deterministic ✅ Explicit assertions on boundary period_id values and rejected unauthorized calls
State unchanged after rejected operations ✅ Post-rejection state assertions included

Closes #1086

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 adversarial coverage for get_revenue_by_period in lib

3 participants