CloakedServices / CloakedNetworkPoC

Whitepaper @ https://github.com/CloakedServices/CloakedNetwork
GNU Affero General Public License v3.0
1 stars 0 forks source link

topup command times out before response is received #42

Closed mixmasala closed 7 months ago

mixmasala commented 7 months ago
12:09:21.839 DEBU katzensocks_client: Got SOCKS5 request: &{en.wikipedia.org:443 1 <nil> 0xc006cafd20}
12:09:21.839 DEBU katzensocks_client: Added session 1c31d5bf4b04ed562dc6fb7d77d5fc0af8b3b1d54476ab2f89e54bfd9fe4048a
12:09:23.318 DEBU provider2_client: SendMessage
12:09:23.321 DEBU provider2_client: doSend [e6f79698941f9e5dc9533a4d6c50ba43] with SURB ID [feab3f4860231a52a8872ca494c36c7c]
12:09:23.321 DEBU minclient:79b71d690a2ffb37144e00cdfcc6417658b659f25b680e37fab7ab7fc83ef542@provider2: Hop[0] 'provider2' - 8 ms
12:09:23.321 DEBU minclient:79b71d690a2ffb37144e00cdfcc6417658b659f25b680e37fab7ab7fc83ef542@provider2: Hop[1] 'mix1' - 9 ms
12:09:23.321 DEBU minclient:79b71d690a2ffb37144e00cdfcc6417658b659f25b680e37fab7ab7fc83ef542@provider2: Hop[2] 'mix2' - 3 ms
12:09:23.321 DEBU minclient:79b71d690a2ffb37144e00cdfcc6417658b659f25b680e37fab7ab7fc83ef542@provider2: Hop[3] 'mix3' - 9 ms
12:09:23.321 DEBU minclient:79b71d690a2ffb37144e00cdfcc6417658b659f25b680e37fab7ab7fc83ef542@provider2: Hop[4] 'provider1' - 33 ms
12:09:23.321 DEBU minclient:79b71d690a2ffb37144e00cdfcc6417658b659f25b680e37fab7ab7fc83ef542@provider2: Hop[0] 'mix1' - 50 ms
12:09:23.321 DEBU minclient:79b71d690a2ffb37144e00cdfcc6417658b659f25b680e37fab7ab7fc83ef542@provider2: Hop[1] 'mix2' - 50 ms
12:09:23.321 DEBU minclient:79b71d690a2ffb37144e00cdfcc6417658b659f25b680e37fab7ab7fc83ef542@provider2: Hop[2] 'mix3' - 34 ms
12:09:23.321 DEBU minclient:79b71d690a2ffb37144e00cdfcc6417658b659f25b680e37fab7ab7fc83ef542@provider2: Hop[3] 'provider2' - 0 ms
12:09:23.326 DEBU minclient/conn:79b71d690a2ffb37144e00cdfcc6417658b659f25b680e37fab7ab7fc83ef542@provider2: Enqueued packet for send.
12:09:23.326 DEBU minclient/conn:79b71d690a2ffb37144e00cdfcc6417658b659f25b680e37fab7ab7fc83ef542@provider2: Dequeued packet for send.
12:09:23.326 DEBU minclient/conn:79b71d690a2ffb37144e00cdfcc6417658b659f25b680e37fab7ab7fc83ef542@provider2: Sent SendPacket.
12:09:23.326 DEBU provider2_client: doSend setting ReplyETA to 196ms
12:09:24.992 ERRO katzensocks_client: Failed to topup session [28 49 213 191 75 4 237 86 45 198 251 125 119 213 252 10 248 179 177 213 68 118 171 47 137 229 75 253 159 228 4 138]: failure waiting for reply, timeout reached
12:09:25.470 DEBU minclient/conn:79b71d690a2ffb37144e00cdfcc6417658b659f25b680e37fab7ab7fc83ef542@provider2: Received MessageACK: 6
12:09:25.470 INFO provider2_client: OnACK with SURBID [feab3f4860231a52a8872ca494c36c7c]
12:09:25.470 WARN provider2_client: Discarding surb [feab3f4860231a52a8872ca494c36c7c] for blocking message &e6f79698941f9e5dc9533a4d6c50ba43 : caller likely timed-out
mixmasala commented 7 months ago

A reply was expected within ~200ms, but arrived 478ms too late.

12:09:23.326 DEBU provider2_client: doSend setting ReplyETA to 196ms
12:09:24.992 ERRO katzensocks_client: Failed to topup session [28 49 213 191 75 4 237 86 45 198 251 125 119 213 252 10 248 179 177 213 68 118 171 47 137 229 75 253 159 228 4 138]: failure waiting for reply, timeout reached
12:09:25.470 DEBU minclient/conn:79b71d690a2ffb37144e00cdfcc6417658b659f25b680e37fab7ab7fc83ef542@provider2: Received MessageACK: 6
12:09:25.470 INFO provider2_client: OnACK with SURBID [feab3f4860231a52a8872ca494c36c7c]
mixmasala commented 7 months ago

The issue is that client.BlockingSendUnreliableMessage presumes when a timeout should occur, but the server-side responder needs to send a message to the cashu mint service, and wait for the response.

The fix is to modify the API so that it accepts a context.Context which the caller can use to decide when to timeout.

mixmasala commented 7 months ago

43