mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-11 21:20:39 +02:00
Merge bitcoin/bitcoin#35808: fuzz: reset connman state in p2p targets
d29b22d078fuzz: reset connman state in p2p targets (Hao Xu) Pull request description: Resets `ConnmanTestMsg` at the start of each input in `cmpctblock` and `p2p_handshake`, matching the other reused-connman fuzz targets and preventing sticky `CConnman` state from leaking between corpus inputs. Before this, deterministic-fuzz-coverage showed single inputs were stable, but all-input directory runs were not: ```diff cmpctblock, src/net.cpp:4172 - Branch (4172:9): [True: 1.21k, False: 33.0k] + Branch (4172:9): [True: 613, False: 33.6k] - Branch (4172:72): [True: 901, False: 311] + Branch (4172:72): [True: 497, False: 116] ``` ```diff p2p_handshake, src/net.cpp:4172 - Branch (4172:9): [True: 98, False: 1.67k] + Branch (4172:9): [True: 743, False: 1.03k] - Branch (4172:72): [True: 90, False: 8] + Branch (4172:72): [True: 612, False: 131] ``` With the resets, `deterministic-fuzz-coverage` passed for both `cmpctblock` and `p2p_handshake`. ACKs for top commit: nervana21: re-tACKd29b22d078maflcko: lgtm ACKd29b22d078Tree-SHA512: bd445ae33ab7f9850046e3de4e318bee9ae7b38ee77ee282d0f5c3a88a4b67610dd00faef2af913a4d7d42bfc42b957855b2d85f1849f77823149baa089afce2
This commit is contained in:
@@ -126,6 +126,8 @@ FUZZ_TARGET(cmpctblock, .init = initialize_cmpctblock)
|
||||
FakeSteadyClock steady_clock;
|
||||
|
||||
auto setup = g_setup;
|
||||
auto& connman = *static_cast<ConnmanTestMsg*>(setup->m_node.connman.get());
|
||||
connman.Reset();
|
||||
auto& mempool = *setup->m_node.mempool;
|
||||
auto& chainman = static_cast<TestChainstateManager&>(*setup->m_node.chainman);
|
||||
chainman.ResetIbd();
|
||||
@@ -133,7 +135,6 @@ FUZZ_TARGET(cmpctblock, .init = initialize_cmpctblock)
|
||||
const size_t initial_index_size{WITH_LOCK(chainman.GetMutex(), return chainman.BlockIndex().size())};
|
||||
|
||||
AddrMan addrman{*setup->m_node.netgroupman, /*deterministic=*/true, /*consistency_check_ratio=*/0};
|
||||
auto& connman = *static_cast<ConnmanTestMsg*>(setup->m_node.connman.get());
|
||||
auto peerman = PeerManager::make(connman, addrman,
|
||||
/*banman=*/nullptr, chainman,
|
||||
mempool, *setup->m_node.warnings,
|
||||
|
||||
@@ -40,6 +40,7 @@ FUZZ_TARGET(p2p_handshake, .init = ::initialize)
|
||||
|
||||
auto& node{g_setup->m_node};
|
||||
auto& connman{static_cast<ConnmanTestMsg&>(*node.connman)};
|
||||
connman.Reset();
|
||||
auto& chainman{static_cast<TestChainstateManager&>(*node.chainman)};
|
||||
FakeNodeClock clock{1610000000s}; // 2021-01-07, arbitrary
|
||||
FakeSteadyClock steady_clock;
|
||||
|
||||
Reference in New Issue
Block a user