Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Guides

How to Design a Runtime Upgrade Proposal Pipeline

This guide provides a structured, developer-focused workflow for creating and executing runtime upgrade proposals, covering specification, testing, audits, and governance voting.
Chainscore © 2026
introduction
INTRODUCTION

How to Design a Runtime Upgrade Proposal Pipeline

A systematic pipeline for runtime upgrades is critical for secure and efficient blockchain governance. This guide outlines the key stages and technical considerations.

A runtime upgrade, or forkless upgrade, allows a blockchain to modify its core logic—its state transition function—without requiring a hard fork. This is a defining feature of modern, adaptable networks like Polkadot, Cosmos, and Substrate-based chains. The process involves proposing, testing, approving, and deploying new Wasm runtime binaries. A well-designed proposal pipeline mitigates risks by enforcing rigorous validation at each stage, from initial ideation to on-chain enactment. Without a structured process, upgrades can introduce critical bugs, governance disputes, or network instability.

The core pipeline stages are: Proposal Creation, Pre-deployment Testing, Governance Voting, and Safe Deployment. Each stage has distinct technical requirements. For instance, the Pre-deployment Testing phase should include unit tests, integration tests on a testnet, and potentially a runtime upgrade dry-run using tools like try-runtime in Substrate. This stage verifies that the new logic correctly migrates the existing chain state. Governance mechanisms, such as Polkadot's OpenGov or Cosmos's x/gov module, then secure community approval through a transparent voting process.

Technical implementation requires careful planning. The upgrade payload must be compiled to Wasm and its hash stored on-chain for verification. Keychain integrations, like Polkadot's sudo pallet or multisig governance, control the final authorization. A critical best practice is to implement delay periods between approval and enactment, providing a final safety window for node operators to upgrade. Furthermore, the pipeline should support emergency response procedures, such as fast-tracked voting or a technical committee's veto power, to address critical vulnerabilities discovered post-approval.

Real-world examples illustrate these principles. The Polkadot network uses a multi-stage referendum process where upgrades are proposed as Preimage hashes and voted on by token holders. The Kusama canary network frequently serves as a live testing ground for upgrades before they reach Polkadot. In the Cosmos ecosystem, a software upgrade Plan is submitted as a governance proposal; upon passing, validators must manually replace the binary at the specified block height. These processes balance decentralization, security, and upgradeability.

Designing your pipeline involves selecting the right tooling. For Substrate chains, leverage the pallet-democracy or pallet-referenda for governance, and pallet-sudo for controlled deployments. Use fork-off-substrate to create a testnet snapshot. Integrate CI/CD systems to automate building the runtime and generating the Wasm blob. The final design must be documented in a clear Runtime Upgrade Protocol that defines roles, timelines, testing requirements, and rollback procedures, ensuring all stakeholders understand the upgrade lifecycle.

prerequisites
PREREQUISITES

How to Design a Runtime Upgrade Proposal Pipeline

A systematic approach to preparing, testing, and deploying runtime upgrades on Substrate-based blockchains.

A runtime upgrade proposal pipeline is a structured workflow for managing changes to a blockchain's state transition function. For Substrate chains, this involves preparing a new runtime.wasm binary, submitting it as a proposal via governance, and executing the upgrade. The pipeline's primary goal is to ensure safety, reproducibility, and community consensus. Key prerequisites include a deep understanding of your chain's governance model (e.g., Sudo, Council, OpenGov), the pallet-sudo and pallet-democracy modules, and the technical process of building a runtime from source. You must also have a local development node and access to the chain's source code repository.

The first technical prerequisite is setting up a deterministic build environment. Runtime upgrades require compiling the exact runtime.wasm binary that will be deployed on-chain. Use tools like srtool to create a reproducible, verifiable build. This ensures the hash of the WASM blob submitted in the proposal matches the hash built from the publicly available source code, a critical step for trustless verification. You'll need Docker installed to run srtool and should be familiar with your chain's specific runtime directory structure and Cargo.toml dependencies.

