How can I check the origin in a SignedExtension?
1 Answer
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
-
are you saying that I should call ensure_signed(who) inside the signed-extension? Commented Oct 31, 2022 at 16:49
-
That will not work.
ensure_signed
is expecting an origin, howeverwho
is anAccountId
.– NachoPalCommented Nov 2, 2022 at 9:48 -
1I 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 modifycheck()
method to reject transactions filtering them withCall
.– NachoPalCommented Nov 2, 2022 at 9:56