Created
August 6, 2022 22:12
-
-
Save arcticmatt/c541b6c0f86b2b848f52470e4bd29658 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Old code | |
#[derive(Accounts)] | |
pub struct PrintAccounts<'info> { | |
foo_account: Account<'info, FooAccount>, | |
bar_account: Account<'info, BarAccount>, | |
} | |
// New code | |
#[derive(Accounts)] | |
pub struct PrintAccounts<'info> { | |
foo_account: Account<'info, FooAccount>, | |
#[account(mut)] | |
bar_account: Account<'info, BarAccount>, | |
} | |
// Error | |
// backwards-compat-examples | |
// AnchorError: AnchorError caused by account: bar_account. Error Code: ConstraintMut. Error Number: 2000. Error Message: A mut constraint was violated. | |
// at Function.parse (/Users/mlim/Documents/software/crypto/solana/formfn/backwards-compat-examples/node_modules/@project-serum/anchor/src/error.ts:167:14) | |
// at translateError (/Users/mlim/Documents/software/crypto/solana/formfn/backwards-compat-examples/node_modules/@project-serum/anchor/src/error.ts:276:35) | |
// at MethodsBuilder.rpc [as _rpcFn] (/Users/mlim/Documents/software/crypto/solana/formfn/backwards-compat-examples/node_modules/@project-serum/anchor/src/program/namespace/rpc.ts:35:29) | |
// at ssTicksAprocendRejections (node:internal/process/task_queues:96:5) { | |
// errorLogs: [ | |
// 'Program log: AnchorError caused by account: bar_account. Error Code: ConstraintMut. Error Number: 2000. Error Message: A mut constraint was violated.' | |
// ], | |
// logs: [ | |
// 'Program Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS invoke [1]', | |
// 'Program log: Instruction: PrintAccounts', | |
// 'Program log: AnchorError caused by account: bar_account. Error Code: ConstraintMut. Error Number: 2000. Error Message: A mut constraint was violated.', | |
// 'Program Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS consumed 4074 of 200000 compute units', | |
// 'Program Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS failed: custom program error: 0x7d0' | |
// ], | |
// error: { | |
// errorCode: { code: 'ConstraintMut', number: 2000 }, | |
// errorMessage: 'A mut constraint was violated', | |
// comparedValues: undefined, | |
// origin: 'bar_account' | |
// }, | |
// _programErrorStack: ProgramErrorStack { stack: [ [PublicKey] ] } | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment