layerzero-labs / devtools Goto Github PK
View Code? Open in Web Editor NEWLayerZero Developer Utilities
Home Page: https://docs.layerzero.network/
LayerZero Developer Utilities
Home Page: https://docs.layerzero.network/
Describe the bug
When using Foundry fork tests, any local deployments made before the fork is set up, will be overwritten to have empty code. And in OptionsHelper.sol
the line UlnOptionsMock ulnOptions = new UlnOptionsMock();
is preformed at deployment, while the fork is set up in the setUp() function.
This leads to a confusing EVM revert when trying to call verifyPackets()
in a forked test
To Reproduce
Steps to reproduce the behavior:
OApp.bridge()
followed by a call to verifyPackets()
Expected behavior
The expectation is that whatever functionality in the receiver contract's _lzReceive()
will be executed
Environment
Additional context
My solution in OptionsHelper.sol
was to replace:
UlnOptionsMock ulnOptions = new UlnOptionsMock();
with
UlnOptionsMock ulnOptions;
function setUp() public virtual {
ulnOptions = new UlnOptionsMock();
}
Note that this setUp() function must be overriden in TestHelperOz5.sol
and also called in the setUp of your test
Describe the bug
After $ npx create-lz-oapp@latest
, I faced error when compiling.
To Reproduce
Steps to reproduce the behavior:
$ npx create-lz-oapp@latest
to create a project.$ pnpm compile
gives this error:$ pnpm compile
> @layerzerolabs/[email protected] compile /Users/abhi3700/F/coding/github_repos/subspace/layerzero-demo2/my-lz-oapp
> $npm_execpath run compile:forge && $npm_execpath run compile:hardhat
> @layerzerolabs/[email protected] compile:forge /Users/abhi3700/F/coding/github_repos/subspace/layerzero-demo2/my-lz-oapp
> forge build
[⠊] Compiling...
[⠔] Compiling 122 files with 0.8.22
[⠒] Solc 0.8.22 finished in 439.99ms
Error:
Compiler run failed:
Error (9582): Member "baseGas" not found or not visible after argument-dependent lookup in struct IExecutor.DstConfigParam memory.
--> node_modules/@layerzerolabs/test-devtools-evm-foundry/contracts/mocks/ExecutorMock.sol:46:17:
|
46 | param.baseGas,
| ^^^^^^^^^^^^^
ELIFECYCLE Command failed with exit code 1.
ELIFECYCLE Command failed with exit code 1.
Expected behavior
It should have compiled successfully. Clearly, the parameter baseGas
is not present in DstConfigParam
struct in IExecutor.sol
. Screenshot attached
Environment (please complete the following information):
Additional context
None
there is a typo while running the following command : npx create-lz-oapp@latest
instead of dapp it shows deap
Is your feature request related to a problem? Please describe.
Currently the EVM nodes that support the test runs are hardhat
nodes. This slows down the pipeline in two ways:
anvil
Describe the solution you'd like
Replace the test-evm-node
package and its usage with anvil
-based node implementation
Hi there,
Looking to deploy an OFT for multiple chains, but starting on Testnets of course. I have Both OFTs Deployed to Arbitrum-Sepolia and to ETH-Sepolia, and I have been facing two Errors.
Error: An error occurred while getting the OApp configuration: AssertionError [ERR_ASSERTION]: Could not find a deployment for address '0xa96b3749D01A50c4353f66455dBD92a52778C65A' on ARBSEP_V2_TESTNET (arbitrumSepolia)
This error occurs when attempting to run the wiring with this command:
npx hardhat lz:oapp:peers:get --oapp-config layerzero.config.ts
and this HardHat Config
const config: HardhatUserConfig = {
paths: {
cache: 'cache/hardhat',
},
solidity: {
compilers: [
{
version: '0.8.22',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
],
},
networks: {
sepolia: {
eid: EndpointId.SEPOLIA_V2_TESTNET,
url: 'https://eth-sepolia.g.alchemy.com/v2/<API_KEY>',
accounts,
},
arbitrumSepolia: {
eid: EndpointId.ARBSEP_V2_TESTNET,
url: 'https://arb-sepolia.g.alchemy.com/v2/<API_KEY>',
accounts,
},
},
namedAccounts: {
deployer: {
default: 0, // wallet address of index[0], of the mnemonic in .env
},
},
and this layerzeroConfig.ts
export const sepoliaContract: OmniPointHardhat = {
eid: EndpointId.SEPOLIA_V2_TESTNET,
contractName: 'GODOFT',
address: '0xDee109faA9a53E6aBD3fE4ca2d1E423E4FC6D019',
}
export const arbSepContract: OmniPointHardhat = {
eid: EndpointId.ARBSEP_V2_TESTNET,
contractName: 'GODOFT',
address: '0xa96b3749D01A50c4353f66455dBD92a52778C65A',
}
const config: OAppOmniGraphHardhat = {
contracts: [
{
contract: arbSepContract,
},
{
contract: sepoliaContract,
},
],
connections: [
{
from: arbSepContract,
to: sepoliaContract,
},
{
from: sepoliaContract,
to: arbSepContract,
},
],
}
export default config
Expected behavior
I would have expected in the first instance for the Configuration to find the Contract deployed on the Arbitrum Sepolia Network, as clearly the transactions and other infrastructure is functioning properly.
Both of the Contracts are IN-fact deployed and validated on testnets
https://sepolia.arbiscan.io/address/0xa96b3749D01A50c4353f66455dBD92a52778C65A
https://sepolia.etherscan.io/address/0xDee109faA9a53E6aBD3fE4ca2d1E423E4FC6D019
Screenshots
Environment (please complete the following information):
Additional context
Additional Context about the Insane Gas Price issue:
Here is the Task that I created to test the bridging between the two test nets:
The second Problem is when trying to bridge any more than 1-10 tokens the Gas fee quickly jumps from Dust essentially to 10x or more as constituted by this error from hardhat.
reason: 'insufficient funds for intrinsic transaction cost',
code: 'INSUFFICIENT_FUNDS',
error: ProviderError: insufficient funds for gas * price + value: balance 203411533023759192, queued cost 153614836329641605, tx cost 137077919996323037, overshot 87281223302205450
task('lz:oft:send', 'test send')
.addParam('contractA', 'contract address on network A')
.addParam('contractB', 'contract address on network B')
.addParam('networkA', 'name of the network A')
.addParam('networkB', 'name of the network B')
.addParam('amount', 'amount to transfer in eth')
.setAction(async (taskArgs, { ethers }) => {
const eidA = getEidForNetworkName(taskArgs.networkA)
const eidB = getEidForNetworkName(taskArgs.networkB)
const contractA = taskArgs.contractA
const contractB = taskArgs.contractB
const environmentFactory = createGetHreByEid()
const providerFactory = createProviderFactory(environmentFactory)
const signer = (await providerFactory(eidA)).getSigner()
const oftContractFactory = await ethers.getContractFactory('MyOFT', signer)
const oft = oftContractFactory.attach(contractA)
const decimals = await oft.decimals()
const amount = ethers.utils.parseUnits(taskArgs.amount, decimals)
const options = Options.newOptions().addExecutorLzReceiveOption(200000, 0).toHex().toString()
const sender = await signer.getAddress()
const sendParam = [eidB, ethers.utils.zeroPad(sender, 32), amount, amount, options, '0x', '0x']
console.log(sendParam)
const [nativeFee] = await oft.quoteSend(sendParam, false)
console.log({ eidA, eidB, contractA, contractB, amount, sender, nativeFee })
console.log(
`sending ${taskArgs.amount} token(s) from network ${taskArgs.networkA} to network ${taskArgs.networkB}`
)
console.log(sendParam, [nativeFee, 0], sender, { value: nativeFee })
const r = await oft.send(sendParam, [nativeFee, 0], sender, { value: nativeFee })
console.log(`Tx initiated. See: https://layerzeroscan.com/tx/${r.hash}`)
})
In Summary:
What am I missing in terms of configuration here to prevent the wild fluctuation in Gas Prices: and How can I get the Arbitrum Sepolia testnet to recognize the Contracts I have deployed to use these tools effectively
Is your feature request related to a problem? Please describe.
Some of the Safe UIs are not compatible with the current way of signing safe transactions. The aforementioned tasks should support a JSON-compatible output generation so that the user can export the transactions and upload them manually to the Safe UI
Describe the solution you'd like
Add a CLI flag to the tasks that will make them either:
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
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.
Describe the bug
Should replace Nothing received yet.
with Test message.
in the line 74.
To Reproduce
No need
Expected behavior
A clear and concise description of what you expected to happen.
Environment (please complete the following information):
No need
Additional context
LayerZero docs notes that make sure that the arguments passed into the _quote function identically match the parameters used in the lzSend function. If parameters mismatch, you may run into errors as your msg.value will not match the actual gas quote.
So the bug may lead beginners to be confused.
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
❯ npx create-lz-oapp@latest
Expected behavior
This command will create of a new omnichain application project, set up the necessary environment and dependencies.
Screenshots
✔ Where do you want to start your project? … ./my-lz-oapp
✔ Which example would you like to use as a starting point? › OFT
✔ What package manager would you like to use in your project? › pnpm
Will create a project in ./my-lz-oapp directory (/Users/gx/temp/demo/my-lz-oapp)
Will use the OFT example
Will use pnpm to install dependencies
✔ Do you want to continue? … yes
𐄂 Getting example source code
Error: Unknown error during example cloning
○ Installing dependencies
Environment (please complete the following information):
❯ uname -a
Darwin MacBook-Pro-3.local 23.0.0 Darwin Kernel Version 23.0.0: Fri Sep 15 14:43:05 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6020 arm64
❯ node --version
v18.12.0
❯ which pnpm
/Users/gx/.nvm/versions/node/v18.12.0/bin/pnpm
Additional context
Add any other context about the problem here.
Describe the bug
The README says to run npx hardhat lz:oapp:wire
when wiring contracts.
To Reproduce
Steps to reproduce the behavior:
npx create-lz-oapp@latest
to scaffold a new LayerZero OApp/ONft.env
and that address has sufficient gas tokens on all chains) Run npx hardhat lz:deploy
npx hardhat lz:oapp:wire
Expected behavior
Wiring continues successfully.
Environment (please complete the following information):
Additional context
Add any other context about the problem here.
Describe the bug
Links in README.md point to 404 page
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.