-
Notifications
You must be signed in to change notification settings - Fork 119
Command to delete price accounts #260
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
| assert_eq!( | ||
| size_of::<TimeMachineWrapper>(), | ||
| TIME_MACHINE_STRUCT_SIZE.try_into().unwrap(), | ||
| TIME_MACHINE_STRUCT_SIZE as usize, |
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.
there are two ambiguous type parameters for the try_into now. Something that got pulled in with tokio i think 🤷
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 like the right cast anyhow.
Reisen
left a comment
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 good, only a minor nitpick on the instruction de structure. The test is especially nice.
| accounts: &[AccountInfo], | ||
| instruction_data: &[u8], | ||
| ) -> ProgramResult { | ||
| let [funding_account, product_account, price_account] = match accounts { |
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.
Tuples over fixed length array literals + explicit return instead of wrapping/unwrapping an unnecessary Result.
| let [funding_account, product_account, price_account] = match accounts { | |
| let (funding_account, product_account, price_account) = match accounts { | |
| [w, x, y] => (w, x, y), | |
| _ => return Err(ProgramError::InvalidArgument), | |
| }; |
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.
hmm yeah that does seem better. we've been doing it this way in a bunch of places already though, so i'm not going to change this right now.
| assert_eq!( | ||
| size_of::<TimeMachineWrapper>(), | ||
| TIME_MACHINE_STRUCT_SIZE.try_into().unwrap(), | ||
| TIME_MACHINE_STRUCT_SIZE as usize, |
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 like the right cast anyhow.
We need this command in order to clean up the situation on pythtest, where we created a bunch of incorrect product and price accounts.
This PR went down a bit of a rabbit hole, as this instruction needs to be tested with the Solana runtime. The existing Python integration tests are pretty hard to work with, so I looked for an alternative. Turns out there's a nice solana TX simulator that you can run directly from Rust, so I built some testing utils around that.