KomodoPlatform / komodo-defi-framework

This is the official Komodo DeFi Framework repository
https://komodoplatform.com/en/docs/komodo-defi-framework/
103 stars 94 forks source link

QRC20: MakerPaymentWaitConfirmFailed (Revert), refund fails too #980

Closed cipig closed 3 years ago

cipig commented 3 years ago

9852fc8d-dcac-4fb2-adc8-f5b9a028e67d.txt

The attached KMD/QC swap failed with

         "event" : {
            "type" : "MakerPaymentWaitConfirmFailed",
            "data" : {
               "error" : "maker_swap:641] !wait for maker payment confirmations: swap:374] swap:1002] Contract call failed with an error: Revert"
            }
         },

MakerPayment was sent though: https://qtum.info/tx/7a92ec4f26dd2b8ed14e754b251c8c3d02d93a623aff9aa2800e6ff89402fe09 and is now stucked in the contract: https://qtum.info/contract/2f754733acd6d753731c00fee32cb484551cc15d

calling recover_funds_of_swap gives error "error" : "rpc:173] dispatcher_legacy:155] lp_swap:1136] lp_swap:737] maker_swap:1044] Error swap:226] swap:630] swap:1002] Contract call failed with an error: Revert when trying to find maker payment spend"

strange is that i did some KMD/QC swaps too and they worked fine, but i used a newer version of ADEX, the taker from above swap used 2.1.3445_mm2.1_419f36ef5_Linux_Release from 0.4.3 Desktop

this is the enable call on my maker node: curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"QC\",\"mm2\":1,\"swap_contract_address\":\"0x2f754733acd6d753731c00fee32cb484551cc15d\",\"fallback_swap_contract\":\"0x2f754733acd6d753731c00fee32cb484551cc15d\"}"

artemii235 commented 3 years ago

The payment seems to be reverted and not sent, some QC balance on the smart contract should be from other swaps. It looks like the transaction ran out of gas, checking now.

artemii235 commented 3 years ago

According to https://qtum.info/tx/7a92ec4f26dd2b8ed14e754b251c8c3d02d93a623aff9aa2800e6ff89402fe09 tx receipt, it was about to use almost 180k gas that exceeds the existing 100k limit set by MM2. Looks like we have to increase the HTLC specific limit to 200k for such cases. The best solution would be to use gas estimation, but QTUM ElectrumX doesn't seem to have such an RPC call.

artemii235 commented 3 years ago

Done, merged to dev, please reopen the issue if the problem occurs again after the update.