-
Notifications
You must be signed in to change notification settings - Fork 235
DEVREL-568 feat: Add slim TestHelper for LayerZero foundry testing #1605
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for implementing this!
packages/test-devtools-evm-foundry/contracts/SlimLzTestHelper.sol
Outdated
Show resolved
Hide resolved
packages/test-devtools-evm-foundry/contracts/SlimLzTestHelper.sol
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
packages/test-devtools-evm-foundry/contracts/mocks/SlimSimpleMessageLibMock.sol
Outdated
Show resolved
Hide resolved
packages/test-devtools-evm-foundry/contracts/SlimLzTestHelper.sol
Outdated
Show resolved
Hide resolved
packages/test-devtools-evm-foundry/contracts/SlimLzTestHelper.sol
Outdated
Show resolved
Hide resolved
packages/test-devtools-evm-foundry/contracts/SlimLzTestHelper.sol
Outdated
Show resolved
Hide resolved
packages/test-devtools-evm-foundry/contracts/SlimLzTestHelper.sol
Outdated
Show resolved
Hide resolved
packages/test-devtools-evm-foundry/contracts/SlimLzTestHelper.sol
Outdated
Show resolved
Hide resolved
packages/test-devtools-evm-foundry/contracts/mocks/EndpointV2Simple.sol
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would also be good to make all the no-op function virtual so that someone, if they want can override it and have a custom EndpointV2Simple or something.
will re-review after any changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
In this PR:
This PR introduces a lightweight testing infrastructure for LayerZero OApp developers using Foundry. It addresses compilation issues, enables
forge coverage, and provides a cleaner import structure without sacrificing essential testing capabilities.Problems Addressed
TestHelperOz5) cause "Stack too deep" compilation errors, requiring--via-irflagforge coverageon projects using existing test infrastructureSolution
Created a parallel "slim" testing infrastructure that maintains backward compatibility while dramatically reducing complexity.
Major Changes
1. New
LzTestHelperSlimContract (packages/test-devtools-evm-foundry/contracts/LzTestHelperSlim.sol)TestHelperOz5(~316 lines vs 700+ lines)LibraryTypesupport (SimpleMessageLib)Testand customOptionsHelper2. New
EndpointV2SimpleMock (packages/test-devtools-evm-foundry/contracts/mocks/EndpointV2Simple.sol)3. Simplified
SimpleMessageLibMock(packages/test-devtools-evm-foundry/contracts/mocks/SimpleMessageLibMock.sol)TestHelperOz5dependency4. Example Updates (
examples/oft/test/foundry/MyOFT.t.sol)TestHelperOz5toLzTestHelperSlimKey Design Decisions
What's Included
What's Excluded
Rationale: These features are better tested in integration environments (localnet)
Results
Compilation
Coverage
Import Size
Migration Guide
Benefits
--via-irRequired: Contracts compile with standard optimizer settingsTesting Philosophy
Verification
forge testworks without special flagsforge coveragegenerates reports successfullyFuture Considerations
TestHelperOz5for advanced protocol testing needsLzTestHelperSlimbecomes the recommended default for OApp developers