LayerZero-v2 icon indicating copy to clipboard operation
LayerZero-v2 copied to clipboard

Foundry compatibility can be improved by reducing npm/js dependency

Open JorgeAtPaladin opened this issue 1 year ago • 5 comments

Hey team!

Can I create a PR to factor out JS/npm dependency throughout the repository?

Example for the oapp subdirectory:

remappings = [
    # note: map to package level only, required for pnp-berry to work with foundry
    # ok - solidity-stringutils/=node_modules/solidity-stringutils/
    # not ok - solidity-stringutils/=node_modules/solidity-stringutils/src/
    '@openzeppelin/contracts/=../lib/openzeppelin-contracts/contracts/',
    '@openzeppelin/contracts-upgradeable/=../lib/openzeppelin-contracts-upgradeable/contracts/',
    'solidity-bytes-utils/=../lib/solidity-bytes-utils',
    'hardhat-deploy/=../lib/hardhat-deploy/',
    '@layerzerolabs/lz-evm-protocol-v2/=../protocol/',
    '@layerzerolabs/lz-evm-messagelib-v2/=../messagelib/',
    '@layerzerolabs/lz-evm-v1-0.7/=../lib/LayerZero/'
]

Let's discuss whether there are any downside to this (eg. the comment wrt pnp-berry). If no downside- I'd like to go ahead with this refactor as the current setup is maybe unnecessarily cumbersome to integrate for foundry users?

Happy holidays, Marco

JorgeAtPaladin avatar Dec 23 '23 23:12 JorgeAtPaladin

I did find that simply adding adjusted versions their remappings to my foundry project's settings resolves this problem. However, I still think doing this is worthwhile. I don't know if eliminating npm will impact their test suite.

Zodomo avatar Jan 01 '24 23:01 Zodomo

Hey guys, I figured this might be helpful and possibly better starter point for someone that's looking for as native Foundry experience as possible and avoiding NPM dependencies: https://github.com/Kuzirashi/layerzero-starter-kit

Not sure if useful but decided to share with you guys. This issue touches Foundry Developer Experience. Feedback for potential improvements welcome.

e00dan avatar Jan 08 '24 23:01 e00dan

LayerZero-v2 is very tricky to add as a dependency of a Foundry-based project because of this issue. Foundry can't handle the NPM-managed dependencies of LayerZero-V2.

CodeSandwich avatar Apr 05 '24 19:04 CodeSandwich

It can if you run yarn and yarn build in the LayerZero-v2 lib folder.

-------- Original Message -------- On Apr 5, 2024, 2:49 PM, Igor Żuk wrote:

LayerZero-v2 is very tricky to add as a dependency of a Foundry-based project because of this issue. Foundry can't handle the NPM-managed dependencies of LayerZero-V2.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

Zodomo avatar Apr 05 '24 20:04 Zodomo

It can if you run yarn and yarn build in the LayerZero-v2 lib folder.

It's not that simple. It requires extra manual work from the devs and all the scripts in the project. It also introduces additional requirement for tools installed on the machine, which makes CI harder to work with and brings a whole new layer of problems with package management. All of this to fetch a few .sol files.

CodeSandwich avatar Apr 08 '24 17:04 CodeSandwich