Skip to content

feat: add notification delivery idempotency - #902

Open
charleswilliams788 wants to merge 1 commit into
Core-Foundry:mainfrom
charleswilliams788:fix/issue-843-add-notification-delivery-idempotency
Open

charleswilliams788 wants to merge 1 commit into
Core-Foundry:mainfrom
charleswilliams788:fix/issue-843-add-notification-delivery-idempotency

Conversation

@charleswilliams788

Copy link
Copy Markdown

Overview

This PR adds Notification Delivery Idempotency to the hello-world contract so that repeated submission of the same notification request does not produce duplicate deliveries. Idempotency state is persisted on-chain, and concurrent duplicate requests are handled safely.

Related Issue

Changes

🔁 Idempotency State & Types

  • [MODIFY] contract/contracts/hello-world/src/base/types.rs

    • Added the idempotency key/record types needed to persist delivery state for a notification request.
  • [MODIFY] contract/contracts/hello-world/src/base/errors.rs

    • Added error variants for idempotency conflicts / invalid idempotency state.

⚙️ Delivery Logic

  • [MODIFY] contract/contracts/hello-world/src/autoshare_logic.rs

    • Delivery path now checks persisted idempotency state before creating a delivery, so repeated requests with the same key do not create duplicates.
    • Persists idempotency state on successful delivery and short-circuits duplicate requests.
    • Guards against concurrent duplicate requests by recording state atomically within the delivery flow.
  • [MODIFY] contract/contracts/hello-world/src/lib.rs

    • Wired up the idempotency-aware delivery entry point and storage accessors.

🧪 Tests

  • [MODIFY] contract/contracts/hello-world/src/tests/notification_test.rs
    • Added coverage for repeated requests not creating duplicate deliveries, persisted idempotency state, and concurrent duplicate handling.

Verification Results

cargo test -p hello-world notification
✅ notification tests passed
Acceptance Criteria Status
Repeated requests do not create duplicate deliveries ✅ Duplicate requests short-circuit on persisted idempotency state
Idempotency state is persisted ✅ State stored on-chain via contract storage
Concurrent duplicate requests are handled safely ✅ State recorded atomically within the delivery flow

Closes #843

@drips-wave

drips-wave Bot commented Sep 30, 2026

Copy link
Copy Markdown

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

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 Notification Delivery Idempotency

1 participant