1

When trying to propose a system.setCode motion the extrinsic fails with WrongProposalWeight. We are experiencing this issue only with the above extrinsic and on polkadot-0.9.42 version.

On an earlier version of polkadot (0.9.36) it seems to work flawlessly!

I think something changed between 0.9.36 and 0.9.42 which impacts weight calculation regarding system extrinsics?

Edit: I found https://github.com/paritytech/substrate/pull/13771 which is causing the issue I think

2
  • What is your MaxProposalWeight set at ?
    – b0zero
    Jul 12, 2023 at 13:23
  • We have set it to 50% Jul 12, 2023 at 15:17

1 Answer 1

0

The weigh of set_code was not properly benchmarked until this MR, so it was probably assuming way too much weight. The proper way would be to integrate that into your runtime and then use the updated weights.
And additionally set your MaxProposalWeight to something sensible.

Another (hackier) way is to wrap the System::set_code in a Utility::with_weight call if you want to ignore the weight check. Note that this introduces the possibility of creating an overweight block, if the set_code does use more than the block limit. But so far the results for set_code indicated about 60ms, which should have more than enough room to not produce an overweight block.

4
  • The second solution does not work because the Utility::with_weight requires a root origin and the collective pallet does not provide that. There is a third option that we actually went for. We created our own pallet to dispatch runtime upgrades, this call can only be called by the Council origin. You can check the weight for this call here: github.com/threefoldtech/tfchain/blob/… Jul 12, 2023 at 15:15
  • Wait, set_code also needs root. So how can you dispatch set_code but not with_weight? Jul 12, 2023 at 21:24
  • We created our own pallet to dispatch set_code having configured some origin, see: github.com/threefoldtech/tfchain/blob/development/… Jul 13, 2023 at 11:34
  • Okay I dont understand the Question. Originally it was about System::set_code, but now you have your own pallet and use weight T::BlockWeights::get().base_block. So so can just benchmark it properly or reduce the weight if you are sure about it? Jul 13, 2023 at 12:01

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.