Skip to content

fix: implement issues 1135, 1136, 1137, 1138 - #1191

Open
sudo-dev-lab wants to merge 4 commits into
StellerCraft:mainfrom
sudo-dev-lab:fix/1135-1136-1137-1138
Open

fix: implement issues 1135, 1136, 1137, 1138#1191
sudo-dev-lab wants to merge 4 commits into
StellerCraft:mainfrom
sudo-dev-lab:fix/1135-1136-1137-1138

Conversation

@sudo-dev-lab

@sudo-dev-lab sudo-dev-lab commented Aug 28, 2026

Copy link
Copy Markdown

Summary

Implements fixes for issues #1135, #1136, #1137, and #1138 across Stellar and backend services.

Issue #1135: Cache eviction strategy for issuer verification

  • Added test asserting oldest-first eviction when issuer verification cache reaches MAX_ISSUER_CACHE_ENTRIES
  • Verifies that adding one more entry than capacity evicts the oldest entry

Issue #1136: Soroban budget monitoring documentation

  • Added comprehensive combined example showing addAnalyticsSink and onBudgetAlert working together
  • Documented why addAnalyticsSink is preferred over deprecated setAnalyticsSink
  • Includes realistic end-to-end snippet tracking contract budget and responding to alerts

Issue #1137: Contract upgrade orchestrator error handling

  • Added test asserting specific error message for dryRun without upgradeTransactionXdr
  • Verifies that diffReport is populated with accurate transaction details

Issue #1138: Atomic idempotency key generation

  • Migration: Add request_fingerprint column and unique index for atomic upserts
  • Service: Rewrite generateKey() with atomic pattern (lookup → insert → re-select)
  • Tests: Updated mock setup to reflect atomic upsert behavior
  • Prevents concurrent duplicate key generation via database-level ON CONFLICT DO NOTHING

Test Plan

  • @craft/stellar trustline-validation tests (33 tests)
  • @craft/stellar upgrade-orchestrator tests (26 tests)
  • @craft/backend payment-idempotency tests (21 tests)
  • All tests pass locally

Closes #1135,
Closes #1136,
Closes #1137,
Closes #1138

…thout an upgrade transaction XDR

- Add test asserting the specific error message when dryRun=true without upgradeTransactionXdr
- Verify that diffReport is still populated in the result even though the dry run did not proceed
- Closes StellerCraft#1135
…example to soroban-budget-monitor

- Add comprehensive end-to-end example showing addAnalyticsSink and onBudgetAlert
  working together with trackContractBudget
- Clarify why addAnalyticsSink is preferred over the deprecated setAnalyticsSink
- Improve discoverability for contributors wiring up budget monitoring for the first time
- Closes StellerCraft#1136
…suer verification cache at full capacity

- Add dedicated test filling cache to MAX_ISSUER_CACHE_ENTRIES
- Verify that the oldest entry (first inserted) is evicted when capacity is reached
- Assert oldest-first eviction by checking that re-querying the evicted key
  triggers a fresh Horizon call instead of a cache hit
- Closes StellerCraft#1137
…se-level conflict handling

Implements Issue StellerCraft#1138: Replace select-then-insert pattern with atomic upsert using database-level ON CONFLICT DO NOTHING.

Changes:
- Migration 021: Add request_fingerprint column and unique index for atomic upserts
- Service: Rewrite generateKey() with lookup → insert → re-select pattern
- Tests: Update mocking to reflect atomic upsert behavior and simplify concurrent test

This ensures concurrent calls converge on a single key, preventing duplicate charges.
@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@sudo-dev-lab 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