Skip to content

chore(sui): update contracts for current Sui framework#218

Open
1-4200 wants to merge 3 commits into
LayerZero-Labs:mainfrom
1-4200:chore/update-sui-coin-registry
Open

chore(sui): update contracts for current Sui framework#218
1-4200 wants to merge 3 commits into
LayerZero-Labs:mainfrom
1-4200:chore/update-sui-coin-registry

Conversation

@1-4200

@1-4200 1-4200 commented May 29, 2026

Copy link
Copy Markdown

Summary

This PR updates the Sui contracts for the current Sui framework and Move 2024 edition APIs.

Key Changes

  1. Migrated all Sui Move.toml files from edition = "2024.beta" to edition = "2024".
  2. Updated deprecated Move and Sui API usage.
    • type_name::get* to type_name::with_*
    • vector::empty() to vector[]
    • VecSet.size() to VecSet.length()
    • Deprecated test helpers to std::unit_test
  3. Migrated ZRO coin creation to the recommended coin_registry::new_currency flow.
  4. Changed ZRO from an OTW drop type to a key coin type.
  5. Added zro::zro::new_currency(&mut CoinRegistry, &mut TxContext).
  6. Refreshed generated Move.lock files.
  7. Added generated Published.toml metadata.
  8. Fixed Sui Move test setup for Call authorization.
    • uln-302 set_config tests now create config calls through EndpointV2.
    • DvnFeeLib, ExecutorFeeLib, and PriceFeed tests now use the tested module’s CallCap identity as the call callee.

ZRO Issuance Flow Change

ZRO is no longer created automatically during package init.
After publishing the ZRO package, call:

zro::zro::new_currency(&mut registry, ctx)

This creates and finalizes the shared Currency<ZRO> through CoinRegistry in the same transaction, then transfers TreasuryCap<ZRO> and MetadataCap<ZRO> to the caller.

Unlike the OTW new_currency_with_otw flow, this does not require a separate finalize_registration transaction.

Verification

Verified with the local Sui CLI.

sui --version
# sui 1.73.0-0a9aa917aabe

Build

Ran the following build command for all Sui packages under packages/layerzero-v2/sui/contracts.

for toml in $(find packages/layerzero-v2/sui/contracts -name Move.toml | sort); do
  dir=${toml%/Move.toml}
  sui move build --path "$dir"
done

Result:
All 35 Sui packages build successfully with no deprecated API warnings.

Targeted Tests

Ran the following targeted tests.

sui move test --path packages/layerzero-v2/sui/contracts/endpoint-v2
sui move test --path packages/layerzero-v2/sui/contracts/oapps/oft/oft
sui move test --path packages/layerzero-v2/sui/contracts/workers/dvns/dvn
sui move test --path packages/layerzero-v2/sui/contracts/workers/executors/executor
sui move test --path packages/layerzero-v2/sui/contracts/message-libs/uln-302
sui move test --path packages/layerzero-v2/sui/contracts/workers/dvns/dvn-fee-lib
sui move test --path packages/layerzero-v2/sui/contracts/workers/executors/executor-fee-lib
sui move test --path packages/layerzero-v2/sui/contracts/workers/price-feed

Results:

Package Result
endpoint-v2 155 / 155 passed
oft 49 / 49 passed
dvn 70 / 70 passed
executor 28 / 28 passed
uln-302 107 / 107 passed
dvn-fee-lib 9 / 9 passed
executor-fee-lib 22 / 22 passed
price-feed 17 / 17 passed

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