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

Enable more optional clippy lints when building contracts #1472

Open
jubnzv opened this issue Jan 24, 2024 · 0 comments
Open

Enable more optional clippy lints when building contracts #1472

jubnzv opened this issue Jan 24, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@jubnzv
Copy link
Contributor

jubnzv commented Jan 24, 2024

We could enable some optional clippy lints to find common errors when compiling ink! contracts.

Since smart contracts demand increased security requirements, it makes sense to add as much available security checks as possible, if it is feasible to get any reasonable results on ink! contracts.

My suggestion is to enable clippy lints to highlight some constructions that look suspicious in production contracts. It would be good to draw the additional attention to them:

  1. panic! and panic! inside functions returning Result
  2. todo!
  3. unimplemented!
  4. unreachable!

There is also the .unwrap() and .expect() lint that works for Option and Result types, but it would be too noisy if we add it.

By default, all these lints are suppressed. I suggest changing their warning level to Warn to allow them to raise non-critical warnings when building with cargo-contract. This might be achieved by changing a single line in cargo-contract, enabling us to reuse the existing infrastructure without extending ink_linting.

@jubnzv jubnzv added the enhancement New feature or request label Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant