apply_authorized_upgrade
Call v151 → current #11Apply a previously authorized runtime upgrade (any origin).
View calls on chainCall Workflow
This diagram shows the call execution flow: starting with apply_authorized_upgrade, passing through validation
(signature, nonce, mortality, fee payment), then pre-dispatch checks, followed by dispatch which emits events: CodeUpdated, RejectedInvalidAuthorizedUpgrade and modifies storage: AuthorizedUpgrade, LastRuntimeUpgrade, and finally post-dispatch where ExtrinsicSuccess is emitted and fees are settled.
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.
Click items to navigate. Pan and zoom to explore.
Used by: validatorsdevelopers
The Big Picture
The execution half of authorize/apply. Anyone with matching code can deploy it.
Use Cases
- Apply governance-approved upgrades
- Decentralized upgrade execution
From Chain Metadata
Provide the preimage (runtime binary) `code` for an upgrade that has been authorized. If the authorization required a version check, this call will ensure the spec name remains unchanged and that the spec version has increased. Depending on the runtime's `OnSetCode` configuration, this function may directly apply the new `code` in the same block or attempt to schedule the upgrade. All origins are allowed.
Input Parameters
| # | Name | Type | Description |
|---|---|---|---|
| 0 | code | Vec<u8> Vec | code (Vec<u8>) |
Permissions
Origin
Unknown
Required Role
Permission data inferred from metadata. May be incomplete.
Requirements
- Upgrade has been authorized
- Code hash matches authorization
Effects
Events Emitted
Storage Modified
Postconditions
- Runtime code deployed
- CodeUpdated event emitted
- Authorization cleared
Side Effects
- Chain behavior changes from next block
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 apply_authorized_upgrade call
const code = 0;
const call = api.tx[stringCamelCase("System")][stringCamelCase("apply_authorized_upgrade")](
code
);Runtime Info
- Pallet Index
- 0
- Call Index
- 11
- First Version
- v151
- Current Version
- v393