Closed vmx closed 1 year ago
Requirements & Risks:
Given this, the main issue we have is with deterministically accepting/rejecting CBOR-encoded objects. Deterministic encoding isn't an issue for us.
Current Rules:
f16
.Future Work:
Currently:
Instead, we should:
This would move all consensus-critical IPLD encoding/decoding (with respect to the FVM, at least) into WASM, significantly reducing any risks.
Visiting for M2.1. Unfortunately, we do need to land at least some part of this because EVM actors will be able to handle arbitrary FVM messages, and send messages to native actors.
NOTE: If we restrict those "native" messages to using precompiles and don't add the "native send opcode" to M2.1, we can significantly reduce the risk. Otherwise, the native send opcode will effectively be writing an arbitrary cbor-encoded block and we'll need to validate it.
The encoding rules for https://github.com/ipld/serde_ipld_dagcbor are already pretty strict, e.g. I think infinite length lists error already. The one that tackles this issue, it would be great if you could add a section for serde_ipld_dagcbor
to https://github.com/ipld/ipld/blob/2f010292da7e3d089f2512b175494abe114f1a2a/specs/codecs/dag-cbor/spec.md#implementations.
I'm punting this to m2.2, limiting to #1001 for now.
We've resolved this by not being strict and instead clearly defining what Filecoin cares about and what it doesn't. This reduces the risk of different implementations defining conflicting rules. If you're interested:
DAG-CBOR only supports a subset of CBOR. Especially for the FVM we should be strict about (de)serializing only valid DAG-CBOR. DAG-CBOR supports:
0xd8 0x2a
. Not any other tag.0xfb
byte. Not 16-bit (0xf9
), 32-bit (0xfa
).false
(0xf4
),true
(0xf5
) andnull
(0xf6
). Not simple values (0xe0
…0xf3
),undefined
(0xf7
), simple value, one byte follows (0xf8
), "break" stop code (0xff
).The development will happen within the DAG-CBOR library, but I opened the issue here for tracking purpose.