-
Notifications
You must be signed in to change notification settings - Fork 260
feat(devtools-aptos): add Aptos devtools packages for OmniGraph wire support #1920
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
feat(devtools-aptos): add Aptos devtools packages for OmniGraph wire support #1920
Conversation
PR SummaryIntroduces full Aptos support following the OmniGraph pattern and enables
Written by Cursor Bugbot for commit 33f5b62. Configure here. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
🧪 E2E Test StatusE2E tests are non-blocking and validate real blockchain interactions. Failures may occur due to network issues, RPC rate limits, or external service downtime. Test Runs (Newest First):
|
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.
Cursor Bugbot has reviewed your changes and found 5 potential issues.
| }), | ||
| description: `Setting enforced options for eid ${opt.eid}, msgType ${opt.option.msgType} (1 of ${enforcedOptions.length})`, | ||
| } | ||
| } |
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.
Multiple enforced options silently dropped
High Severity
The setEnforcedOptions method only processes the first option when multiple OAppEnforcedOptionParam entries are provided. The comment acknowledges this limitation with "(caller should handle batching)" but the IOApp interface returns a single Promise<OmniTransaction>, making it impossible for callers to retrieve the remaining options. All enforced options beyond the first are silently discarded, leading to incomplete cross-chain configuration.
| // Simple encoding - in practice this would use proper BCS encoding | ||
| const encoder = new TextEncoder() | ||
| return encoder.encode(JSON.stringify(config)) | ||
| } |
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.
Config encoding uses JSON instead of BCS serialization
Medium Severity
The encodeExecutorConfig and encodeUlnConfig methods encode configuration data as JSON strings converted to UTF-8 bytes. Aptos Move contracts expect BCS (Binary Canonical Serialization) encoded data. When setExecutorConfig or setUlnConfig transactions are submitted, the contracts will fail to deserialize the JSON payload, causing transaction failures or incorrect on-chain state. This affects all config-related operations advertised in the PR.
| const bytes32 = new Uint8Array(32) | ||
| bytes32.set(bytes, 32 - bytes.length) | ||
| return bytes32 | ||
| } |
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.
Duplicate function exists in devtools-move package
Low Severity
The hexAddrToAptosBytesAddr function is duplicated between packages/devtools-aptos/src/common/addresses.ts and packages/devtools-move/sdk/utils.ts. Both implementations are identical. The existing function in devtools-move is already used by aptosOFT.ts and initiaOFT.ts. This duplication increases maintenance burden and risks inconsistent bug fixes.
| */ | ||
| export function bytesToHex(bytes: Uint8Array): string { | ||
| return '0x' + Buffer.from(bytes).toString('hex') | ||
| } |
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.
Unused exported functions in addresses utility module
Low Severity
Three exported functions are never imported anywhere in the codebase: bytesToHex, isEmptyAddress, and areAddressesEqual. These are dead code that clutters the public API. Additionally, equivalent utilities already exist in @layerzerolabs/devtools (toHex, isZero, and areBytes32Equal respectively).
Additional Locations (2)
| export { createAptosOAppFactory } from './aptosSdkFactory' | ||
| export { createAptosSignerFactory } from './aptosSignerFactory' | ||
| export { createAptosOAppFactory as createAptosOAppFactoryLegacy } from './aptosSdkFactory' | ||
| export { createAptosSignerFactory as createAptosSignerFactoryLegacy } from './aptosSignerFactory' |
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.
Legacy exports are never imported anywhere
Low Severity
The createAptosOAppFactoryLegacy and createAptosSignerFactoryLegacy exports are marked as "backwards compatibility" aliases but are never imported anywhere in the codebase. This dead code adds confusion since the "legacy" stub implementations in aptosSdkFactory.ts and aptosSignerFactory.ts are no longer needed now that real implementations exist.
Additional Locations (1)
Add three new packages for Aptos devtools: - @layerzerolabs/devtools-aptos: Core Aptos utilities (connection, signer, OmniSDK) - @layerzerolabs/protocol-devtools-aptos: EndpointV2 and ULN302 SDKs - @layerzerolabs/ua-devtools-aptos: OFT SDK implementing IOApp interface These packages enable lz:oapp:wire support for Aptos OFTs following the OmniGraph pattern used by Sui and Starknet.
Enable Aptos OFT wiring in oft-main example: - Add INCLUDE_APTOS, APTOS_ENFORCED_OPTIONS in layerzero.config.ts - Add aptosContract definition and pathway generation - Update tasks/aptos/index.ts to use real Aptos devtools packages - Remove Aptos filtering from wire.ts graph processing - Add Aptos environment variables to .env.example - Add aptos/deploy.json.example - Add Aptos devtools packages to package.json
33f5b62 to
1c93382
Compare
|
PR #1920 can be closed. It has been superseded by
|
Summary
This PR adds proper Aptos devtools packages following the OmniGraph pattern, enabling
lz:oapp:wiresupport for Aptos OFTs.Builds on top of PR #1919 (feat/devtools-sui-examples)
Packages Created
@layerzerolabs/devtools-aptos: Connection factory, signer factory, OmniSDK base class@layerzerolabs/protocol-devtools-aptos: EndpointV2 and Uln302 SDKs implementing protocol interfaces@layerzerolabs/ua-devtools-aptos: OFT SDK implementing the IOApp interfaceKey Features
areBytes32Equalfor cross-chain peer comparisonExample Updates
Usage
APTOS_PRIVATE_KEYenvironment variableaptos/deploy.jsonwith your OFT address:{ "oftAddress": "0x..." }layerzero.config.ts:pnpm hardhat lz:oapp:wire --oapp-config layerzero.config.tsTest plan
lz:oapp:wireruns without errors when Aptos is includedGenerated with Claude Code