Next, you must understand the proposal and enactment mechanics. In Substrate, upgrades are typically enacted via the set_code function in frame-system. However, calling this function is permissioned. You'll design your pipeline around the specific governance pallet your chain uses. For example, with pallet-collective, the pipeline must handle creating a proposal, gathering council votes, and scheduling the enactment. With pallet-referenda (OpenGov), you'll manage submitting a referendum, configuring the track, and handling the approval period. Your pipeline logic will differ significantly based on this choice.

Your development environment should include a local testnet (e.g., a --dev node) and potentially a test network like Westend for Kusama-based chains. You need the ability to submit transactions from a privileged account, which requires access to keys with the appropriate authority (e.g., Sudo key or Council membership). For testing, you will write and run integration tests using sp_io::TestExternalities to verify that the new runtime logic works as intended and does not break existing storage migrations or invariants.

Finally, establish a version control and release strategy. Runtime upgrades are linked to specific Git commits. Your pipeline should automate building from a tagged release, generating the WASM blob, and creating the necessary extrinsic data for the proposal (often a sudo.sudoCall or democracy.propose). Familiarity with command-line tools like substrate's node binary for inspecting metadata and constructing calls is essential. This foundational knowledge prepares you to construct an automated, secure pipeline from code commit to on-chain execution.

key-concepts
RUNTIME UPGRADE PIPELINE

Key Concepts and Pipeline Stages

A structured pipeline is critical for secure and successful runtime upgrades. This guide covers the essential stages, from initial specification to on-chain execution.

01

1. Specification and Design

This initial stage defines the technical scope and upgrade logic. Developers must create a detailed Forkless Runtime Upgrade Specification (FRUS). Key tasks include:

  • Auditing existing pallets for state compatibility.
  • Defining new storage migrations and their logic.
  • Specifying pre-upgrade and post-upgrade hooks.
  • Documenting all changes for governance review.

Tools like Polkadot-JS Apps and Substrate's try-runtime are used for initial testing.

02

2. Development and Local Testing

Implement the specification in a fork of the runtime codebase. This involves:

  • Writing new pallet logic or modifying existing ones.
  • Creating migration modules using the OnRuntimeUpgrade trait.
  • Running exhaustive unit and integration tests.
  • Performing a dry-run upgrade on a local development chain (e.g., --dev).

This stage ensures the upgrade logic works in isolation before network deployment.

04

4. Governance Proposal and Voting

Once tested, the upgrade is bundled into a runtime upgrade proposal. The process varies by chain but typically involves:

  • Submitting a democracy proposal or treasury spend with the WASM blob.
  • A public referendum period where token holders vote.
  • Meeting the chain's enactment delay after a successful vote.

Proposals must include the new runtime's spec_version and spec_name.

05

5. Pre-Upgrade and Execution

During the enactment delay, node operators must prepare. At the designated block, the upgrade executes automatically:

  • The pre-upgrade hook runs, preparing the state.
  • The new runtime WASM code is set via set_code.
  • The post-upgrade hook executes final migrations.

All validators and full nodes must have upgraded their client software to a version supporting the new runtime before this block.

06

6. Post-Upgrade Verification

After execution, the network must be monitored to confirm stability. Key verification steps include:

  • Checking that the chain continues producing blocks (no forks).
  • Verifying that all migrated storage items are accessible and correct.
  • Ensuring runtime APIs and RPC endpoints function as expected.
  • Running try-runtime's on-runtime-upgrade check again on the live chain's new state for final validation.
PROPOSAL LIFECYCLE

Pipeline Stage Breakdown and Deliverables

A comparison of deliverables, key stakeholders, and success criteria for each formal stage in a runtime upgrade pipeline.

StagePrimary DeliverablesKey StakeholdersExit CriteriaTypical Duration
  1. Specification & Design

RFC Document, Technical Design Spec, Impact Analysis

Core Developers, Research Team

Formal RFC approval via governance forum

2-4 weeks

  1. Implementation

Pull Request, Unit/Integration Tests, Audit Scope

Core Developers, Security Auditors

All tests pass, code merged to feature branch

4-8 weeks

  1. Testing & Auditing

Audit Report, Testnet Deployment, Bug Bounty Results

Security Auditors, Validators, Community Testers

Critical/high audit issues resolved, testnet stability

3-6 weeks

  1. Governance Proposal

