2

I deployed a program. some account interact with it and created PDA for the user state of the program.

After a while I upgraded the program because i need to modify the user state PDA, adding a new struct property.

Then, users that created the PDA before the program upgrade cannot successfully run any instruction that modify the PDA. This is the error:

Transaction simulation failed: Error processing Instruction 0: custom program error: 0xbbb 
    Program stakxxxxxx invoke [1]
    Program log: Instruction: Claim
    Program log: AnchorError caused by account: user_state. Error Code: AccountDidNotDeserialize. Error Number: 3003. Error Message: Failed to deserialize the account.
    Program stakExxxxxxxx consumed 6957 of 600000 compute units
    Program stakExxxxxxxx failed: custom program error: 0xbbb

*programId are censored

Any user that initiate new PDA and interact with the program are executing instruction smoothly, no error. I assume it was because the PDA structure is modified and the program cannot serialize old PDA properly anymore. My naive solution is that i need to update the old PDA data to have follow structure, but i cannot because only the program can update PDA. Is there a good way to save the old user so they can continue interact with the upgraded program?

1 Answer 1

3

You will need to migrate the account. There's a full guide how to do this on the cookbook

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.