Open mikemaccana opened 1 month ago
Hey @mikemaccana, AFAIK Shank doesn't have macros that generate helpers like this but if it did, how would it handle variable-length types such as Vec<PubKey>
?
I made something similar by extracting the proc macro out of anchor so it can run in non-anchor programs: https://github.com/kevinrodriguez-io/magic-space The only edge-case is when you have dynamic-spaced Vecs with constant realloc calls, or wherever you want to save some sol instead of using #[max_len(#)]
From the demo app:
In current Anchor we can avoid the magic numbers (and the readability or possible errors that go with magic numbers) with
SomeSTRUCT::INIT_SPACE
. It would be useful to have something similar in Shank.