Skip to content

chore: bump go-libp2p-kad-dht to v0.42#1189

Merged
guillaumemichel merged 8 commits into
mainfrom
chore/bump-dht
Jul 21, 2026
Merged

chore: bump go-libp2p-kad-dht to v0.42#1189
guillaumemichel merged 8 commits into
mainfrom
chore/bump-dht

Conversation

@guillaumemichel

@guillaumemichel guillaumemichel commented Jul 20, 2026

Copy link
Copy Markdown
Member

Companion of ipfs/kubo#11398

Summary

  • Store offline routing records using the go-libp2p-kad-dht value-store layout so offline and online routing can share records.
  • Preserve the offline router's existing behavior of serving records until their own validation expiry, with an opt-in WithMaxRecordAge retention cap.
  • Validate records on reads so expired records, such as IPNS records past their EOL, are not returned.
  • Keep repeated writes of the same record idempotent.

Compatibility

The offline router now reads and writes the go-libp2p-kad-dht v0.42+ value-store layout. Records stored using the previous offline-router layout are not migrated or read.

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.47619% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.87%. Comparing base (2353e12) to head (df71d10).

Files with missing lines Patch % Lines
routing/offline/offline.go 89.47% 1 Missing and 1 partial ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1189      +/-   ##
==========================================
- Coverage   63.88%   63.87%   -0.01%     
==========================================
  Files         269      269              
  Lines       27119    27115       -4     
==========================================
- Hits        17325    17320       -5     
- Misses       8082     8085       +3     
+ Partials     1712     1710       -2     
Files with missing lines Coverage Δ
gateway/handler.go 80.48% <ø> (ø)
namesys/ipns_publisher.go 57.33% <100.00%> (-0.78%) ⬇️
routing/offline/offline.go 85.10% <89.47%> (+7.74%) ⬆️

... and 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

gammazero and others added 2 commits July 21, 2026 05:28
The offline router no longer imposes a receive-age cap on stored
records. By default it serves a record until it stops being valid
(for IPNS, its EOL), as it did before moving to the go-libp2p-kad-dht
value store. WithMaxRecordAge adds an opt-in store-age cap for callers
that want to bound a datastore nothing else prunes.
lidel added a commit to ipfs/kubo that referenced this pull request Jul 21, 2026
Bumps boxo, bringing the offline router retention change (records are
served until their EOL, no receive-age cap by default; ipfs/boxo#1189)
and a gateway 304 cache-freshness fix (ipfs/boxo#1188).

The v0.43 "Unified IPNS record storage" highlight now spells out how
retention works: with the offline router and the DHT sharing the /dht
datastore prefix, online nodes drop value records 48h after storage
(the DHT's value-store GC) while offline nodes keep them until EOL.

@gammazero gammazero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some minor suggestions, otherwise looks good.

We can ignore the Gateway Sharness test failure as that should resolve once the kubo PR is merged.

Comment thread routing/offline/offline.go Outdated
Comment thread routing/offline/offline.go Outdated

@lidel lidel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Pushed small change that restores old behavior of routing/offline but allow for opt-in cap in offline one.

And +1 to the failing sharness job is expected: it builds kubo master against this branch, and master won't compile against kad-dht v0.42 until the companion ipfs/kubo#11398 lands. It shouldn't block this PR as long as the kubo PR is green.

Comment thread routing/offline/offline.go Outdated
Comment on lines +55 to +64
// A stored record is served for as long as it stays valid (for IPNS, until its
// EOL); see WithMaxRecordAge to also cap retention by store age.
func NewOfflineRouter(dstore ds.Datastore, validator record.Validator, opts ...Option) routing.Routing {
r := &offlineRouting{
validator: validator,
}
for _, opt := range opts {
opt(r)
}
r.vs = records.NewValueStore(dstore, validator, r.maxRecordAge)

@lidel lidel Jul 21, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@guillaumemichel I made change here in routing/offline to remove cap by default, it is intentional: it restores the offline router's long-standing behavior of serving a record until its EOL (still validated on read). Without it, an offline node, which has no republisher to refresh records, would silently drop still-valid records at amino.DefaultMaxRecordAge. Online nodes still get that cap: the kad-dht value store shares this datastore and its GC evicts records past that age. WithMaxRecordAge is there for callers that do want a store-age cap.

iiuc this is necessary to not break ipfs daemon --offline nodes which dont use DHT and serve imported ipns records that are valid for many years.

@guillaumemichel
guillaumemichel marked this pull request as ready for review July 21, 2026 19:29
@guillaumemichel
guillaumemichel requested a review from a team as a code owner July 21, 2026 19:29
@guillaumemichel
guillaumemichel merged commit 5a26247 into main Jul 21, 2026
26 of 27 checks passed
@guillaumemichel
guillaumemichel deleted the chore/bump-dht branch July 21, 2026 19:44
lidel added a commit to ipfs/kubo that referenced this pull request Jul 21, 2026
Pick up boxo main HEAD (4794174d), which includes the merged offline
router value-store change (ipfs/boxo#1189). This brings the root module,
the kubo-as-a-library example, and test/dependencies onto one boxo pin;
they previously pointed at three different commits.

- go-libp2p moves to ec408fcc as a transitive floor required by boxo
- changelog: note the one-time full-datastore key scan on first start
  after upgrading, and update the pinned boxo and go-libp2p hashes
lidel added a commit to ipfs/kubo that referenced this pull request Jul 21, 2026
* chore: bump go-libp2p-kad-dht to v0.42.0

* bump kad-dht

* fix(init): stop publishing an empty-directory IPNS record

* bump kad-dht to v0.42.1

* bump boxo

* chore: bump boxo, clarify IPNS storage changelog

Bumps boxo, bringing the offline router retention change (records are
served until their EOL, no receive-age cap by default; ipfs/boxo#1189)
and a gateway 304 cache-freshness fix (ipfs/boxo#1188).

The v0.43 "Unified IPNS record storage" highlight now spells out how
retention works: with the offline router and the DHT sharing the /dht
datastore prefix, online nodes drop value records 48h after storage
(the DHT's value-store GC) while offline nodes keep them until EOL.

* fix: sync DHT purge once after deletion

* bump boxo

* depend on boxo@master

* chore: bump boxo to main, align module pins

Pick up boxo main HEAD (4794174d), which includes the merged offline
router value-store change (ipfs/boxo#1189). This brings the root module,
the kubo-as-a-library example, and test/dependencies onto one boxo pin;
they previously pointed at three different commits.

- go-libp2p moves to ec408fcc as a transitive floor required by boxo
- changelog: note the one-time full-datastore key scan on first start
  after upgrading, and update the pinned boxo and go-libp2p hashes

* chore: require make mod_tidy before commit/push

Spell out that the repo has three go.mod files that must stay on the
same dependency versions, and that a bare `go mod tidy` only tidies one
module and lets pins drift between them.

---------

Co-authored-by: Marcin Rataj <lidel@lidel.org>
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.

3 participants