-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
syn: relax entry 'info lifetime for compat. with solana-program-test #2711
base: master
Are you sure you want to change the base?
Conversation
@tilacog is attempting to deploy a commit to the coral-xyz Team on Vercel. A member of the Team first needs to authorize it. |
The Anchor crates compile, but actual usage of Error from my project:
My familiarity with Anchor derive macros is limited, but I am open to discussing the problem further to refine this contribution. |
@@ -47,14 +47,14 @@ pub fn generate(program: &Program) -> proc_macro2::TokenStream { | |||
/// | |||
/// The `entry` function here, defines the standard entry to a Solana | |||
/// program, where execution begins. | |||
pub fn entry<'info>(program_id: &Pubkey, accounts: &'info [AccountInfo<'info>], data: &[u8]) -> anchor_lang::solana_program::entrypoint::ProgramResult { | |||
pub fn entry<'info>(program_id: &Pubkey, accounts: &[AccountInfo<'info>], data: &[u8]) -> anchor_lang::solana_program::entrypoint::ProgramResult { |
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.
I think this would be much easier to fix by creating a new processor!
macro with Anchor's current lifetimes because the same lifetime constraints exist in many places.
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.
Modifying the macro only is not enough. The issue comes from the signature expected by invoke_builtin_function
itself. I think the changes to lifetime and references done in anchor need a bit more work to accommodate all the existing use cases.
NOTE - cargo test is broken pending resolution of this anchor issue: coral-xyz/anchor#2711
This PR removes the
'info
lifetime constraint from theAccountInfo
slice.This change was necessary for passing Anchor's
program::entry
to thesolana-test-program
'sProgramTest::add_program
method.Here's a sample of the lifetime mismatch, before this PR's changes: