Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

feat: add a self-bridge workflow #188

Open
NiloCK opened this issue Oct 28, 2023 · 1 comment
Open

feat: add a self-bridge workflow #188

NiloCK opened this issue Oct 28, 2023 · 1 comment

Comments

@NiloCK
Copy link
Contributor

NiloCK commented Oct 28, 2023

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

  • execute the destination release operation herself (annoying in cases where she has no in-network gas)
  • communicate the preimage to Ivan, so that he can
    • claim his HTLC from Irene (reducing her "take" on the attack to just the gas costs of her step 5 operation)
    • execute step 5 as a courtesy ?

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
Copy link
Contributor Author

NiloCK commented Oct 28, 2023

In the success case, this bridge operation is:

  • fast: off-chain arrangements can generally expected to be done between start-time and the next block of the target chain. On-chain operations can generally expect to occur in consecutive blocks on the destination chain.
  • cheap? Economics of htlc forwarding / gas compensation aren't well established, but it'd be surprising if this wasn't pretty cheap in practice.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant