-
Notifications
You must be signed in to change notification settings - Fork 37.8k
refactor: Fix the chainparamsbase -> util circular dependency #14045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
b77e9ba
to
d1e653c
Compare
Concept ACK Let’s get rid of all circular dependencies! :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK d1e653c2e028c3342cdae4be81e423f96db89214 with a few style nits.
d5c2ab0
to
10652ff
Compare
Fixed tests. |
27f8ab9
to
eca5a9f
Compare
On second thought, removed the |
eca5a9f
to
d5c2ab0
Compare
d5c2ab0
to
613c28d
Compare
85191a6
to
03f21f0
Compare
03f21f0
to
d04063b
Compare
d04063b
to
e9035ea
Compare
55c3b8c
to
8f3b025
Compare
8f3b025
to
60ee8a4
Compare
91f62a7
to
fa190c6
Compare
fa190c6
to
0c0f506
Compare
0c0f506
to
7588c1b
Compare
96b2d9b
to
ab5b67e
Compare
These options are intimately tied to ArgsManager, so their presence here makes sense, and moving them removes a final cause for a circular dependency between util and chainparamsbase.
And call into BaseParams from ArgsManager. Introduce BaseParamsSelected as it's necessary to prevent access to BaseParams prior to selection. This eliminates the chainparamsbase -> util -> chainparamsbase circular dependency. Note I had to guard ArgsManagerHelper::NetworkArg calls with a test for a leading '-' as NetworkArg asserts against the alternative, while values without - are tested for in the util_tests.
ab5b67e
to
764106e
Compare
Rebased |
@@ -774,7 +780,7 @@ BOOST_FIXTURE_TEST_CASE(util_ArgsMerge, ArgsMergeTestingSetup) | |||
// Results file is formatted like: | |||
// | |||
// <input> || <IsArgSet/IsArgNegated/GetArg output> | <GetArgs output> | <GetUnsuitable output> | |||
BOOST_CHECK_EQUAL(out_sha_hex, "b835eef5977d69114eb039a976201f8c7121f34fe2b7ea2b73cafb516e5c9dc8"); | |||
BOOST_CHECK_EQUAL(out_sha_hex, "6e84c6b6a1702f5c2247d175e7e1ad76c342be58b95bf2b7ed7e271d38197a14"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the changes here expected? I don't think they look right. It looks like wallet settings in the top-level of the config file (not in the test section) are now no longer ignored when testnet is enabled.
DIfferences in results.txt before and after this change look like:
-net=test wallet=c1 wallet=c2 || unset | ignored -wallet
+net=test wallet=c1 wallet=c2 || c1 | c1 c2
...
-net=test wallet=c1 wallet=c2 || unset | ignored -wallet
+net=test wallet=c1 wallet=c2 || c1 | c1 c2
...
If this is not intended, it might just be a bug in the test setup, like the parser.m_network = network;
line above no longer having an effect, instead of a real bug.
I wrote a feedback a few months ago, not sure if it still applies: Base params are always selected when the program is running. Only very early in the init sequence (when the chain was not selected) we'd have to (and should) skip the steps that involve the chain name. Imo this is better solved by passing a bool into No strong opinion, though |
Needs rebase |
There hasn't been much activity lately and the patch still needs rebase, so I am closing this for now. Please let me know when you want to continue working on this, so the pull request can be re-opened. |
By making
BaseParams()
responsible for holding the current chain name, and layeringArgsManager
atop it.Without this both
m_network
ofArgsManager
andglobalChainBaseParams
track the current chain, leading to circular dependencies between them.