Strict encoding should provide explicit guarantees on collection sizes
dr-orlovsky opened this issue · comments
Dr. Maxim Orlovsky commented
The main strict encoding rule was to restrict the size of any collection (string, vector of data, maps) to 2^16 elements (i.e. have a length encoded by 2 bytes). This happens implicitly, which leads to a non-obvious bugs missed in code reviews.
To address the issue it is proposed first to perform #97 and than, additionally to that, do the following:
- Abandon
confined_encoding
for unordered hash collections (HashSet
,HashMap
); - Remove
confined_encoding
from all other collection types; - Introduce new types for collections, specifically
ConfinedString
,ConfinedVec
,ConfinedSet
,ConfinedMap
, backed by inner typesString
,Vec
,BTreeSet
,BTreeMap
) and require all consensus code to explicitly use them.