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

Adds sysvar_get lint #92

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The current lints are:
| [`insecure_account_close`](lints/insecure_account_close) | lint for [9-closing-accounts](https://github.com/coral-xyz/sealevel-attacks/tree/master/programs/9-closing-accounts) |
| [`missing_owner_check`](lints/missing_owner_check) | lint for [2-owner-checks](https://github.com/coral-xyz/sealevel-attacks/tree/master/programs/2-owner-checks) |
| [`missing_signer_check`](lints/missing_signer_check) | lint for [0-signer-authorization](https://github.com/coral-xyz/sealevel-attacks/tree/master/programs/0-signer-authorization) |
| [`sysvar_get`](lints/sysvar_get) | Reports uses of `Sysvar::from_account_info` instead of `Sysvar::get` |
| [`type_cosplay`](lints/type_cosplay) | lint for [3-type-cosplay](https://github.com/coral-xyz/sealevel-attacks/tree/master/programs/3-type-cosplay) |

## Usage
Expand Down
10 changes: 10 additions & 0 deletions crate/src/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,13 @@ pub const SOLANA_PROGRAM_CREATE_PROGRAM_ADDRESS: [&str; 4] = [
];

pub const SPL_TOKEN_INSTRUCTION: [&str; 2] = ["spl_token", "instruction"];

pub const SYSVAR_FROM_ACCOUNT_INFO: [&str; 4] =
["solana_program", "sysvar", "Sysvar", "from_account_info"];
pub const SYSVAR_CLOCK: [&str; 3] = ["solana_program", "clock", "Clock"];
pub const SYSVAR_EPOCH_REWARDS: [&str; 3] = ["solana_program", "epoch_rewards", "EpochRewards"];
pub const SYSVAR_EPOCH_SCHEDULE: [&str; 3] = ["solana_program", "epoch_schedule", "EpochSchedule"];
pub const SYSVAR_FEES: [&str; 3] = ["solana_program", "fees", "Fees"];
pub const SYSVAR_LAST_RESTART_SLOT: [&str; 3] =
["solana_program", "last_restart_slot", "LastRestartSlot"];
pub const SYSVAR_RENT: [&str; 3] = ["solana_program", "rent", "Rent"];
14 changes: 14 additions & 0 deletions lints/sysvar_get/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[build]
target-dir = "../../target"

[target.aarch64-apple-darwin]
linker = "dylint-link"

[target.x86_64-apple-darwin]
linker = "dylint-link"

[target.x86_64-unknown-linux-gnu]
linker = "dylint-link"

[target.x86_64-pc-windows-msvc]
linker = "dylint-link"
Loading