Repository navigation
fix: validate cache value before stringify, make airdrops create atomic - #419
Merged
ritaifeoluwa merged 1 commit intoSep 25, 2026
Merged
Conversation
… create atomic - SmartDropLabs#388: Wrap JSON.stringify in try-catch in cache.set to gracefully handle circular references, BigInt, or other non-serializable values instead of crashing - SmartDropLabs#390: Replace cache.set + redis.zadd with MULTI/EXEC in airdrops create() so crash between them can't leave orphaned records Note: SmartDropLabs#389 (webhookEncryption deriveKey caching) and SmartDropLabs#391 (alerts create atomicity) were already addressed in prior commits.
|
@pooramara 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #388
Fixes #389
Fixes #390
Fixes #391
What changed
JSON.stringify(value)incache.set()with a try-catch so circular references, BigInt values, or other non-serializable values are logged and silently skipped instead of crashing the caller.cache.set+redis.zaddinairdrops.js create()with a singleMULTI/EXECtransaction, preventing orphaned records if a crash occurs between the two writes.Notes
deriveKey()caches the derived key incachedDerivedKeyand only computes SHA-256 once.a7855d0—alerts.js create()already usesMULTI/EXEC.Why
JSON.stringifythrows on circular references and BigInt, which would crash the calling code and potentially lose the data it was trying to cache.cache.setandzaddleft an airdrop record invisible tolist()/scanIds()(no entry inIDS_KEY) or a phantom ID inIDS_KEYwith no backing record.How to test
cache.set('test', { self: {} }); self.self = self;should log an error and return without crashingcache.set('test', BigInt(1));should log an error and return without crashing