sapio-lang/sapio

Replace serde-json with a canoncial json library which can support floats?

Opened this issue · 5 comments

Replace serde-json with a canoncial json library which can support floats?

IIRC there was a desire to "ban" the use of floats within sapio due to fundamental determinism issues stemming from hardware discrepancies. My position on this is, and has always been, that memory determinism is far less important than a guarantee of referential transparency at the layer the user interacts with. Memory determinism guarantees referential transparency but is a much stronger requirement, and with these hardware differences you've referenced, may not actually be possible.

i dont think this comment is related. this issue is that the serde-json Values we use in various places cannot contrain floats (it will panic). This is because the matrix.org json canonicalization spec bans floats. so we should ensure that our "generic object serializable" struct is canonicalizable, or else it panics when composed with attest chains.

Understood.

Would this be just another serde backend or is the idea that we would replace serde entirely for this purpose?

seems like maybe CBOR, in partciular the IPFS libraries for it (ipld) might be close to what we're looking for, and are serde compatible.

"IPLD stands for "InterPlanetary Linked Data, and is a series of standards and formats for describing data in a content-addressing-emphatic way. The people who work on IPLD do so because we want a world where it's easy to build decentralized, distributed, and inter-operable applications, and we believe robust data formats and a clear story for content-addressing them is a key piece of leverage towards that goal."

this sounds right