mirror of
https://github.com/lux-apps/papers.git
synced 2026-10-30 18:15:21 +00:00
Restructured from flat .tex/.pdf files into per-paper subdirectories. Added Antje Worring as co-author on all papers. Synced PDFs to pdfs/ for download site.
62 lines
2.2 KiB
TeX
62 lines
2.2 KiB
TeX
\section{Cross-Chain Swap Lifecycle}
|
|
|
|
|
|
\subsection{Complete Flow}
|
|
|
|
|
|
|
|
\begin{algorithmic}[1]
|
|
\State \textbf{Step 1:} User submits $SwapTx$ on X-Chain
|
|
\State \quad $SwapTx(src: \text{LUX}, dst: \text{BTC}, amount, recipient)$
|
|
\State
|
|
\State \textbf{Step 2:} X-Chain emits $\texttt{SwapRequested}$ event
|
|
\State
|
|
\State \textbf{Step 3:} M-Chain validators detect event via watcher
|
|
\State \quad $\text{WatchXChain}() \rightarrow \text{EnqueueSwap}(swapID)$
|
|
\State
|
|
\State \textbf{Step 4:} Validators generate threshold signature
|
|
\State \quad Each $mpckeyd$ daemon:
|
|
\State \quad \quad $share_i \gets \text{GenerateShare}(swapID)$
|
|
\State \quad \quad $\text{Broadcast}(share_i)$
|
|
\State
|
|
\State \textbf{Step 5:} Leader aggregates and submits $SwapSigTx$
|
|
\State \quad $\text{Aggregate}(\{share_i\}_{i \in S}) \rightarrow signature$
|
|
\State \quad $\text{SubmitSwapSigTx}(swapID, signature, bitmap)$
|
|
\State
|
|
\State \textbf{Step 6:} M-Chain validates and finalizes
|
|
\State \quad $\text{ValidateSwapSigTx}() \rightarrow \texttt{SUCCESS}$
|
|
\State \quad $\text{RewardSigners}(\{i \in bitmap\})$
|
|
\State
|
|
\State \textbf{Step 7:} Generate Warp proof for X-Chain
|
|
\State \quad $proof \gets \text{GenerateMProof}(swapID, signature)$
|
|
\State \quad $\text{SendWarpMsg}(X\text{-}Chain, proof)$
|
|
\State
|
|
\State \textbf{Step 8:} X-Chain verifies and settles
|
|
\State \quad $\text{VerifyMProof}(proof) \rightarrow \texttt{VALID}$
|
|
\State \quad $\text{ExecuteSwap}(swapID)$ \Comment{Unlock/mint assets}
|
|
\State
|
|
\State \textbf{Step 9:} Broadcast to external chain
|
|
\State \quad $\text{BroadcastTx}(\text{BTC}, recipient, amount, signature)$
|
|
\State
|
|
\State \textbf{Step 10:} Confirm external finality
|
|
\State \quad $\text{WaitForConfirmations}(\text{BTC}, txID, confirms = 6)$
|
|
\end{algorithmic}
|
|
|
|
|
|
\subsection{Failure Recovery}
|
|
|
|
\textbf{Timeout Handling:}
|
|
\begin{itemize}
|
|
\item If swap not signed within deadline $\to$ automatic slashing
|
|
\item X-Chain refunds user after grace period
|
|
\item Slashed funds partially burned, partially rewarded to reporter
|
|
\end{itemize}
|
|
|
|
\textbf{External Chain Reorg:}
|
|
\begin{itemize}
|
|
\item Monitor external chain for reorgs up to finality depth
|
|
\item If reorg detected before finality $\to$ retry broadcast
|
|
\item If reorg after finality $\to$ proof-of-non-inclusion refund
|
|
\end{itemize}
|
|
|