-
Notifications
You must be signed in to change notification settings - Fork 3
chore(hermes): p2p testing is pre publish #725
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
Merged
Merged
Conversation
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
The previous commit ff8b6d2 changed is_pre_publish_completed to require at least one provider other than ourselves. This broke P2P testing because: 1. Publishing node announces itself as a DHT provider 2. Other nodes receive messages via gossipsub (PubSub) 3. But they don't automatically become DHT providers unless they fetch content 4. Publishing node waits indefinitely, causing HTTP timeouts (exit code 52) This restores the original behavior where finding ourselves as a provider is sufficient for DHT propagation verification, which matches the function's documented contract: 'For P2P testing and small isolated networks, finding ourselves as a provider is sufficient.' Also updates the test case to expect true when only our peer is present. Fixes: ff8b6d2 ("fix: correct is_pre_publish_completed to require other peers")
The 15-second wait was insufficient for nodes to initialize and log their peer IDs, causing init-bootstrap to fail intermittently. Increasing to 30 seconds ensures reliable peer ID discovery during first-time setup and after 'just clean'.
Improved documentation to explain: - The two conditions that return true (ourselves OR others as providers) - Why finding only ourselves is sufficient in P2P testing environments - The distinction between gossipsub propagation vs DHT provider announcements This makes the function's behavior and reasoning more explicit.
bkioshn
previously approved these changes
Dec 17, 2025
Contributor
|
This passes when run locally 👍🏼 |
Fixes Clippy pedantic lint error requiring technical terms in documentation to be properly formatted with backticks.
📚 Docs PreviewThe docs for this PR can be previewed at the following URL: https://docs.dev.projectcatalyst.io/hermes/fix-p2p-testing-is-pre-publish |
bkioshn
approved these changes
Dec 17, 2025
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.
Fix: Restore
is_pre_publish_completedfor P2P TestingSummary
Restore the original
is_pre_publish_completedbehavior to unblock P2P testing (just quickstart). The regression introduced inff8b6d2dcaused publishing to wait indefinitely for DHT providers that never appear in gossipsub-only test environments.Problem
The P2P testing infrastructure (
just quickstart) broke after commitff8b6d2d:52)Other DHT providers not found, abortingRoot Cause
Commit
ff8b6d2dchangedis_pre_publish_completedto require at least one other peer (not ourselves) to be registered as a DHT provider before completing a publish.This assumption is invalid in P2P testing environments due to the difference between gossipsub and DHT provider announcements.
Content Distribution Flow
✅ Publishing node adds content to IPFS and announces itself as a DHT provider
✅ Publishing node broadcasts the message via gossipsub (PubSub)
✅ Subscriber nodes receive the message via gossipsub
❌ Subscriber nodes do not announce themselves as DHT providers
Result:
The publishing node waits indefinitely for another DHT provider that never appears, blocking the HTTP handler for ~50 seconds before timing out.
Solution
1. Restore
is_pre_publish_completedLogicFile:
hermes/bin/src/runtime_extensions/hermes/doc_sync/host.rsReverted to the original behavior:
trueif we are found as a DHT providertrueif other peers are found as providersfalseonly when no providers existFinding ourselves as a provider confirms that:
This matches the function’s documented contract and supports isolated P2P test networks.
3. Update Test Expectations
Updated the test case to reflect intended behavior:
#[test_case("OUR", &["OUR"] => true; "our peer is sufficient for P2P testing")]Previously, this case incorrectly expected
false.4. Increase Bootstrap Initialization Wait
File:
p2p-testing/justfileIncreased
init-bootstrappeer ID discovery wait from 15s → 30s.The original timeout was insufficient for nodes to fully initialize and log peer IDs, causing intermittent bootstrap failures on first run.
Testing Results
Before Fix
52(timeout)After Fix