Skip to content

Task/resolution authsnap - #1054

Merged
greatest0fallt1me merged 4 commits into
Predictify-org:masterfrom
Ayomide-codex:task/resolution-authsnap
Jul 27, 2026
Merged

Task/resolution authsnap#1054
greatest0fallt1me merged 4 commits into
Predictify-org:masterfrom
Ayomide-codex:task/resolution-authsnap

Conversation

@Ayomide-codex

Copy link
Copy Markdown
Contributor

Pull Request Description

📋 Basic Information

Type of Change

  • 🧪 Test addition/update
  • 📚 Documentation update

Related Issues

Closes #873

Priority Level

  • 🟡 High

📝 Detailed Description

What does this PR do?

This PR adds per-entrypoint authorization snapshot tests for the resolution contract. The new tests verify that each state-changing entrypoint requires the expected authorization by capturing and validating the required auth snapshots.

Additionally:

  • Added focused authorization snapshot tests under contracts/resolution/tests/auth_snap.rs.
  • Updated documentation/comments where applicable to reflect the new test coverage.

Why is this change needed?

Authorization snapshot tests help ensure that every state-changing resolution entrypoint continues to enforce the correct require_auth behavior. These tests act as regression protection, making it easier to detect unintended authentication changes during future development.

How was this tested?

  • Added unit tests covering authorization snapshots for each applicable resolution entrypoint.
  • Verified expected authorization requirements are captured correctly.
  • Ran the project's test suite to ensure all tests pass and no existing functionality regressed.

Alternative Solutions Considered

Runtime authorization checks alone were considered sufficient, but snapshot tests provide stronger regression guarantees by validating the complete authorization requirements for each entrypoint over time.


🏗️ Smart Contract Specific

Contract Changes

  • Access control changes

Security Considerations

  • Access control reviewed
  • Input validation

🧪 Testing

Test Coverage

  • Unit tests added/updated
  • All tests passing locally
  • Edge cases covered

Test Results

cargo test
# All tests passed

Manual Testing Steps

  1. Run cargo test.
  2. Execute the authorization snapshot tests.
  3. Verify all snapshots match the expected require_auth behavior for each resolution entrypoint.

📚 Documentation

Documentation Updates

  • Code comments added/updated

Breaking Changes

Breaking Changes: None.


🔍 Code Quality

Code Review Checklist

  • Code follows Rust/Soroban best practices
  • Self-review completed
  • Error handling is appropriate
  • Security considerations addressed
  • Code is readable and well-commented

Performance Impact

  • Gas Usage: None (test-only changes).
  • Storage Impact: None.
  • Computational Complexity: No production code impact.

Security Review

  • No obvious security vulnerabilities
  • Access controls properly validated
  • Input validation in place

🚀 Deployment & Integration

Deployment Notes

  • Migration Required: No
  • Backward Compatibility: Maintained

Integration Points

  • Backward compatibility maintained

📊 Impact Assessment

User Impact

  • End Users: No functional changes.
  • Developers: Improved confidence that authorization requirements remain unchanged across all resolution entrypoints.

Business Impact

  • Strengthens regression testing and helps prevent accidental authorization regressions.

💬 Notes for Reviewers

Please pay special attention to:

  • Authorization snapshots for each state-changing resolution entrypoint.
  • Completeness of test coverage.
  • Snapshot expectations and long-term maintainability.

Add BetBatchPlacedEvent and BetStatsUpdatedEvent with emit methods,
update event topic catalog, and integrate emissions into betting code.

- BetBatchPlacedEvent: emitted for batch bet operations (place_bets)
- BetStatsUpdatedEvent: emitted when per-market bet stats change
- Event topic catalog updated with all betting lifecycle topics
- Focused tests for struct creation, publication, storage, and edge cases
Add comprehensive auth coverage tests for all resolution entrypoints:

- resolve_market_manual (authorized/forged/no-auth/wrong-subject/uninitialized)
- resolve_market_with_ties (authorized/forged/no-auth)
- force_resolve_market (authorized/forged/no-auth/wrong-subject)
- resolve_dispute (authorized/forged/no-auth)
- admin_override_verification (authorized/forged/no-auth)

Each entrypoint has positive (authorized admin succeeds) and negative
(forged admin / no-auth rejected) tests, following the same patterns as
require_auth_coverage_tests.rs.
@drips-wave

drips-wave Bot commented Jul 27, 2026

Copy link
Copy Markdown

@Ayomide-codex 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 f6e32ef into Predictify-org:master Jul 27, 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 (buffer #17)

2 participants