brave/brave-browser

Update IPFS Kubo to 0.18.1

Closed this issue · 1 comments

lidel commented

cc @cypt4 @bbondy @autonome

Release Notes: https://github.com/ipfs/kubo/blob/master/docs/changelogs/v0.18.md
Signed Binaries (MacOS): https://dist.ipfs.tech/kubo/v0.18.0/

This release introduces some configuration changes, and runs a migration on a preexisting repository to apply changes automatically to users who have default settings.

This means Brave, having some custom config overrides, needs to update some hardcoded config.

Necessary Config Updates

(1) Enable UDP transports (QUIC and WebTransport)

Brave runs with hardcoded TCP transport on port 45001

Modern QUIC transport runs on top of UDP. Whenever possible, QUIC will be preferred by IPFS peers over TCP. Not only is it faster, it also increases the chances of a successful holepunch in case of firewalls. It also enables WebTransport over QUIC.

To enable both, brave should update ipfs_service_utils.cc#L46-L50 and add QUIC UDP listeners on the same port as TCP:

      "Addresses": {
		"API": "/ip4/127.0.0.1/tcp/45001",
		"Announce": [],
		"AppendAnnounce": [],
		"Gateway": "/ip4/127.0.0.1/tcp/48080",
		"NoAnnounce": [],
		"Swarm": [
			"/ip4/0.0.0.0/tcp/44001",
+			"/ip4/0.0.0.0/udp/44001/quic-v1/webtransport",
+			"/ip4/0.0.0.0/udp/44001/quic-v1",
+			"/ip6/::/udp/44001/quic-v1",
+			"/ip6/::/udp/44001/quic-v1/webtransport",
			"/ip6/::/tcp/44001"
		]
	},

(we only add /quic-v1 because Brave had no /quic before)

(2) Remove custom ConnMgr limits

Custom limits from ipfs_service_utils.cc#L52-L54 should be removed:

-  dict->SetByDottedPath("Swarm.ConnMgr.GracePeriod", "20s");
-  dict->SetByDottedPath("Swarm.ConnMgr.LowWater", 20);
-  dict->SetByDottedPath("Swarm.ConnMgr.HighWater", 40);

Kubo 0.18 ships with sensible defaults (ipfs/kubo#9483) and we want Brave to benefit from ResourceMgr autoscaling features.

(3) Switch Routing.Type to auto

Automatic migration will replace Routing.Type=dht with Routing.Type=auto. No action needed here.

However, Brave has an additional override which we may consider removing.

Things are much smarter now, users who are behind NAT will remain DHT clients, and we also want Brave users to leverage IPNI router at https://cid.contact (which is enabled in auto mode).

Due to this, we need to remove --routing=dhtclient CLI override from ipfs_service_impl.cc:

- args.AppendArg("--routing=dhtclient");

This will switch to Routing.Type to auto from config.