Skip to content

fix: correct DataLayer wallet type constant from 14 to 11#1583

Merged
TheLastCicada merged 2 commits into
v2-rc2from
fix/dl-wallet-type-mismatch
Apr 16, 2026
Merged

fix: correct DataLayer wallet type constant from 14 to 11#1583
TheLastCicada merged 2 commits into
v2-rc2from
fix/dl-wallet-type-mismatch

Conversation

@TheLastCicada

@TheLastCicada TheLastCicada commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • getDLWalletId() was searching for WalletType 14 but chia-blockchain defines DATA_LAYER as 11 (and has since 2022). This meant the entire transaction health and recovery system — rejected tx detection, auto-clearing, DL unconfirmed tx gating — was silently disabled on real nodes.
  • The original integration test was tautological: it stubbed type 14 in the mock response then asserted CADT found type 14, and also ran under USE_SIMULATOR=true which short-circuits getDLWalletId() without ever hitting the RPC path.
  • Extracted findDLWalletInResponse() as a pure function with named constant CHIA_WALLET_TYPE_DATA_LAYER = 11, testable without simulator bypass. Added live-api test that calls real Chia wallet RPC get_wallets and verifies CADT's constant matches. Added to both v1 and v2 CI live-api jobs as an early sanity check.

Test plan

  • v2 integration tests pass (1391 passing)
  • v1 integration tests pass (112 passing)
  • v2 live-api CI job runs wallet-health test early and confirms DL wallet discovery
  • v1 live-api CI job runs wallet-health test early and confirms DL wallet discovery
  • Verify on ip-10-102-4-71 that "DataLayer wallet not found" warnings stop after deploying this fix

Note

Medium Risk
Touches wallet RPC discovery used by transaction health/recovery and adds new CI live tests that may fail due to environment/RPC connectivity, but the code change itself is small and targeted.

Overview
Fixes DataLayer wallet discovery by changing getDLWalletId() to look for the correct chia-blockchain wallet type (CHIA_WALLET_TYPE_DATA_LAYER = 11) and extracting the parsing logic into a pure helper (findDLWalletInResponse).

Strengthens test coverage by resetting the cached wallet id between tests, adding focused unit tests around the new parser/constant, and introducing a new live API wallet-health test that hits CADT’s /health/wallet and Chia’s get_wallets RPC. CI live API workflows now run this wallet health sanity check early for both v1 and v2 jobs, with a new npm run test:v2:live:wallet-health script.

Reviewed by Cursor Bugbot for commit b2898b6. Bugbot is set up for automated code reviews on this repo. Configure here.

getDLWalletId() was searching for WalletType 14 but chia-blockchain
defines DATA_LAYER as 11 (and has since 2022). This meant the entire
transaction health and recovery system — rejected tx detection,
auto-clearing, DL unconfirmed tx gating — was silently disabled on
real nodes.

The original integration test was tautological: it stubbed type 14 in
the mock response then asserted CADT found type 14. It also ran under
USE_SIMULATOR=true which short-circuits getDLWalletId() to return '2'
without ever hitting the RPC path.

- Extract findDLWalletInResponse() pure function with named constant
  CHIA_WALLET_TYPE_DATA_LAYER = 11, testable without simulator bypass
- Add __test_resetDLWalletCache() to prevent cross-test cache leakage
- Replace tautological test with findDLWalletInResponse unit tests
  that validate the constant value and reject adjacent type values
- Add live-api test (wallet-health.live.spec.js) that calls the real
  Chia wallet RPC get_wallets and verifies CADT's constant matches
- Run wallet-health live test in both v1 and v2 CI jobs as an early
  sanity check before the longer org-creation tests
- Fall back on 403 (not just 404) when v2 is disabled in v1-only CI
- Move wallet-health test after org creation so the DataLayer wallet
  exists (Chia auto-creates it on first datalayer interaction)
@TheLastCicada TheLastCicada merged commit 374c9f3 into v2-rc2 Apr 16, 2026
26 checks passed
@TheLastCicada TheLastCicada deleted the fix/dl-wallet-type-mismatch branch April 16, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant