Skip to content

feat: implement idempotent execution for batch payout#836

Open
Jopsan-gm wants to merge 1 commit into
Pulsefy:mainfrom
Jopsan-gm:feat/idempotent-execution
Open

feat: implement idempotent execution for batch payout#836
Jopsan-gm wants to merge 1 commit into
Pulsefy:mainfrom
Jopsan-gm:feat/idempotent-execution

Conversation

@Jopsan-gm

Copy link
Copy Markdown

Title: feat(crowdfund): add idempotent retry protection for batch payout

Summary

This PR implements idempotent retry protection for the batch_payout mechanism in the crowdfund_vault contract to prevent unintended double-executions of payouts.

Changes include:

  • Added ExecutedBatch(BytesN<32>) to the DataKey enum in storage.rs to persist execution hashes.
  • Introduced a new DuplicateExecution custom error in errors.rs.
  • Updated the batch_payout function in lib.rs to require a batch_id: BytesN<32> and reject duplicate calls if the batch hash is already present in persistent storage.
  • Added comprehensive tests, including test_batch_payout_duplicate_execution, to explicitly verify the idempotency mechanism works correctly.

Linked Issue

Closes #689

Type of Change

  • feat
  • fix
  • docs
  • refactor
  • test
  • chore

Validation

  • Lint passed for affected area(s)
  • Tests passed for affected area(s)
  • Manual verification completed (if applicable)

Documentation

  • Documentation updated (or N/A with explanation)
  • Screenshots/videos attached for UI changes

Screenshots

image

Checklist

  • Branch name uses feat/, fix/, or docs/
  • Commit messages follow Conventional Commits
  • PR scope matches linked issue acceptance criteria

@drips-wave

drips-wave Bot commented Jun 2, 2026

Copy link
Copy Markdown

@Jopsan-gm 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

@Cedarich

Cedarich commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Fix workflow

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.

Idempotent Retry Protection for Relayed and Batched Executions

2 participants