RejectedInvalidAuthorizedUpgrade

Event v301 → current #7

Emitted when an authorized upgrade fails validation during application.

View events on chain
Useful for: validatorsdevelopersanalytics

The Big Picture

When someone tries to apply an authorized upgrade but the code fails checks, this event explains why. The error field contains the specific validation failure. The authorization isn't cleared, so a corrected version can still be applied.

Use Cases

  • Debug failed upgrade attempts
  • Alert on upgrade failures
  • Monitor chain health during upgrades

From Chain Metadata

An invalid authorized upgrade was rejected while trying to apply it.

Triggers

Preconditions

  • Upgrade was previously authorized
  • apply_authorized_upgrade was called
  • Code failed validation (wrong spec name, version didn't increase, etc.)

Effects

Postconditions

  • Upgrade was NOT applied
  • Authorization remains (can retry with correct code)

Side Effects

  • Runtime remains on current version

Event Data

#NameTypeDescription
0
code_hash
H256 Blake2-256 hash of the rejected code
1
error
DispatchError The validation error that caused rejection

Code Examples

import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Subscribe to RejectedInvalidAuthorizedUpgrade events
api.query.system.events((events) => {
  events
    .filter(({ event }) =>
      event.section === stringCamelCase("System") &&
      event.method === "RejectedInvalidAuthorizedUpgrade"
    )
    .forEach(({ event }) => {
      console.log("RejectedInvalidAuthorizedUpgrade:", event.data.toHuman());
    });
});

Runtime Info

Pallet Index
0
Event Index
7
First Version
v301
Current Version
v393