Skip to content

feat(escrow): emit match/limit_reached event when TooManyActiveMatches limit is reached - #1893

Open
Shackole wants to merge 1 commit into
StellarCheckMate:mainfrom
Shackole:feat/1818-too-many-active-matches-event
Open

Shackole wants to merge 1 commit into
StellarCheckMate:mainfrom
Shackole:feat/1818-too-many-active-matches-event

Conversation

@Shackole

Copy link
Copy Markdown

Summary

Emits a match/limit_reached event carrying (player, current_count) when a player reaches the MAX_ACTIVE_MATCHES_PER_PLAYER cap or when create_match / add_active_match rejects a match with Error::TooManyActiveMatches, allowing monitoring tools to alert operators when the active match limit is reached.

Related Issue

Closes #1818

What Changed

  • Contracts: Updated create_match_internal and add_active_match in contracts/escrow/src/lib.rs to emit ("match", "limit_reached") with (player, count) when the active match limit is reached and before returning Error::TooManyActiveMatches.
  • Tests: Added test_too_many_active_matches_emits_limit_reached_event in contracts/escrow/src/tests/events.rs asserting the match/limit_reached event is emitted.
  • Docs: Documented the match/limit_reached monitoring event in docs/security.md.

Checklist

  • cargo test passes locally
  • cargo clippy is clean
  • Tests added or updated for this change
  • Documentation updated (or no update needed)

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.

Enhancement: escrow contract should emit an event when a match reaches TooManyActiveMatches limit

1 participant