Skip to content

Aderyn fails to compile AST for Hardhat project (uint256.sub() not found) while npx hardhat compile succeeds #1064

@ds-rgangavasi

Description

@ds-rgangavasi

Describe the bug
I'm encountering a compilation issue when running Aderyn on a project that compiles successfully with Hardhat.

When compiling the project using Hardhat, everything works as expected. However, when running Aderyn, the tool fails while compiling the Abstract Syntax Tree (AST).

This suggests that the compilation environment used by Aderyn may not fully replicate the Hardhat compilation context.

To Reproduce
Steps to reproduce the behavior:

  1. Clone repo: https://github.com/ds-rgangavasi/hedera-stable-coin
  2. You can double check that project is compiling: npx hardhat compile --force
  3. Run aderyn with this: aderyn .
  4. See error: Compilation Error: Error (9582): Member "sub" not found or not visible after argument-dependent lookup in uint256.

Expected behavior
If slither works, I'm expecting aderyn to also work on this repository e2e

Desktop (please complete the following information):

  • OS: linux / Ubuntu 22.04
  • Chip: amd
  • Aderyn: latest available in Docker container
  • Project framework: Hardhat

Additional context

  • The compilation environment used by Aderyn might differ from the Hardhat environment.
  • Possibly related to dependency resolution, remappings, or SafeMath usage.

Questions:

  1. If I want to run aderyn on this repository, how to run it? Given that slither successfully works here.
  2. Is there a way to make Aderyn reuse Hardhat compilation artifacts (e.g., artifacts/build-info) instead of recompiling?
  3. Is there a recommended workflow for running Aderyn on Hardhat projects?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions