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

Uncaught Error: Expected a valid key to convert, with length 1, 2, 4, 8, 32, 33 #1250

Closed
4 of 10 tasks
ltfschoen opened this issue Apr 16, 2023 · 7 comments
Closed
4 of 10 tasks
Labels
Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.

Comments

@ltfschoen
Copy link

ltfschoen commented Apr 16, 2023

  • I'm submitting a ...

    • Bug report
    • Feature request
    • Support request
    • Other
  • What is the current behavior and expected behavior?

If I go to https://app.zeitgeist.pm/, using the latest Polkadot.js Extension version 0.44.1, and using the latest Brave browser version 1.50.119 Chromium: 112.0.5615.121 (Official Build) (x86_64).

It displays the following error in the DevTools console:

Screen Shot 2023-04-16 at 9 54 59 am

Clicking the error messages shows that it's related to the Polkadot.js Extension

Screen Shot 2023-04-16 at 10 01 49 am

Screen Shot 2023-04-16 at 10 02 01 am

So if i try clicking "Connect" and selecting "Polkadot.js Extension" to connect my wallet it doesn't work.
In the past I have been able to connect my wallet this way without any issues.

Note that I have authorised the website to connect to Polkadot.js Extension already:

Screen Shot 2023-04-16 at 10 16 12 am

Additionally, if i go to https://singular.app/, using the same version of Polkadot.js Extension and Brave version.

It displays the following error in the DevTools console:

Screen Shot 2023-04-16 at 9 48 25 am

Clicking the error messages shows that it's related to the Polkadot.js Extension

Screen Shot 2023-04-16 at 10 03 28 am

Screen Shot 2023-04-16 at 10 03 17 am

Then when I click to "Connect" and choose "Select account" to choose a wallet using the Polkadot.js Extension, it then shows a modal indicating that I don't have any accounts, even though I do.
In the past I have been able to connect my wallet this way without any issues.

Screen Shot 2023-04-16 at 9 48 39 am

  • What is the motivation for changing the behavior?

I'm an end-user of these Substrate-based chains. Seeing a similar error across more than one of them made report it here incase its a bug report or support request that could help more than one chain.

  • Please tell us about your environment:

    • Version: 0.44.1

    • Environment:

      • Node.js
      • Browser - Brave browser version 1.50.119 Chromium: 112.0.5615.121 (Official Build) (x86_64)
      • Other (limited support for other environments)
    • Language:

      • JavaScript
      • TypeScript (include tsc --version)
      • Other
        N/A
@jacogr
Copy link
Member

jacogr commented Apr 16, 2023

Does it inject and display the accounts on the apps UI? (There are additional filters that dapps need to apply for Ethereum-like accounts - the extension only supplies the accounts, the dapp needs to filter based on chain type)

@jacogr
Copy link
Member

jacogr commented Apr 16, 2023

Verified - it is related to the actual dapps, not the extension. Can re-create the issue on the specified dapps with Ethereum accounts.

I would suggest raising the issue there - there is nothing the extension can do, it supplies all accounts to the apps (unless there is a genesis specified by the dapp, in that case it would filter to the accounts for the specific genesisHash). So it sits purely in the account handling code for the dapps.

@jacogr jacogr added the Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance. label Apr 16, 2023
@ltfschoen
Copy link
Author

ltfschoen commented Apr 16, 2023

Does it inject and display the accounts on the apps UI? (There are additional filters that dapps need to apply for Ethereum-like accounts - the extension only supplies the accounts, the dapp needs to filter based on chain type)

yes for example with Zeitgeist it already shows all my balances successfully in the apps UI. however i did notice that i hadn't updated my metadata

Screen Shot 2023-04-16 at 5 33 17 pm

so i did that as shown below, but it still showed the same error in the Zeitgeist and RMRK dapps

Screen Shot 2023-04-16 at 5 33 53 pm

@jacogr
Copy link
Member

jacogr commented Apr 16, 2023

Like I said above - it is in the account handling for the specific dapps. You need to log the issue there. (Ethereum-accounts are non-32-bytes in length, so when injected by the extension it cannot be handled by them)

@ltfschoen
Copy link
Author

So I just checked and https://singular.app have fixed the error.
I still get the error with Zeitgeist, and I published this issue on Polkaverse here https://polkaverse.com/@luke/polkadot-d-app-errors-when-handling-accounts-supplied-by-the-47114 and Dynatle solved the same error message Error: Expected a valid key to convert, with length 1, 2, 4, 8, 32, 33 in Polkaverse dApp here https://github.com/dappforce/polkaverse/pull/210/files#diff-ca62a13994aae3c545ad2d796d272f3ee8c0ab33b83bb3d5c023dc553b55f984R14, where they said the main issue was that before they convert the address directly, they were parsing it using formatBalance from polkadot js, which throws an error if the address is not valid. It can be invalid if the user connects using maybe talisman, and connect all of his accounts, including their EVM wallets. So the solution was to wrap it in try/catch.

@Tbaut
Copy link
Contributor

Tbaut commented Feb 7, 2024

Note that the pjs exension also allows EVM accounts when imported through json afair. The solution is indeed on the dapp side, and is actually not related to the extension, but rather the functions such as encodeAddress or decodeAddress from @polkadot/util-crypto that must be wrapped into a try/catch.

@Tbaut Tbaut closed this as completed Feb 7, 2024
@polkadot-js-bot
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Feb 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.
Projects
None yet
Development

No branches or pull requests

4 participants