Fix the network unreachable test panic - #3869
Open
ii-cruz wants to merge 2 commits into
Open
Conversation
ii-cruz
force-pushed
the
iicruz/fix-local-tests
branch
from
July 13, 2026 18:35
309394d to
29dce28
Compare
ii-cruz
marked this pull request as ready for review
July 13, 2026 18:36
There was a problem hiding this comment.
Pull request overview
This PR aims to fix flaky/panicking network-related tests by avoiding reuse of hardcoded libp2p in-memory listen addresses (/memory/<id>) across parallel test runs.
Changes:
- Updated consensus sync test utilities to derive peer “memory addresses” from a higher, parameter-based base value rather than fixed small constants.
- Changed Tendermint validator tests to use different hardcoded peer IDs for
TestNetwork::build_network.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
validator/tests/tendermint.rs |
Adjusts the in-memory libp2p address IDs used by Tendermint protocol upgrade tests. |
consensus/tests/sync_utils.rs |
Computes peer IDs from a high base derived from num_upgrades and uses that consistently for network setup/connection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jsdanielh
reviewed
Jul 13, 2026
jsdanielh
left a comment
Member
There was a problem hiding this comment.
I'd prefer a random number per test. We should display this generated number though
jsdanielh
force-pushed
the
iicruz/web-client-flaky-tests
branch
from
July 14, 2026 04:19
46636f9 to
93f0d49
Compare
ii-cruz
force-pushed
the
iicruz/fix-local-tests
branch
from
July 14, 2026 13:46
29dce28 to
cbe4044
Compare
commit: |
ii-cruz
force-pushed
the
iicruz/fix-local-tests
branch
from
July 14, 2026 14:07
cbe4044 to
854e03d
Compare
ii-cruz
force-pushed
the
iicruz/fix-local-tests
branch
from
July 14, 2026 17:31
4ee1ce9 to
7e76786
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's in this pull request?
Some two-peer sync tests used hardcoded libp2p memory addresses. Since the memory transport registry is shared by tests running in the same binary, parallel tests could attempt to listen on the same address. This caused
Swarm::listen_onto fail and led to subsequent network cancellation or unreachable panics before the sync assertions were reached.This PR adds an asynchronous
Network::listen_on_addressAPI that waits for libp2p to report the resolved listen address. Test networks can now listen on/memory/0, allowing libp2p to allocate an available address, and return that address to callers for connecting peers.The full, history, light, and pico sync tests now use these allocated addresses instead of deriving or hardcoding memory addresses. A regression test verifies that concurrent
/memory/0listeners receive distinct, nonzero addresses.The PR also fixes a separate deadlock exposed when history-sync tests initialize genesis data in parallel. The temporary genesis block is kept alive until the permanent decompressed BLS keys are cached, preventing its lazy public keys from being dropped while another thread is initializing the same key cache.
Pull request checklist
clippyandrustfmtwarnings.