authorize_upgrade

Call v151 → current #9

Authorize a future runtime upgrade by code hash (root only).

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: validatorsdevelopers

The Big Picture

Separates upgrade authorization from execution. Root authorizes, anyone can apply.

Use Cases

  • Pre-authorize upgrades
  • Governance-approved upgrades with delayed execution

From Chain Metadata

Authorize an upgrade to a given `code_hash` for the runtime. The runtime can be supplied later. This call requires Root origin.

Input Parameters

#NameTypeDescription
0
code_hash
H256 T::Hashcode_hash: Cryptographic hash (32 bytes)

Permissions

Origin
Unknown
Required Role

Permission data inferred from metadata. May be incomplete.

Requirements

  • Caller is root/sudo
  • Valid code hash

Effects

Events Emitted

Storage Modified

Postconditions

  • Upgrade authorized
  • UpgradeAuthorized event emitted
  • AuthorizedUpgrade storage set

Side Effects

  • Anyone can later apply the upgrade with matching code

Code Examples

import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Build authorize_upgrade call (typed, named args)
const code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000";

const tx = api.tx.System.authorize_upgrade({
  code_hash,
});

Runtime Info

Pallet Index
0
Call Index
9
First Version
v151
Current Version
v411