Skip to content

fix(examples): send-task errors print OFT: undefined when --oft-address is omitted - #1950

Open
boleklebovski wants to merge 1 commit into
LayerZero-Labs:mainfrom
boleklebovski:fix/oft-undefined-in-send-task-errors
Open

fix(examples): send-task errors print OFT: undefined when --oft-address is omitted#1950
boleklebovski wants to merge 1 commit into
LayerZero-Labs:mainfrom
boleklebovski:fix/oft-undefined-in-send-task-errors

Conversation

@boleklebovski

Copy link
Copy Markdown

Problem

oftAddress is 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:

DebugLogger.printErrorAndFixSuggestion(
    KnownErrors.ERROR_GETTING_HRE,
    `For network: ${endpointIdToNetwork(srcEid)}, OFT: ${oftAddress}`
)

so anyone hitting an error without passing --oft-address is told:

For network: optimism-testnet, OFT: undefined

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:

file sites
examples/lzapp-migration/tasks/evm/v1/sendEvm.ts 1
examples/lzapp-migration/tasks/solana/sendSolana.ts 1
examples/mint-burn-oft-adapter/tasks/sendEvm.ts 3
examples/native-oft-adapter/tasks/sendEvm.ts 3
examples/oft-adapter/tasks/sendEvm.ts 3
examples/oft-solana/tasks/evm/sendEvm.ts 3
examples/oft-solana/tasks/solana/sendSolana.ts 1
examples/oft-upgradeable/tasks/sendEvm.ts 3
examples/ovault-evm/tasks/sendEvm.ts 3

examples/oft/tasks/sendEvm.ts is 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: X when 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.

--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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant