I'm looking for some kind of hook or channel in the node that gets triggered immediately after the runtime upgrade. Something like on_runtime_upgrade that is available for pallets.

3 Answers 3


There is no such functionality. However, you can do the same as the state_runtimeVersion RPC. Get a import_notification_stream and then get the RuntimeVersion of each block that was imported. When the RuntimeVersion differs between two blocks, then you know that there was a runtime upgrade.


I was thinking of something similar for validator nodes to be able to auto-update, or at least send an alert. Maybe use a cron job to check for updates. For bitcoin miners, updates are very rare compared to the Dot ecosystem.

  • This isn't really an answer, and doesn't seem to add much value or instruct on how to achieve what the question is asking. Please be more prescriptive when trying to answer questions here.
    – Nuke
    Commented Apr 25, 2022 at 2:31
  • @systemnotes - please use the comment feature for this type of response. Commented Apr 29, 2022 at 12:31

There used to be exactly an on_runtime_upgrade which was implemented at the pallet level, but we removed this because it was basically an anti-pattern to assume that all blockchains using a specific version of a pallet would trigger the upgrade in the exact way you expect.

Upgrades of pallets and general runtime logic can and should only be programmed at the runtime level, where you have context of all the other pallets, logic, and behaviors which may be affected by a runtime upgrade.

You can still write your migration / after-upgrade logic in the pallet, and simply expose it as a public function, and then include that into your on_runtime_upgrade hook, which should be exactly the same as what you are looking for here.

  • are spec_version numbers for runtime upgrades sequential? For example, Acala's genesis spec_version was 2000, the latest one is 2083. Who decides the spec_version number? A human? Or is it runtime logic that says the next spec_version number after a runtime upgrade is equal to the previous runtime spec_version number + 1? Context: trying to calculate number of runtime upgrades for a substrate chain. Trying to see whether I can take the difference between latest block spec_version and genesis block spec_version? Or if I need to query spec_version at each block of the chain
    – olliecorbs
    Commented Jul 22, 2022 at 23:32
  • spec version is a human decision. To calculate the number of runtime upgrades, you need to look at the chain history, and query for events or the spec version change.
    – Shawn Tabrizi
    Commented Jul 23, 2022 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.