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 code_hash (H256)

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 { 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 });

// Build authorize_upgrade call
const code_hash = 0 as any /* H256 */;

const call = api.tx[stringCamelCase("System")][stringCamelCase("authorize_upgrade")](
  code_hash
);

Runtime Info

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