Skip to content

Remove redundant Context::remaining_accounts lifetime#4069

Closed
andreisilviudragnea wants to merge 4 commits intosolana-foundation:masterfrom
andreisilviudragnea:clean-context
Closed

Remove redundant Context::remaining_accounts lifetime#4069
andreisilviudragnea wants to merge 4 commits intosolana-foundation:masterfrom
andreisilviudragnea:clean-context

Conversation

@andreisilviudragnea
Copy link
Contributor

When using Context::remaining_accounts, the 'c: 'info constraint is always required, so replacing the 'c lifetime in pub remaining_accounts: &'c [AccountInfo<'info>], with 'info simplifies client code, as shown in MeteoraAg/damm-v2#138.

This is a breaking change though and needs to be done carefully, but it would be nice to include this in v1.0.0 release.

@vercel
Copy link

vercel bot commented Nov 18, 2025

@andreisilviudragnea is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@andreisilviudragnea andreisilviudragnea force-pushed the clean-context branch 2 times, most recently from 4e6df9f to 465f1f5 Compare November 27, 2025 11:56
@jamie-osec
Copy link
Collaborator

#3340 is an alternate approach to eliminating all but 'info. I think this could be a good stopgap measure since the test changes indicate that it allows lifetimes to be completely omitted in some scenarios.

@jamie-osec jamie-osec changed the title Simplify Context::remaining_accounts lifetimes usage Remove redundant Context::remaining_accounts lifetime Dec 4, 2025
@jamie-osec jamie-osec moved this to Todo in Anchor V2 Dec 10, 2025
@febo
Copy link
Contributor

febo commented Dec 14, 2025

@jamie-osec Since V2 will use pinocchio, it will be possible to have a single lifetime – similar to #3340.

@jamie-osec
Copy link
Collaborator

Thanks for the PR - going to close this as it looks like #3340 and the move to Pinocchio will be a more robust solution

@jamie-osec jamie-osec closed this Dec 16, 2025
@github-project-automation github-project-automation bot moved this from Todo to Done in Anchor V2 Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants