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

Add improper_instruction_introspection lint #103

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

S3v3ru5
Copy link
Collaborator

@S3v3ru5 S3v3ru5 commented Jun 21, 2024

The lint checks for this issue in building-secure-contracts: https://github.com/crytic/building-secure-contracts/tree/master/not-so-smart-contracts/solana/improper_instruction_introspection

The lint is very trivial, it flags all calls to load_instruction_at_checked(...).

@S3v3ru5
Copy link
Collaborator Author

S3v3ru5 commented Jun 21, 2024

This lint needs further work.

The lint might not work and should be considered incomplete. It was not possible to compile the lint, hence not tested, ran (Could not run even clippy on the lint). This is the error:

error[E0658]: use of unstable library feature 'offset_of'
   --> /Users/vara/.cargo/registry/src/index.crates.io-6f17d22bba15001f/solana-program-1.18.1/src/program.rs:542:20
    |
542 |         assert_eq!(offset_of!(AccountInfo, executable), 42);
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> for more information
    = help: add `#![feature(offset_of)]` to the crate attributes to enable
    = note: this error originates in the macro `_memoffset__offset_of_impl` which comes from the expansion of the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)

Latest version of solana-program 1.18.7 gives the same error. I could not resolve the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant