Skip to content

Configure NTT migration chains - #999

Open
mswilkison wants to merge 28 commits into
devfrom
codex/ntt-migration-supported-chains
Open

Configure NTT migration chains#999
mswilkison wants to merge 28 commits into
devfrom
codex/ntt-migration-supported-chains

Conversation

@mswilkison

@mswilkison mswilkison commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add fixed-destination L1 NTT depositors for EVM destinations while preserving proxy-upgrade storage slots and legacy in-flight recipient decoding.
  • Add Sui and Solana NTT mint-authority migration primitives with paused/drained guards.
  • Keep Sui/Solana blocked in the L1 config script until spoke-side NTT deployment, token-authority handoff, and legacy lockbox migration are complete.

Notes

This is stacked on #998 because the NTT target set intentionally excludes Sei.

The Base mainnet configuration now uses Wormhole chain ID 30 instead of the EVM chain ID.

Executor transfers default the destination gas refund address to the destination recipient so refunds remain deliverable on non-EVM chains. EVM deployments can set destinationRefundAddress if they want a relayer or treasury refund account instead.

Validation

  • git diff --check
  • typescript/node_modules/.bin/prettier --check cross-chain/solana/tests/01__tbtc.ts cross-chain/solana/tests/helpers/tbtc.ts cross-chain/solana/target/idl/tbtc.json typescript/src/lib/solana/target/idl/tbtc.json solidity/scripts/configure-l1-btc-depositor-ntt.ts
  • rustfmt --check cross-chain/solana/programs/tbtc/src/error.rs cross-chain/solana/programs/tbtc/src/processor/admin/transfer_mint_authority.rs
  • npm run test -- --grep "L1BTCDepositorNtt fixed destination|L1BTCDepositorNttWithExecutor fixed destination" from solidity

Local toolchain blockers:

  • anchor is not installed locally, so Anchor build/test was not runnable here.
  • cargo check -p tbtc is blocked before project code by wasm-bindgen v0.2.87 incompatibility with the installed Rust toolchain.
  • sui move test is blocked by the missing local TokenBridge dependency path.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 631d4676-162c-41e3-a9c6-465c90a84871

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ntt-migration-supported-chains

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mswilkison mswilkison changed the title [codex] Configure NTT migration chains Configure NTT migration chains Jun 30, 2026
@mswilkison
mswilkison force-pushed the codex/ntt-migration-supported-chains branch from 2b5690c to a0c36ee Compare June 30, 2026 23:05
@mswilkison
mswilkison force-pushed the codex/ntt-migration-supported-chains branch 2 times, most recently from acb96b1 to c4148ca Compare July 1, 2026 03:34
@mswilkison
mswilkison force-pushed the codex/ntt-migration-supported-chains branch from 9f45f3e to 721978d Compare July 1, 2026 16:54
mswilkison and others added 15 commits July 1, 2026 12:02
- Reformat L1BTCDepositorNtt.sol and MockNttManagerWithExecutor.sol per
  prettier (contracts-format CI).
- Regenerate typescript API reference for the new normalizeNttRecipient
  export and shifted ntt.ts line references (typescript-docs CI).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The executor variant hardcoded the destination-chain unused-gas refund to
bytes32(uint256(uint160(msg.sender))) — the relayer's L1 address left-padded.
On EVM destinations that is the canonical Wormhole convention, but on non-EVM
destinations (Solana, Sui) it is not a controllable account, so any unused-gas
refund is silently black-holed.

Add a per-instance, owner-settable `destinationRefundAddress` (32-byte universal
address format). When unset it falls back to the deposit recipient, which is
always a controllable account on the destination chain — safe-by-default on any
chain with no governance action. This removes the only chain-type assumption in
the contract, so an instance can be initialized for any destinationChainId
without silently losing refunds.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Base automatically changed from codex/remove-sei-support to main July 15, 2026 15:23
@piotr-roslaniec

Copy link
Copy Markdown
Contributor

Pushed a merge commit (cb278a04) from main to resolve the merge conflict and bring this branch up to date (branch protection is strict).

Rationale for how it was resolved: since the merge-base, main only advanced by one commit — c10e824 (Remove Sei support, #998). Every hunk of that commit is Sei-only (Sei enum/field/mappings, Sei config blocks, Sei doc-comment examples; the encoding logic is untouched). This branch had already dropped Sei as part of its fixed-destination NTT redesign, so all conflicts were resolved in favor of this branch's redesign. The resulting tree is byte-identical to the previous branch tip except for removing the residual cross-chain/sei/ artifacts — i.e. the merge changes none of this PR's actual content, it only clears the conflict and syncs with main. CI is green on the merge commit.

Note this does not touch the open design question of the destination-recipient encoding (full 32-byte vs chain-ID-packed) — that remains as designed in this PR.

Reconciles the NTT migration branch with main. main's only change since the merge-base is the Sei removal (#998), which this branch had already applied via its fixed-destination NTT redesign; all conflicts resolved in favor of this branch's redesign. Resulting tree is identical to the branch tip plus removal of the residual cross-chain/sei artifacts.
Regenerates the TypeScript api-reference docs from the merged source to
resolve conflicts between this branch's NTT migration doc regen and dev's
StarkNet relayer conflict-handling doc regen (#1025). No manual content was
hand-merged; the api-reference tree is the typedoc output for the merged
src/.
@piotr-roslaniec
piotr-roslaniec force-pushed the codex/ntt-migration-supported-chains branch from e9538fb to cc6757f Compare August 31, 2026 08:56
…pported-chains

# Conflicts:
#	solidity/test/cross-chain/wormhole/L1BTCDepositorNtt.core.test.ts
#	solidity/test/cross-chain/wormhole/L1BTCDepositorNtt.ntt.test.ts
#	solidity/test/cross-chain/wormhole/L1BTCDepositorNtt.utils.test.ts
@piotr-roslaniec
piotr-roslaniec marked this pull request as ready for review August 31, 2026 10:39
piotr-roslaniec added a commit that referenced this pull request Aug 31, 2026
## Summary

- Pay the deposit finalization reimbursement before the deferred
initialization reimbursement, so gas consumed by the initialization
receiver cannot be counted again in the finalizer reimbursement.
- Apply the same ordering to the flattened legacy Arbitrum and Base V2
implementations.
- Update focused and existing depositor tests to require the safe
reimbursement order.

This only reorders the two terminal reimbursement calls. It does not
change storage, the ABI, deposit state transitions, or token-transfer
behavior.

## PR #908 evaluation

This is the focused code-level follow-up extracted from #908:

- **Deferred reimbursement double counting:** validated against current
dev; the regression assertion failed before the fix and passes
afterward.
- **Refund blocking:** no fix warranted. The canonical ReimbursementPool
uses a non-reverting low-level send and emits SendingEtherFailed if the
pool is empty or the receiver rejects Ether, so those cases do not block
finalization.
- **Initialization/finalization gas-price mismatch:** confirmed as an
accounting limitation, but #908 proposes an unsafe conversion because
the pool adds staticGas at the later transaction gas price. A correct
fix needs a pool-level fixed-wei reimbursement design rather than an
upgradeable depositor storage change.
- **Executor fee and parameter validation:** already covered by #962, so
none of that work is duplicated here.

I also checked current open PRs immediately before submission. #999
touches AbstractL1BTCDepositor only to add NTT migration hooks and
recipient transformation; it does not change reimbursement accounting.
No open PR other than stale #908 implements this fix.

## Validation

- yarn build
- yarn typecheck
- yarn format (passes with repository-existing warnings)
- AbstractL1BTCDepositor, BTCDepositorWormhole, L1BTCDepositorWormhole,
L1BTCDepositorWormholeV2Arbitrum, L1BTCDepositorWormholeV2Base, and
NativeBTCDepositor suites
- All L1BTCDepositorNtt suites
- All TypeScript StarkNetBitcoinDepositor suites (34 passing, 4
pre-existing pending)

Refs: #908, #962, #999

---------

Co-authored-by: Piotr Rosłaniec <p.roslaniec@gmail.com>
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.

2 participants