# Runbook — upgrading a running node **Audience:** the person putting a new build onto nodes that already hold a chain. **Scope:** classifying a change, rolling it out, and knowing when it stops being a rollout. Not the first launch — that is `docs/RUNBOOK_LAUNCH.md`. Not an incident — that is `docs/RUNBOOK_ROLLBACK.md`. **Every claim in this file is labelled.** `MEASURED` means it was observed by running the thing named, on the date given. `REASONED` means it is an argument from code that was read. `UNBUILT` means the thing does not exist. --- ## 0. Read this first — thirty seconds **Three kinds of change wear the same clothes, and only the first is an upgrade.** | Kind | What moved | What it is | Where it goes | |---|---|---|---| | **A** | Nothing a peer can see. Logging, CLI text, an operator surface, a non-consensus fix. | **A rolling restart.** Nodes on the old build and the new one are the same network. | §3 | | **B** | The **state transition**: how a block changes state. Genesis hash may be **unchanged**. | **A hard fork wearing a version number.** Two builds compute two chains from the same blocks. | §5 | | **C** | The **genesis**: chain name, allocations, declared validator set, bridge attestors. | **A hard fork, and it announces itself.** The genesis hash moves and the two builds cannot peer at all. | §5 | **Kind B is the dangerous one, because it looks exactly like kind A from outside.** `MEASURED, 2026-09-07`: a build whose state-root computation was altered by one line printed a **byte-identical genesis hash**, started cleanly and reported itself healthy — and could not apply a single block its peers produced. `docs/RUNBOOK_CANARY.md` §5 is that case, worked through end to end. **So the first thing you do is classify, and the classification is not a matter of opinion:** §1 gives the procedure, and it is one command. --- ## 1. Classify the change before you deploy it ### 1.1 Kind C is one command ```bash npm run build node dist/src/cli/strblk.js genesis --identity ``` Compare all three lines against what the running network was launched on. `MEASURED, 2026-09-07`: changing the development chain's `chainName` — one caption, no logic — moves `genesisHash`: ```text chainName SourceLess Development Fork genesisHash 7f3013113e1133eb75dfa17892a263afb7e1358716e039ee444c7e51df194adb ``` against a baseline of `8ee28b94…76ea`. `genesisHash` covers the chain id, the chain name, the allocations, the declared validator set and the bridge attestors. **There is no cosmetic change to any of them.** **`--identity` prints two more lines, and they are the ones kind B moves.** `genesisStateRoot` is the ledger root at height 0 and `genesisBlockHash` is block zero's hash, which covers that root plus the header framing. `MEASURED, 2026-09-07`, building this tree twice with one line removed from `LedgerManager.stateRoot`: `genesisHash` was `8ee28b94…` in BOTH builds, while `genesisStateRoot` moved `a6bf0085…` → `e760f04a…` and `genesisBlockHash` moved `abaa1b65…` → `d61464fa…`. So a kind C check that reads only `genesisHash` cannot see a kind B change, and the other two lines can — at least when the change touches genesis state. Read the whole of 1.2 before you treat them as a substitute for a canary. `scripts/canary.mjs` makes the same comparison as stage 0 and refuses before it starts a node. `MEASURED`, exit 1: ```text [HOLD] the candidate is a DIFFERENT NETWORK ... No node was started. Nothing to roll back. ``` If the hash moved: **stop, this is §5.** Do not roll it anywhere. ### 1.2 Kind B needs a canary, and nothing else will find it `MEASURED, 2026-09-07`: a `genesisHash`-only comparison **passes** a state-transition change. So do typecheck and the unit suite, if the change is deliberate. CI used to make exactly that mistake: `REASONED` from reading `.github/workflows/ci.yml` as it stood, its `determinism`, `container`, `linux-binary` and `windows-exe` jobs all extracted `genesisHash` with `grep` + `awk` and compared that one string. All four now `diff` the full `strblk genesis --identity` output instead. **That is CONFIGURATION** — no job in that file has been observed to run from this machine, `gh` is unauthenticated and `act` is absent. The step BODY was run locally on 2026-09-07 against a canonical and a divergent build of this tree: the old body printed one identical hash for both, the new body exited 1 naming `genesisStateRoot` and `genesisBlockHash`. **None of that makes CI a kind-B gate.** It catches a kind B change only when the change moves GENESIS state, and most do not: a change to how a transfer is applied, a fee is charged or a record is folded leaves height 0 identical and diverges at height N. Those three digests are computed over an empty chain, and an empty chain exercises almost none of the state transition. The only thing in this repository that catches kind B is running the two builds against each other on a live chain and comparing heads and state roots at a common height. That is `docs/RUNBOOK_CANARY.md`, and §3 below is where it goes in the sequence. **A shortcut that is not a substitute.** If a node data directory with a real chain is to hand, Hlin will replay it under both builds: ```bash node scripts/rollback.mjs --dir --to --from ``` `MEASURED, 2026-09-07`, against a four-block directory with a divergent candidate: ```text [STOP] the target build replays this chain it could not: ... accepted false reason snapshot belongs to a different genesis ``` and, on a control pair, the check that clears it: ```text [ok] both builds agree about this chain same genesis, same Urd proof 8234871ff522dad8935069e3… ``` This is cheaper than a canary and weaker: it proves the new build can *replay* a chain, not that it can *produce* blocks the old build accepts. Use it as a pre-check, not as the gate. ### 1.3 A change to a governed parameter is not an upgrade at all `MEASURED` by reading `src/governance/parameters.ts`: five parameters are governable — `chain.blockTargetSeconds`, `chain.requiredConfirmations`, `governance.votingWindowMs`, `governance.ordinaryTimelockMs`, `governance.governanceChangeTimelockMs`. Changing one of those is a governance record carried in a block and applied by every node. **Do not ship a build to change one.** Everything else — the gas price, the burn interval, the collateral epoch — changes only by shipping a build, and shipping a build that changes one of them is **kind B**. --- ## 2. What an upgrade physically is Three steps, and none of them touches chain state. That is the entire reason it is safe. ```bash # 1. stop the node, and let it finish kill -TERM # or: systemctl stop strblk # 2. confirm it stopped and the directory is intact node scripts/rollback.mjs --dir --to --from # 3. start the new build on the SAME data directory strblk node --dir --network [--genesis FILE] [--peers ...] ``` **Step 2 is the rollback preflight used forwards.** `REASONED`: Hlin's checks are symmetric — "can that build run this chain" is the same question whichever direction you are going, and it is the check you most want before an upgrade as well as after one. **The lock file is how step 1 is confirmed.** `MEASURED, 2026-09-07`, on a node that did not exit cleanly: ```text [STOP] the node is stopped ...\.cerberus.lock is still present. Either a node is running on this directory, or the last one died without releasing it. ``` and on one that did: ```text [ok] the node is stopped no lock file, so nothing is holding this directory ``` **`identity.json` is not replaceable and an upgrade must not touch it.** It is who this node *is*. Losing it does not roll a node back; it creates a new one, with a new address, that is not the validator anybody seated. --- ## 3. The sequence for a rolling upgrade ### U1 — Gate the candidate ```bash npm run typecheck npm test npm run citations ``` `MEASURED, 2026-09-08`: `typecheck` exit 0; `npm test` exit 0 (**2509 passed across 129 files**, ~3–4 min); `npm run citations` exit 0 (**245 symbol citations checked, 230 landed within 25 lines, 15 unscored for want of a definition, 0 misplaced**). Add `npm run deps` and `npm run agents:check` — both exit 0, both about a second — if you want everything CI would run that can be run here. **Run them on the tree in front of you, not on yesterday's memory.** `MEASURED`: earlier the same afternoon, on this same branch, `npm test` was exit 1 and `npm run citations` was exit 1, from work in flight in `src/core/`. **A candidate whose gates are red is not a candidate, and a candidate whose gates you have not run today has no known state.** ### U2 — Classify it §1. One command for kind C, and a decision about whether the change can touch the state transition. If in doubt, treat it as kind B: the cost of an unnecessary canary is ninety seconds. ### U3 — Control the canary ```bash npm run canary # same dist both sides; must PROCEED ``` `MEASURED, 2026-09-07`: exit 0, PROCEED, ~90 s. `REASONED`: a gate that cannot pass when nothing changed is a gate nobody will believe when something does. ### U4 — Canary the candidate ```bash node scripts/canary.mjs --baseline ./dist-current --candidate ./dist-new \ --nodes 4 --canaries 1 --window 20 ``` Read `docs/RUNBOOK_CANARY.md` §4 for the eight checks and §5 for what a real divergence looks like. Exit 0 is PROCEED. Exit 1 is HOLD **and the cohort has already been rolled back**. Exit 2 is not a verdict. **Do not proceed on `[????]`.** An unevaluated blocking check means the gate was shown nothing. ### U5 — Roll one host Section 2, on one host. Then watch, for longer than feels necessary: ```bash strblk status --dir curl -s http://127.0.0.1:8081/api/status ``` Five fields, in this order. `MEASURED, 2026-09-07` against a running node: 1. **`read from` names an endpoint**, not a directory. A directory means the node did not start. 2. **`height` rising** over ~30 seconds. 3. **`finality line` rising too.** A height that climbs while the line does not is a node accepting blocks it is not settling. 4. **`peer sessions` > 0.** 5. **`needs a person` false**, and `escalatedFaults` empty. **The one signature to know.** `MEASURED, 2026-09-07`, the exact fault a divergent build raised about itself: ```text sync-stalled: this node searched every peer ahead of it and found no common ancestor within the finality window; rejoining is not something it can decide for itself ``` **A node that stops advancing after an upgrade is a consensus failure until proven otherwise.** Roll it back — §4 — and go back to §1. ### U6 — Roll the rest, one at a time There is no orchestrator. `MEASURED` by reading the tree: no fleet inventory, no deployment agent, no per-host version state. "Roll the fleet" means "do §2 on each host, one at a time", and U5's five fields on each one before moving to the next. **A gap that bites exactly here.** Nothing watches a production node and acts. `/api/status` carries every field the canary gates on, and there is **no watcher**. During a rolling upgrade, the monitoring is a person with a terminal. --- ## 4. When it goes wrong: how the canary and the rollback fit together They are the same procedure at two scales, and the canary is a rehearsal of the rollback. | | Vidar (`scripts/canary.mjs`) | Hlin (`scripts/rollback.mjs`) | `docs/RUNBOOK_ROLLBACK.md` | |---|---|---|---| | When | before the fleet | before touching a node | during an incident | | Decides | proceed or hold | cleared or refused | what a person does | | Acts | yes — rolls its own cohort back | **no.** It clears; you act | you act | | Scope | a cohort it created | one directory | one node you are logged into | `MEASURED, 2026-09-07`, from the canary's HOLD path — this is the rollback runbook's §4 executed by machine: ```text 7. Verdict: HOLD — rolling the canary cohort back This is docs/RUNBOOK_ROLLBACK.md section 4, executed: stop the node, put the previous build back, start it on the SAME data directory. Chain state is not touched, because chain state is not what changed. node4 back on baseline rolled back 1/1 rejoined the network yes — one head across the whole cohort ``` **Rolling an upgrade back is the same three steps as rolling it forward**, with the old `dist` in place of the new one. Chain state is not touched by either direction, which is why both are safe. **What is never safe, in either direction:** rewinding chain state at or below the depth line. A validator that rewinds past a block it has gossiped and re-seals at that height has provably equivocated, `Nidingr` takes its seat, and no later agreement undoes it. `docs/RUNBOOK_ROLLBACK.md` §6 is the only place that decision belongs. --- ## 5. What makes an upgrade a hard fork **Two things, and they fail in opposite ways.** ### 5.1 The genesis moved (kind C) — a clean partition The upgraded node and its peers cannot agree they are on the same chain, so they do not peer at all. `MEASURED`: the canary refuses at stage 0 and starts nothing. `REASONED`: this failure is loud and immediate, which makes it the *safer* of the two. ### 5.2 The state transition moved (kind B) — a silent partition The two builds agree on the genesis and disagree about every block after the one where they diverge. `MEASURED, 2026-09-07`: the diverged node reported `chainValid: true` — its own chain is internally consistent — while being unable to find a common ancestor with any peer. **A node can be perfectly valid and on the wrong chain, and it will tell you it is fine.** ### 5.3 A consensus change is scheduled by vote, and is no longer a flag day **`MEASURED, 2026-09-07`, and now WRONG — kept here because how it went wrong is the useful part.** It read: *"there is no activation height, no protocol version gate, no 'this rule applies from block N' mechanism anywhere in `src/`, `spec/` or `consensus/`."* That was true when a tree search was run, and a measurement whose method is "I searched and found nothing" is the kind that rots the moment somebody adds the thing. Nothing re-ran it. `MEASURED, 2026-09-18`: **`src/core/logretta.ts` is that mechanism.** It carries rule versions, a per-realm activation schedule, `consensusRulesAtHeight`, and a named refusal — never a fallback — when a node meets a version it cannot implement. Three versions are declared; the realms differ on purpose, and `src/core/snotra.ts` holds each one's schedule. (`forkHeight` in `src/core/blockchain.ts` is still fork *choice* — where two chains diverged — not fork *scheduling*.) `BUILT, 2026-09-23`: **the schedule is chain state and governance appends to it.** Until this date the schedule arrived once when a node was constructed and was fixed for the life of the process, so giving a rule a height still meant every operator restarting on a new build inside a window agreed somewhere off the chain. That is workable across a fleet you own. Across a public network whose operators you have never met it is not, because the ones who miss the window do not fork onto a minority chain — they stop validating. A `schedule-rules` governance action appends `{version, activationHeight}` to `LogrettaSchedule`, a register on `LedgerManager` that folds into the state root. Four properties make that safe, and each has a test that breaks it (`tests/integration/rule-schedule.integration.test.ts`): | | | |---|---| | It carries its own height | Voted, in a block every node replays. Nothing changes without a height | | It must clear a minimum lead | **1,325 blocks**, `logretta.minRuleActivationLead` — about 66 minutes at the 3 s target, about 22 hours at Asgard's ~60 s cadence. A node syncing from behind meets the record long before the height it names. This is the floor the chain enforces; the 28,800-block `consensus.ruleActivationMinLeadBlocks` Logberg also states is not enforced on this path ([HARD_FORKS_AND_UPGRADES.md](HARD_FORKS_AND_UPGRADES.md) §3.2) | | Append-only and ascending | A height or version at or below one already scheduled is refused, so nothing re-judges a sealed block | | Consensus state | Folded into the state root, absent while nothing is scheduled. Two nodes cannot hold different schedules and both report a valid chain | ```sh strblk wallet propose schedule-rules ``` Then the ordinary governance path: a vote (seven days by default), then the **thirty-day governance-change timelock**, then `execute`. The activation lands in the register at the enacting height plus one and the rules change at the height it names — which is a much later number, and the two are separate fields so they cannot be confused. **What still needs every operator to act, and what happens if one does not.** The vote schedules the switch; it does not install the build. An operator who has not upgraded by the activation height meets a rule version their binary does not implement and **stops with a named refusal** rather than computing a quiet fork. That is the designed outcome and it is why the lead exists: the lead is the upgrade window, not a grace period after it. **The CLI refuses a version this build does not implement; the chain deliberately does not.** `parseGovernanceAction` runs during block application, so refusing there would split the network at the vote — a split no operator can avoid — in place of one at the activation that every operator avoids by upgrading in time. The check is therefore advisory and lives on the submission surface. The residual hazard is real and has no guard: **a passed vote naming a version nobody implements halts the chain at the height it names, and there is no action that un-schedules one.** Treat it as the same class of decision as voting a network halt. Wire-level version negotiation is a separate thing and is still exact-match: `BIFROST_VERSION` refuses a peer rather than negotiating, which partitions peering rather than consensus. **A change that is NOT expressible as a rule version is still a flag day**, and that is the case to check for before reaching for the procedure above: the register gates the rules `ConsensusRules` names, and a change outside that shape has no height to be given. For one of those, a kind-B change remains a coordinated restart of the whole network — a published height or time, every operator agreeing in advance, and `docs/RUNBOOK_ROLLBACK.md` on standby on every host. **And `Ragnarok` — the coordinated chain-wide halt — is **BUILT, 2026-09-10** (`src/governance/ragnarok.ts`, `docs/RUNBOOK_RAGNAROK.md`, `tests/integration/ragnarok.integration.test.ts`, 46 tests).** If a kind-B rollout goes wrong mid-flight there is now something that stops the network: `strblk node --halt-at H --halt-reason "…"` on each host you can reach, immediately, and a `halt-chain` vote for the rest. **What it does not give you is a way to start again** — lifting a network halt is every operator restarting by hand, and any who do not, fork (`docs/RUNBOOK_RAGNAROK.md` §5). A halt is a decision to stop this rollout permanently, not a pause button. `REASONED`: that is a strong argument for not shipping kind-B changes at all until an activation mechanism exists, and for treating any that must ship as a governance action rather than an operations one. ### 5.4 A wire-protocol change is a third thing, and it is milder `REASONED` from `src/network/protocol.ts`: `SLNN_WIRE_VERSION` is `1`, it is written into every frame, and a frame carrying another value is rejected with *"unsupported wire version"*. A bump partitions **peering** without partitioning **consensus** — two nodes that cannot handshake still compute the same chain from the same blocks, so an upgraded node rejoins as soon as its peers follow. **UNMEASURED**: no wire bump has been exercised here. --- ## 6. A validator key compromised after launch is a hard fork, not an operation This is the case most likely to be mistaken for an operations task, and it is not one. **Why.** `MEASURED` by reading `src/core/genesis.ts` and `src/ops/fulla-public.ts`: the declared node set — every seat's **address** — is inside the genesis hash. Changing a seat's address therefore changes the genesis, which is kind C, which is a new network. **What the chain can do instead, and what it cannot.** `REASONED` from `src/governance/nidingr.ts` and `docs/NAMING.md`: - **Nidingr takes a seat.** A validator caught signing two blocks in one slot is ejected from the assembly's roll by a governance record carried in a block. The evidence *is* the decision; there is no vote. - **Nothing replaces one.** There is no record kind, no governance action and no tool that seats a new address in place of an ejected one. The roster shrinks by one and stays shrunk. - **Fenrir — economic slashing — is BUILT (2026-09-10) and reaches bonded seats only.** The ejection record also burns the offender's bond, which is a ledger lock posted by a `fenrirRecords` transaction after genesis; `Einherjar.stake` still has no ledger lock behind it and is not what is burned. **A validator that never posted a bond loses standing and nothing else.** Ask the node for `validatorBonds()` before assuming otherwise — it reports `unbondedSeats` for this reason. **So the honest procedure for a compromised validator key is:** 1. **Stop that node.** A stopped validator is a missed slot. A validator whose key is in somebody else's hands is an equivocation waiting to be signed. 2. **Expect Nidingr, do not wait for it.** Ejection is automatic on proven `same-slot` equivocation and does nothing at all otherwise. A key that is stolen but not yet *used* to equivocate produces no record. 3. **Escalate to governance immediately, and which instrument depends on whose seat it is.** A seat admitted by vote is removed by vote: `evict-validator`, at the thirty-day governance-change timelock, applied through `EinherjarRoll` — no new genesis and no restart. **A GENESIS seat cannot be evicted**; `evict-validator` refuses one deliberately, so the 1,313 cannot be voted off the chain they constitute. For one of those the remedy is dilution — `admit-validator` seats honest producers around it — or a hard fork, which is a new genesis and a coordinated restart with every operator agreeing. Ragnarok can stop the chain while you decide (`docs/RUNBOOK_RAGNAROK.md`); it cannot start it again. 4. **Do not rotate the key locally.** `MEASURED`: there is no import path into `identity.json` — `strblk node` has no flag that takes a key — so "rotating" a node key means giving that host a *new* identity, which is a node the genesis has never heard of. `REASONED` from `verifyProducerAuthorised`: its blocks are refused by every peer with *"producer … is not in the authorised validator set"*. You will have replaced a compromised validator with no validator, and made it look like a deployment problem. **And if more than one node's key is compromised at once:** that is a governance escalation for the operator of the Asgard seats, and the coordinated halt is Ragnarok (`src/governance/ragnarok.ts`), not anything on this page. --- ## 7. Escalation Escalate, do not proceed, when any of these is true: - the genesis hash moved and somebody wants to roll it as an upgrade; - the canary reports HOLD, or `[????]` on the head and state-root checks together with a node that stopped advancing; - Hlin reports `both builds agree about this chain` **failed** — two builds disagreeing about one file on disk disagree about what the chain means; - a node does not rejoin after being rolled back; - anybody proposes a consensus change that is NOT a scheduled rule version, given §5.3, since that one is still a coordinated restart; - anybody proposes replacing a validator address without a hard fork, given §6; - anybody proposes rewinding state at or below the depth line, in any circumstance. Take with you: the canary stdout, the Hlin output, `strblk status --dir `, `curl -s http://127.0.0.1:8081/api/status`, and the node's log. --- ## 8. What this runbook does not cover Each of these is stated where it bites; collected here so a skimming reader cannot mistake the coverage for wider than it is. - **A fleet rollout.** §3 U6. No inventory, no agent, no per-host version state. - **An automated rollback trigger.** §3 U6. The signal exists; the watcher does not. - **~~Scheduling a consensus change.~~ CLOSED, 2026-09-23.** §5.3. A `schedule-rules` governance action appends an activation to chain state with a mandatory 1,325-block lead, so a rule version switches at a voted height with no coordinated window. What remains a flag day is a consensus change that is not expressible as a rule version, and a vote for a version nobody implements still halts the chain at the height it names. - **~~A coordinated halt.~~ CLOSED, 2026-09-10.** §5.3 and §6. `Ragnarok` is **BUILT, 2026-09-10** (`src/governance/ragnarok.ts`, `docs/RUNBOOK_RAGNAROK.md`, `tests/integration/ragnarok.integration.test.ts`, 46 tests). An upgrade that goes wrong now has a stop to reach for; it does not have an automated way to start again, and `RUNBOOK_RAGNAROK.md` §5 explains why that is by construction. - **~~Replacing a validator seat.~~ CLOSED, and this entry was stale.** §6. `MEASURED 2026-09-23` by reading the action register: governance carries `admit-validator` and `evict-validator`, `src/governance/effects.ts` applies both, and `tests/integration/validator-roll.integration.test.ts` covers the roll changing. Nidingr still only TAKES a seat — that part was never wrong — but the roll stopped being fixed at genesis when Einherjar landed, and a replacement is a vote rather than a new chain. An admission must name a proved STR.domain, which is the check that stopped one compromise converting into an unbounded number of seats. - **~~Economic slashing.~~ BUILT 2026-09-10.** §6. `Fenrir` (`src/governance/fenrir.ts`) burns a bonded validator's stake on the same evidence Nidingr ejects on. What is still true is that the bond is optional: an unbonded seat is ejectable and not slashable, and the coverage is measured rather than assumed. - **A wire-version bump.** §5.4. Reasoned from source; never exercised. - **A passphrase rotation across an upgrade.** If `SOURCELESS_KEY_PASSPHRASE` was set when the identity was written, the same passphrase must be present on restart. Not rehearsed. - **Any evidence from CI.** `MEASURED, 2026-09-07`: `gh` is unauthenticated here and `act` is not installed, so **no job in `.github/workflows/ci.yml` has ever been observed to run from this machine.** Anything in a release plan that depends on CI is configuration, not evidence — and §1.2 shows that the jobs which *are* configured compare a genesis hash, which a kind-B change does not move.