Skip to content

Comments

feat(namesys/IPNSPublisher): expose ability to set Sequence#962

Merged
lidel merged 7 commits intoipfs:mainfrom
gsergey418:feat/10796-name-publish-sequence-option
Aug 13, 2025
Merged

feat(namesys/IPNSPublisher): expose ability to set Sequence#962
lidel merged 7 commits intoipfs:mainfrom
gsergey418:feat/10796-name-publish-sequence-option

Conversation

@gsergey418
Copy link
Contributor

Fixes ipfs/kubo#10796. Added an option to PublishOptions(namesys) that allows for setting a custom sequence number for the IPNS record. Kubo PR

@codecov
Copy link

codecov bot commented Jun 25, 2025

Codecov Report

❌ Patch coverage is 91.17647% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.43%. Comparing base (b9beaf4) to head (b6498cb).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
namesys/ipns_publisher.go 90.00% 2 Missing and 1 partial ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #962      +/-   ##
==========================================
+ Coverage   61.34%   61.43%   +0.08%     
==========================================
  Files         254      254              
  Lines       31709    31731      +22     
==========================================
+ Hits        19452    19494      +42     
+ Misses      10653    10636      -17     
+ Partials     1604     1601       -3     
Files with missing lines Coverage Δ
namesys/interface.go 76.47% <100.00%> (+2.00%) ⬆️
namesys/ipns_publisher.go 59.18% <90.00%> (+5.81%) ⬆️

... and 9 files with indirect coverage changes

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

@gsergey418 gsergey418 force-pushed the feat/10796-name-publish-sequence-option branch from 9450103 to 0d30983 Compare June 25, 2025 13:12
@gammazero
Copy link
Contributor

@lidel Do you think it is necessary to include a note that setting a sequence number that is less than the current sequence of an existing record, may cause the new record not to be seen because it's sequence is lower?

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.

@gammazero yes, that should be an error IMO

@gsergey418 afaik sequence is a monotonic clock, is there any case when it is something user wants to publish a record that will be ignored due to sequence not being the highest?

@guillaumemichel
Copy link
Contributor

Triage notes:

  • This PR will be triaged before kubo v0.37

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.

Thank you @gsergey418!

I added tests and security validation to prevent sequence numbers from going backwards.

Explainer: the original PR accepted any sequence number, creating unintentional vulnerability. If previous record exists, and we publish with lower sequence, the update will be ignored (at best) or we create unintentional replay attack (at worst).

Fixed this by requiring custom sequences to be greater than the current record's sequence, added proper error handling with ErrInvalidSequence, and wrote tests covering the validation scenarios to illustrate what is expected behavior.

Next steps

I think this is good to go but I would like to see tests in ipfs/kubo#10851 pass before we merge this.

@lidel lidel changed the title feat(ipns): Add a parameter in name.publish to change the sequence number feat(namesys/IPNSPublisher): expose ability to set Sequence Aug 6, 2025
@lidel
Copy link
Member

lidel commented Aug 13, 2025

IPNS tests in CI in ipfs/kubo#10851 look good (only failures are due to lint/using forked dependency).

I'm going to merge this and switch Kubo to commit from boxo main.

@lidel lidel merged commit 825361b into ipfs:main Aug 13, 2025
13 checks passed
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.

Add a parameter in name.publish to change the sequence number

4 participants