feat: Introduce separate replica version - #11401
Conversation
There used to be a single version: the one under `/opt/ic/share/version.txt`, read by the orchestrator and passed to the replica. During fast GuestOS upgrade, the replica binaries are hot-swapped via an overlay while the node keeps running the old GuestOS. The base GuestOS version and the replica version must be distinguished. - **`PlatformVersion`** (new struct in `ic-types`, next to `ReplicaVersion`) holds both `guestos_version` (the GuestOS the node booted from) and `replica_version` (the running replica binary). `replica_version: ReplicaVersion` in ``ReplicaConfig` is replaced by `platform_version: PlatformVersion`. - **Build**: the GuestOS image now ships a second version artifact, `/opt/ic/share/binary_version.txt` (plus its `-test` variant). During a fast upgrade, the sysext overlay will shadow it with the post-upgrade version, while `version.txt` — now explicitly the GuestOS version — is never shadowed. - **Orchestrator**: reads both files (`--version-file` → binary version, `--guestos-version-file` → GuestOS version) and passes them when starting the replica process. - **Observability**: `/api/v2/status` gains an optional `guestos_version` field alongside `impl_version`. - **Metrics**: `custom-metrics.sh` now also exports a binary_version metric.
|
✅ No security or compliance issues detected. Reviewed everything up to d9e0da2. Security Overview
Detected Code Changes
|
|
✅ No security or compliance issues detected. Reviewed everything up to d9e0da2. Security Overview
Detected Code Changes
|
There was a problem hiding this comment.
Pull request overview
Introduces separate GuestOS and replica binary version tracking for fast upgrades.
Changes:
- Adds
PlatformVersionand propagates it through replica and consensus. - Exposes GuestOS version through status APIs and metrics.
- Packages separate GuestOS and binary version artifacts.
Reviewed changes
Copilot reviewed 42 out of 42 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
rs/types/types/src/replica_version.rs |
Defines PlatformVersion. |
rs/types/types/src/replica_config.rs |
Uses platform version configuration. |
rs/types/types/src/messages/http/tests.rs |
Updates status fixtures. |
rs/types/types/src/messages/http.rs |
Adds GuestOS status field. |
rs/types/types/src/lib.rs |
Exports PlatformVersion. |
rs/types/types_test_utils/src/ids.rs |
Adds platform-version fixture. |
rs/replica/src/setup_ic_stack.rs |
Propagates platform versions. |
rs/replica/src/args.rs |
Adds GuestOS version argument. |
rs/replica/setup_ic_network/src/lib.rs |
Passes platform versions into consensus. |
rs/replica/bin/replica/main.rs |
Constructs runtime platform version. |
rs/replica_tests/src/lib.rs |
Updates replica test setup. |
rs/replay/src/validator.rs |
Updates replay configuration. |
rs/orchestrator/src/upgrade.rs |
Tracks both versions during upgrades. |
rs/orchestrator/src/processes.rs |
Passes both versions to replicas. |
rs/orchestrator/src/orchestrator.rs |
Loads both version files. |
rs/orchestrator/src/args.rs |
Adds GuestOS version-file argument. |
rs/https_outcalls/consensus/src/pool_manager.rs |
Uses binary version for artifacts. |
rs/http_endpoints/public/tests/common/mod.rs |
Updates endpoint test setup. |
rs/http_endpoints/public/src/status.rs |
Reports both versions. |
rs/http_endpoints/public/src/lib.rs |
Propagates platform versions. |
rs/determinism_test/src/setup.rs |
Updates determinism fixture. |
rs/consensus/tests/payload.rs |
Updates payload test configuration. |
rs/consensus/tests/framework/types.rs |
Uses nested replica version. |
rs/consensus/tests/framework/test_runner.rs |
Updates consensus fixtures. |
rs/consensus/src/consensus/validator.rs |
Validates binary versions. |
rs/consensus/src/consensus/share_aggregator.rs |
Updates test configuration. |
rs/consensus/src/consensus/random_tape_maker.rs |
Emits binary version. |
rs/consensus/src/consensus/random_beacon_maker.rs |
Emits binary version. |
rs/consensus/src/consensus/notary.rs |
Uses binary version. |
rs/consensus/src/consensus/malicious_consensus.rs |
Uses binary version. |
rs/consensus/src/consensus/finalizer.rs |
Uses binary version. |
rs/consensus/src/consensus/catchup_package_maker.rs |
Uses binary version. |
rs/consensus/src/consensus/block_maker.rs |
Uses binary version. |
rs/consensus/src/consensus/batch_delivery.rs |
Updates test configuration. |
rs/consensus/mocks/src/lib.rs |
Builds platform-version mocks. |
rs/consensus/dkg/src/payload_validator.rs |
Updates test configuration. |
rs/consensus/dkg/src/lib.rs |
Extracts binary version for DKG. |
rs/consensus/dkg/src/dkg_key_manager.rs |
Updates test configuration. |
rs/boundary_node/ic_boundary/src/http/handlers.rs |
Updates status response construction. |
ic-os/defs.bzl |
Packages binary version artifacts. |
ic-os/components/monitoring/guestos/custom-metrics.sh |
Adds binary-version metric. |
ic-os/components/guestos/ic-replica.service |
Supplies both version files. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Pierugo Pace <pierugo.pace@dfinity.org>
| registry_replicator.get_latest_certified_time(), | ||
| processes_manager, | ||
| Arc::clone(&subnet_assignment), | ||
| replica_version, |
There was a problem hiding this comment.
I think it would be a good idea to report the GuestOS version in the orchestrator's dashboard as well.
There was a problem hiding this comment.
Reopening because I don't think this was addressed
Co-authored-by: Pierugo Pace <pierugo.pace@dfinity.org>
| update_binary_version_metric | ||
| update_guestos_boot_action_metric | ||
| update_config_version_metric | ||
| update_tee_metrics |
There was a problem hiding this comment.
Should we stay consistent and replace all binary_version with replica_version? This also applies to metrics-proxy.yaml and ic-os/defs.bzl
| @@ -68,7 +68,7 @@ impl OrchestratorMetrics { | |||
| orchestrator_info: metrics_registry.int_gauge_vec( | |||
| "ic_orchestrator_info", | |||
| "version info for the internet computer orchestrator running.", | |||
There was a problem hiding this comment.
| "version info for the internet computer orchestrator running.", | |
| "Replica & GuestOS versions info for the running Internet Computer orchestrator", |
| pub skip_prompts: bool, | ||
|
|
||
| #[clap(long)] | ||
| /// The GuestOS version to report; defaults to the replica version. |
There was a problem hiding this comment.
| /// The GuestOS version to report; defaults to the replica version. | |
| /// The GuestOS version the validator uses; defaults to the replica version. |
| pub guestos_version: ReplicaVersion, | ||
| /// The replica binary version, possibly hot-swapped by a fast upgrade. | ||
| pub replica_version: ReplicaVersion, | ||
| } |
There was a problem hiding this comment.
I'm starting to lean towards introducing type GuestosVersion = VersionOf<GuestosVersionTag> and type ReplicaVersion = VersionOf<ReplicaVersionTag>, i.e. have them share same semantics (same methods, same representation in memory) while keeping the two types strictly different from one another.
I think this should be more robust on the long-run.
But this would probably deserve its own PR.
There used to be a single version: the one under
/opt/ic/share/version.txt, read by the orchestrator and passed to the replica. During fast GuestOS upgrade, the replica binaries are hot-swapped via an overlay while the node keeps running the old GuestOS. The base GuestOS version and the replica version must be distinguished.PlatformVersion(new struct inic-types, next toReplicaVersion) holds bothguestos_version(the GuestOS the node booted from) andreplica_version(the running replica binary).replica_version: ReplicaVersioninReplicaConfigis replaced byplatform_version: PlatformVersion./opt/ic/share/binary_version.txt(plus its-testvariant). During a fast upgrade, the sysext overlay will shadow it with the post-upgrade version, whileversion.txt— now explicitly the GuestOS version — is never shadowed.--version-file→ binary version,--guestos-version-file→ GuestOS version) and passes them when starting the replica process./api/v2/statusgains an optionalguestos_versionfield alongsideimpl_version.custom-metrics.shnow also exports a binary_version metric.