nervosnetwork / fiber

19 stars 10 forks source link

Cross-chain hub future works #88

Open doitian opened 4 months ago

doitian commented 4 months ago

From #46

doitian commented 4 months ago

In issue #46, a workaround is implemented for the second action item. When the preimage is submitted through RemoveTlc, both the blake2b and sha256 algorithms are attempted.

However, it is important to note that the lock contract has not been updated. Therefore, if a dispute arises, the saved sha256 preimage cannot be utilized to claim the HTLC outputs.

As an alternative solution, it is suggested to configure the hash algorithm either when opening a channel or when adding a tlc. The lock contract must update to accept sha256 preimage as well.

EthanYuan commented 2 weeks ago

Hi ian,

I hope you're doing well. I have two questions regarding the current setup:

1 Fiber e2e test cross-chain-hub: I have an idea for an extended case. Suppose Node 1 and Node 3 (cch) don't have a direct channel, but they both have channels with Node 2. Would this multi-hop test case still work?

From what I understand, in test 07-node1-add-tlc.bru, if we switch to using send_payment, would that be sufficient? However, I'm unsure about the cch remove_tlc step, as it requires the tlc_id.

2 On the BTC LN side, if lngrid and Bob don't have a direct channel but there is a middle node (Alice) between them, would the cross-chain-hub test still run successfully?

EthanYuan commented 1 week ago

I tried Experiment 1, which involves setting up a channel between Node 1 and Node 2, and another channel between Node 2 and Node 3. (Node 1 and Node 3 do not have a direct channel established)

Then, I used the CKB invoice generated in the 02-create-send-btc-order.bru step to have Node 1 initiate a payment. Currently, an error occurs during the process. Is this error expected at this stage?

Could it be that the CCH node 3 cannot route the payment because it doesn't have the preimage (Bob knows the preimage)?

curl -X POST http://127.0.0.1:21714 \
-H "Content-Type: application/json" \
-d '{
  "id": 42,
  "jsonrpc": "2.0",
  "method": "send_payment",
  "params": [
    {
      "invoice": "fibt200001q6qhaqvpmhkgfw0pnm6vk6egd84umqfwzzjrhvpnhznuf244vrdmthrur2fjea8r2c59wau3ua4862cgfusnqkmg80hgpqds43fglkfqzjhrmhtrcyqttn6dfvygyg04dulr6wzzey00zh4rvel6zff33ng596ut9sgzffze68ekll49mtnad59rupakj285esp5ln2e9f8dqu76lugnmrt9ndact3f73h2elapzd58e2zts9cj9vnkygg5579jwmn2aj7zkqd6dfuj",
      "target_pubkey": "03032b99943822e721a651c5a5b9621043017daa9dc3ec81d83215fd2e25121187"
    }
  ]
}'
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32000,
    "message": "Send payment error: Failed to build route: Hash256(0xbf1a8f1d755f0643108fd7f94596cd3f82647f8491e095f4f99adad9e4a5533b)",
    "data": {
      "target_pubkey": "03032b99943822e721a651c5a5b9621043017daa9dc3ec81d83215fd2e25121187",
      "amount": null,
      "payment_hash": null,
      "final_cltv_delta": null,
      "invoice": "fibt200001q6qhaqvpmhkgfw0pnm6vk6egd84umqfwzzjrhvpnhznuf244vrdmthrur2fjea8r2c59wau3ua4862cgfusnqkmg80hgpqds43fglkfqzjhrmhtrcyqttn6dfvygyg04dulr6wzzey00zh4rvel6zff33ng596ut9sgzffze68ekll49mtnad59rupakj285esp5ln2e9f8dqu76lugnmrt9ndact3f73h2elapzd58e2zts9cj9vnkygg5579jwmn2aj7zkqd6dfuj",
      "timeout": null,
      "max_fee_amount": null,
      "max_parts": null,
      "keysend": null,
      "udt_type_script": null,
      "allow_self_payment": null
    }
  },
  "id": 42
}
doitian commented 1 week ago

Multi-hop cross-chain payment is not supported yet