🚀 Feature Overview
The wallet generation and keypair creation endpoints may have race conditions under concurrent load. If two requests simultaneously check for an available wallet and both proceed to create, they can produce duplicate or conflicting state. This is critical for the airdrop and testnet faucet integration.
🛠️ Implementation Requirements
- Audit wallet creation, keypair generation, and faucet dispense endpoints for race conditions
- Implement pessimistic locking using PostgreSQL
SELECT ... FOR UPDATE or Redis distributed locks (Redlock algorithm)
- Use database transactions with proper isolation levels (SERIALIZABLE for critical operations)
- Add idempotency keys to wallet creation endpoints (allowing safe retries)
- Implement atomic counters for faucet dispense limits using Redis INCR
- Add load tests that simulate 50+ concurrent wallet creation requests to verify correctness
- Document the concurrency model in the API docs
🔧 Technical Specifications
PostgreSQL, Redis, Node.js, TypeScript, Redlock/Redis distributed locks
✅ Acceptance Criteria
- Concurrent wallet creation requests do not produce duplicates
- Faucet dispense limits are enforced correctly under load
- Deadlocks are detected and retried automatically (with jitter)
- Load test with 50 concurrent requests produces exactly 50 unique wallets
- Performance under contention is acceptable (< 500ms p99)
🎓 Difficulty Level
Advanced — requires deep understanding of database isolation levels, distributed locking, and concurrent access patterns
⏱️ Timeline
ETA: 2-3 days
🚀 Feature Overview
The wallet generation and keypair creation endpoints may have race conditions under concurrent load. If two requests simultaneously check for an available wallet and both proceed to create, they can produce duplicate or conflicting state. This is critical for the airdrop and testnet faucet integration.
🛠️ Implementation Requirements
SELECT ... FOR UPDATEor Redis distributed locks (Redlock algorithm)🔧 Technical Specifications
PostgreSQL, Redis, Node.js, TypeScript, Redlock/Redis distributed locks
✅ Acceptance Criteria
🎓 Difficulty Level
Advanced — requires deep understanding of database isolation levels, distributed locking, and concurrent access patterns
⏱️ Timeline
ETA: 2-3 days