UpgradeAuthorized
Event v151 → current #6Emitted when a runtime upgrade is authorized for future application.
View events on chainUseful for: validatorsdevelopersanalytics
The Big Picture
The authorize/apply pattern separates upgrade approval from execution. This event fires when the approval happens. Watch for CodeUpdated to know when it's actually applied.
Use Cases
- Monitor governance-approved upgrades
- Track pending runtime changes
- Alert when upgrades are authorized
From Chain Metadata
An upgrade was authorized.
Triggers
Preconditions
- Caller is root/sudo
- Valid code hash provided
Effects
Storage Modified
Postconditions
- Upgrade hash stored in AuthorizedUpgrade storage
- Anyone can now apply the upgrade with matching code
Side Effects
- Previous authorization (if any) is overwritten
Event Data
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);
// Subscribe to UpgradeAuthorized events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.System.UpgradeAuthorized.get(block.hash);
for (const evt of events) {
console.log("UpgradeAuthorized:", evt.payload);
}
});Runtime Info
- Pallet Index
- 0
- Event Index
- 6
- First Version
- v151
- Current Version
- v411