IPLD Autocodec

A presentation at IPFS þing in July 2022 in Reykjavík, Iceland by Brooklyn Zelenka

Slide 1

Slide 1

Autocodec Self-Decoding Graphs

Slide 2

Slide 2

High Level Pure Functions FTW

Slide 3

Slide 3

High Level Why?

Slide 4

Slide 4

High Level Why? Dynamically load codecs Instantly discoverable, travels with data Content signalling

Slide 5

Slide 5

High Level Blob vs DSL

Slide 6

Slide 6

High Level Blob vs DSL Content addressed Wasm blob Alternate: schema More “correct” via DSL, but would likely be extremely complex “Worse is better” Adoptable, familiar Easy tooling “Do exactly what I mean” Openly extensible

Slide 7

Slide 7

Layout Options

Slide 8

Slide 8

Layout Options Direct Optional Field Bytes Codec Links Bytes Codec Links Bytes Codec Links

Slide 9

Slide 9

Layout Options Direct Optional Field Bytes Codec Links Compact (Bitswap friendly) Deep linking intact Redundancy (space) Bytes Codec Links Bytes Codec Links

Slide 10

Slide 10

Layout Options Wrap DAG Entry Points Bytes Links AC Wrapper Bytes Links Bytes Links AC Wrapper Bytes Links

Slide 11

Slide 11

Layout Options Wrap DAG Entry Points Bytes Links More nodes (deeper graphs) AC Wrapper Potentially Byzantine (stacked wrappers) Have to be careful to wrap all nodes Breaks all existing codecs… but the Wasm will fix that Bytes Links Bytes Links AC Wrapper Bytes Links

Slide 12

Slide 12

Layout Options Self-Describing AC Wrapper ABI Metadata

Slide 13

Slide 13

Layout Options Self-Describing All interfaces via Wasm ABI AC Wrapper MUST include raw IPLD decoder (e.g. from DAG-CBOR) MUST include one or more codecs, with a default MAY include transversal functions for output type ABI Metadata

Slide 14

Slide 14

Layout Options Execution & Bounding

Slide 15

Slide 15

Layout Options Execution & Bounding MUST terminate Gas or timeout or AOT cost dynamics (probably gas)

Slide 16

Slide 16

Mutation Who Encodes the Encoders?

Slide 17

Slide 17

Mutation Adaptive Optimization AC Wrapper

Slide 18

Slide 18

Mutation Adaptive Optimization Either signalling method is “just” a tag Don’t have to execute exactly this Wasm blob AC Wrapper

Slide 19

Slide 19

Mutation Adaptive Optimization Either signalling method is “just” a tag Don’t have to execute exactly this Wasm blob AC Wrapper

Slide 20

Slide 20

Mutation Adaptive Optimization Either signalling method is “just” a tag Don’t have to execute exactly this Wasm blob AC Wrapper 🚀

Slide 21

Slide 21

Mutation In Place Upgrades & Fixes …why? Deterministic codec: check it Wrong layer: just replace 🤷 If you REALLY want to… Convention (detect and replace) Back to AOT loading Discourages updates 👍+👎 Mutable pointer (e.g. IPNS) How often to check? Malicious updates?

Slide 22

Slide 22

Mutation In Place Upgrades & Fixes …why? Deterministic codec: check it Wrong layer: just replace 🤷 If you REALLY want to… Convention (detect and replace) Back to AOT loading Discourages updates 👍+👎 Mutable pointer (e.g. IPNS) How often to check? Malicious updates?

Slide 23

Slide 23

Mutation In Place Upgrades & Fixes …why? Deterministic codec: check it Wrong layer: just replace 🤷 If you REALLY want to… Convention (detect and replace) Back to AOT loading Discourages updates 👍+👎 Mutable pointer (e.g. IPNS) How often to check? Malicious updates? AC Wrapper

Slide 24

Slide 24

Mutation In Place Upgrades & Fixes …why? Deterministic codec: check it Wrong layer: just replace 🤷 If you REALLY want to… Convention (detect and replace) Back to AOT loading Discourages updates 👍+👎 Mutable pointer (e.g. IPNS) How often to check? Malicious updates? AC Wrapper 🥚🐣🐥

Slide 25

Slide 25

Mutation In Place Upgrades & Fixes …why? Deterministic codec: check it Wrong layer: just replace 🤷 If you REALLY want to… Convention (detect and replace) Back to AOT loading Discourages updates 👍+👎 Mutable pointer (e.g. IPNS) How often to check? Malicious updates? AC Wrapper 🥚 🐣 🐥🍗

Slide 26

Slide 26

Wrap Up 🎁

Slide 27

Slide 27

Wrap Up Summary

Slide 28

Slide 28

Wrap Up Summary Highly extensible Dynamic Concrete Pure function Optimizable

Slide 29

Slide 29

🎉 Thank You, IPFS þing 🇮🇸 https://fission.codes brooklyn@fission.codes @expede