Repository navigation
fix(indexer): correct native SAC network defaults - #225
Conversation
|
This is already fixed on What it found, verified against the SDK rather than inferred:
#251 also added the assertion that stops it recurring: expect(DEFAULT_XLM_SAC_MAINNET).toBe(Asset.native().contractId(Networks.PUBLIC));
expect(DEFAULT_XLM_SAC_TESTNET).toBe(Asset.native().contractId(Networks.TESTNET));Deriving the expectation from the SDK rather than pasting the literal twice — a test that asserts the constant equals itself would have passed against the wrong value for as long as the bug existed. This PR now conflicts with that. Please check whether anything here is still needed once you rebase on current Your call either way; I am not closing a contributor's PR. |
|
Merged. And I verified the addresses rather than taking the diff's word, because contract IDs are exactly the thing a review must not rubber-stamp — I derived them here: All three match what you claimed. The constants in
The drift guard is the better half of this PR, and it's the part I'd have asked for if you hadn't written it: it.each([
['mainnet', Networks.PUBLIC, DEFAULT_XLM_SAC_MAINNET],
['testnet', Networks.TESTNET, DEFAULT_XLM_SAC_TESTNET],
])('uses the SDK-derived native SAC for %s', (network, passphrase, defaultId) => {
expect(defaultId).toBe(Asset.native().contractId(passphrase));
})Deriving from the SDK instead of restating the constant is what makes this stick. A test that reads the same constant the code reads will confirm any value, right or wrong — which is presumably how the original pair survived as long as it did. This one fails on a wrong constant. Merge note: Verified on the merge result rather than your branch: Closes #184. |
Summary
Deployments without an explicit SAC watch list currently select the testnet native SAC on mainnet and the standalone native SAC on testnet. Correct both defaults and the known-SAC detection set using the addresses derived by the installed Stellar SDK.
Update the native XLM and mainnet USDC examples in
.env.exampleand the dual-network guide. Regression tests compare the defaults and detection behavior against SDK derivation, and ensure the standalone address does not bypass detection on mainnet or testnet.Related issue
Closes #222
Type of change
Validation
npm run db:generatenpx tsc --noEmitnpm run typechecknpm run buildnpm test: 53 suites, 648 tests passed, including coverage thresholds.Validation ran on Windows with Node.js 24.14.0.
npm run docs:openapinormalized the local OpenAPI snapshot to LF before the full suite; its Git content is unchanged and it is not part of this PR.AI assistance: implemented with Codex and validated with the commands above.
Checklist
npx tsc --noEmitpassesnpm run buildpasses