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

GRS swap fails #460

Closed
cipig opened this issue Jul 13, 2019 · 15 comments
Closed

GRS swap fails #460

cipig opened this issue Jul 13, 2019 · 15 comments
Assignees
Labels
bug Something isn't working

Comments

@cipig
Copy link
Member

cipig commented Jul 13, 2019

sendrawtransaction fails with mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation) (code 16)

         "timestamp" : 1562984481696,
         "event" : {
            "data" : {
               "error" : "lp_swap:1030] utxo:759] utxo:483] utxo:480] rpc_clients:291] JsonRpcError { request: JsonRpcRequest { jsonrpc: \"1.0\", id: \"0\", method: \"sendrawtransaction\", params: [String(\"0100000001fceaa037047ee4ba1e81fc7a4a334eeddd35d2af4db5471a461916fedc330e4e000000006a473044022069277e6c74926406d232ea2a9f29128d747d6a5550885794d0f4623223f9429f02203f97fa1ef36b2846d9124530a04d8b2f5466d6fc9429f368c60c337c52ba344b0121031bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8ffffffff0280f0fa020000000017a914b1f95a3ed3441eca6964c4c7b8628e0f7394967b87aa91adfb030000001976a914c3f710deb7320b0efa6edb14e3ebeeb9155fa90d88ac2140295d\")] }, error: Transport(\"rpc_clients:244] Rpc request JsonRpcRequest { jsonrpc: \\\"1.0\\\", id: \\\"0\\\", method: \\\"sendrawtransaction\\\", params: [String(\\\"0100000001fceaa037047ee4ba1e81fc7a4a334eeddd35d2af4db5471a461916fedc330e4e000000006a473044022069277e6c74926406d232ea2a9f29128d747d6a5550885794d0f4623223f9429f02203f97fa1ef36b2846d9124530a04d8b2f5466d6fc9429f368c60c337c52ba344b0121031bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8ffffffff0280f0fa020000000017a914b1f95a3ed3441eca6964c4c7b8628e0f7394967b87aa91adfb030000001976a914c3f710deb7320b0efa6edb14e3ebeeb9155fa90d88ac2140295d\\\")] } failed with HTTP status code 500 Internal Server Error, response body: {\\\"result\\\":null,\\\"error\\\":{\\\"code\\\":-26,\\\"message\\\":\\\"mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation) (code 16)\\\"},\\\"id\\\":\\\"0\\\"}\\n\") }"
            },
            "type" : "MakerPaymentTransactionFailed"
         }
@artemii235
Copy link
Member

@cipig Hi, thank you for your report, I remember this issue #348, have the swaps ever worked with GRS after this one was fixed?

@cipig
Copy link
Member Author

cipig commented Sep 23, 2019

#462 (comment)

@gruve-p
Copy link

gruve-p commented Sep 6, 2020

@cipig Thanks for making me aware of this issue.

@artemii235 Transaction hashes are sha256 digests in Groestlcoin instead of sha256d digests as in Bitcoin.
Source: https://github.com/Groestlcoin/grs-dev-docs/blob/master/hashes.md

@jl777 integrated GRS a while ago in Supernet: jl777@632047f

@ca333
Copy link

ca333 commented Sep 10, 2020

Thank you for the information @gruve-p - we will look into this soon and keep you posted.

@gruve-p
Copy link

gruve-p commented Jan 20, 2021

Any updates on this @artemii235 ?

@artemii235
Copy link
Member

@gruve-p Thanks for following up! I added this issue to my next week's task list.

artemii235 added a commit that referenced this issue Feb 8, 2021
@artemii235
Copy link
Member

@cipig Could you please try to withdraw and swap GRS using the https://github.com/KomodoPlatform/atomicDEX-API/tree/mm2.1-grs-fix branch?

@artemii235 artemii235 self-assigned this Feb 8, 2021
@artemii235 artemii235 added the bug Something isn't working label Feb 8, 2021
@cipig
Copy link
Member Author

cipig commented Feb 8, 2021

Tried a swap, but doesn't work as expected. It started and maker sent MakerPayment:

      {
         "event" : {
            "data" : {
               "tx_hex" : "0100000001fceaa037047ee4ba1e81fc7a4a334eeddd35d2af4db5471a461916fedc330e4e000000006b4830450221009b7aafec76121b93c74254fe0948f750d667892fd43cd1fdc79719e85734cf5902205e4bd001d6b3ddfb8bffa8f9d70f97e092258a2d5b96753added6444bb4481f10121031bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8ffffffff0380f0fa020000000017a9142a02d38e434bce4f5af7546c7ede3a7bcac83675870000000000000000166a14f7207242c5a763136fcfced86591bb1088b80c49cea4adfb030000001976a914c3f710deb7320b0efa6edb14e3ebeeb9155fa90d88ac0e382160",
               "tx_hash" : "225565cd43e49065a6c3d11ababe8a34fd9f273a632d4435fbc2173199576730"
            },
            "type" : "MakerPaymentSent"
         },
         "timestamp" : 1612789774633
      }

