Skip to content

Conversation

@St0rmBr3w
Copy link
Contributor

Summary

This PR adds proper Aptos devtools packages following the OmniGraph pattern, enabling lz:oapp:wire support 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 interface

Key Features

  • Transaction signing with sequence number tracking and retry logic
  • Proper 32-byte address normalization for Aptos
  • areBytes32Equal for cross-chain peer comparison
  • Support for setPeer, getPeer, setDelegate, and config operations

Example Updates

  • oft-main: Added Aptos contract configuration, dependencies, and wire support
  • oft-solana: Updated to use real Aptos packages instead of stub implementations
  • Removed Aptos filtering from wire tasks to enable actual transaction processing

Usage

  1. Set APTOS_PRIVATE_KEY environment variable
  2. Create aptos/deploy.json with your OFT address:
    { "oftAddress": "0x..." }
  3. Enable Aptos in layerzero.config.ts:
    const INCLUDE_APTOS = true
  4. Run: pnpm hardhat lz:oapp:wire --oapp-config layerzero.config.ts

Test plan

  • All three packages build successfully
  • Package exports are correct
  • lz:oapp:wire runs without errors when Aptos is included
  • Peers are set correctly between Aptos and other chains
  • Cross-chain send works and shows DELIVERED on LayerZero Scan

Generated with Claude Code

@cursor
Copy link

cursor bot commented Jan 28, 2026

PR Summary

Introduces full Aptos support following the OmniGraph pattern and enables lz:oapp:wire for Aptos in examples.

  • New packages: @layerzerolabs/devtools-aptos (connection/signer factories, OmniSDK base, address utils), @layerzerolabs/protocol-devtools-aptos (EndpointV2, Uln302 SDKs), @layerzerolabs/ua-devtools-aptos (OFT SDK)
  • Aptos signer implements sequence tracking + retries; bytes32 normalization helpers for cross-chain comparisons
  • Examples updated:
    • layerzero.config.ts: INCLUDE_APTOS=true, Aptos contract loader, enforced options, and pathway generation
    • Wire tasks now include Aptos (Initia still excluded); real Aptos factories re-exported with legacy compat wrappers
    • .env.example adds APTOS_PRIVATE_KEY, RPC_URL_APTOS(_TESTNET); aptos/deploy.json.example added
    • package.json deps updated to use new Aptos devtools packages

Written by Cursor Bugbot for commit 33f5b62. Configure here.

@socket-security
Copy link

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​layerzerolabs/​lz-aptos-sdk-v2@​3.0.156801001009690
Addednpm/​@​layerzerolabs/​lz-v2-utilities@​3.0.1561001001009690

View full report

@github-actions
Copy link
Contributor

🧪 E2E Test Status

E2E 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):

  • Run #6650 - Failed - 2026-01-28 00:29 (UTC)

Copy link

@cursor cursor bot left a 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})`,
}
}
Copy link

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.

Fix in Cursor Fix in Web

// Simple encoding - in practice this would use proper BCS encoding
const encoder = new TextEncoder()
return encoder.encode(JSON.stringify(config))
}
Copy link

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.

Fix in Cursor Fix in Web

const bytes32 = new Uint8Array(32)
bytes32.set(bytes, 32 - bytes.length)
return bytes32
}
Copy link

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.

Fix in Cursor Fix in Web

*/
export function bytesToHex(bytes: Uint8Array): string {
return '0x' + Buffer.from(bytes).toString('hex')
}
Copy link

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)

Fix in Cursor Fix in Web

export { createAptosOAppFactory } from './aptosSdkFactory'
export { createAptosSignerFactory } from './aptosSignerFactory'
export { createAptosOAppFactory as createAptosOAppFactoryLegacy } from './aptosSdkFactory'
export { createAptosSignerFactory as createAptosSignerFactoryLegacy } from './aptosSignerFactory'
Copy link

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)

Fix in Cursor Fix in Web

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
@St0rmBr3w St0rmBr3w force-pushed the feat/devtools-aptos-examples branch from 33f5b62 to 1c93382 Compare January 28, 2026 00:37
@St0rmBr3w
Copy link
Contributor Author

PR #1920 can be closed. It has been superseded by
the two split PRs:

@St0rmBr3w St0rmBr3w closed this Jan 28, 2026
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