test: RPC coverage linter + related fixes for listaddressbalances#7279
test: RPC coverage linter + related fixes for listaddressbalances#7279PastaPastaPasta merged 7 commits intodashpay:developfrom
Conversation
8aed477 test: fix RPC coverage check (Brandon Odiwuor) 2630b64 test: add abortrescan RPC test (Brandon Odiwuor) Pull request description: This is bitcoin#27593 cleaned up / rebased, now that the legacy wallet has been dropped. Closes bitcoin#27593. ACKs for top commit: maflcko: lgtm ACK 8aed477 cedwies: ACK 8aed477 Tree-SHA512: 14a28b1ef0c1f63236d04c2ff6c11adddc40642e4a23d30398e8a03fc47f911465af91affc6e66ee2d548515ef4f65fb1cb5d69985c5a771a17b1c9c009f48ad Co-authored-by: merge-script <fanquake@gmail.com>
|
✅ Review complete (commit c27ba87) |
✅ No Merge Conflicts DetectedThis PR currently has no conflicts with other open PRs. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe PR moves the Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
thepastaclaw
left a comment
There was a problem hiding this comment.
Code Review
This backport looks clean on the checked-out SHA. listaddressbalances is moved to the wallet RPC coins module and still registered correctly, and the functional-test coverage plumbing change does what it intends: the cache node now advertises wallet RPCs for coverage reference generation via uses_wallet=True, while tests that never opt into wallet options still run with -disablewallet. I did not find a Dash-specific incompatibility or missing prerequisite on this head.
Reviewed commit: 53cd792
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
thepastaclaw
left a comment
There was a problem hiding this comment.
Code Review
Verified both agents' findings against the checked-out tree at c27ba87. Codex's line-619 finding is a real and high-confidence logic gap: add_dynamically_node() fails to propagate uses_wallet to TestNode, defeating the new flag on that code path. Claude's overlapping-flags observation and backport prerequisite note are both valid but lower-impact suggestions.
Reviewed commit: c27ba87
🟡 2 suggestion(s) | 💬 1 nitpick(s)
1 additional finding
🟡 suggestion: `add_dynamically_node()` does not propagate `uses_wallet`
test/functional/test_framework/test_framework.py (line 619)
The point of uses_wallet (added in this PR) is to let tests opt into wallet support even when options.descriptors is not set, by preventing TestNode.__init__ from appending -disablewallet at test_node.py:117. It is threaded through add_nodes() at line 581 and through _initialize_chain() at line 971, but add_dynamically_node() at line 619 instantiates TestNode without passing uses_wallet=self.uses_wallet. Any node created through this path silently reverts to the old behavior: with uses_wallet=False and descriptors unset, the node is started with -disablewallet even when the enclosing test sets self.uses_wallet = True. Fix by forwarding the framework's flag like the other two call sites do.
💡 Suggested change
t_node = TestNode(p0, p1, p2, chain=p3, rpchost=p4, timewait=p5, timeout_factor=p6, bitcoind=p7, bitcoin_cli=p8, mocktime=p9, coverage_dir=p10, cwd=p11, extra_conf=p12, extra_args=p13, use_cli=p14, start_perf=p15, use_valgrind=p16, uses_wallet=self.uses_wallet)
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `test/functional/test_framework/test_framework.py`:
- [SUGGESTION] line 619: `add_dynamically_node()` does not propagate `uses_wallet`
The point of `uses_wallet` (added in this PR) is to let tests opt into wallet support even when `options.descriptors` is not set, by preventing `TestNode.__init__` from appending `-disablewallet` at test_node.py:117. It is threaded through `add_nodes()` at line 581 and through `_initialize_chain()` at line 971, but `add_dynamically_node()` at line 619 instantiates `TestNode` without passing `uses_wallet=self.uses_wallet`. Any node created through this path silently reverts to the old behavior: with `uses_wallet=False` and `descriptors` unset, the node is started with `-disablewallet` even when the enclosing test sets `self.uses_wallet = True`. Fix by forwarding the framework's flag like the other two call sites do.
- [SUGGESTION] lines 144-147: Two overlapping wallet flags: `_requires_wallet` and `uses_wallet`
`BitcoinTestFramework.__init__` now owns two separately-purposed wallet flags: `_requires_wallet` (set by `skip_if_no_wallet()` at line 1071, gates `import_deterministic_coinbase_privkeys()` at lines 466 and 1820) and `uses_wallet` (controls whether `-disablewallet` is appended by `TestNode` at test_node.py:117). The distinction is undocumented and easy to get wrong — e.g. the missed propagation in `add_dynamically_node()` at line 619 is partly enabled by the fact that tests must now remember both flags. Consider either deriving one from the other (`self.uses_wallet = self.uses_wallet or self._requires_wallet`) or adding an explanatory comment at the definition site so future test authors don't set only one and wonder why the wallet is still disabled.
| self._requires_wallet = False | ||
| # Disable ThreadOpenConnections by default, so that adding entries to | ||
| # addrman will not result in automatic connections to them. | ||
| self.uses_wallet = False |
There was a problem hiding this comment.
🟡 Suggestion: Two overlapping wallet flags: _requires_wallet and uses_wallet
BitcoinTestFramework.__init__ now owns two separately-purposed wallet flags: _requires_wallet (set by skip_if_no_wallet() at line 1071, gates import_deterministic_coinbase_privkeys() at lines 466 and 1820) and uses_wallet (controls whether -disablewallet is appended by TestNode at test_node.py:117). The distinction is undocumented and easy to get wrong — e.g. the missed propagation in add_dynamically_node() at line 619 is partly enabled by the fact that tests must now remember both flags. Consider either deriving one from the other (self.uses_wallet = self.uses_wallet or self._requires_wallet) or adding an explanatory comment at the definition site so future test authors don't set only one and wonder why the wallet is still disabled.
source: unknown
🤖 Fix this with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `test/functional/test_framework/test_framework.py`:
- [SUGGESTION] lines 144-147: Two overlapping wallet flags: `_requires_wallet` and `uses_wallet`
`BitcoinTestFramework.__init__` now owns two separately-purposed wallet flags: `_requires_wallet` (set by `skip_if_no_wallet()` at line 1071, gates `import_deterministic_coinbase_privkeys()` at lines 466 and 1820) and `uses_wallet` (controls whether `-disablewallet` is appended by `TestNode` at test_node.py:117). The distinction is undocumented and easy to get wrong — e.g. the missed propagation in `add_dynamically_node()` at line 619 is partly enabled by the fact that tests must now remember both flags. Consider either deriving one from the other (`self.uses_wallet = self.uses_wallet or self._requires_wallet`) or adding an explanatory comment at the definition site so future test authors don't set only one and wonder why the wallet is still disabled.
| @@ -114,7 +114,7 @@ def __init__(self, i, datadir, extra_args_from_options, *, chain, rpchost, timew | |||
| if self.mocktime != 0: | |||
| self.args.append(f"-mocktime={mocktime}") | |||
|
|
|||
| if self.descriptors is None: | |||
| if uses_wallet is not None and not uses_wallet and self.descriptors is None: | |||
| self.args.append("-disablewallet") | |||
There was a problem hiding this comment.
💬 Nitpick: Partial backport of bitcoin#28710 uses_wallet infrastructure
bitcoin#33064 relies on the uses_wallet plumbing introduced upstream as part of bitcoin#28710 (legacy wallet removal, commit c847dee). That broader series is not backported to Dash — only the minimum-viable subset needed for bitcoin#33064 was added in follow-up commit 53cd792 (default uses_wallet=False, uses_wallet= kwarg on TestNode.__init__, and the gated -disablewallet branch at line 117). This is sufficient for the current fix, but worth recording: if future backports pull in more of bitcoin#28710's descriptor-only semantics, a more complete port of that series may become warranted.
source: ['claude']
Issue being fixed or feature implemented
Further investigation discovered the bug, that exclude all wallet RPCs from coverage linter.
What was done?
listaddressbalanceslistaddressbalancesmoved between files to where it is supposed to belistaddressbalancesabortrescanRPC)Backport candidate
only this commit is considerable useful for backporting: fix: RPC doc for listaddressbalances
How Has This Been Tested?
See updates in functional tests
Breaking Changes
N/A
Checklist: