Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guidance on testing OFT contracts locally (LZ endpoint mock/local deploy) #408

Open
actuallymentor opened this issue Feb 15, 2024 · 4 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@actuallymentor
Copy link

Thanks @kushdave95 for your support in DM, as requested an issue with details on my testing questions.

Is your feature request related to a problem? Please describe.

When building an LZ OFT contract and wanting to test it locally with hardhat/foundry, the OFT contract requires an LZ endpoint to be deployed (or perhaps mocked).

I would appreciate guidance on how to best do this. Note that this example in this repository does NOT show how to do this. It only tests a mock OFT contract.

Describe the solution you'd like

A clear example (or docs) on how to test an OFT contract locally in hardhat. I assume this means having a clear mock of an LZ endpoint (and how to implement it in a testing context).

Describe alternatives you've considered

I tried this repo's examples but as #399 indicates, this did not actually show how to test the contract, only the mock.

Additional context

From a DX perspective this would be very appreciated, as testing only on live testnets is suboptimal at best.

@janjakubnanista
Copy link
Contributor

Hey @actuallymentor! Thanks for reaching out!

At the moment there indeed is no easy, out-of-the-box solution for a local E2E test. It's something we are considering exposing to external developers since it's something that we have available in this repo - we deploy our own EndpointV2 contracts to test the wiring scripts.

The bad news is that I can't give you a timeline for this. We will keep you in the loop once we get a rough estimate of how and when this should be available.

@actuallymentor
Copy link
Author

Thanks for the context @janjakubnanista!

What would it take to convince you to prioritise this?

Local testing is not a luxury for many devs. Even if you don't subscribe to test-driven development, it's an integral part of writing good contracts (as evidenced by your own doing of this).

I understand that there is always unlimited work and limited people to do the work, but I'd like to strongly advocate for this. Both to help your devs, and to signal to the dev community that you care about testing.

@janjakubnanista janjakubnanista added question Further information is requested enhancement New feature or request labels Feb 28, 2024
@janjakubnanista
Copy link
Contributor

Hey @actuallymentor!

Not sure if this will completely solve your problem, but it should at least be a step forward. We merged #442 which contains a TestHelper contract for testing contracts using foundry.

We'll see how much work it takes to provide functionality that emulates a LayerZero environment completely, with the off-chain bits as well. As always, will keep you updated!

@actuallymentor
Copy link
Author

Thanks for keeping me posted @janjakubnanista! Do you know whether this has hardhat compatibility, and are there docs available for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants