Skip to content

feat: make pause idempotent and emit pause events#1675

Merged
Baskarayelu merged 1 commit into
QuickLendX:mainfrom
AugistineCreates:fix-pause-idempotency
Jun 27, 2026
Merged

feat: make pause idempotent and emit pause events#1675
Baskarayelu merged 1 commit into
QuickLendX:mainfrom
AugistineCreates:fix-pause-idempotency

Conversation

@AugistineCreates

@AugistineCreates AugistineCreates commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

This pr closes #1544

📝 Description

This PR resolves the issue where consecutive calls to pause() would duplicate emitted events. We ensure that pause() is fully idempotent by only emitting the Paused event on an actual transition to the paused state (and similarly for unpause()).

🎯 Type of Change

  • Bug fix (non-breaking change which fixes an issue)

🔧 Changes Made

Files Modified

  • quicklendx-contracts/src/pause.rs — Added idempotency validation using Self::is_paused(env) before updating state or emitting events.
  • quicklendx-contracts/src/test_pause.rs — Added test_pause_idempotent_no_duplicate_events to count and verify that duplicate events are not produced when pause() is called twice.

🧪 Testing

  • Unit tests covering pause/unpause behavior.
  • New regression test specifically validating that duplicate events are not emitted.

@drips-wave

drips-wave Bot commented Jun 26, 2026

Copy link
Copy Markdown

@AugistineCreates 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

@Baskarayelu

Copy link
Copy Markdown
Contributor

make pause idempotent and emit pause events — good stuff, merging 👍

@Baskarayelu Baskarayelu merged commit e192abc into QuickLendX:main Jun 27, 2026
1 check failed
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 a "no-op on already-paused" regression

2 participants