-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
backport: bitcoin#15934, #15864, #19188, #18338, #19413, #18571, #18575 (deglobalization part 3) #4844
Conversation
This pull request has conflicts, please rebase. |
e615bd6
to
191718e
Compare
This pull request has conflicts, please rebase. |
me reading PR description 😮 pls see https://github.com/UdjinM6/dash/commits/pr4844 |
Co-authored-by: UdjinM6 <[email protected]>
This commit is from bitcoin@145fe95 but the commit wasn't titled as such, this to prevent confusion due to a potentially misleading commit title as the change doesn't match the pull request title's description per-se.
Co-authored-by: UdjinM6 <[email protected]>
…testing setup [-Wshadow-field] Co-authored-by: UdjinM6 <[email protected]>
Co-authored-by: UdjinM6 <[email protected]>
|
Co-authored-by: UdjinM6 <[email protected]>
New changes have been pushed that should fix |
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.
LGTM with one nit (see inline comment). ready for review? ;)
const TestingSetup* g_setup; | ||
} // namespace | ||
|
||
void initialize() | ||
{ | ||
static RegTestingSetup setup{}; | ||
static TestingSetup setup{ | ||
CBaseChainParams::REGTEST, | ||
{ | ||
"-nodebuglogfile", | ||
}, | ||
}; |
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.
18571: should is partial for now I guess. same changes should be applied to src/test/fuzz/process_messages.cpp
which we don't have yet (18521 is a part of #4829)
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.
Or just remember to apply this patch to 18521.
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 👍
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 for merging via merge commit
, bitcoin#22872, bitcoin#23477, bitcoin#23492, bitcoin#23713, bitcoin#23780, bitcoin#23826, bitcoin#23373, bitcoin#24201, bitcoin#24665, bitcoin#22910, partial bitcoin#23025 (addrman backports: part 3) f032119 merge bitcoin#22910: Encapsulate asmap in NetGroupManager (Kittywhiskers Van Gogh) 8020bfa merge bitcoin#24665: document clang tidy named args (Kittywhiskers Van Gogh) 40a22e4 merge bitcoin#24201: Avoid InitError when downgrading peers.dat (Kittywhiskers Van Gogh) cdcaf22 merge bitcoin#23373: Parse command line arguments from unit and fuzz tests, make addrman consistency check ratio easier to change (Kittywhiskers Van Gogh) b30f0fa test: remove `connman` local from `BasicTestingSetup` (Kittywhiskers Van Gogh) df43565 merge bitcoin#23826: Make AddrMan unit tests use public interface, extend coverage (Kittywhiskers Van Gogh) c14a540 merge bitcoin#23780: update `addrman_tests.cpp` to use output from `AddrMan::Good()` (Kittywhiskers Van Gogh) 8b2db6b merge bitcoin#23713: refactor addrman_tried_collisions test to directly check for collisions (Kittywhiskers Van Gogh) 5b5dd39 merge bitcoin#23492: tidy up addrman unit tests (Kittywhiskers Van Gogh) aba0ebd merge bitcoin#23477: tidy up unit tests (Kittywhiskers Van Gogh) cdc8321 merge bitcoin#22872: improve checkaddrman logging with duration in milliseconds (Kittywhiskers Van Gogh) 8d22fe9 merge bitcoin#23084: avoid non-determinism in asmap-addrman test (Kittywhiskers Van Gogh) ba46967 partial bitcoin#23025: update nanobench add `-min_time` (Kittywhiskers Van Gogh) c28b05c merge bitcoin#22831: add addpeeraddress "tried", test addrman checks on restart with asmap (Kittywhiskers Van Gogh) c4fe608 merge bitcoin#22226: add unittest core dump instructions (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * In [bitcoin#22831](bitcoin#22831), when restarting the node in `rpc_net.py`'s `test_addpeeraddress()`, existing commands need to be appended to `extra_args` to ensure they're retained when the node is restarted (default behavior is to overwrite the argument list with `extra_args`) to prevent the test from hanging and then failing due to missing fast DIP3 activation params from the arguments list. Missing arguments result in a block database sanity check failure on restart due to `bad-qc-premature` arising from the activation height being higher than the height of a block with a quorum commitment. * `NodeContext` was moved from `TestingSetup` to `BasicTestingSetup` in [bitcoin#18571](bitcoin#18571) ([dash#4844](#4844)) but `connman` as a `BasicTestingSetup` variable still stuck around (despite `NodeContext`'s presence making this unnecessary). To prepare for [bitcoin#22910](bitcoin#22910), the remnant variable has been replaced with `m_node.connman` and adjustments have been made to that effect. ## Breaking Changes None observed. ## Checklist: - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK f032119 PastaPastaPasta: utACK f032119 Tree-SHA512: b29c292ecda54cda8301ea804b433f80476a1cdbb72bd48740cc9b2e885a4ff52350e5e42f112426856282bd6d961f0e37f1b23020c52f07238413070bbc504a
Additional Notes
Depends on merge bitcoin#16240...21526: assumeutxo project backports (part 2) #4703
During the backporting process, efforts to backport refactor: Remove confusing BlockIndex global bitcoin/bitcoin#19413 resulted in failures in the test suite
setup_common.cpp
(source),m_node.peer_logic
accepted*m_node.chainman
as an argument before its initialisation, resulting in a dereferenced null pointer, that wasn't being used anywhere (yet).m_node
being overridden by every inherited class and that resulted inTestingSetup::TestingSetup
's initialisation logic being rendered pointless (which included definingm_node.chainman
). This was resolved by backporting test: Avoid overwriting the NodeContext member of the testing setup [-Wshadow-field] bitcoin/bitcoin#19188 (which in turn relies on the backport below)Efforts to backport fuzz: Disable debug log file bitcoin/bitcoin#18571 (which plays a part in the backport mentioned above as its responsible for moving the definition of
m_node
fromTestingSetup
to its parent,BasicTestingSetup
) resulted in failures in the test suiteInitial suspicion was placed on potential
gArgs
/m_node.args
shenanigans, which resulted in debug and troubleshoot efforts similar to the previous backport. This turned out not to be the case.The next step involved looking for backports done around that time period and through
git blame
-ing our way through pull requests, Fix wallet unload race condition bitcoin/bitcoin#18338 was backported. This unfortunately, didn't solve the problem either.I decided to focus on the
importwallet_rescan
failure first and stepped through each line of the test case and the error was triggered when callingdumpwallet
. We still didn't know the nature of the error and so I attempted to ask Boost.Test to politely stop catching exceptions and hand over control to the debugger usingBOOST_TEST_IGNORE_NON_ZERO_CHILD_CODE
(source). That did not help, at all.make clean
and re-build everything than to step through with TSan enabled.Finally, I decided to set a breakpoint within
rpcdump.cpp
(wheredumpwallet
is defined) and stepped through the routine, finally finding the reason why the test failure happened. AJSONRPCError
exception (source) which seemed to indicate shenanigans withGetDataDir()
was why.git blame
-ing throughutil/system.cpp
resulted in backporting Fix datadir handling bitcoin/bitcoin#15864, which didn't help either.Adding a
std::cout
print revealed thatGetDataDir()
was giving us/dash/.dashcore/regtest/wallet.backup
instead of something like/tmp/test_common_Dash Core/dc97848d42956a1f35b76515f8b54088a89a8bbc87943435722a16b49197f151/regtest/wallet.backup
violating defined behaviour (source), which took me down thegArgs
/m_node.args
rabbithole again which proved to not help.Reading through the changes made in backport itself, out of curiosity I decided to check every function called by any additions and
ParseParameters
proved to be the source of our woes.Turns out, calling
ForceSetArg
beforeParseParameters
means exactly squat asParseParameters
will erase all overrides before parsing its argument (source). Searching through, the source tree of the original bitcoin backport, Merge settings one place instead of five places bitcoin/bitcoin#15934 was discovered. Did it help? Yes. Did it just get backported easily? Nope!Backporting Merge settings one place instead of five places bitcoin/bitcoin#15934 required dealing with some Dash-isms.
It required reversal of qt: Fix Repair tab #4715 due to the logic it introduced. Of course, only the implementation of the fix can be reversed, not the fix itself, so while backporting,
GetCommandLineArgs
needed to be re-worked around the backport.ForceRemoveArg
is a Dash-ism that, upon removal, will cause multiple test failures and so removal of it entirely seemed out of the question, thus requiring it to be re-adapted around the backportNote, this does result in behaviour change.
ForceRemoveArg
can no longer remove a network flag, unlike the pre-backport variant. This is due to underlying changes inArgsManager
. Luckily, I saw no such invocations and so continued further.This alone did not solve test failures, which can be attributed to the backport removing the foremost hyphen of the argument key from its internal maps, this was remedied by a scripted change that removed all prefixed hyphens from
ForceRemoveArg
calls.