1

Unfortunately, I could not find how to add unchecked weight to a call via Polkadot.js, e.g. within signAndSend or when preparing the unsigned extrinsic. Even in the cookbook example for runtime upgrades, it is not mentioned.

I am trying to fix the following error when calling api.tx.configuration.setValidationUpgradeDelay(5) with sudo by adding unchecked weight:

/app/node_modules/@polkadot/rpc-provider/coder/index.cjs:76
      throw new _error.default(fmtMessage, code, data);
            ^

RpcError: 1010: Invalid Transaction: Transaction would exhaust the block limits
2
  • 4
    You may be looking for sudo.sudoUncheckedWeight as opposed to sudo.sudo
    – Jaco
    Mar 25, 2022 at 18:19
  • Thank you, that did the trick! Mar 28, 2022 at 11:43

1 Answer 1

4

I believe Jaco's comment above points to the right answer, at least I cannot find a reference to unchecked weight elsewhere. So I dug a bit into code and docs.

That led me to looking at the JS UI as well, specifically the sudo page and the "with weight" option there. Specifying it indeed calls the sudo.sudoUncheckedWeight with the specified weight in the params as per the extrinsic definition.

You should be able to do -

/* the weight we want to use, unchecked */
const weight = 1

/* the upgrade we want to send */
const upgrade = api.tx.system.setCode("0x...")

/* make the upgrade, unchecked */
const sudo = api.tx.sudo.sudoUncheckedWeight(upgrade, weight)

/* send sudo here with signAndSend */
...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.