On-Chain Proposal, Upgrade Metadata, Community Announcement

Proposers, Token Holders, Validators

Proposal successfully submitted to chain

1-2 weeks

  1. Voting Period

Real-time Voting Dashboard, Community Discussion

Token Holders, Validators

Quorum and approval threshold met

1-2 weeks

  1. Upgrade Execution

Final Client Binary, Upgrade Height/Block, Monitoring Tools

Validators, Node Operators, RPC Providers

67% of network upgrades successfully

1-24 hours

  1. Post-Upgrade Monitoring

Network Health Dashboard, Performance Metrics, Incident Reports

Core Developers, Validators

Network stable for 24-48 hours, no critical regressions

2-7 days

specification-phase
PHASE 1: FORMAL SPECIFICATION AND DEVELOPMENT

How to Design a Runtime Upgrade Proposal Pipeline

A robust proposal pipeline is critical for managing on-chain upgrades. This guide outlines the design process for a formal, secure, and community-driven pipeline.

A runtime upgrade proposal pipeline is a structured workflow for submitting, reviewing, voting on, and executing changes to a blockchain's core logic. Unlike simple parameter changes, runtime upgrades can modify the state transition function itself, making a formal process essential for security and governance. The pipeline typically consists of several stages: Pre-Proposal Discussion, Formal Specification, Implementation, On-Chain Proposal, Voting, and Execution. Each stage acts as a gate, ensuring only well-vetted and widely supported changes are enacted. This structure mitigates risks like network forks, consensus failures, or unintended protocol behavior.

The first phase, Formal Specification, begins with a Runtime Upgrade Proposal (RUP) document. This is a technical specification, often written in a format like RFC (Request for Comments) or SIP (Substrate Improvement Proposal). It should detail the proposed change's motivation, technical design, storage migrations, and backward compatibility considerations. For Substrate-based chains, referencing the Substrate FRAME architecture is crucial. The specification must be precise enough for independent implementation and review, serving as the single source of truth before any code is written. This stage relies heavily on off-chain forums like Commonwealth, Polkassembly, or dedicated Discord channels for community feedback.

Once a specification reaches maturity, the Development phase begins. This involves implementing the changes in a dedicated fork of the runtime's codebase, such as a Git branch named feature/new-pallet-X. Development should follow the chain's established standards, including comprehensive unit and integration tests. A critical step is building a forkless runtime upgrade payload. In Substrate, this is a wasm blob compiled from the new runtime logic. Developers must also write any necessary storage migration code to transform the existing on-chain state to be compatible with the new runtime. This code is often encapsulated in a migration pallet or on_runtime_upgrade hook.

Before the upgrade is proposed on-chain, rigorous testing is non-negotiable. The new runtime wasm blob must be deployed and tested on a testnet or a local development network. Key tests include: replaying blocks from the live network, executing the storage migration in a sandboxed environment, and running end-to-end tests for all new functionalities. Tools like fork-off-substrate or zombienet are invaluable here. This phase identifies bugs and performance issues that could cause chain halts. The goal is to achieve a high degree of confidence that the upgrade will execute smoothly without requiring a hard fork.

With a tested implementation, the proposal moves to the on-chain pipeline. This is typically managed by a pallet like pallet-democracy or pallet-collective. The proposal, containing the new runtime wasm hash and optional preimage, is submitted with a deposit. A Technical Committee or Council may fast-track urgent security fixes. The proposal then enters a public referendum period where token holders vote. Critical parameters to design here include the enactment delay (time between vote approval and execution), minimum deposit, and voting thresholds. A well-designed pipeline uses the enactment delay as a final safety net, allowing nodes time to upgrade and stakeholders to react if issues are discovered.

Finally, the pipeline must account for failure modes and rollbacks. Design considerations include: a cancelation mechanism for flawed proposals, a safe mode or temporary downgrade capability in client software, and clear communication channels for node operators. The pipeline should be documented in the chain's runtime itself, perhaps via a pallet-scheduler for timed executions or a versioning system. By institutionalizing these steps—specification, independent implementation, testing, and phased on-chain governance—the pipeline reduces upgrade risk and aligns protocol evolution with community consensus.

