Skip to content

test: add adversarial coverage for set_rounding_mode - #1298

Closed
waledev1 wants to merge 3 commits into
RevoraOrg:masterfrom
waledev1:fix/issue-1121-add-adversarial-coverage-for-set-rounding-mode
Closed

waledev1 wants to merge 3 commits into
RevoraOrg:masterfrom
waledev1:fix/issue-1121-add-adversarial-coverage-for-set-rounding-mode

Conversation

@waledev1

Copy link
Copy Markdown

Overview

This PR adds focused adversarial test coverage for the public set_rounding_mode entry point in src/lib.rs. The new test module exercises valid calls, boundary/invalid RoundingMode values, unauthorized callers, and verifies that state is unchanged after rejected operations.

Related Issue

Changes

🧪 Adversarial coverage for set_rounding_mode

  • [ADD] src/test_rounding_mode.rs
    • Focused test module targeting set_rounding_mode(env: Env, issuer: Address, namespace: Symbol, token: Address, mode: RoundingMode).
    • Success paths: valid calls with each RoundingMode variant, asserting the stored mode is observable and deterministic.
    • Boundary / invalid inputs: invalid RoundingMode values and boundary namespace/token inputs, asserting rejected calls surface deterministic errors.
    • Authorization: unauthorized issuer callers are rejected.
    • State integrity: after every rejected operation, the previously stored rounding mode is re-read and asserted unchanged.

Verification Results

cargo test test_rounding_mode
✅ focused test module passes

cargo test
✅ surrounding suite passes

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

cargo build
✅ builds cleanly
Acceptance Criteria Status
Cover the named behavior with focused automated tests, including the relevant success and failure paths ✅ Valid, boundary/invalid, and unauthorized cases covered
Preserve the existing public contract unless the change includes an explicit compatibility plan ✅ No changes to set_rounding_mode signature or behavior
Make error and boundary behavior observable and deterministic ✅ Rejected calls assert deterministic errors and unchanged state

Closes #1121

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 set_rounding_mode in lib

3 participants