You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New sui-bridge-client crate built on the MystenLabs sui-rust-sdk
crates over gRPC (Sui JSON-RPC is decommissioned): init_transfer, fin_transfer, log_metadata, deploy_token, views, and MPC event
logs.
deploy_token is fully automated despite Sui's one-time-witness rule:
the crate vendors precompiled token-template bytecode and patches the
identifiers and constants per token (no Move compiler dependency),
then publishes and calls deploy_token<T> back-to-back. Symbol, name,
and description live in a single vector<vector<u8>> constant so the
Move verifier's duplicate-constant check can never reject a token
(e.g. symbol == name).
omni-connector wiring: build_sui_mpc_sign_payload (raw BCS event
contents, no JSON canonicalization), Sui variants and dispatch arms
for deploy/init/fin/bind/claim-fee, storage-deposit derivation.
CLI: sui-init-transfer, sui-fin-transfer, sui-log-metadata
(takes the coin type — Sui token ids are keccak hashes and can't be
reversed), config/env/defaults for all three networks.
Pins: omni-types -> 67b37e6c (feat/sui; re-pin after #633 merges),
near-mpc-contract-interface -> 9295cf29 (adds the Sui foreign-tx
types; verified drop-in for existing chains).
Bytecode patcher: byte-lossless identity patch, fixtures validated
with sui move disassemble, edge cases covered (symbol == name,
empty symbol/name, long names).
Ignored network tests against the Sui testnet deployment: reads and
BCS-decodes the real InitTransfer event, checks finality, runs view
simulations, and publish-simulates patched token modules (the node's
own verifier accepts them).
cargo test --workspace green (136 tests), fmt/clippy clean.
Notes
End-to-end NEAR-side finalization waits on the omni-bridge contract's
Sui prover dispatch (follow-up noted in #633); payloads are ready.
Mainnet defaults are placeholders until a mainnet deployment exists;
testnet defaults point at the #633 test deployment.
Adds Sui as a new bridge chain across the whole SDK + CLI, mirroring the Aptos MPC-proof pattern. The centerpiece is a new sui-bridge-client crate that talks to Sui over gRPC (sui-rpc), builds programmable transaction blocks, and — because Sui can't create a currency at runtime (one-time-witness rule) — vendors a precompiled token_template module and patches its identifiers/constants per token at the binary-format table level, then publishes + deploy_token<T> back-to-back. MPC proof construction feeds the raw BCS event contents into ForeignTxSignPayload::Sui, validated against near/mpc's snapshot hash.
Changes:
New sui-bridge-client crate: builder, gRPC rpc wrappers, bytecode patcher, init_transfer/fin_transfer/log_metadata/deploy_token/views, MPC event-log extraction, unit + ignored network tests.
omni-connector: sui_bridge_client field + builder, build_sui_mpc_sign_payload, Sui variants for DeployTokenArgs/InitTransferArgs/FinTransferArgs, dispatch/helper methods, storage-deposit derivation, and Sui arms in every exhaustive ChainKind/OmniAddress match.
Ignored network tests against the #633 testnet deployment
bridge-connector-common/src/result.rs
From<SuiBridgeClientError> + new error variants
omni-connector/src/omni_connector.rs
Full connector wiring incl. build_sui_mpc_sign_payload + snapshot-hash test
Findings
Blocking (must fix before merge):
Cargo.toml:621 — omni-types is pinned to 67b37e6c…, a commit on the unmerged feat/sui branch (per the PR description: "re-pin after #633 merges"). A feature-branch commit is only reproducibly fetchable while the branch keeps it reachable; if #633 is rebased/squash-merged and the branch is deleted, cargo can no longer resolve this rev and every build breaks. Gate this merge on re-pinning omni-types (and confirming near-mpc-contract-interface9295cf29) to commits that live on main. This is a merge-ordering gate, not a code defect.
Non-blocking (nits, follow-ups, suggestions):
sui-bridge-client/src/sui_bridge_client.rs (deploy_token, ~L2103–2141 in the diff) — the published coin currency is created with clamped_decimals = min(origin_decimals, 9), but the deploy_token<T> call passes the unclampedorigin_decimals (decimals_arg = tx.pure(&origin_decimals)). This is presumably intentional (the on-chain utils::normalize_decimals recomputes the cap, and the contract needs origin decimals for cross-chain amount scaling), but since the deploy path isn't exercised end-to-end yet, please confirm the Sui contract does not assert decimals == CoinMetadata.decimals — that would revert for any token with >9 origin decimals.
sui-bridge-client/src/sui_bridge_client.rs (fin_transfer/deploy_token) — the 65-byte MPC signature is passed whole (signature.to_bytes().to_vec()), whereas the Aptos client splits it into rs(64)+v(1). Passing the full compact signature matches Sui's ecdsa_k1::secp256k1_ecrecover, so this looks right, but it's untested end-to-end — worth a byte-level check against the #633 contract's expected vector<u8> layout (and that the trailing recovery byte is the 0/1 form Sui expects, not 27/28).
sui-bridge-client/src/bytecode.rs / sui_bridge_client.rs — numerous x as usize / x as u64 casts (e.g. offset as usize/len as usize in parse_module, event_index as u64 in get_event_log, .len() as u64 in the uleb/serialize helpers). The advisory -D clippy::as_conversions step will flag these; prefer usize::try_from(..) / u64::from(..) to match the repo convention (non-gating, since both clippy steps are continue-on-error).
bridge-cli/src/defaults.rs:669 — SUI_*_MAINNET are all-zero placeholders, so --network mainnet builds a client that fails at call time. Already documented in the PR; just confirm this ships guarded rather than silently attempting zero-address calls.
Nice touches worth calling out: the MPC sign payload has a snapshot-hash test against near/mpc, the bytecode patcher covers the symbol == name / empty-metadata duplicate-constant edge cases with a toolchain-validated fixture, and every ChainKind/OmniAddress exhaustive match plus the full CLI config-precedence chain (or/env_config/all three default_config arms) is wired for Sui.
⚠️ Issues found
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Sui support to the SDK and CLI. Contract side: Near-One/omni-bridge#633.
What's inside
sui-bridge-clientcrate built on the MystenLabs sui-rust-sdkcrates over gRPC (Sui JSON-RPC is decommissioned):
init_transfer,fin_transfer,log_metadata,deploy_token, views, and MPC eventlogs.
deploy_tokenis fully automated despite Sui's one-time-witness rule:the crate vendors precompiled token-template bytecode and patches the
identifiers and constants per token (no Move compiler dependency),
then publishes and calls
deploy_token<T>back-to-back. Symbol, name,and description live in a single
vector<vector<u8>>constant so theMove verifier's duplicate-constant check can never reject a token
(e.g. symbol == name).
build_sui_mpc_sign_payload(raw BCS eventcontents, no JSON canonicalization), Sui variants and dispatch arms
for deploy/init/fin/bind/claim-fee, storage-deposit derivation.
sui-init-transfer,sui-fin-transfer,sui-log-metadata(takes the coin type — Sui token ids are keccak hashes and can't be
reversed), config/env/defaults for all three networks.
near-mpc-contract-interface -> 9295cf29 (adds the Sui foreign-tx
types; verified drop-in for existing chains).
Testing
with
sui move disassemble, edge cases covered (symbol == name,empty symbol/name, long names).
BCS-decodes the real InitTransfer event, checks finality, runs view
simulations, and publish-simulates patched token modules (the node's
own verifier accepts them).
cargo test --workspacegreen (136 tests), fmt/clippy clean.Notes
Sui prover dispatch (follow-up noted in #633); payloads are ready.
testnet defaults point at the #633 test deployment.