LayerZero-Labs / devtools

LayerZero Developer Utilities
https://docs.layerzero.network/
91 stars 144 forks source link

bug: can't build oapp-evm package #892

Closed Zodomo closed 5 days ago

Zodomo commented 2 weeks ago

Describe the bug I cannot run forge build in the oapp-evm package. I want to build it because I'm trying to fork it to remove OpenZeppelin's Ownable library, as I use Solady's Ownable instead. I am aware of the security considerations I need to manage in doing so.

When building, I see the following console output:

zodomo@zaptop7:~/code/forks/devtools/packages/oapp-evm$ forge build
[⠃] Compiling...2024-09-18T01:33:49.319973Z ERROR foundry_compilers_artifacts_solc::sources: error="/home/zodomo/code/forks/devtools/packages/oapp-evm/node_modules/@layerzerolabs/toolbox-foundry/src/forge-std/src/Test.sol": No such file or directory (os error 2)
[⠊] Compiling...
Error: 
failed to resolve file: "/home/zodomo/code/forks/devtools/packages/oapp-evm/node_modules/@layerzerolabs/toolbox-foundry/src/forge-std/src/Test.sol": No such file or directory (os error 2); check configured remappings
        --> /home/zodomo/code/forks/devtools/packages/oapp-evm/test/RateLimiter.t.sol
        forge-std/Test.sol

To Reproduce Steps to reproduce the behavior:

  1. Clone devtools
  2. cd devtools
  3. Run pnpm install in root directory
  4. Navigate to oapp-evm package (cd packages/oapp-evm)
  5. Run pnpm install in package's root dir
  6. Run forge build or forge build --hardhat

Expected behavior Forge should build the contracts.

Screenshots image

Environment (please complete the following information):

Additional context These problems occur before any modifications are made to the package.

janjakubnanista commented 2 weeks ago

Hey @Zodomo! I think I have seen this error before, it had to do with a forge bug that was fixed some time ago.

Could you run foundryup to update your forge? I think everything should work afterwards

Zodomo commented 2 weeks ago

@janjakubnanista I ran pnpm i and foundryup. I still see errors such as these when running forge build, regardless of if on node v20 or v21:

image

Zodomo commented 6 days ago

@janjakubnanista upon further investigation, it seems the path devtools/packages/oapp-evm/node_modules/@layerzerolabs/toolbox-foundry/lib/solidity-bytes-utils/BytesLib.sol doesnt exist, or might be incorrect. Do I need to be doing anything other than running pnpm i in the oapp-evm package to get forge build working? Seems the dependencies might have flaws.

image

image

janjakubnanista commented 6 days ago

@Zodomo hey there! Yeah what you need is the submodules included with this repo. In the DEVELOPMENT.md there are steps to get them in

Zodomo commented 5 days ago

I see, thanks for pointing me in the right direction! Following the process in the DEVELOPMENT.md file, I found that I was able to run forge build in the oapp-evm package after these steps:

  1. git clone --recurse-submodules https://github.com/Zodomo/devtools.git (my fork)
  2. nvm install 18.16.0
  3. nvm use 18.16.10
  4. corepack enable
  5. pnpm install
  6. pnpm build