Looking through examples like Soldev, one sees PDAs sizes calculated using code like:
pub fn get_account_size(title: String, description: String) -> usize {
return (4 + MovieAccountState::DISCRIMINATOR.len())
+ 1
+ 1
+ (4 + title.len())
+ (4 + description.len());
}
Where do these magic numbers come from? I have seen these values in the anchor account space docs
Type: String
Space in bytes: 4 + length of string in bytes
Details: Account size is fixed so account should be initialized with sufficient space from the beginning
but where are these standards defined? Are they from Solana, borsh, Anchor or something else? Where is the definitive reference for the size of different types?