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

Unable to sign transactions from extension but works with keyring #1269

Open
3 of 10 tasks
Leouarz opened this issue Jul 5, 2023 · 1 comment
Open
3 of 10 tasks

Unable to sign transactions from extension but works with keyring #1269

Leouarz opened this issue Jul 5, 2023 · 1 comment
Labels
Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.

Comments

@Leouarz
Copy link

Leouarz commented Jul 5, 2023

  • I'm submitting a ...

    • Bug report
    • Feature request
    • Support request
    • Other
  • What is the current behavior and expected behavior?
    When signing a transaction with polkadot extension, i get 1010: Invalid Transaction: Transaction has a bas signature
    image

Now the chain has a signed extensions but no additional signed. When debugging in the extension, i don't see any missing data.
From the node itself, i compared correct and incorrect data and the only difference is in the signature (quite obvious I guess)

Working:
AppUncheckedExtrinsic: Signed: 0687ecfe54a6970a799958522f58646c446891535cc54fa5cd0d7c3a8f6ab105 (5CDGXH8Q...), Signature: MultiSignature::Sr25519(7c01d7eb3ed15dbfa674c42555204c620592e9be10527cb2dea4a45bbf313b48e4d9ccd5f88a4f51f8cd2ea95def17d428819b6536fde28f15552dae54fcf98d), RawPayload: SignedPayload(call: RuntimeCall::Balances(Call::transfer_keep_alive { dest: MultiAddress::Id(581fc8e1118518d6073c2800a3e2dadac231e45eb8c73367bc24fb67e429fc4f (5E4FWi7V...)), value: 1000000000000000000 }), extra: (CheckNonZeroSender, CheckSpecVersion, CheckTxVersion, CheckGenesis, CheckMortality(Era::Mortal(64, 49)), CheckNonce(0), CheckWeight, ChargeTransactionPayment<0>, CheckAppId: 0), additional_signed: ((), 9, 1, 0x0692a0b7fa1b54f57f0f1e5c341231f8c56431b1c1ca45d23b94f57e21ff1272, 0xe9b397dc7e6cbbd596588a2562af0cc05d2608d91956218f54d7bbc5542b0ade, (), (), (), ()))

Non working:
AppUncheckedExtrinsic: Signed: 0687ecfe54a6970a799958522f58646c446891535cc54fa5cd0d7c3a8f6ab105 (5CDGXH8Q...), Signature: MultiSignature::Sr25519(620c04627e7195b03ad21f5454830887fcbd6cf0b005bc1f6b7bfab63ca72e3122f3114bf6a5e776f747135818a3b6c8d72cd84be92016fccea993ca4f16e984), RawPayload: SignedPayload(call: RuntimeCall::Balances(Call::transfer_keep_alive { dest: MultiAddress::Id(581fc8e1118518d6073c2800a3e2dadac231e45eb8c73367bc24fb67e429fc4f (5E4FWi7V...)), value: 1000000000000000000 }), extra: (CheckNonZeroSender, CheckSpecVersion, CheckTxVersion, CheckGenesis, CheckMortality(Era::Mortal(64, 55)), CheckNonce(1), CheckWeight, ChargeTransactionPayment<0>, CheckAppId: 0), additional_signed: ((), 9, 1, 0x0692a0b7fa1b54f57f0f1e5c341231f8c56431b1c1ca45d23b94f57e21ff1272, 0x297ea3d04c56ffce1739904318c4bd566afac8fdd49f3baaf92a9a3ae8c53146, (), (), (), ()))

I tried testing from a test app, signing payload direct and setting up the types / registry and I have the same results. Using the keyring works, using the extension yields the same error.

The script can be found here.
I pointed the function that does not work but the working one can be found.
For reproduction, some test tokens can be given using this faucet and typing /deposit <address>

The initialisation of the API Promise can be found here.

Here's also the corresponding stalled stackexchange post

I was wondering if the chain was too heavily modified or if there is something I did not understand regarding the data that are signed.

  • Version:

    • Polkadot extension: 0.46.5
    • Polkadot API: 10.9.1
    • Substrate: polkadot-v0.9.37
  • Environment:

    • Node.js
    • Browser (Chrome)
    • Other (limited support for other environments)
  • Language:

    • JavaScript
    • TypeScript (include tsc --version --> v4.6.3)
    • Other
@Leouarz
Copy link
Author

Leouarz commented Jul 23, 2023

It turns out, the extension even if aware that there is a signedExtension, does not know how to encode it, I had to use injector.metadata.provide(metadata) with the default metadata + the corresponding userExtensions.

My questions are:

  • Can userExtensions be added automatically ? Did we forget to put it somewhere ?
  • Since using injector.metadata.provide(metadata) displays a popup everytime, how is it possible to check if, from the extension, the userExtensions are already setup so we won't have to make the request again ?

Thanks for the time !!

@TarikGul TarikGul added the Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance. label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.
Projects
Development

No branches or pull requests

2 participants