Skip to content

Prevent claim retries from duplicating intent - #922

Merged
greatest0fallt1me merged 4 commits into
Predictify-org:mainfrom
Johnsource-hub:Prevent-claim-retries-from-duplicating-intent
Aug 30, 2026
Merged

Prevent claim retries from duplicating intent#922
greatest0fallt1me merged 4 commits into
Predictify-org:mainfrom
Johnsource-hub:Prevent-claim-retries-from-duplicating-intent

Conversation

@Johnsource-hub

@Johnsource-hub Johnsource-hub commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

closes #894

Summary:

  • Add client-side intent deduplication to prevent duplicate transaction submissions when users retry claims.
  • Persist minimal intent state in localStorage with a 24h TTL to allow retries to reuse signed XDR or detected submission hashes.
  • Integrate intent handling into useTransaction to ensure deterministic behavior across retries and partial failures.

Files changed:

  • lib/transaction/intent.ts - intent store (get/upsert/remove, computeXdrHash)
  • hooks/useTransaction.hook.ts - integrate intent deduplication and locking
  • lib/transaction/__tests__/intent.test.ts - intent store tests
  • hooks/__tests__/useTransaction.test.tsx - focused transaction flow tests

Behavior and invariants:

  • Intent key: walletAddress:sha256(builtXdr) ensures same wallet + same built XDR map to same intent.
  • If an intent has submissionHash, retry polls for confirmation instead of re-submitting.
  • If an intent has signedXdr but not submitted, retry will re-submit stored signedXdr (avoids re-signing in many cases).
  • Signed XDRs are removed shortly after successful confirmation to reduce exposure.

Security considerations:

  • Signed XDRs are persisted temporarily in localStorage. If this is unacceptable, switch to storing only the xdrHash and require re-signing on retry.
  • Avoid storing private keys or secrets; only XDR strings are stored.

Testing:

  • Unit tests cover intent store operations and transaction flows for sign-submit-confirm and retry scenarios.
  • Run tests locally with pnpm test.

Migration / compatibility:

  • No server changes or DB migrations required.
  • Public API to useTransaction.executeTransaction(buildXdr) unchanged.

Observability:

  • Intents are stored with timestamps and status; support can inspect localStorage under predictify:intents:v1 for debugging.

Next steps (optional):

  • Consider encrypting signed XDR in localStorage or reducing persistence TTL.
  • Add telemetry/metrics when intents transition to submitted and success.

Femi John added 2 commits August 28, 2026 10:10
- Implement DisputeEvidencePreview component for displaying evidence links with safety checks.
- Introduce normalization functions for dispute evidence to handle various input formats and ensure valid URLs.
- Update DisputesPage to utilize the new DisputeEvidencePreview component.
- Add tests for evidence normalization to validate functionality and edge cases.
@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

@renoschubert is attempting to deploy a commit to the Jagadeesh B's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@Johnsource-hub 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

@greatest0fallt1me

Copy link
Copy Markdown
Contributor

Thanks for the implementation. Before this can be merged, please add a valid issue-closing reference in the PR description, such as Closes #894. The current #closes/#894 text is not recognized by GitHub as a linked issue.

@Johnsource-hub

Copy link
Copy Markdown
Contributor Author

done

@greatest0fallt1me
greatest0fallt1me merged commit 3bd2258 into Predictify-org:main Aug 30, 2026
0 of 2 checks passed
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.

[Quality-2][High] Prevent claim retries from duplicating intent

2 participants