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

未关闭
#469 0 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
文档
描述清晰度
基本清楚
活跃度
停滞
技术栈
go

调研方向

从 IPNS 记录规范中关于 TTL、序列和有效性的章节开始,然后将 #319 和 #376 中关于 v1 和 v2 的背景与所引用的 boxo/ipns record.go 和 go-ipld-prime 代码进行比较。当规范使用与语言无关的整数术语,并清楚记录 v1 的 protobuf uint64 表示形式与 v2 的 DAG-CBOR int64 表示形式时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

need/triage

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.

主要语言
HTML
星标
1.2k
派生
250
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ipfs/specs 的其他 Issue

查看 ipfs/specs 的全部 Issue

相似的 Issue

更多 Documentation Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。