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

Application error when sending certain SIP10 tokens #5436

Closed
DeeList opened this issue May 24, 2024 · 8 comments · Fixed by #5438 or #5442
Closed

Application error when sending certain SIP10 tokens #5436

DeeList opened this issue May 24, 2024 · 8 comments · Fixed by #5438 or #5442
Assignees
Labels
bug-p1 Critical functionality broken for many customers, with no clear workarounds

Comments

@DeeList
Copy link

DeeList commented May 24, 2024

The error occurs in 6.41.0 when trying to send certain tokens. I could only see the issue when testing the send of these tokens NOT, BULL, MOJO, FOX, DOGE, ALL.

siperror
@pete-watters
Copy link
Contributor

pete-watters commented May 24, 2024

I checked this with DOGE and can reproduce.

It's failing as we have some code that is looking for an entry for a 3rd item in the tx.payload.functionArgs[3] .

I'm not familiar with this flow so not sure why its hardcoded to look for functionArgs[3] . Looking at related code it could be the memo should be there? I tried sending with a memo and no luck.

I checked and the change comes from this PR: #4696

We had an open Q about it: #4696 (comment)

@pete-watters pete-watters self-assigned this May 24, 2024
@pete-watters pete-watters added the bug-p1 Critical functionality broken for many customers, with no clear workarounds label May 24, 2024
@pete-watters pete-watters linked a pull request May 24, 2024 that will close this issue
@pete-watters
Copy link
Contributor

I have added some defensive code that will stop the UI crashing and allow users to get past the initial error but when I try and actually send these tokens it fails at the next step:
Screenshot 2024-05-24 at 06 21 43

It gives a 400 (Bad Request) from https://api.hiro.so/v2/transactions then a transaction broadcast error:

{
    "error": "transaction rejected",
    "reason": "BadFunctionArgument",
    "reason_data": {
        "message": "IncorrectArgumentCount(4, 3)"
    },
    "txid": "33903b1126f0dea7234a58ec879f00cc1d38c844d26837024b01d76ace168cef"
}

It seems like these tokens are missing the 4th entry in functionArgs (functionArgs[3]) which is needed

@314159265359879
Copy link
Contributor

I tested 6.41.0 with several SIP010 tokens but not these; I am surprised there is a difference between them, though.

@pete-watters
Copy link
Contributor

I merged am improvement #5438 so that we don't crash the UI on send here but broadcast is still failing

@kyranjamie
Copy link
Collaborator

kyranjamie commented May 24, 2024

Yeah so 4 arguments are indeed required, not sure where/how this changed.

(transfer ((amount uint) (sender principal) (recipient principal) (memo (optional (buff 34)))) (response bool uint))

Looks like useGenerateFtTokenTransferUnsignedTx has changed recently with some refactor work so likely introduced there.

Does this code not run?

https://github.com/leather-wallet/extension/blob/cd0dc590ab9866a5634e577a3695733447e185df/src/app/store/transactions/token-transfer.hooks.ts#L126-L128

@pete-watters
Copy link
Contributor

Yeah so 4 arguments are indeed required, not sure where/how this changed.

(transfer ((amount uint) (sender principal) (recipient principal) (memo (optional (buff 34)))) (response bool uint))

Looks like useGenerateFtTokenTransferUnsignedTx has changed recently with some refactor work so likely introduced there.

Does this code not run?

https://github.com/leather-wallet/extension/blob/cd0dc590ab9866a5634e577a3695733447e185df/src/app/store/transactions/token-transfer.hooks.ts#L126-L128

I checked and we don't seem to hit this section at all. I can look into it.

On retry a send of DOGE I got different errors. First it got rejected for a BadNonce:
Screenshot 2024-05-24 at 10 08 40

Then it got rejected for another issue, I assume relates to API rate limiting:

Your transaction failed to broadcast because of the error: cannot read properties of undefined (reading 'startswith')

I notice that we also don't convert the amount from DOGE to USD and I can see a console error for a 404 to https://api.coincap.io/v2/assets/undefined

