iroha
iroha copied to clipboard
Immutable payload in `iroha_crypto`
Check this comment. Payload (currently a Vec<u8>
) in structures like PublicKey
, PrivateKey
and Signature
is immutable for the lifetime of the wrapping type. This means that capacity field of the Vec
is redundant and could be removed to reduce the size. A similar thing was done in #1985
Probably we can somehow generalize this to no to repeate the code for Name
struct
This is a different situation.
In case of ConstStr
we want to be able to heap-allocate objects beyond a certain length.
Keys are all stored in enum
s, immutable and their length is known at compile time. It's likely that the final implementation is going to be a newtype wrapping [u8; X]
where X
is determined for each key as a constant. (const generics are stable).