testing-audit-phase
TESTING, AUDIT, AND TESTNET DEPLOYMENT

How to Design a Runtime Upgrade Proposal Pipeline

A systematic pipeline for proposing, testing, and deploying runtime upgrades is critical for maintaining network stability and security.

A runtime upgrade proposal pipeline is a formalized process for introducing changes to a blockchain's core logic. This process is essential for decentralized governance, ensuring upgrades are transparent, secure, and community-approved. The typical pipeline involves four key stages: proposal drafting, off-chain testing, on-chain testing, and governance execution. For Substrate-based chains, this process is managed through the pallet-democracy or pallet-collective modules, where token holders or a council vote on encoded upgrade proposals.

The first technical step is to encode the proposed changes into a runtime upgrade extrinsic, often using the sudo or scheduler pallet on a test network. This extrinsic contains the new compiled WebAssembly (WASM) blob of the runtime. Before this blob is created, rigorous off-chain testing is mandatory. This includes unit testing for new pallets, integration testing within the full node context, and simulating the upgrade on a local development network using tools like substrate-node-template. The goal is to catch logic errors and state transition issues before any code touches a live chain.

Following successful local tests, the proposal must undergo on-chain testing on a dedicated testnet. Deploy the WASM blob to a testnet (e.g., Westend for Polkadot, Sepolia for Ethereum L2s) using a privileged call. Monitor the upgrade's execution and the network's behavior for several epochs. Key metrics to watch include block production, finalization, runtime API compatibility, and the state of key pallets like balances and system. This phase validates the upgrade under real network conditions, including validator behavior and cross-block consensus.

Concurrently, a professional security audit should be conducted. Engage a reputable Web3 security firm to review the runtime's new and modified code. The audit scope should cover business logic flaws, economic attack vectors, and adherence to best practices for ink! smart contracts or Substrate pallets. Audit findings must be addressed, and the final audit report should be published publicly as part of the governance proposal. This step is non-negotiable for mainnet upgrades and is a strong signal of E-E-A-T (Experience, Expertise, Authoritativeness, Trustworthiness) to your community.

Once the testnet deployment is stable and audits are resolved, the final proposal for the mainnet can be drafted. The proposal should include the new WASM runtime hash, a detailed changelog, links to the audit reports, and the testnet block height where the upgrade was successfully enacted. This bundle is then submitted to the chain's governance system. A typical democracy.propose extrinsic will include the call to system.set_code, which schedules the upgrade. A majority vote from the community or council is required to enact it.

After a successful vote, the upgrade is scheduled and executed autonomously by the network at a predefined block. Post-upgrade, continue monitoring network health and be prepared with a rollback procedure—often a subsequent upgrade—in case critical bugs are discovered. A well-designed pipeline turns a potentially risky network change into a predictable, secure operation, fostering trust and long-term chain sustainability.

governance-execution
GOVERNANCE PIPELINE

Phase 3: Governance Proposal and On-Chain Execution

This guide details the final phase of a runtime upgrade: crafting a formal governance proposal, securing community approval, and executing the upgrade on-chain.

After thorough testing, the upgrade moves to the on-chain governance phase. This involves creating a formal proposal containing the compiled wasm blob of the new runtime. On Substrate-based chains, this is typically done using the sudo pallet (for initial, centralized launches) or directly via the democracy or collective pallets. The proposal includes critical metadata: the spec_version increment, the hash of the new runtime code, and the block height at which activation should occur. This proposal is submitted as an extrinsic to the network, initiating a voting period.

The voting mechanism varies by chain but generally involves token-weighted voting by stakeholders. For major upgrades, a referendum is often required. Voters weigh factors like the upgrade's technical merits, audit reports, and the success of the testnet deployment. Key parameters to configure are the enactment delay (the time between approval and execution) and any required minimum approval thresholds. A well-designed proposal clearly communicates the changes via the Preimage Hash and links to the full changelog and discussion, such as a Polkadot or Kusama forum post.

