From f8e1833f4a150b746f5356f3573f05d4bcee0637 Mon Sep 17 00:00:00 2001 From: Ian Suvak Date: Wed, 6 Sep 2023 11:25:16 -0400 Subject: [PATCH] Add missing constrains to the canonical messagepack spec --- dev/crypto.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dev/crypto.md b/dev/crypto.md index dc9d58c..2b5969b 100644 --- a/dev/crypto.md +++ b/dev/crypto.md @@ -33,11 +33,13 @@ A canonical msgpack encoding in Algorand must follow these rules: 3. Positive integer values must be encoded as "unsigned" in msgpack, regardless of whether the value space is semantically signed or unsigned; - 4. Integer values must be represented in the shortest possible - encoding; + 4. All variable length encoding values must be represented in the shortest possible; + encoding (integers, binary arrays, strings); 5. Binary arrays must be represented using the "bin" format family (that is, use the most recent version of msgpack rather than the - older msgpack version that had no "bin" family). + older msgpack version that had no "bin" family); + 7. Strings must be represented using the "str" format family (instead of "bin"); + 9. Structs must be encoded as maps (with the keys in lexicographic order as per rule 1) instead of being encoded as arrays. ### Domain Separation