You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: use standard peer-record domain and payload type
Fixes#6204
PAYLOAD_TYPE: "/libp2p/routing-state-record" → [0x03, 0x01]
DOMAIN_SEP: "libp2p-routing-state" → "libp2p-peer-record"
The payload type [0x03, 0x01] is the multicodec identifier for libp2p-peer-record, as defined in:
[Multicodec table](https://github.com/multiformats/multicodec/blob/master/table.csv)
This matches the implementations in:
[Go libp2p](https://github.com/libp2p/go-libp2p/blob/master/core/peer/record.go#L21-L24)
[JS libp2p](https://github.com/libp2p/js-libp2p/blob/main/packages/peer-record/src/peer-record/consts.ts#L7)
PR Recreation Notice
This PR is a recreation of [#6205], which was automatically closed after I mistakenly deleted my fork.
It restores the exact same code and commits as before. No additional changes were made.
Follow-up plan (based on discussion in the original PR)
During the previous review, the suggested direction was:
Introduce this change behind a new Cargo feature, which will be false by default.
Deprecate the current implementation, allowing users to switch gradually.
Give the ecosystem time to migrate, before potentially making the new behavior the default in the future.
Why I’m reopening now
This PR is being reopened and then I added the new optional `peer-record-interop` feature flag.
Testing
Added cross-implementation interoperability tests:
core/tests/peer_record_interop.rs - Tests that verify Rust can decode and verify signed peer records from Go and JS
core/tests/fixtures/ - Test fixtures with signed peer records generated by Go and JS implementations
Before the fix, these tests failed with:
BadPayload(UnexpectedPayloadType { expected: [47, 108, ...], got: [3, 1] })
After the fix, all tests pass.
Breaking Change
⚠️ BREAKING CHANGE: Existing signed peer records created with Rust libp2p will not be verifiable with this change, as the domain and payload type have changed. However, this is necessary to fix interoperability with Go/JS libp2p implementations.
Notes & open questions
None - this is a straightforward alignment with the standard used by other libp2p implementations.
Change checklist
[x ] I have performed a self-review of my own code
I have made corresponding changes to the documentation
I have added tests that prove my fix is effective or that my feature works
[x ] A changelog entry has been made in the appropriate crates
Pull-Request: #6230.
0 commit comments