Skip to content

Conversation

gammazero
Copy link
Contributor

@gammazero gammazero commented Apr 29, 2025

@gammazero gammazero requested a review from a team as a code owner April 29, 2025 20:12
@gammazero gammazero changed the title eat(config): ability to disable Bitswap fully or just server feat(config): ability to disable Bitswap fully or just server Apr 30, 2025
Original PR: #10782

This pull request introduces changes to the Bitswap configuration and functionality, including the addition of new configuration options, modifications to the Bitswap server/client behavior, and the inclusion of new tests to verify these changes.

* Added a new `BitswapConfig` struct in `config/bitswap.go` to hold Bitswap configuration options, including `Enabled` and `ServerEnabled` flags.
* Updated the `Config` struct in `config/config.go` to include the new `BitswapConfig` field.

* Modified the `Bitswap` function in `core/node/bitswap.go` to respect the `ServerEnabled` flag, using an empty blockstore when the server is disabled to prevent serving blocks to other peers.
* Updated the `OnlineExchange` function to return a no-op exchange when Bitswap is disabled.
* Added a `noopExchange` struct to handle cases where Bitswap is disabled, ensuring no blocks are served or retrieved.

* Introduced a new test file `test/cli/bitswap_config_test.go` with multiple test cases to verify the behavior of Bitswap configuration, including scenarios where the server is enabled, disabled, or Bitswap is completely disabled.

- Closes #10717
- Depends on ipfs/boxo#912
@gammazero gammazero force-pushed the feat/bitswap-disable branch from 729e23f to e5e7cf1 Compare April 30, 2025 13:41
@lidel
Copy link
Member

lidel commented Apr 30, 2025

nit: I'll be reverting the squash on the commits here or amend and add Co-authored-by.

We want to keep credit for the original author from #10782 and we usually do squash only when PR is merged, keeping commits on PR in original form, that way all commit authors are credited via Co-authored-by line added by github in squash commit message that ends up in master branch (example)

If that is too much work, we can also add Co-authored-by: manually once this PR is merged but figuring out correct user handle and email requires manual work – up to you, just want to make sure the credit is not lost.

@lidel lidel self-assigned this Apr 30, 2025
@lidel lidel marked this pull request as draft April 30, 2025 16:11
@lidel
Copy link
Member

lidel commented Apr 30, 2025

since we've switched master to upstream boxo with ipfs/boxo#911, we no longer need this PR, let's continue in #10782

@lidel lidel closed this Apr 30, 2025
@lidel lidel deleted the feat/bitswap-disable branch April 30, 2025 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

config: Flag to disable Bitswap client and server
3 participants