ExchangeUnion / xud

Exchange Union Daemon 🔁 ⚡️
https://exchangeunion.com
GNU Affero General Public License v3.0
115 stars 44 forks source link

Got free DAI because of failed swap from connext side #1574

Closed raladev closed 4 years ago

raladev commented 4 years ago

Your environment

Taker's env - master of simnet docker setup Maker's env - lndltc and connext are from master of simnet docker setup, but xud was installed natively and tradehistory branch was used.

Steps to reproduce

  1. ./xucli -p 28886 buy 0.2 LTC/DAI 200 1 as maker
  2. sell 0.2 LTC/DAI 200 1 as taker

Actual behaviour

  1. msg about successful swap for taker;
  2. 40 DAI is received by taker;
  3. xud node died because of the assertion;
  4. 0.2 LTC was in pending_htlcs for ~30 sec and after that it was returned to taker's channel (he did not pay for DAI).

Screens

balances_before_the_swap swap_proccess LTC_Returned_back_to_taker

Logs

Note: Some of logs can be bigger then others because of re-installation cycles, dont try to match startup phases of them.

22/05/2020 13:25 - approx. time of the swap for taker 22/05/2020 06:25 - approx. time of the swap for maker

takers_log.zip makers_log.zip

UPD: Add missed connext log for maker. freedai_connext_maker.log

ghost commented 4 years ago

Looking at the logs indicates that the app install for 9012739211802103871b05e223b7afd56c41b9be6aba607c13687253cc9da7df hash failed.

Node logs:

2020-05-22T10:52:43.116Z [CF-ProposeProtocol] [479265b7-d315-44fb-b1f1-aa2e62dadee8] Persisted app instance 0xd6a09199792b6b6687261c3e3f693c9ccce01c1a71b521631c87eb5f3c0a4db0 in 38 ms
2020-05-22T10:52:43.117Z [CF-ProposeProtocol] [479265b7-d315-44fb-b1f1-aa2e62dadee8] Response finished in 64 ms
2020-05-22T10:52:43.118Z [ListenerService] PROPOSE_INSTALL_EVENT event fired from indra8E9hArarrQrmJz89UXeVkP1yZq15VmFBrUdtujUeMMrs9DiC6M, data: {"params":{"abiEncodings":{"actionEncoding":"tuple( bytes32 preImage)","stateEncoding":"tuple( tuple( address to, uint256 amount)[2] coinTransfers, bytes32 lockHash, bytes32 preImage, uint256 expiry, bool finalized)"},"appDefinition":"0x4d516B3eED3Ae82c7712CBD50D3095Ed696DD772","initialState":{"coinTransfers":[{"amount":{"_hex":"0x2086ac351052600000"},"to":"0xB9826b681dDc94455D4308b4ea38C9de5E6E50B6"},{"amount":{"_hex":"0x00"},"to":"0xdA64cad97C32285cbcB51436E41e7e9EE8937BF2"}],"expiry":{"_hex":"0x1831"},"lockHash":"0x9012739211802103871b05e223b7afd56c41b9be6aba607c13687253cc9da7df","preImage":"0x0000000000000000000000000000000000000000000000000000000000000000","finalized":false},"initiatorDeposit":{"_hex":"0x2086ac351052600000"},"initiatorDepositAssetId":"0x302171031c4fB3cca3395DDb489AC7c0E5Bf5D96","meta":{"recipient":"indra8MdcjxcmKmyTFX2FkSxreb5fUsBUYs9XMQqTuDrYv4TB128wrg","sender":"indra8E9hArarrQrmJz89UXeVkP1yZq15VmFBrUdtujUeMMrs9DiC6M","timelock":"640"},"multisigAddress":"0x77Ca2F04D550867F6f07B10F9E6b081880D6C255","outcomeType":"SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER","responderDeposit":{"_hex":"0x00"},"responderDepositAssetId":"0x302171031c4fB3cca3395DDb489AC7c0E5Bf5D96","defaultTimeout":{"_hex":"0x21c0"},"stateTimeout":{"_hex":"0x00"},"responderIdentifier":"indra684iFVA3WjTFM9PNTVK23AeyaCoTipyoaxdGEeqAmu55FVWDDX"},"appIdentityHash":"0xd6a09199792b6b6687261c3e3f693c9ccce01c1a71b521631c87eb5f3c0a4db0"}
2020-05-22T10:52:43.118Z [AppRegistryService] validateAndInstallOrReject for app 0xd6a09199792b6b6687261c3e3f693c9ccce01c1a71b521631c87eb5f3c0a4db0 with params {"abiEncodings":{"actionEncoding":"tuple( bytes32 preImage)","stateEncoding":"tuple( tuple( address to, uint256 amount)[2] coinTransfers, bytes32 lockHash, bytes32 preImage, uint256 expiry, bool finalized)"},"appDefinition":"0x4d516B3eED3Ae82c7712CBD50D3095Ed696DD772","initialState":{"coinTransfers":[{"amount":{"_hex":"0x2086ac351052600000"},"to":"0xB9826b681dDc94455D4308b4ea38C9de5E6E50B6"},{"amount":{"_hex":"0x00"},"to":"0xdA64cad97C32285cbcB51436E41e7e9EE8937BF2"}],"expiry":{"_hex":"0x1831"},"lockHash":"0x9012739211802103871b05e223b7afd56c41b9be6aba607c13687253cc9da7df","preImage":"0x0000000000000000000000000000000000000000000000000000000000000000","finalized":false},"initiatorDeposit":{"_hex":"0x2086ac351052600000"},"initiatorDepositAssetId":"0x302171031c4fB3cca3395DDb489AC7c0E5Bf5D96","meta":{"recipient":"indra8MdcjxcmKmyTFX2FkSxreb5fUsBUYs9XMQqTuDrYv4TB128wrg","sender":"indra8E9hArarrQrmJz89UXeVkP1yZq15VmFBrUdtujUeMMrs9DiC6M","timelock":"640"},"multisigAddress":"0x77Ca2F04D550867F6f07B10F9E6b081880D6C255","outcomeType":"SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER","responderDeposit":{"_hex":"0x00"},"responderDepositAssetId":"0x302171031c4fB3cca3395DDb489AC7c0E5Bf5D96","defaultTimeout":{"_hex":"0x21c0"},"stateTimeout":{"_hex":"0x00"},"responderIdentifier":"indra684iFVA3WjTFM9PNTVK23AeyaCoTipyoaxdGEeqAmu55FVWDDX"} from indra8E9hArarrQrmJz89UXeVkP1yZq15VmFBrUdtujUeMMrs9DiC6M started
2020-05-22T10:52:43.119Z [ChannelRepository] Retrieving channel for user indra8E9hArarrQrmJz89UXeVkP1yZq15VmFBrUdtujUeMMrs9DiC6M
2020-05-22T10:52:43.121Z [CF-RequestHandler] Event for propose protocol was processed in 110 ms
2020-05-22T10:52:43.121Z [ListenerService] PROTOCOL_MESSAGE_EVENT event fired from indra8E9hArarrQrmJz89UXeVkP1yZq15VmFBrUdtujUeMMrs9DiC6M, data: {"protocol":"propose","processID":"479265b7-d315-44fb-b1f1-aa2e62dadee8","params":{"abiEncodings":{"actionEncoding":"tuple( bytes32 preImage)","stateEncoding":"tuple( tuple( address to, uint256 amount)[2] coinTransfers, bytes32 lockHash, bytes32 preImage, uint256 expiry, bool finalized)"},"appDefinition":"0x4d516B3eED3Ae82c7712CBD50D3095Ed696DD772","initialState":{"coinTransfers":[{"amount":{"_hex":"0x2086ac351052600000"},"to":"0xB9826b681dDc94455D4308b4ea38C9de5E6E50B6"},{"amount":{"_hex":"0x00"},"to":"0xdA64cad97C32285cbcB51436E41e7e9EE8937BF2"}],"expiry":{"_hex":"0x1831"},"lockHash":"0x9012739211802103871b05e223b7afd56c41b9be6aba607c13687253cc9da7df","preImage":"0x0000000000000000000000000000000000000000000000000000000000000000","finalized":false},"initiatorDeposit":{"_hex":"0x2086ac351052600000"},"initiatorDepositAssetId":"0x302171031c4fB3cca3395DDb489AC7c0E5Bf5D96","meta":{"recipient":"indra8MdcjxcmKmyTFX2FkSxreb5fUsBUYs9XMQqTuDrYv4TB128wrg","sender":"indra8E9hArarrQrmJz89UXeVkP1yZq15VmFBrUdtujUeMMrs9DiC6M","timelock":"640"},"multisigAddress":"0x77Ca2F04D550867F6f07B10F9E6b081880D6C255","outcomeType":"SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER","responderIdentifier":"indra684iFVA3WjTFM9PNTVK23AeyaCoTipyoaxdGEeqAmu55FVWDDX","responderDeposit":{"_hex":"0x00"},"responderDepositAssetId":"0x302171031c4fB3cca3395DDb489AC7c0E5Bf5D96","defaultTimeout":{"_hex":"0x21c0"},"stateTimeout":{"_hex":"0x00"},"initiatorIdentifier":"indra8E9hArarrQrmJz89UXeVkP1yZq15VmFBrUdtujUeMMrs9DiC6M"},"seq":1,"to":"indra684iFVA3WjTFM9PNTVK23AeyaCoTipyoaxdGEeqAmu55FVWDDX","customData":{"signature":"0x380b3648824d4f95a5fa7ace2a57d3a460173be12550f46ffd4a6df44c2882130ea90694d421ffaaa7b913bd2e16acd71453ca6d1daad66edea02218e95251fb1c"}}
2020-05-22T10:52:43.130Z [AppRegistryService] runPreInstallValidation for app name HashLockTransferApp started
2020-05-22T10:52:43.137Z [HashLockTransferService] installHashLockTransferReceiverApp started: {
  "senderIdentifier": "indra8E9hArarrQrmJz89UXeVkP1yZq15VmFBrUdtujUeMMrs9DiC6M",
  "receiverIdentifier": "indra8MdcjxcmKmyTFX2FkSxreb5fUsBUYs9XMQqTuDrYv4TB128wrg",
  "appState": {
    "coinTransfers": [
      {
        "amount": "600000000000000000000",
        "to": "0xB9826b681dDc94455D4308b4ea38C9de5E6E50B6"
      },
      {
        "amount": "0",
        "to": "0xdA64cad97C32285cbcB51436E41e7e9EE8937BF2"
      }
    ],
    "expiry": "6193",
    "lockHash": "0x9012739211802103871b05e223b7afd56c41b9be6aba607c13687253cc9da7df",
    "preImage": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "finalized": false
  },
  "assetId": "0x302171031c4fB3cca3395DDb489AC7c0E5Bf5D96",
  "meta": {
    "recipient": "indra8MdcjxcmKmyTFX2FkSxreb5fUsBUYs9XMQqTuDrYv4TB128wrg",
    "sender": "indra8E9hArarrQrmJz89UXeVkP1yZq15VmFBrUdtujUeMMrs9DiC6M",
    "timelock": "640"
  }
}
2020-05-22T10:52:43.140Z [ChannelRepository] Retrieving channel for user indra8MdcjxcmKmyTFX2FkSxreb5fUsBUYs9XMQqTuDrYv4TB128wrg
2020-05-22T10:52:43.153Z [HashLockTransferService] findReceiverAppByLockHash 0x9012739211802103871b05e223b7afd56c41b9be6aba607c13687253cc9da7df started
2020-05-22T10:52:43.163Z [HashLockTransferService] findReceiverAppByLockHash 0x9012739211802103871b05e223b7afd56c41b9be6aba607c13687253cc9da7df completed: undefined
2020-05-22T10:52:43.164Z [CFCoreService] Calling cfCore RPC method chan_getFreeBalanceState with params: {
  "multisigAddress": "0x3592554b6611D2c599dA6d6c9B3D57691792E645",
  "assetId": "0x302171031c4fB3cca3395DDb489AC7c0E5Bf5D96"
}
2020-05-22T10:52:43.178Z [CF-RpcRouter] Processed chan_getFreeBalanceState method in 14 ms
2020-05-22T10:52:43.179Z [CFCoreService] chan_getFreeBalanceState called with result: {
  "0xdA64cad97C32285cbcB51436E41e7e9EE8937BF2": "20000000000000000000",
  "0x38528B54CE837d4b9eBAcf74F47AC8256bcf1418": "2000000000000000000000"
}
2020-05-22T10:52:43.180Z [ChannelService] Getting rebalancing targets for user: indra8MdcjxcmKmyTFX2FkSxreb5fUsBUYs9XMQqTuDrYv4TB128wrg, assetId: 0x302171031c4fB3cca3395DDb489AC7c0E5Bf5D96
2020-05-22T10:52:43.180Z [ChannelService] getDataFromRebalancingService for indra8MdcjxcmKmyTFX2FkSxreb5fUsBUYs9XMQqTuDrYv4TB128wrg asset 0x302171031c4fB3cca3395DDb489AC7c0E5Bf5D96 start
2020-05-22T10:52:43.181Z [ChannelService] Rebalancing service URL not configured for indra8MdcjxcmKmyTFX2FkSxreb5fUsBUYs9XMQqTuDrYv4TB128wrg
2020-05-22T10:52:43.181Z [ChannelService] Unable to get rebalancing targets from service, falling back to profile
2020-05-22T10:52:43.187Z [MessagingInterface] Got NATS message for subject indra8E9hArarrQrmJz89UXeVkP1yZq15VmFBrUdtujUeMMrs9DiC6M.lock.release.0x77Ca2F04D550867F6f07B10F9E6b081880D6C255 with data {"lockValue":"89bc2f68bb311fb85aa9b119e8c0f995","id":"c16c8a19-7039-4f72-b0ad-5745cb354640"}
2020-05-22T10:52:43.188Z [AuthService] Parsed lockName 0x77Ca2F04D550867F6f07B10F9E6b081880D6C255
2020-05-22T10:52:43.189Z [LockService] Releasing lock for 0x77Ca2F04D550867F6f07B10F9E6b081880D6C255 at 1590144763189 with secret 89bc2f68bb311fb85aa9b119e8c0f995
2020-05-22T10:52:43.190Z [ChannelService] No profile for this channel and asset, falling back to default profile
2020-05-22T10:52:43.191Z [ChannelService] Rebalancing target: {
  "assetId": "0x302171031c4fB3cca3395DDb489AC7c0E5Bf5D96",
  "channels": [],
  "id": 0,
  "collateralizeThreshold": "5000000000000000000",
  "target": "20000000000000000000",
  "reclaimThreshold": "0"
}
2020-05-22T10:52:43.193Z [DepositService] Deposit started: {"channel":"0x3592554b6611D2c599dA6d6c9B3D57691792E645","amount":{"_hex":"0x1fb681808983840000"},"assetId":"0x302171031c4fB3cca3395DDb489AC7c0E5Bf5D96"}
2020-05-22T10:52:43.195Z [LockService] Released lock for 0x77Ca2F04D550867F6f07B10F9E6b081880D6C255
2020-05-22T10:52:43.196Z [MessagingInterface] Responded to indra8E9hArarrQrmJz89UXeVkP1yZq15VmFBrUdtujUeMMrs9DiC6M.lock.release.0x77Ca2F04D550867F6f07B10F9E6b081880D6C255 in 8 ms
2020-05-22T10:52:43.198Z [DepositService] Collateral request is in flight for 0x302171031c4fB3cca3395DDb489AC7c0E5Bf5D96, waiting for transaction
2020-05-22T10:52:43.199Z [DepositService] Collateralization in flight for user indra8MdcjxcmKmyTFX2FkSxreb5fUsBUYs9XMQqTuDrYv4TB128wrg, waiting
2020-05-22T10:52:43.206Z [CFCoreService] Calling cfCore RPC method chan_getAppInstances with params: {
  "multisigAddress": "0x3592554b6611D2c599dA6d6c9B3D57691792E645"
}
2020-05-22T10:52:43.222Z [CF-RpcRouter] Processed chan_getAppInstances method in 14 ms
2020-05-22T10:52:43.223Z [CFCoreService] chan_getAppInstances called with result: {
  "appInstances": []
}
2020-05-22T10:54:07.268Z [DepositService] Only resolved 0/0 expected deposits, but it has been more than 5 blocks. Returning. Resolved: [], all: []
2020-05-22T10:54:07.288Z [AppRegistryService] App install failed: Error: Attempted to wait for ongoing transaction, but it took longer than 5 blocks, retry later.
    at DepositService.<anonymous> (/root/modules/node/src/deposit/deposit.service.ts:80:15)
    at Generator.next (<anonymous>)
    at fulfilled (/root/modules/node/src/deposit/deposit.service.ts:14:58)
2020-05-22T10:54:07.290Z [CFCoreService] Calling cfCore RPC method chan_rejectInstall with params: {
  "appIdentityHash": "0xd6a09199792b6b6687261c3e3f693c9ccce01c1a71b521631c87eb5f3c0a4db0",
  "multisigAddress": "0x77Ca2F04D550867F6f07B10F9E6b081880D6C255"
}
kilrau commented 4 years ago

@erkarl just reproduced the takers leg 1 btc htlc disappearing . Needs a VERY close look to understand whats happening.