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

Can't find swaps made with wasm in seednode DB #1603

Closed SirSevenG closed 1 year ago

SirSevenG commented 1 year ago

6e4de5d35 - current seednodes version https://github.com/KomodoPlatform/atomicDEX-API/releases/tag/beta-2.1.8741

WASM module: mm2-9350a3ef8-Linux-Wasm-Release.zip

Needed a taker-swap.json paired to my maker one:

"uuid": "4ac6a9ea-5d18-4fe7-b4eb-b173f829a199",
"my_order_uuid": "0e885d52-97b9-432f-bce1-c54c4ac1b2a3",

And couldn't find it on seednodes.

Same goes for finished RICK-MORTY taker swap: 01f6848c-6654-409b-be78-9f2eec04155b Looking in path ..DB/hash/SWAPS/STATS/TAKER

SirSevenG commented 1 year ago

IRIS-KMD failed swap done in the same WebDEX version by Ivan: 1ffa3542-d49a-4c66-bb26-f251e651c858 Also not present in seednodes DB

cipig commented 1 year ago

i have those orders on my node check eg https://dexapi.cipig.net/public/error.php?uuid=1ffa3542-d49a-4c66-bb26-f251e651c858

SirSevenG commented 1 year ago

What mm2 version you use on that node?

cipig commented 1 year ago

mm2-44003eb85-Linux-CI.zip from dev branch

22 02:34:58, lp_native_dex:408] INFO Version: 2.1.9318_dev_44003eb85_Linux_CI DT 2022-12-21T17:30:34+03:00

sergeyboyko0791 commented 1 year ago

This is most likely due to the fact that mm2 in WASM connects to the default seednodes only https://github.com/KomodoPlatform/atomicDEX-API/blob/4f1190b7fc16972b22f6399b7264bd57a9d2d2b1/mm2src/mm2_main/src/lp_native_dex.rs#L64 mm2 in WASM doesn't participate in peer discovery.

SirSevenG commented 1 year ago

mm2 in WASM doesn't participate in peer discovery.

I've checked DB directory exactly on "seed1.defimania.live" and "seed3.defimania.live"

artemii235 commented 1 year ago

@sergeyboyko0791

This is most likely due to the fact that mm2 in WASM connects to the default seednodes only

Even if the WASM node is not connected to other seed nodes, the swap status should be broadcasted to them over Gossipsub.

@SirSevenG

Please check the ERROR level logs. Are there messages like Couldn't deserialize 'SwapStatus'?

SirSevenG commented 1 year ago

@artemii235 @sergeyboyko0791

Repeated tests to get fresh logs, on seed1:

11 13:20:53, adex_ping:27] ERROR Ping error Ping timeout. Disconnecting peer 12D3KooWNeZ5Cp482DpBLEc77CcgmttTkcJ8sfLsmWvJYBEG9Niw
11 13:22:02, adex_ping:27] ERROR Ping error Ping error: unexpected end of file. Disconnecting peer 12D3KooW9xaFr1YCRn21YtpB2ninRBnhnhKt9Xa5FaPQDGmi3B8M
11 13:22:44, lp_swap:215] ERROR Couldn't deserialize 'SwapMsg': Syntax("invalid type: integer `123`, expected struct SignedMessageSerdeHelper")
11 13:22:44, lp_swap:216] ERROR Couldn't deserialize 'SwapStatus': Error("invalid value: string \"d80f133bce6012cd758995d2c413b21308934c70f009d5ed94a25047179f09e3\", expected a hash string", line: 1, column: 6662)
11 13:22:49, lp_swap:215] ERROR Couldn't deserialize 'SwapMsg': Syntax("invalid type: integer `123`, expected struct SignedMessageSerdeHelper")
11 13:22:49, lp_swap:216] ERROR Couldn't deserialize 'SwapStatus': Error("invalid value: string \"d80f133bce6012cd758995d2c413b21308934c70f009d5ed94a25047179f09e3\", expected a hash string", line: 1, column: 7365)

swap uuid: 9ab99205-c469-4b00-b6d4-6f708cf8c638

sergeyboyko0791 commented 1 year ago

I'm checking this, thanks!

sergeyboyko0791 commented 1 year ago

This WASM module targets to the dev branch

WASM module: mm2-9350a3ef8-Linux-Wasm-Release.zip

But the seednode is on mm2.1 branch.

6e4de5d35 - current seednodes version

I suppose that the seednodes can't deserialize the swap status due to this change: https://github.com/KomodoPlatform/atomicDEX-API/blob/c505bfbca3fffeebf06488a91694439cf21c6065/mm2src/mm2_main/src/lp_swap/maker_swap.rs#L137 https://github.com/KomodoPlatform/atomicDEX-API/blob/ffee29455724fecf621575fb6b960a6f14f3451d/mm2src/mm2_main/src/lp_swap/maker_swap.rs#L132

As I can see, d80f133bce6012cd758995d2c413b21308934c70f009d5ed94a25047179f09e3 is H256 hash, so the old mm2 nodes can't deserialize it as H160. Please note that the H256 secret hash algo is used for Tendermint and Lightning swaps only https://github.com/KomodoPlatform/atomicDEX-API/blob/2e720274af8173b42a50fa54bbf36517096bbb51/mm2src/mm2_main/src/lp_swap.rs#L1314-L1321

This will be fixed when dev is merged into mm2.1. Until that time I can prepare a fix into mm2.1 branch.