question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support `Option<T>` in Extrinsic signed payload

See original GitHub issue

I’m using an Option<MyType> in a custom extrinsic signed payload. The expected behavior is unclear for the None case. The rust side expects a 0 to be encoded for the signature to verify. This implementation encodes nothing for None when isBare = true

Option is an implementation detail so it seems that polkadot-js/api is taking the correct approach here but the change will be much harder to implement on the substrate side.

https://github.com/polkadot-js/api/blob/56dc116d92ed3de5994e3dc7c767940617e088e9/packages/types/src/codec/Option.ts#L133-L149

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jacogrcommented, Nov 4, 2019

There is another approach we can take when we convert the payload for signing that will not strip all. As it stands it works for defaults but not all, like here.

So yes - can be done and should be done for overall correctness by adjusting where we serialize the payload.

0reactions
polkadot-js-botcommented, Jun 4, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tx.addSignature emiting error · Issue #4446 · polkadot-js/api
The extrinsic payload is signed, not the transaction. You are serializing the transaction and signing that. The payload has all transaction ...
Read more >
offchain.rs.html -- source - Docs.rs
Submit an unsigned transaction with a signed payload //! //! Initially, a payload ... signature: Option<<T::Extrinsic as ExtrinsicT>::SignaturePayload>, ...
Read more >
Why unsigned extrinsics? [closed] - Substrate Stack Exchange
In this case, we used an unsigned extrinsic for a few reasons: To support a secp256k1 Ethereum signature, instead of the sr25519 /...
Read more >
Make offchain transactions | Substrate_ Docs
Use unsigned transactions with signed payload if you want to record the associated ... index: Index, ) -> Option<(RuntimeCall, <UncheckedExtrinsic as ...
Read more >
Transactions in Off-chain Workers - Substrate Recipes
Unsigned Transactions with Signed Payloads. With this type of transaction, we first specify a signer, sign the transaction, and then send it back...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found