This diff adds a structure for remembering the nodes waiting for a
proof, and bind them as soon as this proof is known (i.e. a peer with
this proof is created).
Ref T1634.
Differential D9703
[avalanche] Remember nodes pending a proof and bind them when available Fabien on Jun 25 2021, 12:52. Authored by
Details
This diff adds a structure for remembering the nodes waiting for a Ref T1634. ninja all check-avalanche
Diff Detail
Event TimelineComment Actions You have a fundamental problem here. You can register a node for 2 proofs and 2 keys. In addition, the key seems duplicated between the PeerManager and the node state. Is it used at all in the peer manager? If not, then get rid of it. In any case, you need to resolve this duplication problem. It seems like you'd need unit tests for this. Comment Actions Address feedback, rebase on top of D9720:
Comment Actions Build Bitcoin ABC Diffs / Diff Testing (build-diff) failed.
Failed tests logs: ====== Bitcoin ABC functional tests with the next upgrade activated: p2p_blockfilters.py ====== ------- Stdout: ------- 2021-07-05T14:43:54.641000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_ _20210705_144159/p2p_blockfilters_290 2021-07-05T14:43:59.769000Z TestFramework (INFO): get cfcheckpt on chain to be re-orged out. 2021-07-05T14:43:59.820000Z TestFramework (INFO): Reorg node 0 to a new chain. 2021-07-05T14:44:02.278000Z TestFramework (INFO): Check that peers can fetch cfcheckpt on active chain. 2021-07-05T14:44:02.331000Z TestFramework (ERROR): Assertion failed Traceback (most recent call last): File "/work/test/functional/test_framework/test_framework.py", line 127, in main self.run_test() File "/work/test/functional/p2p_blockfilters.py", line 115, in run_test assert_equal(response.stop_hash, request.stop_hash) File "/work/test/functional/test_framework/util.py", line 60, in assert_equal for arg in (thing1, thing2) + args))) AssertionError: not(20976074930306478592554250300701327872062515716428437594998550489965476602495 == 53636499989420933765690773610164576424255569450400882896522682575725428720027) 2021-07-05T14:44:02.381000Z TestFramework (INFO): Stopping nodes 2021-07-05T14:44:02.934000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_ _20210705_144159/p2p_blockfilters_290 2021-07-05T14:44:02.934000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_ _20210705_144159/p2p_blockfilters_290/test_framework.log 2021-07-05T14:44:02.934000Z TestFramework (ERROR): 2021-07-05T14:44:02.934000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_ _20210705_144159/p2p_blockfilters_290' to consolidate all logs 2021-07-05T14:44:02.935000Z TestFramework (ERROR): 2021-07-05T14:44:02.935000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log. 2021-07-05T14:44:02.935000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues 2021-07-05T14:44:02.935000Z TestFramework (ERROR): Each failure log is accessible here: Comment Actions The general approach seems to make sense, but holly hell, the code is a total mess. You need to think about what these different function do, or should do, and ventilate accordingly, instead of just patching things in random places. I won't hide that I'm upset. The code in there was clean, it has turned into a complete mess. It now does all kind of random crap that seem unrelated (broadcast all proofs? Does the mempool has a broadcast all transaction? It doesn't, which leaves me with the question: how did this code become even more nonsensical that the legacy satoshi codebase? Is that a joke? Am I being pranked?). there is simply no way for me - and I doubt anyone else - to convince themselve that this code is correct or even udnerstand what it does. In fact, it's not even clear anymore what anything in there actually does. The API that is exposed for tests has grow to 17 methods, vs 6 for the actual class API. How does this happen? This only need to touch a couple of codepath:
So how come this touches code all over the place, checks for orphaning, and need to check for random crap all over the place? This patch should look like three green blocks + header + tests.
Comment Actions Address feedback:
There is a change in behavior since the last version: when a peer is removed, all the nodes The pending node erasure is kept oustside of the addOrUpdateNode(). Erasing in the method Comment Actions Move the erasure to addOrUpdateNode. This makes the code easier to reason about but requires a double loop in the fetchOrUpdatePeer() method to deal with invalidated iterators. |