fix: correct DataLayer wallet type constant from 14 to 11#1583
Merged
Conversation
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)
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.
Summary
getDLWalletId()was searching for WalletType14but chia-blockchain definesDATA_LAYERas11(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.14in the mock response then asserted CADT found type14, and also ran underUSE_SIMULATOR=truewhich short-circuitsgetDLWalletId()without ever hitting the RPC path.findDLWalletInResponse()as a pure function with named constantCHIA_WALLET_TYPE_DATA_LAYER = 11, testable without simulator bypass. Added live-api test that calls real Chia wallet RPCget_walletsand verifies CADT's constant matches. Added to both v1 and v2 CI live-api jobs as an early sanity check.Test plan
wallet-healthtest early and confirms DL wallet discoverywallet-healthtest early and confirms DL wallet discoveryip-10-102-4-71that "DataLayer wallet not found" warnings stop after deploying this fixNote
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-healthtest that hits CADT’s/health/walletand Chia’sget_walletsRPC. CI live API workflows now run this wallet health sanity check early for both v1 and v2 jobs, with a newnpm run test:v2:live:wallet-healthscript.Reviewed by Cursor Bugbot for commit b2898b6. Bugbot is set up for automated code reviews on this repo. Configure here.