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 detectors for incorrect use of Oracle API #2289

Open
wants to merge 102 commits into
base: dev
Choose a base branch
from
Open

Conversation

talfao
Copy link

@talfao talfao commented Feb 4, 2024

I am creating this pull request based on the following issue: #2283.

The code here presents basic foundations for detecting improper usage of Oracle API's. So far, the detector supports just Chainlink, but I plan to add other providers such as Tellor or Chronicle.

The PR contains three detectors:
oracle-data-validation - Staleness price, check for price != 0
deprecated-chainlink-call - Check if the smart contract uses deprecated chainlink API functions
oracle-sequencer - Recommendation to the user to check the liveness of sequence if planning to use chainlink oracle on L2.

The checks that indicate improper data validation, such as staleness price, are still under development. I will improve these checks and overall detection in the following weeks.

The reason behind this PR is to get feedback for the approach I have chosen to detect an oracle and if the checks for data validation make sense from your side.

I have one question: Should support for other oracles and improvements of checks be included in different pull requests, or should I add it to this one?

Talfao

Summary by CodeRabbit

  • New Features

    • Updated version of the actions/setup-node action in the workflow file.
    • Updated Solidity compiler version selection logic in the Dockerfile.
    • Enhanced installation instructions for Slither in the README.md.
    • Added new detectors for identifying deprecated Chainlink calls, oracle vulnerabilities, and sequencer checks.
    • Introduced new classes and functions for managing oracle contracts and variables.
    • Included additional support files for oracle validation and detection.
  • Tests

    • Expanded test coverage for OracleDataCheck and DeprecatedChainlinkCall detectors using various Solidity files.

@talfao
Copy link
Author

talfao commented Mar 18, 2024

Hello people,

From my side, the PR is ready for review. The checks were improved, and the code was also tested on several contracts to improve overall detection and variations of Oracle usage.

So far, the detection is supporting just Chainlink. The capabilities of detection of other providers can be extended in the future 😃

I am looking forward to hearing your feedback.
Talfao

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 10

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Out of diff range and nitpick comments (1)
slither/detectors/oracles/supported_oracles/chainlink_oracle.py (1)

27-113: Class ChainlinkOracle is well-structured. Consider adding more comments to complex methods to improve readability and maintainability.

This was referenced Apr 27, 2024
@montyly montyly self-assigned this Oct 2, 2024
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.

3 participants