-
Notifications
You must be signed in to change notification settings - Fork 260
feat: add Sui and Starknet devtools support #1917
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
base: main
Are you sure you want to change the base?
Conversation
- Add SuiSigner for transaction signing with sender context - Add createConnectionFactory and createRpcUrlFactory for RPC connections - Add OmniSDK base class with transaction serialization - Add Sui chain type to normalizePeer/denormalizePeer in devtools Key design decisions: - Transaction.serialize() used instead of build() to defer sender context - Signer reconstructs transaction and sets sender during signing - Connection factory reads from RPC_URL_SUI environment variable
- Add EndpointV2 SDK implementing IEndpointV2 interface - Add Uln302 SDK for ULN configuration management - Fix setConfig to call populateSetConfigTransaction (Move result consumption) - Add graceful handling of missing configurations Key fixes for lz:oapp:wire: - setConfigMoveCall returns Call<Param, Result> that must be consumed - populateSetConfigTransaction() adds necessary follow-up move call - Missing config queries return defaults instead of throwing
- Add OFT SDK implementing IOApp interface - Fix setPeer to pad EVM addresses (20 bytes) to 32 bytes - Fix hasPeer to use areBytes32Equal for normalized comparison - Add isMissingSuiPeer helper for graceful error handling Key fixes for lz:oapp:wire: - EVM addresses must be right-padded with zeros to 32 bytes for Sui - Address comparison must normalize both addresses before comparing - Missing peer/enforced_options errors return defaults instead of throwing
- Add Sui Move contracts for OFT token and OFT implementation - Add Sui send task with proper RPC connection factory usage - Update layerzero.config.ts with Sui pathway configuration - Add deploy.json.example showing expected deployment format - Update .gitignore to exclude deployment artifacts Configuration notes: - Enforced options order: [TO_SUI_OPTIONS, TO_EVM_OPTIONS] - SUI_ENFORCED_OPTIONS uses 5000 gas (sufficient for Sui) - EVM_ENFORCED_OPTIONS uses 80000 gas (sufficient for EVM)
Document 8 key painpoints discovered while making lz:oapp:wire work: 1. Transaction serialization vs building (defer sender context) 2. Transaction reconstruction during signing 3. Address length normalization (EVM 20-byte to Sui 32-byte) 4. Address comparison must be normalized 5. Move call results must be consumed 6. Graceful handling of missing configuration 7. Enforced options naming convention (by destination) 8. RPC URL factory environment variable usage Also adds testing checklist for new VM packages and verified working status with LayerZero Scan transaction links.
PR SummaryProvides a complete, multi-VM OFT reference under
Written by Cursor Bugbot for commit 283c045. Configure here. |
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. 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): |
|
|
||
| try { | ||
| // Use the SDK to check if configs exist | ||
| const [sendConfig, receiveConfig] = await getSolanaUlnConfigPDAs( |
|
|
||
| try { | ||
| // Use the SDK to check if configs exist | ||
| const [sendConfig, receiveConfig] = await getSolanaUlnConfigPDAs( |
| const connection = await connectionFactory(taskArgs.eid) | ||
| const umi = createUmi(connection.rpcEndpoint).use(mplToolbox()) | ||
| const umiWalletSigner = createSignerFromKeypair(umi, umiKeypair) | ||
| const web3WalletKeyPair = toWeb3JsKeypair(umiKeypair) |
- Add @layerzerolabs/devtools-starknet for Starknet signer/provider - Add @layerzerolabs/ua-devtools-starknet for Starknet OFT SDK - Add @layerzerolabs/protocol-devtools-starknet for EndpointV2/ULN302 SDKs - Fix address comparison in ua-devtools to use areBytes32Equal - Fix library skip logic to prevent SAME_VALUE errors Wire task now works correctly for Starknet OFTs with proper address normalization and idempotent configuration detection. Note: Send FROM Starknet has protocol-level bug in SendLib contract. Send TO Starknet works correctly.
Key fixes: - Fix fromHex to handle odd-length hex strings by padding with leading '0' (Buffer.from silently truncates odd-length strings) - Fix ByteArray encoding in setEnforcedOptions to use raw calldata instead of string-based encoding (starknet.js UTF-8 re-encodes bytes >= 128) - Update sendStarknet to use createRpcUrlFactory() for RPC URL resolution - Update starknet.js v8 Account constructor format These fixes resolve the "out of bound" error when sending from Starknet OFT caused by corrupted enforced options (byte 0x80 becoming UTF-8 0xc2 0x80).
| hexValue = value | ||
| } else if (typeof value === 'bigint') { | ||
| hexValue = `0x${value.toString(16)}` | ||
| } else if (typeof value === 'object' && value !== null && 'value' in value) { |
| if (value instanceof Uint8Array || Buffer.isBuffer(value)) { | ||
| return `0x${Buffer.from(value).toString('hex')}` | ||
| } | ||
| if (typeof value === 'object' && value !== null && 'data' in value && 'pending_word' in value) { |
| if (typeof value === 'bigint') { | ||
| return `0x${value.toString(16)}` | ||
| } | ||
| if (typeof value === 'object' && value !== null && 'value' in value) { |
- Refactor layerzero.config.ts with toggle flags for each VM - Add automatic full mesh pathway generation - Optional deployment file loading (won't crash if missing) - Rewrite README with concise multi-VM instructions - Add endpoint ID reference table - Add troubleshooting section
- Convert workspace: protocol to version specifiers for published packages
- Remove @layerzerolabs/devtools-{starknet,sui} (not published to npm)
- Remove @layerzerolabs/protocol-devtools-{starknet,sui} (not published)
- Remove @layerzerolabs/ua-devtools-{starknet,sui} (not published)
- Add STRK approval to sendStarknet.ts for LayerZero fee payment
- Regenerate pnpm-lock.yaml with --ignore-workspace flag
Summary
This PR adds Sui and Starknet support to the devtools packages, enabling
lz:oapp:wireto work with Sui and Starknet OFTs.Sui Changes
ua-devtools-sui) with peer, delegate, and enforced options supportdevtools-sui)protocol-devtools-sui)oft-mainexample with send and wire tasksStarknet Changes
ua-devtools-starknet) with enforced options, peer, and delegate supportfromHexutility to handle odd-length hex strings (prevents Buffer.from truncation)oft-mainexample with send and wire tasksKey Bug Fixes
fromHex odd-length handling:
Buffer.from(str, 'hex')silently truncates odd-length strings. Fixed by padding with leading '0'.Starknet ByteArray UTF-8 corruption: starknet.js re-encodes string-based ByteArray as UTF-8, corrupting bytes >= 128 (e.g., 0x80 → 0xc2 0x80). Fixed by using raw calldata construction for enforced options.
Test plan
Sui
npx hardhat lz:oapp:wire --oapp-config layerzero.config.ts- successfully sets peers and enforced optionsStarknet
npx hardhat lz:oapp:wire --oapp-config layerzero.config.ts- successfully sets peers and enforced options