statechannels / SCBridge-Wallet

MIT License
1 stars 2 forks source link

feat: add a self-bridge workflow #188

Open NiloCK opened 11 months ago

NiloCK commented 11 months ago

This wallet can enable a decent flow for bridging assets (ie: sending them to yourself) across EVMs.

Note: executing a BridgePay with yourself as the target would work, but it requires that you already have the inbound capacity on the destination chain. This is unlikely to be the general case, and "pre-loading" all of that capacity is massively inefficient - not economically viable.

Instead, we reuse the HTLC flow but with the final step as an on-chain tx at the destination chain.

Scenario: Alice, with intermediary Irene, has an active BridgeWallet on Ethereum. She wants to bridge assets to the same wallet on Optimism.

  1. (off-chain) Alice creates an HTLC for Irene in her BW
  2. (off-chain) Irene creates an HTLC to another intermediary Ivan with liquidity on Optimism (or skips to 3 herself if that person is her)
  3. (on-destination-chain) Ivan makes a tx on Optimism, depositing the specified amount, releasable via the HL preimage.
  4. (off-chain) Alice & Irene craft a userOp that inits her wallet and claims the funds via the preimage.
  5. (on-destination-chain) Irene submits it and assumes paymaster duties to cover gas (Alice is "moving in" to this EVM and doesn't presume to have funds)

Griefing Attack: After step 4, Irene can claim her HTLC from Alice but decline to perform step 5. Step 5 costs her a wallet deployment + some other gas costs.

In this failure case, Alice can

In the failure case, one of Alice or Ivan is robbed of the gas costs associated with step 5. Alice's recourse is to boot Irene from her wallet and to shout about it (Ivan can corroborate). Alice is not out her bridged funds - they exist on the target chain, addressed to her, waiting for unlock.

NiloCK commented 11 months ago

In the success case, this bridge operation is: