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

wrong signRaw signature for polkadotjs due to u8aWrapBytes that forced adding <Bytes>...<Bytes> to payload before "sign" function #1357

Open
4 of 10 tasks
S0c5 opened this issue May 2, 2024 · 2 comments · May be fixed by #1358

Comments

@S0c5
Copy link

S0c5 commented May 2, 2024

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

As a developer when I want to sign a RAW hex payload, this payload must not be manipulated by adding any additional data like this wrapper, That why it is named signRaw.

Sorry, but WDF, it was a terrible idea to wrap this with tag in the signer, that manipulation must be done on the Dapp side, not on the signer side. the change was introduced by e4ce268

  • What is the motivation for changing the behavior?

I'm crafting a raw substrate transaction, and the payload must be RAW and not manipulated given that it can not be verified for the blockchain node.

Solution

To avoid break changes to anyone using that signRaw with bytes, I recommend including an extra type called 'raw' in the SignRawPayload, then if the type is raw no manipulation must be done.

  • Version:

  • Environment:

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

    • JavaScript
    • TypeScript (include tsc --version)
    • Other
@S0c5 S0c5 changed the title wrong signRaw signature for polkadotjs due to u8aWrapBytes that forced adding <Bytes>...<Bytes> to "sign" function wrong signRaw signature for polkadotjs due to u8aWrapBytes that forced adding <Bytes>...<Bytes> to payload before "sign" function May 2, 2024
@Tbaut
Copy link
Contributor

Tbaut commented May 2, 2024

This is obviously not a bug,and if you read the description of the pr, you'll see where it comes from #743

I'm not saying it's great, but it is what it is.

@S0c5 S0c5 linked a pull request May 2, 2024 that will close this issue
@S0c5
Copy link
Author

S0c5 commented May 2, 2024

I'd say it's a bug since it introduces an unwanted and undocumented behavior (I searched through the documentation and found no mention of that wrapping bytes feature), and today it doesn't follow the definition for "signRaw". Anyway, 😄 we must fix this, as there are plenty of use cases where we need to sign the payload as it is, more for low-level developers.

If the intention was to prevent evil actors from performing raw signatures, that must be in my opinion a warning in the UI that alerts to the user that a "low-level" operation is being performed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants