LayerZero-Labs / LayerZero-v2

Other
542 stars 327 forks source link

Foundry compatibility can be improved by reducing npm/js dependency #6

Open JorgeAtPaladin opened 9 months ago

JorgeAtPaladin commented 9 months ago

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

Zodomo commented 9 months ago

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.

e00dan commented 8 months ago

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.

CodeSandwich commented 5 months ago

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.

Zodomo commented 5 months ago

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: @.***>

CodeSandwich commented 5 months ago

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.