When tried to roll back to v6.40.0 to test as I think the bug could come from #5414 but I am getting a ton of API issues, rate limiting etc. in the dev wallet. I tried using a VPN but no luck.

I will keep investigating

@pete-watters
Copy link
Contributor

@DeeList @314159265359879 , we have a release for this ready: #5450

Can you confirm that sending of these tokens was working previously? It's unclear if this is a regression or something that wasn't working in the past either. Any help QA-ing the release would be most appreciated. Thanks!

CC @fbwoolf

@fbwoolf
Copy link
Contributor

fbwoolf commented May 24, 2024

Will close this again bc it was released.

@fbwoolf fbwoolf closed this as completed May 24, 2024
kyranjamie pushed a commit that referenced this issue May 24, 2024
## [6.41.1](v6.41.0...v6.41.1) (2024-05-24)

### Bug Fixes

* always set memo for SIP10, ref [#5436](#5436) ([9a8d965](9a8d965))
* display runes balance, closes [#5434](#5434) ([76ee219](76ee219))
* handle undefined memo type for SIP10, ref [#5436](#5436) ([613ab55](613ab55))
@fbwoolf fbwoolf mentioned this issue Jun 6, 2024
kyranjamie pushed a commit that referenced this issue Jun 6, 2024
## [6.42.0](v6.41.1...v6.42.0) (2024-06-06)

### Features

* add query error analytics ([f46cc89](f46cc89))
* panda preset package, ref leather-wallet/issues[#62](#62) ([36e5238](36e5238))
* update error page ([4fd1dbe](4fd1dbe))
* use bitcoin queries from monorepo + inscriptions from monorepo ([2f113fc](2f113fc))

### Bug Fixes

* align DialogHeader title on center, ref [#5419](#5419) ([2e7fd2d](2e7fd2d))
* always set memo for SIP10, ref [#5436](#5436) ([40f6059](40f6059))
* asset list formatted balance, closes [#5452](#5452) ([81f4fa8](81f4fa8))
* asset models contractid inconsistencies ([d023622](d023622))
* close button still showing in breakpoint ([632a32d](632a32d))
* display runes balance, closes [#5434](#5434) ([aa50a08](aa50a08))
* extension build workflow, ref leather-wallet/issues[#72](#72) ([a24c6de](a24c6de))
* handle undefined memo type for SIP10, ref [#5436](#5436) ([b98a5e7](b98a5e7))
* inconsistent typing with txValue ([56d4fa2](56d4fa2))
* integration tests setup ([ea2d8ea](ea2d8ea))
* **long-bns-names:** truncate BNS names ([a45024a](a45024a))
* merge main conflicts ([176b0d8](176b0d8))
* reenable compliance checks ([e9d7ed2](e9d7ed2))
* remove hover style in sign out button, ref [#5406](#5406) ([3656acf](3656acf))
* scroll in settings menu popup ([348d688](348d688))
* set pointer events to none in toast viewport ([093856e](093856e))
* tests using test app ([51e05fb](51e05fb))
* warn users against using support tool for help ([755448f](755448f))

### Internal

* **deps:** bump @leather-wallet/tokens from 0.0.14 to 0.4.0 ([8b26fdd](8b26fdd))
* move fees models out of extension ([a48ba01](a48ba01))
* move money and market utils out of extension ([ab7fb16](ab7fb16))
* post-release merge back ([281e718](281e718))
* update panda + panda-preset ([8489f69](8489f69))
* update pnpm ([b3411dc](b3411dc))
* upgade @stacks/* packages, closes [#5184](#5184) ([3f53051](3f53051))
* upgrade @noble/* packages ([aea1c99](aea1c99))
* upgrade leather packages ([b117fab](b117fab))
* upgrade various dependencies ([16b7567](16b7567))
* **utils:** migrate money utils out of extension ([43ad127](43ad127))
* **utils:** mirgrate more utils out of extension ([d8e0088](d8e0088))
* **utils:** use utils package, closes leather-wallet[#73](#73) ([53430a7](53430a7))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-p1 Critical functionality broken for many customers, with no clear workarounds
Projects
None yet
6 participants