but the tx hash is wrong and he can't find it

08 13:16:19, rpc_clients:156] Error JsonRpcError { client_info: "coin: GRS", request: JsonRpcRequest { jsonrpc: "1.0", id: "99", method: "getrawtransaction", params: [String("225565cd43e49065a6c3d11ababe8a34fd9f273a632d4435fbc2173199576730"), Number(1)] }, error: Transport("rpc_clients:445] Rpc request JsonRpcRequest { jsonrpc: \"1.0\", id: \"99\", method: \"getrawtransaction\", params: [String(\"225565cd43e49065a6c3d11ababe8a34fd9f273a632d4435fbc2173199576730\"), Number(1)] } failed with HTTP status code 500 Internal Server Error, response body: {\"result\":null,\"error\":{\"code\":-5,\"message\":\"No such mempool or blockchain transaction. Use gettransaction for wallet transactions.\"},\"id\":\"99\"}\n") } getting the transaction 225565cd43e49065a6c3d11ababe8a34fd9f273a632d4435fbc2173199576730, retrying in 10 seconds

in the debug.log of groestlcoind there is this entry:

2021-02-08T13:09:34Z [default wallet] AddToWallet 3c2aa49e7ecd19e21277b056fcf93467116b2122e42dcc5985d32c5ec1c9a0d3  new
2021-02-08T13:12:51Z UpdateTip: new best=000000000000067682aa9276d688dbb5e0c38c5be0ef6325e2b68dbb30b3a58b height=3457301 version=0x20000000 log2_work=71.580122 tx=4538404 date='2021-02-08T13:12:27Z' progress=1.000000 cache=0.0MiB(80txo)
2021-02-08T13:12:51Z [default wallet] AddToWallet 3c2aa49e7ecd19e21277b056fcf93467116b2122e42dcc5985d32c5ec1c9a0d3  update

so mm2 thinks the tx hash is 225565cd43e49065a6c3d11ababe8a34fd9f273a632d4435fbc2173199576730, but in reality it is 3c2aa49e7ecd19e21277b056fcf93467116b2122e42dcc5985d32c5ec1c9a0d3
the block explorer shows it: https://chainz.cryptoid.info/grs/tx.dws?3c2aa49e7ecd19e21277b056fcf93467116b2122e42dcc5985d32c5ec1c9a0d3.htm

@artemii235
Copy link
Member

Thanks for testing! GRS also uses single sha256 for transaction hash, which makes things a bit more complicated for MM2. I'm going this fix this now.

@artemii235
Copy link
Member

@cipig Could you recheck it 1 more time using the same branch, please?

@cipig
Copy link
Member Author

cipig commented Feb 9, 2021

Worked perfect this time. See https://github.com/KomodoPlatform/coins/blob/master/swaps/GRS-KMD.md for the swap transactions.

@cipig cipig closed this as completed Feb 9, 2021
@artemii235
Copy link
Member

@cipig Could you please test it a bit more? There are quite many minor code changes in various places so it's worth checking different swap scenarios: both taker and maker sides, refunds, recovery of stuck swaps, etc.

@artemii235 artemii235 reopened this Feb 10, 2021
@cipig
Copy link
Member Author

cipig commented Feb 10, 2021

sure, i will do more tests

Refund worked, i could refund the swap that failed before your last fix

{
   "result" : {
      "tx_hex" : "0100000001d3a0c9c15e2cd38559cc2de422216b116734f9fc56b07712e219cd7e9ea42a3c00000000b7483045022100853950cfd10e69d1e400138a89677ee818e07e9f3e020648a1c1fd2f7340766f022076a756c75689466de4a2c8b0e29e748d938c4c8044a455743604f81f636e0ad201514c6b6304fb742160b17521031bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8ac6782012088a914f7207242c5a763136fcfced86591bb1088b80c4988210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ac68feffffff01a8d8fa02000000001976a914c3f710deb7320b0efa6edb14e3ebeeb9155fa90d88ac62062360",
      "tx_hash" : "1c719de2b3b7830638b85d6672e7f236b3e56be9cc3f4c4cfbb3aee95586f224",
      "action" : "RefundedMyPayment",
      "coin" : "GRS"
   }
}

the tx: https://chainz.cryptoid.info/grs/tx.dws?1c719de2b3b7830638b85d6672e7f236b3e56be9cc3f4c4cfbb3aee95586f224.htm

artemii235 added a commit that referenced this issue Feb 11, 2021
* Fix GRS tx signing #460

* WIP.

* Set the tx_hash_algo to coin's tx_hash_algo on tx deserialization.
@artemii235
Copy link
Member

I have merged the PR with a fix to mm2.1. It will be included in the upcoming GUIs release.

@cipig
Copy link
Member Author

cipig commented Feb 11, 2021

btw, works in latest Desktop GUI build:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants