signum-network / signum-xt-wallet

Cryptocurrency wallet for the green Signum 🍀 blockchain as an extension for your browser.
MIT License
14 stars 6 forks source link

Unable to display P2P Messages on account with has_encrypttoself_message=1 #63

Closed Namudril closed 1 year ago

Namudril commented 1 year ago

Describe the bug If an account with existing messages have sent encrypted message with parameter EncryptToSelfMessage via API, XT Wallet can't display no new nor old messages on the P2P Messages tab.

To Reproduce Steps to reproduce the behavior:

  1. Create and activate a new account: S-XZHR-G9B3-2QTZ-DDZLM
  2. Send some messages with this new account to random existing accounts
  3. Send an encrypted message with parameter EncryptToSelfMessage via API parameters set are: [string]recipient : self account address S-XZHR-G9B3-2QTZ-DDZLM [int64]feeNQT : 1000000 [string]secretPhrase : pass/seed phrase [int32]deadline : 60 [string]messageToEncryptToSelf : some text to encrypt, used the following: When encrypting messages to yourself, you may want to use this field. [boolean]messageToEncryptToSelfIsText : true Test transaction ID: 897980924246487487
  4. See error : 4.1 For a test account, transaction to self can't be displayed in XT Wallet and Copy button takes a copy of an address, not a message, like in other cases изображение

4.2 For a main account S-BHGT-NTCV-K4VS-ACTUZ there's an error on a P2P Message tab, none of existing messages can be seen изображение

Expected behavior An icon of a lock with a text Click to reveal is expected to be displayed, with an ability to decrypt an encrypted message sent to self.

Screenshots If applicable, add screenshots to help explain your problem.

Browser (please complete the following information):

Additional context Main account S-BHGT-NTCV-K4VS-ACTUZ messages were broken after transaction id 3967388505940051613 and can be displayed by Classic Wallet only (all except the message to self).

ohager commented 1 year ago

Thank for reporting.

ohager commented 1 year ago

The error in wallet is caused by Transaction 7571099779367044149, which is marked as Arbitrary Message (Type:1, Subtype: 0) but has no attachment at all and though causes an undefined exception. Not sure, how you were able to create this transaction.

{
    "type": 1,
    "subtype": 0,
    "timestamp": 265893110,
    "deadline": 1440,
    "senderPublicKey": "bbc48b1e7f47816a718ed2a687e7e598c4813550575bac82c78966d5c20c1431",
    "recipient": "10370429460841545177",
    "recipientRS": "S-BHGT-NTCV-K4VS-ACTUZ",
    "amountNQT": "0",
    "feeNQT": "1000000",
    "signature": "4ce82222d30f81fb49e0156eedca7be6f65d3ec77b78058806daefb9ec3d6700fdc3db45a67208fef1fc23508ede668bb272ec606b0ff0ab2264e64bce092c55",
    "signatureHash": "2ee4b89101f5224c3eb3443d93938d325a658e6f79aa2104732fac48728a7e5d",
    "fullHash": "350436cc22f311697e51a3ca089d4dd2b57ba111f7eecd9d2dfbea8a780a2a02",
    "transaction": "7571099779367044149",
    "sender": "10370429460841545177",
    "senderRS": "S-BHGT-NTCV-K4VS-ACTUZ",
    "height": 1101780,
    "version": 2,
    "ecBlockId": "13018393768308794197",
    "ecBlockHeight": 1101770,
    "cashBackId": "10370429460841545177",
    "block": "13020333166423716473",
    "confirmations": 19776,
    "blockTimestamp": 265893151
}

I'm adding an additional check...This type of tx should not be possible imho, as the type requires an attachment object.

ohager commented 1 year ago

After I consulted @jjos2372 it is technically legit to have message transactions without attachment (not sure how you did this), and I fixed the message list, such no error appears anymore. Furthermore, I found a small bug, which did not decrypted messages send to self using the common encryption feature. At this moment, the encryptToSelf thing is not supported by XT (nor SignumJS), and I do not see any good reason to do so - yet. Will discuss further with jjos and deleterium regarding the encryptToSelf thing.

I close this as (partially) solved. At least the wallet won't show the error anymore (upcoming version)

Namudril commented 1 year ago

After I consulted @jjos2372 it is technically legit to have message transactions without attachment (not sure how you did this), and I fixed the message list, such no error appears anymore. Furthermore, I found a small bug, which did not decrypted messages send to self using the common encryption feature. At this moment, the encryptToSelf thing is not supported by XT (nor SignumJS), and I do not see any good reason to do so - yet. Will discuss further with jjos and deleterium regarding the encryptToSelf thing.

I close this as (partially) solved. At least the wallet won't show the error anymore (upcoming version)

Hi, thank a lot, really appreciate the efforts and fixes! It's a shame I can't even reproduce the issue and can't tell exactly now what fields were filled into the api form. Regarding a transaction that prevents XT Wallet to display any message, I think it is 9011436419893624201, that has an attachment, not 7571099779367044149 you mentioned. I can see both those Txs in Classic Wallet in the Transactions section and even an encrypted message of Tx 9011436419893624201 can be decrypted and displayed correctly. In a Messages section of Classic Wallet I can see only 9011436419893624201 in a list but without a message displayed. All other messages (to and from other accounts) are displayed correctly. XT, Phoenix Web 1.4.2 and Phoenix 1.5.0-beta.2 can't display any message at all for my account. Looking forward to the new version of XT Wallet to see the progress. GL!

ohager commented 1 year ago

I think in Phoenix it will be the same problem. I assume that a message has always an attachment object, but that's apparently not guaranteed... so, I need to apply the same fix there. For Phoenix you have to wait for beta.3 then. Sorry. But XT 1.4.1 was just released.