Skip to content

Issue: Cannot resolve @openzeppelin imports with certoraRun despite packages/packages_path parameters #29

@dayday2019

Description

@dayday2019

Issue: Cannot resolve @OpenZeppelin imports with certoraRun despite packages/packages_path parameters

Hi team,

I'm encountering an issue with certoraRun when trying to compile Solidity files that use OpenZeppelin imports with alias paths like @openzeppelin/....

Background:
In regular solc, I can use --include-path node_modules to tell the compiler to search in the node_modules directory when it encounters alias imports like @openzeppelin/contracts/....

Problem:
With certoraRun, I've tried using both the packages and packages_path parameters, but neither seems to achieve the same effect. I've also set $NODE_PATH to point to my node_modules directory, but the compilation still fails with:

solc had an error:
ParserError: Source "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol" not found: File not found. Searched the following locations: "".
 --> /mnt/c/Users/chenxi/PycharmProjects/PropertyAgent/zkContracts/1.btcd-stablecoins/btcd-stablecoins/contracts/btcdVault/BTCDVault.sol:4:1:
  |
4 | import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Question:
What's the correct way to configure certoraRun to handle alias imports like @openzeppelin/... and make it search in the node_modules directory? Is there an equivalent to solc's --include-path parameter for certoraRun?

Setup:

  • OpenZeppelin packages are properly installed in node_modules
  • Regular solc compilation works fine with --include-path node_modules
  • The issue only occurs when using certoraRun

Any guidance would be greatly appreciated!

Metadata

Metadata

Assignees

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