Skip to content

lang: Remove AccountInfo from Context#4103

Open
Aursen wants to merge 18 commits into
otter-sec:masterfrom
Aursen:feat/account_info
Open

lang: Remove AccountInfo from Context#4103
Aursen wants to merge 18 commits into
otter-sec:masterfrom
Aursen:feat/account_info

Conversation

@Aursen

@Aursen Aursen commented Dec 3, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@vercel

vercel Bot commented Dec 3, 2025

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@Aursen Aursen marked this pull request as draft December 3, 2025 03:36
@Aursen

Aursen commented Dec 15, 2025

Copy link
Copy Markdown
Contributor Author

To solve the issue I need to get ride of #[cfg(feature = "cpi")] for the system_program file. For this 2 choices: the first is to filter by name in the proc macro but it's not really elegant. The second is to create a small crate to put the system program for anchor and import it in Anchor with the feature cpi. What do you prefer @jamie-osec

@jamie-osec

Copy link
Copy Markdown
Collaborator

To solve the issue I need to get ride of #[cfg(feature = "cpi")] for the system_program file

I don't quite follow, can you explain more what you mean and why this is?

@Aursen

Aursen commented Dec 16, 2025

Copy link
Copy Markdown
Contributor Author

To solve the issue I need to get ride of #[cfg(feature = "cpi")] for the system_program file

I don't quite follow, can you explain more what you mean and why this is?

https://github.com/solana-foundation/anchor/blob/master/lang%2Fsyn%2Fsrc%2Fcodegen%2Fprogram%2Fcpi.rs#L82

@Aursen Aursen marked this pull request as ready for review December 19, 2025 12:55
@nutafrost nutafrost added the v1.1 label Apr 8, 2026
@jamie-osec

Copy link
Copy Markdown
Collaborator

Sorry that this fell behind, do you still want to push this through and fix it up for current master?

Comment thread lang/src/accounts/account_info.rs
@Aursen

Aursen commented May 9, 2026

Copy link
Copy Markdown
Contributor Author

Sorry that this fell behind, do you still want to push this through and fix it up for current master?

Sure I can do it

@Aursen

Aursen commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

@jamie-osec the bench test is quite buggy on my current laptop, I cannot generate it properly

@jamie-osec

jamie-osec commented May 12, 2026

Copy link
Copy Markdown
Collaborator

Hmm, I misread here, looks like this is actually completely disallowing AccountInfo in Accounts structs? This would be a breaking change, so we can't do this part (hence the deprecation)

Comment thread lang/src/system_program.rs Outdated
vec![
AccountMeta::new(self.from.key(), true),
AccountMeta::new(self.to.key(), false),
AccountMeta::new_readonly(self.to.key(), true),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
AccountMeta::new_readonly(self.to.key(), true),
AccountMeta::new_readonly(self.base.key(), true),

Comment on lines -18 to 22
impl<'info> UncheckedAccount<'info> {
pub fn try_from(acc_info: &'info AccountInfo<'info>) -> Self {
Self(acc_info)
impl<'info> From<&'info AccountInfo<'info>> for UncheckedAccount<'info> {
fn from(value: &'info AccountInfo<'info>) -> Self {
Self(value)
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same note here about breaking changes; the new impl is a good idea, we should probably just deprecate the old one as the name was misleading

@Aursen

Aursen commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

Hmm, I misread here, looks like this is actually completely disallowing AccountInfo in Accounts structs? This would be a breaking change, so we can't do this part (hence the deprecation)

That's the goal of the PR, the title is explicit about it

@jamie-osec

Copy link
Copy Markdown
Collaborator

Definitely in favour of the 'remove AccountInfo' part which is the bulk of this PR, we just can't remove this as a feature entirely

@Aursen

Aursen commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

Definitely in favour of the 'remove AccountInfo' part which is the bulk of this PR, we just can't remove this as a feature entirely

I can adjust the PR to this direction

@Aursen

Aursen commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

Just to be sure the goal is to let the old warning macro and just keep the new syntaxe and the removal on spl?

@jamie-osec

Copy link
Copy Markdown
Collaborator

Yeah. Though I did want to ask if you think it might be a cleaner patch to switch AccountInfo to UncheckedAccount in accounts, rather than manually implementing the traits? Since this has led to at least one copy-paste error (above)

@Aursen

Aursen commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

Yeah. Though I did want to ask if you think it might be a cleaner patch to switch AccountInfo to UncheckedAccount in accounts, rather than manually implementing the traits? Since this has led to at least one copy-paste error (above)

If we keep the macro we can generate it let me update tomorrow

@0x4ka5h

0x4ka5h commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

@Aursen bumping

@Aursen Aursen force-pushed the feat/account_info branch from 002bab5 to 3e50eac Compare June 4, 2026 14:26
@Aursen Aursen requested a review from chen-robert as a code owner June 4, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants