0

After going through some of the posts here, as an experiment I tried removing the transaction-payment-pallet from the construct_runtime! to test if that would set all transaction fees to zero. However, cargo build threw an error saying the impl of the pallet is required for the Config trait of some primitive.

Is there a right way to remove this pallet, or say in the example above, will I be required to go through the code more manually?

1 Answer 1

1

The transaction payment pallet is not that easy to remove since it is used in a lot of different parts of the runtime. If you goal is to remove this pallet, indeed you will need to go through the code of the runtime more manually, and remove all uses of it.

However, if your goal is just to make everything zero fees, you can do that by updating your config of the pallet's WeighToFee and LengthToFee types.

Easiest is probably to use ConstantMultiplier: https://paritytech.github.io/substrate/master/frame_support/weights/struct.ConstantMultiplier.html

Then set the multiplier to zero.

use frame_support::weights::ConstantMultiplier; // ADD THIS TOO
impl pallet_transaction_payment::Config for Runtime {
    type RuntimeEvent = RuntimeEvent;
    type OnChargeTransaction = CurrencyAdapter<Balances, ()>;
    type OperationalFeeMultiplier = ConstU8<5>;
    type WeightToFee = ConstantMultiplier<Balance, ConstU128<0u128>>;
    type LengthToFee = ConstantMultiplier<Balance, ConstU128<0u128>>;
    type FeeMultiplierUpdate = ConstFeeMultiplier<FeeMultiplier>;
}
3
  • you are 100% right, this is by far the quickest way to set ALL transaction fees to zero. I guess other pallets will have to check case by case. have re-worded my original question to expand scope to other pallets in case anyone can add
    – kenta_desu
    Commented Oct 9, 2022 at 2:17
  • I think it is best to update your question to ask how to most easily set the fees to zero, which this answers, and can be answered. I do not think there is any simple and general answer on how to remove a pallet than to simply remove all the code that references it.
    – Shawn Tabrizi
    Commented Oct 9, 2022 at 5:45
  • understood, thanks
    – kenta_desu
    Commented Oct 9, 2022 at 5:49

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.