I have this field on the data account of my pda:
#[max_len(0)]
pub users: Vec<Pubkey>,
But I'm still able to push a value to it, even though it should have 0 space allocated. Why is that so? Also, when I have the init
attribute for the #[accounts()]
attribute macro, does the fields of the account being initialized are initialized using Default e.g. Option is initialized to None and Vec to empty?
InitSpace
macro to figure out what is the required number of bytes to be allocated oninit
(i.e., to be possible to useINIT_SPACE
with types likeString
) and that there is no other functionality of the declaration (anchor-lang.com/docs/space#the-init-space-macro).