0

How can I check the origin in a SignedExtension?

1 Answer 1

4

You could check the 'who' parameter in the 'fn validate()' function.

An example from the chech_non_zero_sender extension: https://github.com/paritytech/substrate/blob/21d58f6f7b3ed2ea529f3c118b2e042b29551672/frame/system/src/extensions/check_non_zero_sender.rs#L85

3
  • are you saying that I should call ensure_signed(who) inside the signed-extension?
    – Yatusabes
    Commented Oct 31, 2022 at 16:49
  • That will not work. ensure_signed is expecting an origin, however who is an AccountId.
    – NachoPal
    Commented Nov 2, 2022 at 9:48
  • 1
    I am not sure what you are trying to achieve, but if what you want is to check if a transaction is signed or not before it is included in the block, what you can do is to use build your own UncheckedExtrinsic. You could modify check() method to reject transactions filtering them with Call.
    – NachoPal
    Commented Nov 2, 2022 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.