-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Recreation of solana-labs/solana-program-library#5518
Problem
When working with spl-type-length-value, it's possible to use types that implement bytemuck's Pod and Zeroable trait, as well as spl_discriminator::SplDiscriminate to create TLV entries and utilize the library's tooling.
However, it appears that Pod types using u64 and higher are not supported by the library, since they require proepr alignment.
Solution
We need to figure out a way to make this relationship amongst Pod types work with various integer sizes.
There are a few solutions:
Add padding to the length value within the library.
Make the length value use the same integer size required by a type's padding.
Allow a user to specify the integer type for length.
Regardless, it's also worth mentioning that the error coming back from pod_from_bytes(..) is not very helpful (ProgramError::InvalidArgument). We should also introduce a pass-through error for bytemuck errors.