Repository navigation
fix: correct native XLM SAC defaults and add derivation-based test - #251
Open
Daveeee-tech wants to merge 1 commit into
Open
Daveeee-tech wants to merge 1 commit into
Daveeee-tech wants to merge 1 commit into
Conversation
|
@Daveeee-tech 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 branch has not been deployed
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.
closes #222
Summary
Fixes the hard-coded native XLM Stellar Asset Contract (SAC) addresses, which were each shifted one network along. Adds a test that checks them against the SDK's own derivation so this can't regress silently.
Problem
DEFAULT_XLM_SAC_MAINNETandDEFAULT_XLM_SAC_TESTNETinsrc/indexer.ts, andKNOWN_SAC_IDSinsrc/indexer/sac-detect.ts, did not matchAsset.native().contractId(...):CDLZFC3S…)CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMACDMLFMKM…)CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSCAll three are valid StrKey contract IDs, so nothing flagged the error. Only the derivation was wrong.
Impact
SAC_CONTRACT_IDSunset,resolveSacContractIds()falls back to a contract that doesn't exist on mainnet.getEventsreturns nothing forever, and the service looks healthy while the table stays empty.SAC_CONTRACT_IDSexplicitly.sac-detect.ts: real mainnet XLM transfers missedKNOWN_SAC_IDSand took the slow RPC path. Testnet XLM hit the set through the entry labelled "mainnet", so it was right for the wrong reason.Changes
src/indexer.ts: correctedDEFAULT_XLM_SAC_MAINNETandDEFAULT_XLM_SAC_TESTNET.src/indexer/sac-detect.ts: corrected the two values inKNOWN_SAC_IDS..env.example:SAC_CONTRACT_IDS_TESTNET/SAC_CONTRACT_IDS_MAINNETexamplesCCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75, which is whatnew Asset('USDC', 'GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN').contractId(Networks.PUBLIC)produces (the issuer key was already correct)Asset.native().contractId(Networks.PUBLIC | Networks.TESTNET)instead of against a literal.Background
The wrong value originated in #166, which quoted
CDLZFC3SY…as the mainnet SAC and carried intodocs/DEPLOY_MAINNET.mdvia #211. The doc was corrected on merge, but the code was not.Acceptance criteria
DEFAULT_XLM_SAC_MAINNET/DEFAULT_XLM_SAC_TESTNETequal the SDK derivation forNetworks.PUBLIC/Networks.TESTNETKNOWN_SAC_IDSholds the same two corrected values.env.examplecorrected (both native fallbacks, known-mainnet-SAC block, USDC example)Asset.native().contractId(...)Notes for reviewers
SAC_CONTRACT_IDSexplicitly are unaffected.