Skip to content

Commit

Permalink
Add sysvar_get lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Vara Prasad Bandaru committed Mar 8, 2024
1 parent 3a33c4c commit 2c640a2
Show file tree
Hide file tree
Showing 16 changed files with 4,035 additions and 0 deletions.
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

0 comments on commit 2c640a2

Please sign in to comment.