Skip to content
This repository was archived by the owner on Jan 8, 2026. It is now read-only.
This repository was archived by the owner on Jan 8, 2026. It is now read-only.

Invariants for IPLD Codecs #328

@vmx

Description

@vmx

One of the ideas of IPLD is that it defines a Data Model that is independent of the underlying codec. You can leverage existing formats like CBOR, JSON or Protocol Buffers or create your own special purpose one. IPLD Codecs usually specify additional restrictions on top of the codecs, in order to make them practical for content addressing. Things like restricting the types that can be used (so that there is only one way to encode each Data Model Kind) or the sort order in maps. That's the reason there are those DAG-* codecs.

So far there is no explicit invariant in the specs that those IPLD Codecs are a strict subset of the underlying codec (I always assumed that, but it has never been written down AFAIK). That is an important feature, as this way you can deserialize and serialze any data which was encoded by a DAG-* codec with codecs that comply to their original specs.

A concrete example is that the Protocol Buffers reference implementations can deserialize any DAG-PB data and serialize it again into a byte-identical copy of the original data. You wouldn't need to use any of the tooling provided by the IPLD project, you could just use existing parsers/implementations of the codec.

This ensures that data produces by IPLD is interoperable even outside of IPLD itself.

Hence I propose putting this invariant explicitly into the specs, else IPLD wouldn't live up to the ideas of being independent of the underlying codec and interoperable with a wide variety of other systems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions