fix(indexer): stop scValToNative from silently corrupting plain values - #328
Merged
Conversation
@stellar/stellar-sdk 17 (merged via #326) changed scValToNative to return undefined for a value that isn't a real xdr.ScVal, instead of throwing. eventParser.js relied on the throw to fall back to the raw value, so plain already-native args (as used in our tests, and potentially some event shapes) were getting silently turned into undefined -> NaN/null downstream. Fix: treat an unexpected undefined result the same as the old throw-and-fall-back path. Verified: all 112 indexer tests pass (previously 2 failing in processor.test.js). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F8ndA3fFsSkp8qw6sqeAva
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
4 tasks
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.
Descripción
Hotfix de la regresión introducida por #326 (
@stellar/stellar-sdk16.2.0 → 17.0.1).Causa raíz
@stellar/stellar-sdk17 cambió el comportamiento descValToNative: para un valor que no es unxdr.ScValreal, antes lanzaba una excepción; ahora devuelveundefineden silencio.eventParser.jsdependía de que ese throw activara el fallback al valor crudo:Con el SDK 17, cualquier argumento que ya viniera como valor nativo (no un
ScValreal) se convertía enundefinedsin que elcatchlo notara — de ahí queprocessor.test.jsfallara con{ id: NaN, yield_entregado_delta: null }en vez de{ id: 10, yield_entregado_delta: "250000" }.Fix
Si
scValToNativedevuelveundefinedpara un argumento que no eraundefined, se trata igual que elcatchde antes: se conserva el valor crudo.Verificación
npm test— 112/112 tests pasan (antes: 2 fallando enprocessor.test.js)🤖 Generated with Claude Code
https://claude.ai/code/session_01F8ndA3fFsSkp8qw6sqeAva
Generated by Claude Code