mpcium icon indicating copy to clipboard operation
mpcium copied to clipboard

Repeatedly create the same walletID

Open cppfuns opened this issue 1 year ago • 9 comments

When the same walletID is used to call mpcClient.createWallet again to create a wallet, the front end does not return for a long time and keeps waiting.

CreateWallet request sent via core NATS for wallet: 8244ab67-4630-44aa-bf9d-8100e5f7cf6b:0
2025-07-16T01:02:49.556Z CreateWallet sent #1, awaiting result... walletID: 8244ab67-4630-44aa-bf9d-8100e5f7cf6b:0

The mpcium node issues an error message

WRN Keygen session error error="Key already exists: 81418adb-fb32-4e17-9b85-8ae207aa9cb8:0" context="Failed to create ECDSA key generation session" errorCode=ERROR_KEY_ALREADY_EXISTS walletID=81418adb-fb32-4e17-9b85-8ae207aa9cb8:0

Suggestion: Exceptions should be handled properly, error information should be returned to the front end, and back end errors should not be triggered.

cppfuns avatar Jul 16 '25 01:07 cppfuns

hey @cppfuns thanks for reporting

CreateWallet request sent via core NATS for wallet: 8244ab67-4630-44aa-bf9d-8100e5f7cf6b:0 2025-07-16T01:02:49.556Z CreateWallet sent #1, awaiting result... walletID: 8244ab67-4630-44aa-bf9d-8100e5f7cf6b:0

Are you running multiple clients?

You probably might receive the response on the other client, not from the client that you sent the message

anhthii avatar Jul 16 '25 01:07 anhthii

WRN Keygen session error error="Key already exists: 81418adb-fb32-4e17-9b85-8ae207aa9cb8:0" context="Failed to create ECDSA key generation session" errorCode=ERROR_KEY_ALREADY_EXISTS walletID=81418adb-fb32-4e17-9b85-8ae207aa9cb8:0

Suggestion: Exceptions should be handled properly, error information should be returned to the front end, and back end errors should not be triggered.

Ok we may just not log this at all on the node and only return the error to client

anhthii avatar Jul 16 '25 01:07 anhthii

I only have one client running and it is waiting for a long time

Modify this to become a fixed walletID https://github.com/fystack/mpcium-client-ts/blob/d6d347267049aa5e3302d62038bda7803c466421/examples/generate.ts#L73

cppfuns avatar Jul 16 '25 04:07 cppfuns

The expected result is that the node should not trigger the error level, and the client should receive the corresponding information from onWalletCreationResult, which should not only contain successful KeygenSuccessEvent information, but also errors and some timeouts.

Best wishes

cppfuns avatar Jul 16 '25 04:07 cppfuns

ImageThere is an idempotentkey here which is cached for several minutes, so if you already do something with the same wallet id earlier, it may consider it as duplicate event and discard it

anhthii avatar Jul 16 '25 04:07 anhthii

The expected result is that the node should not trigger the error level, and the client should receive the corresponding information from onWalletCreationResult, which should not only contain successful KeygenSuccessEvent information, but also errors and some timeouts.

Best wishes

on what case you get time out error @cppfuns ?

anhthii avatar Jul 16 '25 04:07 anhthii

The expected result is that the node should not trigger the error level, and the client should receive the corresponding information from onWalletCreationResult, which should not only contain successful KeygenSuccessEvent information, but also errors and some timeouts. Best wishes

on what case you get time out error @cppfuns ?

When you call mpcClient.createWallet again to create a wallet using the same walletID

I only have one client running and it is waiting for a long time

Modify this to become a fixed walletID https://github.com/fystack/mpcium-client-ts/blob/d6d347267049aa5e3302d62038bda7803c466421/examples/generate.ts#L73

I can reproduce it every time I try it, maybe you can try it

Best wishes

cppfuns avatar Jul 17 '25 01:07 cppfuns

The expected result is that the node should not trigger the error level, and the client should receive the corresponding information from onWalletCreationResult, which should not only contain successful KeygenSuccessEvent information, but also errors and some timeouts.

Best wishes

Expected to receive relevant errors from onWalletCreationResult

cppfuns avatar Jul 17 '25 01:07 cppfuns

ok we will have a fix for this

anhthii avatar Jul 17 '25 02:07 anhthii