Skip to content
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

update anchor and solana #156

Closed
wants to merge 2 commits into from
Closed

Conversation

DemidovVladimir
Copy link

No description provided.

@Target911
Copy link

Hope i get right!

@DemidovVladimir
Copy link
Author

DemidovVladimir commented Jul 1, 2024

Problems faced during upgrade:

  1. Anchor specific Zero copy does not support tuple structs and unaligned fields: https://solana.stackexchange.com/questions/15043/can-not-use-zero-copy-with-u8-primitive-type
  2. Max stack size is 4 kb and it is strict. So we most likely should refactor alignments in big accounts and make them zero_copy so it will use bytemuck (custom Zeroable and Pod does not work, as it creates wrong IDL) and read from validator directly.
  3. Solana 1.18.17 uses some solana deps which are v2, need to forcefully downgrade at list this one: https://solana.stackexchange.com/questions/14973/error-after-updating-solana-program-to-1-18-17-and-anchor-to-0-30-1
  4. Anchor deprecates AccountInfo, which is heavily used in this program: Feature request: deprecate AccountInfo, have people explicitly use UncheckedAccount coral-xyz/anchor#2794
  5. Remaining accounts now have lifetimes and this is a problem, because Account::try_from(account_info) does not live long enough: https://solana.stackexchange.com/questions/13310/how-to-use-lifetime-on-context-correctly
  6. Big Accounts should use zero_copy and AccountLoad, but this program is not using it: https://github.com/solana-developers/anchor-zero-copy-example
  7. Use spl-transfer-hook-interface v0.6.3
  8. cargo update -p [email protected] --precise 1.18.17 (Solana 2.0.0 breaks a lot of things coral-xyz/anchor#3044)
  9. https://solana.stackexchange.com/questions/5489/getting-an-error-of-proc-macro-derive-panicked-message-invariant-violation-com
  10. Lifetimes changes: https://solana.stackexchange.com/questions/11823/anchor-28-to-29-ctx-remaining-accounts-lifetime

@DemidovVladimir DemidovVladimir marked this pull request as draft July 1, 2024 18:50
Copy link
Member

@wjthieme wjthieme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting started with this. Updating to 0.30 is definitely on our roadmap. I'm afraid with the current state of the PR already existing whirlpool accounts can no longer be parsed.

Wanted to make some minor tweaks to the versions and config but don't have permission to push to your fork. Anyway it will probably take a little while before we can fully upgrade to 0.30.

In the meantime if you are just trying to do CPIs (depending on what your use-case is) you might be able to use our cpi crate: https://github.com/orca-so/whirlpool-cpi

#[derive(Default)]
#[repr(C)]
#[repr(align(16))]
#[account(zero_copy)]
pub struct Whirlpool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid that by changing the ordering of the properties here to be compliant with repr(C) rules it can no longer parse whirlpool accounts. On chain the accounts follow a certain byte layout, AFAIK this would change the byte layout of the Whirlpool account

@wjthieme
Copy link
Member

wjthieme commented Aug 7, 2024

Closing this since it is superseded by #174

@wjthieme wjthieme closed this Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants