Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPNS: clarify serialization and the type of ValidityType, TTL and Seq fields #469

Open
lidel opened this issue Mar 27, 2024 · 0 comments
Open
Labels
need/triage Needs initial labeling and prioritization

Comments

@lidel
Copy link
Member

lidel commented Mar 27, 2024

Problem

IPNS Record spec lists Validity, TTL and Seq as uint64:

..but this only applies to the protobuf fields from IPNS v1.
For wider background, documentation and cleanup of v1 vs v2 was done in #319, #376.

In IPNS v2 we store values in DAG-CBOR map in Data field, and fields like the TTL read from v2 Data field (DAG-CBOR) is represented as int64 (see boxo/ipns code).

In other words, in GO impl. time.Duration is represented as int64, and that is how "uint64" fields like TTL are stored in v2 Data field (CBOR). This is also confirmed by the way IPLD data model impl. at go-ipld-prime/node/basic works.

Solution

Ideas welcome. My initial idea is to move away from go specific.

Clarify this in the IPFS specification and mark these fields as language-agnostic integer and then add bullet points in their respective section that when represented in legacy v1, the type for protobuf is uint64, and when represented in v2 (dag-cbor) it is int64.

cc @2color as you've been working with TTL in JS recently.

@lidel lidel added the need/triage Needs initial labeling and prioritization label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

1 participant