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 clippy check for overflowing arithmetic, fix existing cases #1274

Closed
wants to merge 8 commits into from

Conversation

Br1ght0ne
Copy link
Member

@Br1ght0ne Br1ght0ne commented Feb 12, 2024

Fix #1238.

Uses [workspace.lints] to set uniform linting configuration for all our packages (see [package.lints]).

Uses checked_ where a Result is returned from the function already, and saturating_sub where a value of 0 on overflow makes sense (to avoid refactoring Result into most of the codebase).

Checklist

  • I have linked to any relevant issues.
  • I have updated the documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary labels.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@Br1ght0ne Br1ght0ne added the tech-debt Improves code quality or safety label Feb 12, 2024
@Br1ght0ne Br1ght0ne self-assigned this Feb 12, 2024
Copy link
Contributor

@iqdecay iqdecay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% convinced by the approach, we can discuss it on Slack.

packages/fuels-accounts/src/provider/retry_util.rs Outdated Show resolved Hide resolved
packages/fuels-core/src/codec/abi_encoder.rs Outdated Show resolved Hide resolved
packages/fuels-core/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing all these saturating adds here makes me question if this is a good idea or not, I could see a transaction being crafted to trigger these saturating adds and resulting in, at best an invalid transaction, at worse a malicious one.

@Br1ght0ne Br1ght0ne marked this pull request as draft March 20, 2024 12:54
@Br1ght0ne Br1ght0ne closed this May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech-debt Improves code quality or safety
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add clippy check for overflowing arithmetic
3 participants