Skip to content

fix: SweepingProvider shouldn't error when missing DHT#10975

Merged
lidel merged 3 commits intomasterfrom
sweepingprovider-fx-err
Sep 19, 2025
Merged

fix: SweepingProvider shouldn't error when missing DHT#10975
lidel merged 3 commits intomasterfrom
sweepingprovider-fx-err

Conversation

@guillaumemichel
Copy link
Contributor

If Sweeping Provider is enabled, but no DHT is supplied, SweepingProviderOpt() shouldn't return an error.

We want to transition Sweeping Provider to being the default provide mode, and it should be OK for a kubo node not to use a DHT. DHT provides will not happen, but fx shouldn't fail.

IIRC this was included in #10834 but probably overwritten due to conflicts in #10951

@guillaumemichel guillaumemichel requested a review from a team as a code owner September 19, 2025 13:45
@guillaumemichel guillaumemichel added the skip/changelog This change does NOT require a changelog entry label Sep 19, 2025
@lidel lidel self-assigned this Sep 19, 2025
when SweepingProvider is enabled but no DHT is available (e.g., Routing.Type=none),
the daemon would panic with a nil pointer dereference in ResettableKeystore.ResetCids.

this fix:
- returns NoopProvider when no DHT implementation is available
- skips keystore initialization for NoopProvider to avoid unnecessary operations
- allows nodes to run without DHT when using HTTP-only routing or offline mode

the panic occurred because initKeyStore tried to access a nil keystore when
SweepingProvider returned nil for the keystore parameter. by checking if the
provider is NoopProvider and skipping keystore operations, we avoid the panic
while maintaining correct behavior for all other provider types.

cc #10974 #10975
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All green, merging for testing in 0.38.0-rc1

@lidel lidel merged commit 2a669d8 into master Sep 19, 2025
16 checks passed
@lidel lidel deleted the sweepingprovider-fx-err branch September 19, 2025 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip/changelog This change does NOT require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants