Skip to content

Add contract call idempotency and deduplication keys #338

@Oluwaseyi89

Description

@Oluwaseyi89

Summary

Implement idempotency and deduplication mechanisms for contract call records by associating each call with a unique business workflow ID, ensuring that repeated or retried operations do not result in duplicate or ambiguous contract interactions.

Social Media Link

Let's collaborate on Discord. And ensure to star our repo.

Technical Context

  • Motivation: Without idempotency and deduplication, network failures, retries, or client errors can lead to multiple contract calls for the same business operation, causing inconsistent state, double execution, or reconciliation challenges. Tying contract calls to workflow IDs enables safe resumption and reliable state tracking.
  • Current State: Contract call records may not be uniquely associated with business workflow IDs, making it difficult to detect and prevent duplicate submissions or to resume interrupted operations safely.

Requirements

Backend Changes

  • Update the contract call persistence logic to require a unique workflow ID (or equivalent business identifier) for each contract call operation.
  • Enforce uniqueness of contract call records based on the workflow ID and contract method, rejecting duplicate submissions for the same workflow.
  • Implement deduplication logic to detect and ignore repeated contract call attempts with the same workflow ID.
  • Ensure all relevant endpoints and service layers propagate and validate workflow IDs for contract-related operations.
  • Provide clear error responses when duplicate or conflicting contract calls are attempted.
  • Document the idempotency and deduplication strategy in code and operational docs.

Acceptance Criteria

  • Each contract call record is uniquely tied to a business workflow ID.
  • Duplicate contract call attempts with the same workflow ID are safely ignored or rejected.
  • Retried or resumed operations do not result in duplicate contract calls or inconsistent state.
  • Tests cover normal, duplicate, and retry scenarios.
  • Documentation updated to describe the idempotency and deduplication approach.

Definition of Done

  • PR with code changes, tests, and documentation
  • Verified in staging/production environments
  • Team review completed

Working Directory

corporate-platform/corporate-platform-backend

Metadata

Metadata

Assignees

Labels

Nest.jsThis issue is to be implemented with Nest.js frameworkStellar WaveIssues in the Stellar wave programTypescriptThis issue is to be implemented with TypescriptbackendThis issue is about building backend API services.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions