-
Notifications
You must be signed in to change notification settings - Fork 1
feat: rewrite instruction and state types to support versioning #8
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
Conversation
core record type now supports versioning via enum representation sync instruction also supports versioning to reflect changes in Record type evolution. + some dependencies version adjustements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! The only consideration is that it may be worth adding a discriminator to the account, so that we can easily retrieve all the records by filtering for it. A follow-up consideration is that if we have a discriminator, the enum used for versioning could be avoided, as we could just bump the discriminator with the same effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Just a small comment on .take
usage in getters
How borsh will be able to differentiate versions, if we don't use enums, every version bump will keep breaking existing code... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just minor stuff, but maybe you can address
They will just be treated as different accounts, since the discriminator is different, each parsing it's own struct. New version won't break previous ones. What I'm thinking is that most likely we need to retrieve all records with something like: let filters = vec![RpcFilterType::Memcmp(Memcmp::new(
0,
MemcmpEncodedBytes::Bytes(vec![1, 0, 0, 0, 0, 0, 0, 0]),
))]; But I see your point, if Borsh serialize the enum in a predictable way, in the first bytes of the accounts, we could use it as a discriminator. It's gonna be not standard (typically the discriminator is the first 8 bytes) and I guess variable size, but if the above is true, it's fine with me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, but please make those error msgs a bit more helpful by including pubkeys :)
core record type now supports versioning via enum representation sync instruction also supports versioning to reflect changes in Record type evolution.