-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: zero-copy for accounts with resizable lists #2837
Comments
This would certainly be a great improvement over the current sized one. Regarding the example API you shared, why is it necessary for the user to differentiate between |
@acheroncrypto just curious here on the impl of zero-copy for heap allocated types and how is it even possible, isnt anchor current approach to zero-copy is via bytemuck and its pod traits which strictly is not impl for type such as a |
@ckamm I remember solana having something similar implement, with the account resizing feature isnt the resulting solution for the above feature going to be what this is : https://github.com/solana-labs/solana-program-library/blob/master/stake-pool/program/src/big_vec.rs |
@acheroncrypto In the example, One path is to add more magic and to somehow allow Vec<> fields in zero_copy annotated structs, but I'd say it's saner to keep that for the case where the struct does indeed describe the account bytes exactly. @nabeel99 That big_vec has some similarities, but is not sufficient.
|
This proposal is about adding support for resizable lists in zero-copy accounts. It comes from existing unusual anchor use in the Mango program and the needs of OpenBook v2.
Resizing accounts and
Vec<T>
fields in accounts work well with the usual borsh serialization but not with zero-copy. Often zero-copy is essential to reduce compute costs in programs.Wants
Why
Example
This doesn't intend to define a concrete API, just wants to show what API could look like.
The text was updated successfully, but these errors were encountered: