You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fromFlatTerm impl of PeekTokenType is insufficently precise #324
This creates a problem for some decoders that use peekTokenType and only look for the Type(U|N)Int(64) tokens and do not consider TypeInteger. Such decoders will not correctly round-trip via FlatTerm, where the will correctly round-trip via the binary CBOR representation.
The solution is to return TypeUInt64 and TypeNInt64 when the integer fits within the range, e.g.
tokenTypeOf (TkInteger n)
| n >= 0 && n < 2^64 = TypeUInt64
| n < 0 && n > -2^64 = TypeNInt64
| otherwise = TypeInteger
Alternatively, we could change the representation of FlatTerm to preserve more token type information, e.g. by splitting TkInt into TkUInt, TkNInt, TkUInt64, TkNInt64.
Activity
Make `tokenTypeOf` more precise
Make `tokenTypeOf` more precise (#325)
Test that consensus emits valid CBOR (#323)