You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
mikemaccana
changed the title
Something like INIT_SPACE (or better yet, TOTAL_SPACE)
Feature request: something like INIT_SPACE
Jul 31, 2024
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.The text was updated successfully, but these errors were encountered: