Skip to content

test: add per-entrypoint auth snapshots for resolution entrypoints (#…#1013

Merged
greatest0fallt1me merged 1 commit into
Predictify-org:masterfrom
baling-1:feature/auth-snapshot-resolution
Jul 26, 2026
Merged

test: add per-entrypoint auth snapshots for resolution entrypoints (#…#1013
greatest0fallt1me merged 1 commit into
Predictify-org:masterfrom
baling-1:feature/auth-snapshot-resolution

Conversation

@baling-1

Copy link
Copy Markdown
Contributor

test: add per-entrypoint auth snapshots for resolution entrypoints
Problem
Resolution entrypoints (resolve_market_manual, force_resolve_market, distribute_payouts, etc.) had no auth snapshot coverage, unlike bets, voting, and disputes which already had per-entrypoint test suites. Without these tests, regressions that accidentally require or skip authorization checks on resolution paths would go undetected.
What this PR adds
contracts/predictify-hybrid/tests/auth_snapshot_resolution.rs — 23 tests covering every resolution entrypoint in PredictifyHybrid.
Entrypoint matrix
Category Entrypoints Auth assertion
Admin auth (committed snapshot) resolve_market_manual, resolve_market_with_ties, force_resolve_market, admin_override_verification, set_resolution_cooldown env.auths() records the admin address
Permissionless (committed snapshot) fetch_oracle_result, distribute_payouts No auth recorded
Read-only (committed snapshot) get_resolution_analytics, get_verified_result, is_result_verified No auth recorded
Deprecated / caller auth (auth boundary) resolve_market, verify_result, verify_result_with_retry Call passes require_auth
Edge-case coverage

  • No-auth panics: #[should_panic] tests confirm that calling admin-gated entrypoints (resolve_market_with_ties, force_resolve_market, admin_override_verification, set_resolution_cooldown) without auth panics at the host level
  • Non-admin rejection: non-admin callers get Error::Unauthorized from resolve_market_with_ties, force_resolve_market, admin_override_verification, and set_resolution_cooldown
  • Auth-subject isolation: verifies that resolve_market_manual and force_resolve_market bind auth to the declared admin address specifically, not to any other address in the environment
    Design decisions
  • Follows the same Fixture pattern and required_auth() / assert_requires_auth() / assert_no_auth() helper conventions established in auth_snapshot.rs and auth_snapshot_disputes.rs
  • Uses try_* variants for deprecated entrypoints since they return Result, matching the existing auth-boundary test pattern
  • All tests call env.mock_all_auths() in setup then check env.auths() after the call — no committed .toml snapshots, keeping the suite self-contained and CI-independent
    Testing
    cargo test --test auth_snapshot_resolution
    Note: The library currently has pre-existing compilation errors on master (870 errors from duplicate method definitions, missing imports, and duplicate enum variants across recent merge commits). This blocks local test execution but is unrelated to this change. The new test file introduces zero additional errors.
    Closes Add per-entrypoint auth snapshot test for resolution #977

…redictify-org#977)

Snapshot the auth subject recorded by the Soroban host for every
resolution entrypoint of PredictifyHybrid:

Admin-auth (committed snapshot):
- resolve_market_manual
- resolve_market_with_ties
- force_resolve_market
- admin_override_verification
- set_resolution_cooldown

Permissionless (committed snapshot):
- fetch_oracle_result
- distribute_payouts

Read-only (committed snapshot):
- get_resolution_analytics
- get_verified_result
- is_result_verified

Caller-auth / deprecated (auth boundary):
- resolve_market
- verify_result
- verify_result_with_retry

Includes edge-case tests: no-auth panics for admin entrypoints,
non-admin Unauthorized rejections, and auth-subject isolation checks
ensuring only the declared admin address is authenticated.
@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@baling-1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@greatest0fallt1me
greatest0fallt1me merged commit a9ba796 into Predictify-org:master Jul 26, 2026
0 of 2 checks passed
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 per-entrypoint auth snapshot test for resolution

2 participants