Once the proposal passes, the on-chain execution is automated. At the predefined block, the chain's Runtime module reads the approved wasm blob from storage and instantiates it as the new runtime. This is a forkless upgrade; the chain continues producing blocks without halting. Validators and node operators must have the new runtime code ready locally. If they don't, their nodes will stop syncing at the upgrade block. Post-upgrade, it's critical to monitor network health, block production, and finality using tools like Polkadot-JS Explorer and validator telemetry to confirm the new logic is functioning as intended.

tools-resources
RUNTIME UPGRADE PIPELINE

Essential Tools and Resources

A secure, automated pipeline is critical for safe runtime upgrades. These tools help you design, test, and execute proposals.

06

Runtime Upgrade Checklist

A procedural guide to mitigate risk. Your pipeline should automate these checks:

  1. WASM Validation: Ensure the new runtime compiles to valid, deterministic WebAssembly.
  2. Storage Migration Dry-Run: Use try-runtime to verify all migrations.
  3. Fork Testing: Run fork-off-substrate against a recent mainnet block.
  4. Testnet Deployment: Execute via governance on Westend/Rococo.
  5. Monitoring & Rollback Plan: Have node operators ready with the previous runtime binary in case of critical failure.
RUNTIME UPGRADES

Frequently Asked Questions

Common questions and technical troubleshooting for designing a robust runtime upgrade pipeline for Substrate-based blockchains.

A runtime upgrade is a hot-swap of a blockchain's logic—its state transition function—without requiring a hard fork or network downtime. It's executed by submitting a set_code extrinsic with new WebAssembly (Wasm) binary. This is critical because it allows for:

  • Protocol Evolution: Adding new features, fixing bugs, or improving performance without resetting chain history.
  • Governance Demonstration: On-chain proposals and referenda make upgrades transparent and community-driven.
  • Risk Management: A flawed upgrade process can brick the network or introduce critical vulnerabilities, making pipeline design a core security concern.
conclusion
IMPLEMENTATION GUIDE

Conclusion and Best Practices

A robust runtime upgrade pipeline is a critical governance component for any production blockchain. This guide outlines the final steps and key principles for designing a secure and efficient proposal process.

A successful runtime upgrade pipeline balances security, transparency, and community engagement. The core workflow should be codified in your chain's governance pallet, typically involving distinct proposal stages: pre-proposal discussion, technical audit and testing, on-chain proposal submission, voting period, and a final enactment delay. Each stage serves a purpose: discussion builds consensus, testing mitigates risk, the delay allows node operators to prepare, and the voting mechanism enforces decentralized decision-making. For Substrate-based chains, this is often implemented using the pallet_democracy or pallet_referenda in conjunction with the pallet_sudo or a pallet_collective (like the Technical Committee) for emergency measures.

Best practices for proposal design start with rigorous pre-live testing. All runtime upgrades must be tested on a testnet that mirrors mainnet conditions. Use tools like fork-off-substrate to create a mirrored state for accurate simulation. Proposals should include a clear runtime spec version bump and be accompanied by comprehensive documentation, including a detailed release notes document and a precompiled WASM blob hash for verification. The voting threshold should be carefully calibrated; a simple majority may suffice for minor upgrades, while major changes might require a supermajority or adaptive quorum biasing, as seen in Polkadot's pallet_referenda.

Security is paramount. Implement a mandatory enactment delay (e.g., 7-14 days) after a proposal passes. This gives node operators ample time to upgrade their nodes before the new runtime activates, preventing chain halts. For critical security patches, design a fast-track mechanism controlled by a trusted pallet_collective. This group, often called the Technical Committee or Council, can shorten the enactment delay for emergency upgrades, but their power should be constitutionally limited and transparently logged. All upgrade logic, especially the on_runtime_upgrade hook in your lib.rs, must be thoroughly audited for state migration correctness to avoid fund loss or chain corruption.

Finally, foster a strong off-chain governance process. Maintain a dedicated forum (like Commonwealth or Polkassembly) for pre-proposal discussion and require a community signaling post before any on-chain proposal is submitted. Use tools like substrate-api-sidecar to provide easy access to proposal metadata and voting history. Document every upgrade in a public changelog. By combining a technically sound on-chain pipeline with an open, participatory off-chain process, your blockchain can achieve resilient and decentralized evolution, turning runtime upgrades from a point of centralization into a strength of community governance.