Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BEP20: MakerPaymentRefundFailed for swap failed couple days ago #947

Closed
cipig opened this issue May 14, 2021 · 8 comments
Closed

BEP20: MakerPaymentRefundFailed for swap failed couple days ago #947

cipig opened this issue May 14, 2021 · 8 comments
Assignees

Comments

@cipig
Copy link
Member

cipig commented May 14, 2021

  • DOGE/USDT-BEP20 swap failed while waiting for MakerPayment (USDT-BEP20)
  • automatic MakerPaymentRefundFailed with following error:
      {
         "timestamp" : 1620694064780,
         "event" : {
            "type" : "MakerPaymentRefundFailed",
            "data" : {
               "error" : "maker_swap:810] !maker_coin.send_maker_refunds_payment: eth:1518] Payment SignedTransaction { transaction: UnverifiedTransaction { unsigned: Transaction { nonce: 110, gas_price: 10000000000, gas: 150000, action: Call(0xedc5b89fe1f0382f9e4316069971d90a0951db31), value: 0, data: [155, 65, 91, 42, 28, 164, 50, 244, 46, 105, 188, 148, 222, 8, 174, 46, 237, 125, 229, 210, 121, 157, 215, 57, 213, 116, 169, 175, 251, 73, 219, 166, 209, 56, 175, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 67, 228, 60, 45, 81, 247, 101, 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 211, 152, 50, 111, 153, 5, 159, 247, 117, 72, 82, 70, 153, 144, 39, 179, 25, 121, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 74, 95, 139, 20, 81, 121, 253, 148, 162, 3, 143, 171, 158, 50, 230, 45, 148, 208, 72, 178, 82, 238, 46, 131, 245, 184, 68, 231, 127, 198, 37, 51, 65, 228, 225, 38, 161, 66, 169, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 153, 212, 47] }, v: 28, r: 15180228933674485270422506957969189562179954685824090138543294902969416588674, s: 29471192486334254496098423215450959197869664119593231610762645038051493679517, hash: 0xbe94448ebbf32baa557868a74fa1234bfc2c2ab8469cfbc98413c431fb590452 }, sender: 0xf2ed2ac92489106c942c9e32c6a912ba61af93e3, public: Some(0xdbd8c73e2e80e4f3cf88d2f04a9d2d0df4269496608b14a3e17556fdcb01e0c114625f5d933b0c76a7d409eddee7c044d10387d3011998f942d84324c4d0d49c) } state is not PAYMENT_STATE_SENT, got 0"
            }
         }
      },

the reason of the swap failure is not that important (there were some problems with out of sync nodes and too low fee on BSC, solved in the meantime)

but the real problem is this on calling recover_funds_of_swap:

{
   "error" : "rpc:173] dispatcher_legacy:152] lp_swap:1084] lp_swap:675] maker_swap:1006] Error eth:451] eth:411] Transport error: request MethodCall(MethodCall { jsonrpc: Some(V2), method: \"eth_getLogs\", params: Some(Array([Object({\"fromBlock\": String(\"0x6f75ba\"), \"address\": String(\"0xedc5b89fe1f0382f9e4316069971d90a0951db31\"), \"topics\": Array([String(\"0x36c177bcb01c6d568244f05261e2946c8c977fa50822f3fa098c470770ee1f3e\")])})])), id: Num(838295) }) failed: web3_transport:131] timeout; web3_transport:131] timeout; web3_transport:131] timeout when trying to find maker payment spend"
}

i guess that eth_getLogs for such a long period of time (4 days) is not a good idea: bnb-chain/bsc#101 ... i haven't used --rangelimit on my nodes yet, but will need to add it soon, the CPU load it causes is huge

can eth_getLogs calls be limited to a certain block range in mm2?

the entire swap file:
630d81e5-42c2-4d91-9e9e-c47fb884a780.txt

