forge test is failing to compile
jinankjain opened this issue · 3 comments
jinankjain commented
The following error message is reported:
❯ forge test
[⠒] Compiling...
[⠢] Unable to resolve imports:
"openzeppelin-solidity/contracts/utils/Context.sol" in "/home/ubuntu/electron/zk-ibc/ibc-solidity/contracts/app/ICS20Bank.sol"
"openzeppelin-solidity/contracts/utils/Address.sol" in "/home/ubuntu/electron/zk-ibc/ibc-solidity/contracts/app/ICS20Bank.sol"
"openzeppelin-solidity/contracts/utils/Context.sol" in "/home/ubuntu/electron/zk-ibc/ibc-solidity/tests/foundry/src/MockApp.sol"
"openzeppelin-solidity/contracts/token/ERC20/ERC20.sol" in "/home/ubuntu/electron/zk-ibc/ibc-solidity/contracts/app/SimpleToken.sol"
"openzeppelin-solidity/contracts/token/ERC20/IERC20.sol" in "/home/ubuntu/electron/zk-ibc/ibc-solidity/contracts/app/ICS20Bank.sol"
"openzeppelin-solidity/contracts/utils/Context.sol" in "/home/ubuntu/electron/zk-ibc/ibc-solidity/contracts/app/ICS20Transfer.sol"
"openzeppelin-solidity/contracts/access/AccessControl.sol" in "/home/ubuntu/electron/zk-ibc/ibc-solidity/contracts/app/ICS20Bank.sol"
with remappings:
ds-test/=/home/ubuntu/electron/zk-ibc/ibc-solidity/tests/foundry/lib/forge-std/lib/ds-test/src/
forge-std/=/home/ubuntu/electron/zk-ibc/ibc-solidity/tests/foundry/lib/forge-std/src/
[⠰] Compiling 41 files with 0.8.17
[⠔] Solc 0.8.17 finished in 76.26ms
Error:
Compiler run failed
error[6275]: ParserError: Source "openzeppelin-solidity/contracts/utils/Context.sol" not found: File not found. Searched the following locations: "/home/ubuntu/electron/zk-ibc/ibc-solidity".
--> contracts/app/ICS20Bank.sol:4:1:
|
4 | import "openzeppelin-solidity/contracts/utils/Context.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[6275]: ParserError: Source "openzeppelin-solidity/contracts/access/AccessControl.sol" not found: File not found. Searched the following locations: "/home/ubuntu/electron/zk-ibc/ibc-solidity".
--> contracts/app/ICS20Bank.sol:5:1:
|
5 | import "openzeppelin-solidity/contracts/access/AccessControl.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[6275]: ParserError: Source "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol" not found: File not found. Searched the following locations: "/home/ubuntu/electron/zk-ibc/ibc-solidity".
--> contracts/app/ICS20Bank.sol:6:1:
|
6 | import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[6275]: ParserError: Source "openzeppelin-solidity/contracts/utils/Address.sol" not found: File not found. Searched the following locations: "/home/ubuntu/electron/zk-ibc/ibc-solidity".
--> contracts/app/ICS20Bank.sol:7:1:
|
7 | import "openzeppelin-solidity/contracts/utils/Address.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[6275]: ParserError: Source "openzeppelin-solidity/contracts/utils/Context.sol" not found: File not found. Searched the following locations: "/home/ubuntu/electron/zk-ibc/ibc-solidity".
--> contracts/app/ICS20Transfer.sol:12:1:
|
12 | import "openzeppelin-solidity/contracts/utils/Context.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[6275]: ParserError: Source "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol" not found: File not found. Searched the following locations: "/home/ubuntu/electron/zk-ibc/ibc-solidity".
--> contracts/app/SimpleToken.sol:4:1:
|
4 | import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[6275]: ParserError: Source "openzeppelin-solidity/contracts/utils/Context.sol" not found: File not found. Searched the following locations: "/home/ubuntu/electron/zk-ibc/ibc-solidity".
--> tests/foundry/src/MockApp.sol:11:1:
|
11 | import "openzeppelin-solidity/contracts/utils/Context.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
bluele commented
Since we are currently using truffle&npm to manage external dependencies, probably you need to do npm install
before forge test
.
might be helpful: https://github.com/hyperledger-labs/yui-ibc-solidity/blob/main/.github/workflows/test.yml#L4
jinankjain commented
Is there any plan to migrate away from truffle and npm and use native dependency management from forge? @bluele
bluele commented
There are no concrete plans yet, but it may be worth considering. cc: @hyperledger-labs/yui-committers