Open armaniferrante opened 3 years ago
We could potentially put the version number in the account header, next to the discriminant. So the layout is 8-byte-discriminant || version || borsh(account)
We will also need to force that no one will be able to create an old version of the account. Maybe allow for only one use of init/associated ?
@NorbertBodziony I believe no one will be able to create an old version of the account by virtue of the program's code being updated, since only the program can modify account data.
Accounts can have a version field (which is part of the seed when creating associated accounts). Then, we can change the data of an account with a method that will migrate data from the old to the new account, destroying the old one.
Suggested by @NorbertBodziony