Skip to content

lang: Remove AccountInfo from Context#2470

Closed
Aursen wants to merge 13 commits into
otter-sec:masterfrom
Aursen:account-info
Closed

lang: Remove AccountInfo from Context#2470
Aursen wants to merge 13 commits into
otter-sec:masterfrom
Aursen:account-info

Conversation

@Aursen

@Aursen Aursen commented Apr 25, 2023

Copy link
Copy Markdown
Contributor

No description provided.

@vercel

vercel Bot commented Apr 25, 2023

Copy link
Copy Markdown

@Aursen is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

@Aursen

Aursen commented Apr 26, 2023

Copy link
Copy Markdown
Contributor Author

Blocked here: tokio-rs/tokio#5655

@Aursen Aursen marked this pull request as ready for review April 26, 2023 11:32
@Aursen

Aursen commented Apr 26, 2023

Copy link
Copy Markdown
Contributor Author

What has changed:

  • Replaced all AccountInfo with UncheckedAccount in tests.
  • Added a new attribute to use AccountInfo on structures (useful in cross program internal invocation).
  • Removed abusive .clone() in the spl.
  • Added an indication on the fields to prevent the use of the AccountInfo type.
  • Removal of the CHECK on the AccountInfo type.

Comment thread lang/derive/accounts/src/lib.rs Outdated
Comment thread lang/src/accounts/account_info.rs
Comment thread lang/syn/src/codegen/accounts/mod.rs Outdated
Aursen added 4 commits May 5, 2023 10:00
commit ac86e15
Author: Matthew Callens <callensmatt@gmail.com>
Date:   Wed May 3 17:53:46 2023 -0500

    spl: remove mpl `create_metadata_account_v2` wrapper that were removed from program (otter-sec#2480)

    * remove mpl ix wrappers that were removed from program

    * update changelog

commit c166712
Author: acheron <98934430+acheroncrypto@users.noreply.github.com>
Date:   Wed May 3 09:09:41 2023 +0200

    bench: Add a script to sync benchmark results for all versions (otter-sec#2477)

commit a195106
Author: acheron <98934430+acheroncrypto@users.noreply.github.com>
Date:   Mon May 1 13:39:50 2023 +0200

    spl: Use fixed version for `winnow` crate to fix new builds (otter-sec#2478)

commit 03b1e4d
Author: acheron <98934430+acheroncrypto@users.noreply.github.com>
Date:   Thu Apr 27 12:10:23 2023 +0200

    Upgrade `clap` to 4.2.4 (otter-sec#2474)

commit 876ef41
Author: Proph3t <metaproph3t@protonmail.com>
Date:   Thu Apr 27 08:53:04 2023 +0000

    docs: fix broken links in `AccountLoader` docs (otter-sec#2473)

commit c14ae6b
Author: Tuan Pham Minh <tuanpmhd@gmail.com>
Date:   Wed Apr 26 00:07:39 2023 +0700

    Fix typo of `is_signer` field in intro-to-solana docs page (otter-sec#2469)
@Aursen Aursen requested a review from acheroncrypto May 5, 2023 10:20
Aursen added 5 commits June 10, 2023 12:55
commit e1afcbf
Author: acheron <98934430+acheroncrypto@users.noreply.github.com>
Date:   Fri Jun 9 18:00:35 2023 +0200

    v0.28.0 (otter-sec#2527)

commit c7c7319
Author: acheron <98934430+acheroncrypto@users.noreply.github.com>
Date:   Thu Jun 8 18:59:44 2023 +0200

    Allow wider range of dependency versions to reduce dependency issues (otter-sec#2524)

commit 6df34e7
Author: acheron <98934430+acheroncrypto@users.noreply.github.com>
Date:   Wed Jun 7 19:12:56 2023 +0200

    Update crate authors and remove outdated registry (otter-sec#2522)

commit 1705d16
Author: Jean Marchand (Exotic Markets) <jeanno11@orange.fr>
Date:   Wed Jun 7 16:29:23 2023 +0200

    docs: Add doc for InitSpace macro (otter-sec#2521)

commit 3d7c97b
Author: acheron <98934430+acheroncrypto@users.noreply.github.com>
Date:   Tue Jun 6 19:28:24 2023 +0200

    cli: Accept program lib name for `anchor deploy --program-name` (otter-sec#2519)

commit a88be42
Author: Sergo <rogaldh@radsh.red>
Date:   Tue Jun 6 14:07:33 2023 +0300

    ts: Validate `error.data` exists on simulation response (otter-sec#2508)

commit 65c9d6e
Author: Jean Marchand (Exotic Markets) <jeanno11@orange.fr>
Date:   Tue Jun 6 09:43:46 2023 +0200

    client: Add async to anchor-client (otter-sec#2488)

    Co-authored-by: acheron <acheroncrypto@gmail.com>

commit b8eda69
Author: Deep Mehta <65382963+0xdeepmehta@users.noreply.github.com>
Date:   Mon Jun 5 22:35:24 2023 +0530

    cli: Print not found message if the given program cannot be found during deployment (otter-sec#2517)

commit 1902b8e
Author: CanardMandarin <thibault.marboud@gmail.com>
Date:   Mon Jun 5 14:16:10 2023 +0200

    cli: Update programs in `Anchor.toml` when using `anchor new` (otter-sec#2516)

commit 383e440
Author: acheron <98934430+acheroncrypto@users.noreply.github.com>
Date:   Sun Jun 4 21:02:16 2023 +0200

    cli: Initialize with the correct program id (otter-sec#2509)

commit 835dc5b
Author: Sarfaraz Nawaz <sir_nawaz959@yahoo.com>
Date:   Sun Jun 4 23:20:03 2023 +0530

    lang: Rename derive_anchor_deserialize -> derive_init_space (otter-sec#2510)

commit 1c6f86e
Author: acheron <98934430+acheroncrypto@users.noreply.github.com>
Date:   Sun Jun 4 13:09:39 2023 +0200

    Upgrade Solana to 1.16.0 (otter-sec#2512)

commit 2bf8afe
Author: acheron <98934430+acheroncrypto@users.noreply.github.com>
Date:   Tue May 30 19:50:45 2023 +0200

    cli: Use `confirmed` commitment level in commands (otter-sec#2506)

commit 70d9223
Author: acheron <98934430+acheroncrypto@users.noreply.github.com>
Date:   Sun May 28 22:34:53 2023 +0200

    cli: Add `anchor keys sync` command (otter-sec#2505)

commit 0c8498d
Author: cavemanloverboy <93507302+cavemanloverboy@users.noreply.github.com>
Date:   Sat May 27 06:53:02 2023 -0700

    cli: Exit `anchor clean` without error when dirs don't exist (otter-sec#2504)

commit 23b90bf
Author: Noah Gundotra <ngundotra@users.noreply.github.com>
Date:   Fri May 26 12:36:46 2023 -0400

    Feature: CPI Events API (otter-sec#2438)

    Co-authored-by: acheron <acheroncrypto@gmail.com>

commit c3625c8
Author: Last Emperor <46998219+lastemp@users.noreply.github.com>
Date:   Wed May 24 15:05:47 2023 +0300

    examples: Add an example with `instruction` method (otter-sec#2501)

    Co-authored-by: acheron <acheroncrypto@gmail.com>

commit 67eb752
Author: acheron <98934430+acheroncrypto@users.noreply.github.com>
Date:   Sat May 20 20:34:38 2023 +0200

    tests: Fix zero-copy tests (otter-sec#2498)

commit f9d0eca
Author: acheron <98934430+acheroncrypto@users.noreply.github.com>
Date:   Fri May 19 13:18:14 2023 +0200

    spl: Update `spl-token-2022` to 0.6.1 (otter-sec#2496)

commit 4793b90
Author: acheron <98934430+acheroncrypto@users.noreply.github.com>
Date:   Fri May 19 10:58:16 2023 +0200

    Fix `toml_datetime` 1.64.0 MSRV error (otter-sec#2495)

commit 41a4d82
Author: chalda <chalda@seznam.cz>
Date:   Thu May 18 19:12:25 2023 +0200

    cli: Add print base64 instruction option for some of the IDL commands (otter-sec#2486)

    Co-authored-by: acheron <acheroncrypto@gmail.com>

commit b7bada1
Author: Pierre <Arrowana@users.noreply.github.com>
Date:   Tue May 16 23:46:40 2023 +1000

    fix: remove skip preflight from cli (otter-sec#2492)

    ---------

    Co-authored-by: acheron <acheroncrypto@gmail.com>

commit 89e94d1
Author: Ryan De La O <rdelao@users.noreply.github.com>
Date:   Sat May 13 02:17:47 2023 -0700

    cli: Fix incorrect metadata.address generation (otter-sec#2485)

    Currently when running 'anchor deploy --program-name <name> --program-keypair <specified keypair>' the cli still uses the auto-generated keypair when fetching the program id to add to the IDL metadata at the end. It should instead use the address from the specified keypair.

    ---------

    Co-authored-by: acheron <acheroncrypto@gmail.com>

commit 714d524
Author: CanardMandarin <thibault.marboud@gmail.com>
Date:   Tue May 9 16:17:11 2023 +0200

    lang: Add error message when Mint and TokenAccount with `init` are not ordered correctly (otter-sec#2484)

commit 9a93a2e
Author: James <juicy66173@gmail.com>
Date:   Mon May 8 10:17:51 2023 +0100

    ts: Improve IDL typing (otter-sec#2482)

    * Use XOR pattern for enum variants to prevent two variants being used at the same time.

    * Fix unknown for types like Option<[u8; 32]>

commit d1ddf00
Author: CanardMandarin <thibault.marboud@gmail.com>
Date:   Sun May 7 11:03:37 2023 +0200

    lang: Fix incorrectly checking the first init constraint (otter-sec#2483)
@Aursen

Aursen commented Jun 16, 2023

Copy link
Copy Markdown
Contributor Author

@acheroncrypto I think this PR is ready, I will handle the rest in another PR

@acheroncrypto

Copy link
Copy Markdown
Collaborator

Thanks, I'll have to test this locally before merging. How did you fix the bench issue?

@Aursen

Aursen commented Jun 16, 2023

Copy link
Copy Markdown
Contributor Author

Thanks, I'll have to test this locally before merging. How did you fix the bench issue?

I did it with fresh packages and cache cleaned

@jamie-osec

Copy link
Copy Markdown
Collaborator

@Aursen Is this still needed, or does #2762 replace it?

@Aursen

Aursen commented Oct 13, 2025

Copy link
Copy Markdown
Contributor Author

This one is different, is to disable the usage of the account info with dérive(Accounts) macro

@nutafrost nutafrost assigned nutafrost and 0x4ka5h and unassigned nutafrost Nov 13, 2025
@nutafrost nutafrost moved this to In Progress in Anchor 1.0 Nov 13, 2025
@nutafrost nutafrost moved this from In Progress to Security Review Required in Anchor 1.0 Nov 13, 2025

@0x4ka5h 0x4ka5h left a comment

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.

LGTM.

but ain't these changes leads to fail in all tests/*. I think those tests + /// CHECK lint in cli parser (this could be done in another pr) should also be updated.

@Aursen

Aursen commented Nov 19, 2025

Copy link
Copy Markdown
Contributor Author

I'm waiting for the green light to update it

@swaroop-osec

Copy link
Copy Markdown
Collaborator

@Aursen Can you please rebase this PR onto master?

@nutafrost nutafrost moved this from Todo to In Progress in Anchor 1.0 Nov 21, 2025
@jamie-osec

Copy link
Copy Markdown
Collaborator

Added a new attribute to use AccountInfo on structures (useful in cross program internal invocation).

Also, is this still the case? I don't see any new attributes

Comment thread lang/src/accounts/mod.rs
Comment on lines +4 to 5
#[doc(hidden)]
pub mod account_info;

@jamie-osec jamie-osec Nov 28, 2025

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.

We don't have to export this at all, the implementations will still be usable

Suggested change
#[doc(hidden)]
pub mod account_info;
mod account_info;

@jamie-osec

Copy link
Copy Markdown
Collaborator

While we're migrating to UncheckedAccount, I think the try_from method should be replaced with a From<&AccountInfo> implementation. It conflicts with the TryFrom trait and implies the function is fallible, where it is not

@Aursen

Aursen commented Nov 29, 2025

Copy link
Copy Markdown
Contributor Author

Let me get it back on it early next week

@Aursen

Aursen commented Dec 3, 2025

Copy link
Copy Markdown
Contributor Author

Close in favor of #4103

@Aursen Aursen closed this Dec 3, 2025
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Anchor 1.0 Dec 3, 2025
@7zkm7b8gw9-web

Copy link
Copy Markdown

Hey my account wasn't supposed to be deleted

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.

7 participants