Designing a Bridge From the Post-Mortems: Wormhole, Ronin, and the Phantom-Deposit Drains
Designing a Bridge From the Post-Mortems
Bridges are where crypto loses its money. Not in ones and twos — in nine-figure single events, and usually not because the cryptography failed. The signatures verify fine in most bridge post-mortems. What fails is everything around them: a check that doesn't check, a quorum that isn't independent, an event nobody verified actually happened.
So when I built the bridge for Machine — my Solana-derived L1 (Agave 2.3.13 fork, its own genesis, $MACHINE as native gas) — I didn't start from a template. I started from the post-mortems, treated each one as a failing test the design had to pass, and wrote down which defence answers which incident. The bridge is a plain lock/mint design: SPL tokens lock in a program-owned vault on Solana, wrapped copies mint on Machine, burning the wrapped copy unlocks the original. Nothing exotic. All the work is in the parts that decide whether a crossing is real.
The status, up front: the programs and relayer are written and tested locally — 821 tests across the repo, 241 in the bridge workspace — but the bridge is not deployed and not audited, Machine is a single-node localnet today, and no asset has ever crossed. This is a design article, not a launch announcement.
Failure class 1: verification that doesn't verify — Wormhole
February 2022: an attacker minted 120,000 wETH (~$326M) on Solana with no ETH locked behind it. Wormhole's Solana program verified guardian signatures by reading the instructions sysvar through a deprecated API that never checked the account it was handed actually was the sysvar. The attacker passed a fake account containing a forged signature set, the program believed the guardians had approved, and minted. The cryptography was never broken — the program just never confirmed it was looking at real verification output.
The defence is to not hand-roll the step that failed. My bridge programs do no in-program signature cryptography at all. The submitting transaction carries an ed25519-precompile instruction holding the relayer signatures over the message hash; the Solana runtime verifies those signatures before any instruction executes. The programs then read the attestation back from the instructions sysvar and require at least 3 distinct, currently registered relayers on exactly that hash — the standard verification path, with the set membership checked on-chain. The off-chain collector independently re-verifies every signature with the same verifier the programs use before submitting, and a forged signature in the exchange fails closed rather than being counted toward quorum.
The message itself is bound tight so a valid attestation can't be repurposed: the hash covers the direction (a Solana→Machine attestation can't replay as Machine→Solana), the source mint — which both destination programs check against the mint registered in their config — the source transaction signature (one deposit can't fund two mints), and a timestamp window. Attestations expire; a signed message whose lifetime exceeds 400,000 seconds, or that is submitted after its expiry, is rejected, so a quorum-signed message can't be stockpiled and used months later.
Failure class 2: quorum in name only — Ronin
March 2022: ~$625M left the Ronin bridge in two transactions. The threshold was 5-of-9 validators — respectable on paper. In practice, four of the nine keys belonged to one company, and the fifth signature came from a DAO validator that had given that company signing access months earlier for a temporary traffic spike. The access was never revoked. One infrastructure compromise produced all five signatures. Then the second failure: nobody noticed for six days, until a user couldn't withdraw.
Three defences, aimed at three different parts of that story:
- Independence is a property of the set, not the number. My relayer set is 5 with a 3-of-5 quorum, composed so no single operator is close to threshold: one relayer per validator plus two operators who run no validators, each with its own keypair, and relayer keys, admin keys, and validator keys are distinct keypairs held for distinct roles. One relayer key alone is useless; the attack needs three independent compromises.
- Assume the quorum falls anyway, and bound the blast radius. Caps are enforced in the programs, not the relayer, so even a fully compromised quorum can't bypass them. Two layers, both must pass: absolute per-transaction and daily caps, and on the Solana unlock side, dynamic caps — a single unlock can move at most 1% of the vault's locked total, a day's window at most 5%. The vault also has a ceiling set at initialization that no instruction can raise; changing it means a new deployment.
- Make outflows impossible to miss. Ronin's six silent days are a monitoring failure, so every crossing in my design writes evidence as it happens: a receipt PDA per crossing (message hash, amount, recipient, destination slot) that anyone can derive and read without trusting the relayers, an on-chain event record per crossing that external watchers can enumerate and reconcile against balances, and a proof bundle — receipt, canonical message, signatures, and the set they were checked against — that a third party can verify fully offline. And every unpause after an incident automatically tightens the dynamic caps to a quarter of normal (0.25% per transaction, 1.25% per window) for a full cap window, relaxing on their own by slot count — a bridge that was just paused does not reopen at full speed.
Failure class 3: the event that never happened — the 2026 phantom deposits
The most instructive recent cases are the phantom-deposit drains, and my relayer's source code names one directly: Coreum, August 2026, where relayers attested to a transaction that moved the bridge's own wrapped token between two attacker wallets and treated it as a deposit — because nothing checked that the transaction actually delivered funds to the bridge. A record existed; the transfer backing it didn't. Variants of the same shape — forged or misread events, a decoy transfer in the same transaction standing in for the real one — keep recurring because "a transaction exists and mentions the right accounts" is treated as proof.
So the relayer verifies the transfer, not the event. Before signing, it fetches the parsed source transaction and requires all of this:
- The transaction succeeded — a failed transaction created nothing, whatever its contents claim.
- Inside the inner-instruction group of the one top-level instruction that created this event record, there is an SPL Token program transfer of exactly the record's amount, into the vault (for a deposit) or burning the wrapped mint (for a burn). A transfer elsewhere in the transaction doesn't count; a decoy top-level transfer doesn't count; the wrong amount, destination, or mint doesn't count. If the creating instruction's own group holds no matching transfer, the relayer refuses to sign — fail closed, no partial credit.
- The event is finalized, plus a 16-slot safety margin. Never a confirmed-only transaction.
- The source transaction's own block time exists. Expiry is derived from it; a transaction without one is never signed, rather than substituting a local clock.
The test suite pins the incident shapes by name — phantom_deposit_rejected_coreum_case is a literal test — alongside wrong-amount, wrong-destination, decoy-transfer, and batched-transaction cases (one genuine transfer must not verify two records).
Failure class 4: the incident after the incident — rotation that doesn't rotate
The freshest lesson is from this month. The Cyber bridge post-mortem follow-up (Bitquery, 22 November 2026) describes a bridge whose verifier was effectively a single key — and, worse, the response: after the first rotation, a third forged message was still approved the next morning, because the keys the thief had used remained accepted. Rotating during an incident is exactly when teams are tired, rushed, and most likely to leave the old set half-alive.
So the incident sequence is a tested code path, not a runbook hope. Pause and rotation compose in the order an incident actually demands: pause first (2-of-3 admins, or any 2 of 5 relayers — a low threshold for stopping, a high one for moving funds), rotate the set while paused — rotation is not blocked by the pause, or a compromised set could never be removed mid-incident — and the bridge stays paused until a separate admin unpause. The test rotation_while_paused_takes_effect_without_unpausing pins the whole sequence, including the part Cyber got wrong: after the sequence completes, attestations from the old set are dead, not just immediately after rotation but at the end of the drill, and only the new set's quorum moves funds.
Two more valves, kept distinct because they answer different questions. Pause halts movement in both directions while it is active — it is an emergency stop, and only admins can lift it once the cause is understood; it can stop the bridge, but it holds no funds and moves none. The kill switch is the one-way version: 2-of-3 admins permanently disable minting, while burns — the exit back to Solana — stay open forever. If minting itself is ever compromised, users can still leave.
The honest limits
A post-mortem-driven design is still a design. What it doesn't fix:
- 3-of-5 relayers is a trust assumption. It is weaker than validator-set attestation, which is a later phase, and I don't present it as decentralization. The caps exist precisely because I assume the quorum can fail.
- The upgrade authority is a single key in the code today. No multisig, no timelock. Assigning it to a multisig with a minimum 48-hour timelock is a hard requirement in the deployment gate — before any real asset crosses — not a shipped feature, and the docs say so in those words.
- Nothing here is live. The deployment gate is a written list — a real multi-validator net, public RPC, fresh production keys generated on the deployment hosts (the keys in the repo are throwaway), an independent audit with the report published, and worthless-amount crossings in both directions with pause and outage drills — and until every item exists, the bridge stays off. A bridge without an audit does not hold other people's funds.
The post-mortems are free. Every bridge team gets to learn from Wormhole's $326M, Ronin's $625M, and the 2026 drains, or from their own. I know which tuition I'd rather pay.
The code, the design document this article is drawn from, and the threat model: https://github.com/yourmememachine/mememachine