@artemii235 artemii235 self-assigned this May 17, 2021
@artemii235
Copy link
Member

Thanks for opening the issue! Sure, we can reduce the block range for eth_getLogs - will do this week.

@cipig
Copy link
Member Author

cipig commented May 19, 2021

started the BSC node on bsc3.cipig.net with --rangelimit 2 days ago and it makes a huge difference
image
image
image
the last picture is from bsc3... so the load comes almost exclusively from eth_getLogs without block limit... load of 1.00 is 100%, so all 64 cores in use, top then shows 6400% CPU usage for geth

the error message on mm2 when using bsc3 with the rangelimit looks like this on a tried refund
"error" : "rpc:173] dispatcher_legacy:152] lp_swap:1084] lp_swap:675] maker_swap:1006] Error eth:451] eth:411] RPC error: Error { code: ServerError(-32000), message: \"exceed maximum block range: 5000\", data: None } when trying to find maker payment spend"

@cipig
Copy link
Member Author

cipig commented May 19, 2021

had to restart the other BSC nodes too with --rangelimit, after load increase and they dropped out of sync
image

@artemii235
Copy link
Member

Could you please try to refund the same swap using the https://github.com/KomodoPlatform/atomicDEX-API/tree/mm2.1-various-fixes branch?

@cipig
Copy link
Member Author

cipig commented May 28, 2021

i get "error" : "rpc:173] dispatcher_legacy:155] lp_swap:1136] lp_swap:737] maker_swap:1044] Error eth:2550] eth:415] RPC error: Error { code: ServerError(-32000), message: \"exceed maximum block range: 5000\", data: None } when trying to find maker payment spend" from the BSC nodes when trying to refund

@artemii235
Copy link
Member

Yeah, I have an error there, will push the fix soon.

artemii235 added a commit that referenced this issue May 28, 2021
Also fix the block range in EthCoin::search_for_swap_tx_spend #947
@artemii235
Copy link
Member

@cipig Could you please pull the changes and retry?

artemii235 added a commit that referenced this issue May 28, 2021
Also fix the block range in EthCoin::search_for_swap_tx_spend #947
@cipig
Copy link
Member Author

cipig commented May 28, 2021

now it works, thanks for the fix

630d81e5-42c2-4d91-9e9e-c47fb884a780
{
   "result" : {
      "coin" : "USDT-BEP20",
      "action" : "RefundedMyPayment",
      "tx_hash" : "5d3f72e8b537663b58b659833ec76717d9714f8f0677a85eed567945d02b964c",
      "tx_hex" : "f9010c82010785012a05f200830249f094edc5b89fe1f0382f9e4316069971d90a0951db3180b8a446fc02941ca432f42e69bc94de08ae2eed7de5d2799dd739d574a9affb49dba6d138af2f00000000000000000000000000000000000000000000000743e43c2d51f76578b252ee2e83f5b844e77fc6253341e4e126a142a900000000000000000000000000000000000000000000000055d398326f99059ff775485246999027b3197955000000000000000000000000864a5f8b145179fd94a2038fab9e32e62d94d0481ba08875ec824410979b3b3291eef158e673ee8a77ae52ce949381ea3a369bdc786aa061e0740a7df953f1248b62cd0db3c59120d160ed0a3f7810ad710eb984e6a0e8"
   }
}

https://bscscan.com/tx/0x5d3f72e8b537663b58b659833ec76717d9714f8f0677a85eed567945d02b964c

@cipig cipig closed this as completed May 28, 2021
artemii235 added a commit that referenced this issue Jun 1, 2021
* Add chain_id param to ETH/ERC20 conf, use it for transaction signing.
#943

* WIP. Reducing `eth_getLogs` blocks interval.

* Use MTP in p2sh_tx_locktime #951
Also fix the block range in EthCoin::search_for_swap_tx_spend #947

* Fix WASM build and add logs_block_range field to EthCoinImpl.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants