test: remove circular dependency between authproxy and util #35049

pull rkrux wants to merge 2 commits into bitcoin:master from rkrux:test-circular changing 15 files +56 −50
  1. rkrux commented at 11:26 am on April 10, 2026: contributor

    I noticed this issue while reviewing PR 34773 where a lazy import is added in the call method of the AuthServiceProxy class in authproxy.py

    There’s a circular dependency between authproxy.py and util.py due to which the former can’t use the common utility functions and thus lazy imports are used as a workaround.

    This patch set breaks the dependency so that authproxy.py can use the utility functions from util.py in a standard fashion. Few tests that explicitly use get_rpc_proxy and JSONRPCException needed to have their imports updated.

  2. DrahtBot added the label Tests on Apr 10, 2026
  3. DrahtBot commented at 11:26 am on April 10, 2026: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    LLM Linter (✨ experimental)

    Possible typos and grammar issues:

    • node_number: the node number (or id) that this calls to -> node_number: the node number (or id) that this calls [“calls to” is awkward/incorrect grammar; the extra “to” makes the sentence harder to parse]
    • Returns: AuthServiceProxy. convenience object for making RPC calls. -> Returns: AuthServiceProxyWrapper convenience object for making RPC calls. [wrong type name + stray period; could confuse readers about what is actually returned]

    2026-04-11 07:57:29

  4. rkrux commented at 11:31 am on April 10, 2026: contributor
    Ah taking a look at the failing tests, the test runner had passed on my local.
  5. l0rinc commented at 11:32 am on April 10, 2026: contributor
    Can you do the bulk of the change via a scripted diff to help with the review?
  6. DrahtBot added the label CI failed on Apr 10, 2026
  7. rkrux force-pushed on Apr 10, 2026
  8. DrahtBot removed the label CI failed on Apr 10, 2026
  9. maflcko commented at 1:34 pm on April 10, 2026: member
    Not sure about placing the different assert_ functions into different modules. If the circular dep is an issue, I think it may be easier to just leave the file as-is and not create the circular dep in the first place
  10. rkrux commented at 1:42 pm on April 10, 2026: contributor

    Not sure about placing the different assert_ functions into different modules.

    I had not planned on it but I had to do it because they use JSONRPCException which is present in authproxy. Maybe there could be a way wherein JSONRPCException can be removed from authproxy so that assert_* need not be moved out - I will take a look; I, too, would prefer a minimal diff.

  11. rkrux force-pushed on Apr 10, 2026
  12. DrahtBot added the label CI failed on Apr 10, 2026
  13. test: move out get_rpc_proxy from util
    So that util is not dependent on coverage and AuthServiceProxy.
    271e357193
  14. test: move out JSONRPCException from authproxy to util
    So that util is not dependent on authproxy at all and going
    forward authproxy can use util methods.
    a6858d90d5
  15. rkrux force-pushed on Apr 11, 2026
  16. DrahtBot removed the label CI failed on Apr 11, 2026
  17. rkrux commented at 8:46 am on April 11, 2026: contributor

    Re previously failing job run: I’ve reordered the commits so that the first commit doesn’t fail with the circular dependency issue in the test ancestor commits job.

    Not sure about placing the different assert_ functions into different modules.

    I have changed the approach so that the assert_* functions need not be split into multiple modules. Only the get_rpc_proxy function is moved out from and JSONRPCException is moved in the util module. This removes util’s dependency on authproxy so that the latter can use the former freely.

    Can you do the bulk of the change via a scripted diff to help with the review?

    With the new approach, the diff has reduced significantly and the PR now consisting of two commits should be easier to review.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-12 00:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me