Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Make extrinsics executed as sudo require 0 fees #6657

@lovesh

Description

@lovesh

I want to make some extrinsics require 0 fees, these are required to be sent by sudo. For non-sudo extrinsics, I can annotate the extrinsic with #[weight = (0, Pays::No)] and it works. But with sudo, I see the extrinsic call is wrapped with sudo pallet'ssudo dispatchable which itself has non-zero weight and thus the extrinsic ends up having weight. I tried using the sudo pallet's sudo_unchecked_weight and pass 0 weight but still the extrinsic will have some fee due to the length, base fee, etc
My understanding of the weight annotations of the sudo pallet's extrinsics like

#[weight = (call.get_dispatch_info().weight + 10_000, call.get_dispatch_info().class)]
fn sudo(origin, call: Box<<T as Trait>::Call>) {

is that the sudo will inherit the DispatchClass of the actual call (from my pallet) being made through get_dispatch_info().class. If it was inheriting the Pays enum as well like this

#[weight = (call.get_dispatch_info().weight + 10_000, call.get_dispatch_info().class, call.get_dispatch_info().pays_fee)]
fn sudo(origin, call: Box<<T as Trait>::Call>) {

then annotating my pallet's extrinsic with Pays::No will work. Is that correct?

Is there another way of achieving my objective?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Z7-questionIssue is a question. Closer should answer.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions