fix(examples): send-task errors print OFT: undefined when --oft-address is omitted - #1950
Open
boleklebovski wants to merge 1 commit into
Open
Conversation
--oft-address is optional, so the error context printed a literal undefined whenever it was omitted. Covers the nine example tasks left out of LayerZero-Labs#1677. Signed-off-by: boleklebovski <160799963+boleklebovski@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
oftAddressis an optional task argument (oftAddress?: string), and when it is left out the address is resolved from deployments instead. But the error context is built unconditionally:so anyone hitting an error without passing
--oft-addressis told:which reads like the address failed to resolve and sends people looking in the wrong place.
Scope
Issue #1695 reported this, and PR #1677 fixed it — but only in
examples/oft/tasks/sendEvm.ts. The same pattern is still present at 21 sites across 9 other example tasks:examples/lzapp-migration/tasks/evm/v1/sendEvm.tsexamples/lzapp-migration/tasks/solana/sendSolana.tsexamples/mint-burn-oft-adapter/tasks/sendEvm.tsexamples/native-oft-adapter/tasks/sendEvm.tsexamples/oft-adapter/tasks/sendEvm.tsexamples/oft-solana/tasks/evm/sendEvm.tsexamples/oft-solana/tasks/solana/sendSolana.tsexamples/oft-upgradeable/tasks/sendEvm.tsexamples/ovault-evm/tasks/sendEvm.tsexamples/oft/tasks/sendEvm.tsis deliberately untouched here so this does not collide with #1677.Fix
Same behaviour as #1677 — the
OFT:fragment is omitted when the address was not supplied — expressed inline so the diff stays one line per site rather than introducing 21 local variables:`For network: ${endpointIdToNetwork(srcEid)}${oftAddress ? `, OFT: ${oftAddress}` : ''}`Output is identical to #1677's version:
For network: X, OFT: 0x…when the flag is passed,For network: Xwhen it is not.A patch changeset is included for the seven affected example packages.
If you would rather I match #1677's exact
const errorMessage = …shape for consistency, say the word and I will restructure it.