1

Let's say our pallet dispatchable returns DispatchResultWithPostInfo, where we are trying to manually calculate the weight, albeit with helpers obtained from benchmarking, but that's not relevant to the question. How do we account for the weight consumed by ensure_signed or ensure_root calls? Must they be benchmarked as well?

1 Answer 1

1

ensure_signed and ensure_root are just a singular match statement.
They dont do any signature verification - that was already done prior and is included in the transaction base weight.
Otherwise if you want to be really pedantic, you can obviously add an ensure_signed call to your benchmark code or benchmark it independently and add the weight, but I dont think its necessary.

You can check their implementations; for example ensure_signed:

pub fn ensure_signed<OuterOrigin, AccountId>(o: OuterOrigin) -> Result<AccountId, BadOrigin>
where
    OuterOrigin: Into<Result<RawOrigin<AccountId>, OuterOrigin>>,
{
    match o.into() {
        Ok(RawOrigin::Signed(t)) => Ok(t),
        _ => Err(BadOrigin),
    }
}

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.