Skip to content

refactor: Remove ReplicaVersion::default() - #11087

Open
frankdavid wants to merge 26 commits into
masterfrom
frankdavid/explicit-replica-version
Open

refactor: Remove ReplicaVersion::default()#11087
frankdavid wants to merge 26 commits into
masterfrom
frankdavid/explicit-replica-version

Conversation

@frankdavid

Copy link
Copy Markdown
Contributor

The replica version is the git commit hash that the replica (and the entire GuestOS) is built from. The value is read from /opt/ic/share/version.txt in the GuestOS and passed to the orchestrator and the replica via CLI args. Previously, we used a global static variable to store the version. The code could access it via ReplicaVersion::default(). The implementation read the global variable which was usually set at the start of the program (e.g., in main). The implementation fell back to the CARGO_PKG_VERSION when the global was unset (in most tests). Since ReplicaVersion is defined in ic_types, the implementation used the crate version which has been 0.9.0 since Dec 2023. The replica version was stored in a global variable, so tests could not mock this value. In addition, prod code that transitively depended on ReplicaVersion::default() may have not known about it and thus implicitly used the confusing 0.9.0 value (which does not even match the commit hash format).

This is a major refactor which:

  • explicitly wires ReplicaVersion to components that previously used ReplicaVersion::default() -> any prod code that uses the replica version must explicitly pass the version
  • adds a test_replica_version() to be used strictly by tests only
  • removes ReplicaVersion::default() since the default value was confusing and error-prone

The replica version is the git commit hash that the replica (and the entire GuestOS) is built from. The value is read from `/opt/ic/share/version.txt` in the GuestOS and passed to the orchestrator and the replica via CLI args. Previously, we used a global static variable to store the version. The code could access it via `ReplicaVersion::default()`. The implementation read the global variable which was usually set at the start of the program (e.g., in main). The implementation fell back to the `CARGO_PKG_VERSION` when the global was unset (in most tests). Since `ReplicaVersion` is defined in ic_types, the implementation used the crate version which has been 0.9.0 since Dec 2023. Because the replica version was stored in a global variable, tests could not mock this value.

This is a major refactor which:
- explicitly wires `ReplicaVersion` to components that previously used `ReplicaVersion::default()`
- adds a `test_replica_version()` to be used strictly by tests only
- removes `ReplicaVersion::default()` since the default value was confusing and error-prone
@frankdavid
frankdavid requested review from a team as code owners August 10, 2026 12:19

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request changes code owned by the Governance team. Therefore, make sure that
you have considered the following (for Governance-owned code):

  1. Update unreleased_changelog.md (if there are behavior changes, even if they are
    non-breaking).

  2. Are there BREAKING changes?

  3. Is a data migration needed?

  4. Security review?

How to Satisfy This Automatic Review

  1. Go to the bottom of the pull request page.

  2. Look for where it says this bot is requesting changes.

  3. Click the three dots to the right.

  4. Select "Dismiss review".

  5. In the text entry box, respond to each of the numbered items in the previous
    section, declare one of the following:

  • Done.

  • $REASON_WHY_NO_NEED. E.g. for unreleased_changelog.md, "No
    canister behavior changes.", or for item 2, "Existing APIs
    behave as before.".

Brief Guide to "Externally Visible" Changes

"Externally visible behavior change" is very often due to some NEW canister API.

Changes to EXISTING APIs are more likely to be "breaking".

If these changes are breaking, make sure that clients know how to migrate, how to
maintain their continuity of operations.

If your changes are behind a feature flag, then, do NOT add entrie(s) to
unreleased_changelog.md in this PR! But rather, add entrie(s) later, in the PR
that enables these changes in production.

Reference(s)

For a more comprehensive checklist, see here.

GOVERNANCE_CHECKLIST_REMINDER_DEDUP

@zeropath-ai

zeropath-ai Bot commented Aug 10, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 3cc7b91.

Security Overview
Detected Code Changes

The diff is too large to display a summary of code changes.

@zeropath-ai

zeropath-ai Bot commented Aug 10, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 3cc7b91.

Security Overview
Detected Code Changes

The diff is too large to display a summary of code changes.

@zeropath-ai

zeropath-ai Bot commented Aug 10, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 3cc7b91.

Security Overview
Detected Code Changes

The diff is too large to display a summary of code changes.

@frankdavid
frankdavid marked this pull request as draft August 10, 2026 12:24
@daniel-wong-dfinity-org-twin

Copy link
Copy Markdown
Contributor

Wow. I mean, I guess we all agree that impl Default for ReplicaVersion is evil, but I was not expecting anyone to actually do the surgery needed to get rid of that, since it is fairly pervasive. I mean, I would be a little bit afraid of rocking the boat on this one. OTOH, once you simply delete impl Default for ReplicaVersion, the bazel + rustc COMPREHENSIVELY shows you all the code that needs to be reworked, and the rework would be "easy" to verify, so I guess there is no reason to be afraid of this change...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is not ready for review, since it is still in draft, and more commits are coming in, but I opened this, and started looking, so let me send some of my early incomplete thoughts...

Comment thread rs/types/types_test_utils/src/ids.rs
Comment thread rs/types/types_test_utils/src/ids.rs Outdated
Comment thread rs/nns/integration_tests/src/subnet_handler.rs Outdated
frankdavid and others added 8 commits August 13, 2026 13:55
…-replica-version

# Conflicts:
#	rs/consensus/dkg/src/lib.rs
#	rs/consensus/mocks/src/lib.rs
#	rs/consensus/src/consensus/notary.rs
#	rs/consensus/src/consensus/priority.rs
#	rs/https_outcalls/consensus/src/pool_manager.rs
…-replica-version

# Conflicts:
#	rs/nns/integration_tests/src/upgrades_handler.rs
#	rs/registry/canister/tests/update_subnet_and_elect_replica_version.rs
@frankdavid
frankdavid marked this pull request as ready for review August 14, 2026 14:33

@Pace222 Pace222 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two suggestions maybe worth exploring:

  • Similar to the FakeContent<T> trait, maybe we could introduce a trait that exposes a method fake. Each artifact would implement it and pass test_replica_version. Now all tests would replace ArtifactName::new(..., test_replica_version()) with ArtifactName::fake(...). I haven't looked at all artifacts, so I am not sure this is 100% feasible, but it would give the flexibility to mock certain fields at a single place.
  • More involved, but we could introduce a new
pub struct Versioned<T> {
    pub version: RepilcaVersion,
    pub content: T,
}

        struct and replace all artifact aliases from Signed<T, S> to Signed<Versioned<T>, S>. This would definitely involve even more plumbing, but we could enforce versioning of artifacts at the type-level and collapse duplicate implementations of checking version matches to a single place.

Comment thread rs/consensus/dkg/src/lib.rs Outdated
Comment thread rs/consensus/dkg/src/lib.rs Outdated
Comment thread rs/consensus/dkg/src/utils.rs Outdated
Comment thread rs/consensus/src/consensus/status.rs
Comment thread rs/consensus/src/consensus/batch_delivery.rs
Comment thread rs/replica/setup_ic_network/src/lib.rs Outdated
Comment thread rs/test_utilities/artifact_pool/src/consensus_pool.rs Outdated
Comment thread rs/test_utilities/consensus/src/lib.rs Outdated
Comment thread rs/types/types/src/replica_version.rs Outdated
Comment thread rs/types/types/src/replica_version.rs
…-replica-version

# Conflicts:
#	rs/https_outcalls/consensus/src/pool_manager.rs
#	rs/https_outcalls/pricing/src/fees.rs
@frankdavid

Copy link
Copy Markdown
Contributor Author

Thanks, @Pace222 for your comments and suggestions. I addressed the simpler ones. As for the larger refactorings, I think they are cool ideas, but I'd prefer if the consensus team could think about the right approach and implement the changes as necessary.

Comment thread rs/test_utilities/artifact_pool/src/consensus_pool.rs

@daniel-wong-dfinity-org-twin daniel-wong-dfinity-org-twin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving for Governance-owned files.

UPDATE: Strike out the following, because I already said this earlier.

For constants like test_replica_version_id, I would instead do
lazy_static! {
    pub static ref TEST_REPLICA_VERSION_ID ...
}

unless, ofc, that would be inconsistent with the crate where it is defined.

The benefit is that this makes it clear that this thing is fixed. A 0-argument function CAN return different values every time (e.g. random number generators). A lazy_static + all caps says, "No, really. This is FIXED!". That's why (when possible), we use const + all caps instead of 0-argument functions. It gives a helpful hint to the reader.

Comment thread rs/nns/integration_tests/src/upgrades_handler.rs

@pierugo-dfinity pierugo-dfinity left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would approve but I'd gladly first let Leo have a look at the two locations I pinged him at 🙏 And thanks for the plumbing!

Comment thread rs/replay/src/player.rs
Comment on lines +226 to +232
// Without a consensus pool there is nothing to replay.
if !cfg.artifact_pool.consensus_pool_path.exists() {
panic!(
"No consensus pool found at {:?}",
cfg.artifact_pool.consensus_pool_path
);
Some(consensus_pool)
} else {
None
};
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eichhorl Can you think of a use-case for ic-replay without a consensus pool?

With the suggested changes, Player::consensus_pool will always be Some, but there is quite some deeper amount of code that properly handles a missing pool. Not sure what to set the replica_version to in that case though...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there could be a scenario where we might want to make multiple changes to a recovery state over multiple calls to ic-replay. In that case, only the first call replays the pool, every subsequent call only applies extra batches on top of the checkpoint that the previous call created.

There are also some sub-commands that don't need a pool.

If we have a pool, then we could probably also use ic_artifact_pool::get_replica_version. But if there is no pool, and a replica version is needed, then it could be a new CLI argument.

Arc::clone(&consensus_crypto),
Arc::clone(&consensus_pool_cache),
ReplicaConfig { subnet_id, node_id },
replica_config.clone(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
replica_config.clone(),
replica_config,

@pierugo-dfinity
pierugo-dfinity requested a lite review from Copilot and removed request for Pace222 August 19, 2026 14:15
@pierugo-dfinity pierugo-dfinity added the CI_ALL_BAZEL_TARGETS Runs all bazel targets label Aug 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the confusing global/default ReplicaVersion value and instead threads an explicit ReplicaVersion through the replica, consensus, and related tooling, while adding test-only helpers to supply deterministic versions in unit/integration tests.

Changes:

  • Remove ReplicaVersion::default() and global “set default version” behavior; represent ReplicaVersion as Arc<str> with custom serde helpers.
  • Plumb ReplicaVersion through ReplicaConfig and consensus/artifact constructors (blocks, notarizations, random beacon/tape, DKG dealings, etc.) so production code must pass a version explicitly.
  • Update extensive test/util code to use deterministic test versions (test_replica_version() or fixed per-test versions) and adjust build/dependency wiring accordingly.

Reviewed changes

Copilot reviewed 143 out of 144 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rs/utils/src/serde_arc.rs Allow serializing Arc<str> (DST) and add deserialize_arc_str helper.
rs/types/types/src/replica_version.rs Remove default/global version; store version ID in Arc<str> and update parsing/serde.
rs/types/types/src/replica_config.rs Add replica_version to ReplicaConfig (no implicit defaults).
rs/types/types/src/crypto/hash/tests.rs Make hash stability tests pass a deterministic replica version.
rs/types/types/src/consensus/dkg.rs Require explicit ReplicaVersion when creating DealingContent.
rs/types/types/src/consensus.rs Thread ReplicaVersion through consensus content constructors.
rs/types/types/src/canister_http.rs Update tests to construct explicit replica versions.
rs/types/types/src/batch/canister_http.rs Update tests to construct explicit replica versions.
rs/types/types/Cargo.toml Remove rusty-fork dev-dependency.
rs/types/types/BUILD.bazel Remove rusty-fork test dependency.
rs/types/types_test_utils/src/ids.rs Add test_replica_version() helper for tests.
rs/tests/testnets/mainnet_nns/src/lib.rs Replace try_from usage with from_str for replica version parsing.
rs/tests/consensus/subnet_recovery/common.rs Replace try_from usage with from_str for replica version parsing.
rs/test_utilities/types/src/batch/batch_builder.rs Use test_replica_version() instead of removed ReplicaVersion::default().
rs/test_utilities/registry/src/lib.rs Use test_replica_version() when producing subnet records.
rs/test_utilities/registry/Cargo.toml Add ic-test-utilities-types dependency to use test_replica_version().
rs/test_utilities/registry/BUILD.bazel Add Bazel dep on //rs/test_utilities/types.
rs/test_utilities/execution_environment/src/lib.rs Use test_replica_version() in execution test builder defaults.
rs/test_utilities/consensus/src/lib.rs Thread explicit replica version into genesis artifacts.
rs/test_utilities/consensus/src/fake.rs Thread replica version through fake consensus content creation.
rs/test_utilities/artifact_pool/src/consensus_pool.rs Store replica version in test pool and use it in created artifacts.
rs/state_machine_tests/src/tests.rs Use test replica version for registry keys instead of default.
rs/state_machine_tests/src/lib.rs Use test_replica_version() throughout StateMachine test harness.
rs/replica/src/setup.rs Remove set_replica_version (no global/default version to set).
rs/replica/src/setup_ic_stack.rs Pass replica version into IC stack construction and pool compatibility checks.
rs/replica/setup_ic_network/src/lib.rs Add replica version to setup path and propagate into consensus components.
rs/replica/bin/replica/main.rs Derive explicit replica version from args (or “unknown”) and report it in metrics.
rs/replica_tests/src/lib.rs Use test_replica_version() for replica test configuration and wiring.
rs/replay/src/validator.rs Carry replica version through replay validator and consensus pool construction.
rs/replay/src/player.rs Remove default-version setting; read replica version from finalized tip and pass into components.
rs/registry/regedit/src/tests.rs Update prep/regedit tests to use explicit test replica versions.
rs/registry/helpers/src/subnet.rs Switch tests to from_str for replica versions.
rs/registry/canister/tests/update_unassigned_nodes_config.rs Use test_replica_version() string for registry test payloads.
rs/registry/canister/tests/update_subnet.rs Use test_replica_version() string for subnet record fields.
rs/registry/canister/tests/update_subnet_and_elect_replica_version.rs Use test_replica_version() string in elect/update tests.
rs/registry/canister/tests/update_subnet_admins.rs Use test_replica_version() string in subnet admin tests.
rs/registry/canister/tests/swap_node_in_subnet_directly.rs Use test_replica_version() string when building subnet records.
rs/registry/canister/tests/remove_node_directly.rs Use test_replica_version() string when building subnet records.
rs/registry/canister/tests/recover_subnet.rs Use IC config’s initial replica version rather than ReplicaVersion::default().
rs/registry/canister/tests/create_subnet.rs Use test_replica_version() for create subnet payloads.
rs/registry/canister/tests/common/test_helpers.rs Accept a replica version param and use test_replica_version() elsewhere.
rs/registry/canister/src/mutations/node_management/do_remove_node_directly.rs Use test_replica_version() in mutation tests.
rs/registry/canister/src/mutations/node_management/do_add_node.rs Use test_replica_version() in mutation tests.
rs/registry/canister/src/mutations/do_update_subnet.rs Use test_replica_version() in mutation tests.
rs/registry/canister/src/mutations/do_update_api_boundary_nodes_version.rs Use test_replica_version() in mutation tests.
rs/registry/canister/src/mutations/do_remove_api_boundary_nodes.rs Use test_replica_version() in mutation tests.
rs/registry/canister/src/mutations/do_deploy_guestos_to_all_subnet_nodes.rs Use test_replica_version() in mutation tests.
rs/registry/canister/src/mutations/do_create_subnet.rs Use test_replica_version() in mutation tests.
rs/registry/canister/src/mutations/do_add_api_boundary_nodes.rs Use test_replica_version() in mutation tests.
rs/registry/canister/src/invariants/replica_version.rs Use test_replica_version() in invariant tests; adjust key construction.
rs/registry/canister/src/common/test_helpers.rs Use test_replica_version() in invariant-compliant fixtures.
rs/registry/admin/bin/create_subnet.rs Make replica_version_id required and remove defaulting to ReplicaVersion::default().
rs/prep/src/subnet_configuration.rs Remove Default derive where replica version is now explicit.
rs/prep/src/prep_state_directory.rs Update prep tests to use test_replica_version().
rs/prep/src/internet_computer.rs Expose initial_replica_version_id for consumers needing explicit version.
rs/prep/src/bin/prep.rs Make --replica-version required and use it for default URL/hash computations.
rs/prep/Cargo.toml Add dev-dep for ic-test-utilities-types used in tests.
rs/prep/BUILD.bazel Add Bazel dep on //rs/test_utilities/types for tests.
rs/p2p/artifact_downloader/src/fetch_stripped_artifact/test_utils.rs Use test_replica_version() when building test blocks.
rs/p2p/artifact_downloader/src/fetch_stripped_artifact/download.rs Use test_replica_version() in consensus message construction for tests.
rs/p2p/artifact_downloader/benches/assembler.rs Use test_replica_version() when building benchmark blocks.
rs/orchestrator/src/upgrade.rs Thread explicit replica versions into CUP/test fixtures.
rs/orchestrator/src/registry_helper_tests.rs Switch tests to from_str for replica versions.
rs/orchestrator/registry_replicator/src/internal_state.rs Use test_replica_version() for subnet record fixtures in tests.
rs/orchestrator/registry_replicator/Cargo.toml Add ic-test-utilities-types dev-dependency.
rs/orchestrator/registry_replicator/BUILD.bazel Add Bazel dep on //rs/test_utilities/types.
rs/nns/test_utils/src/registry.rs Use test_replica_version() for registry fixture records.
rs/nns/integration_tests/src/upgrades_handler.rs Use test_replica_version() and improve elected-version assertions.
rs/nns/integration_tests/src/update_unassigned_nodes_config.rs Use test_replica_version() for elected replica version in tests.
rs/nns/integration_tests/src/subnet_handler.rs Use test_replica_version() for subnet record setup.
rs/nns/integration_tests/Cargo.toml Add ic-test-utilities-types dependency.
rs/nns/integration_tests/BUILD.bazel Add Bazel dep on //rs/test_utilities/types.
rs/messaging/src/state_machine/tests.rs Use explicit replica version in ValidationContext construction.
rs/messaging/src/message_routing/tests.rs Use test_replica_version() in ValidationContext construction.
rs/ic_os/guest_upgrade/tests/src/lib.rs Switch tests to from_str for replica versions.
rs/https_outcalls/pricing/src/fees.rs Use test_replica_version() in canister HTTP metadata tests.
rs/https_outcalls/pricing/Cargo.toml Add ic-types-test-utils dev-dependency for test replica version helper.
rs/https_outcalls/pricing/BUILD.bazel Add Bazel dep on //rs/types/types_test_utils for tests.
rs/https_outcalls/consensus/src/pool_manager.rs Use ReplicaConfig.replica_version instead of ReplicaVersion::default(); compare versions directly.
rs/https_outcalls/consensus/src/payload_builder/utils.rs Use test_replica_version() in metadata construction for tests.
rs/https_outcalls/consensus/src/payload_builder/tests.rs Use test_replica_version() in metadata construction for tests.
rs/https_outcalls/consensus/src/payload_builder/proptests.rs Use test_replica_version() in generated metadata.
rs/https_outcalls/consensus/src/gossip.rs Use test_replica_version() in test receipt fixtures.
rs/https_outcalls/consensus/benches/payload_validation.rs Use test_replica_version() in benchmark fixtures.
rs/http_endpoints/public/tests/common/mod.rs Thread explicit replica version into test server setup.
rs/http_endpoints/public/src/status.rs Serve impl_version using injected replica version instead of default.
rs/http_endpoints/public/src/lib.rs Pass replica version into status/dashboard services.
rs/http_endpoints/public/src/dashboard.rs Render dashboard with injected replica version instead of default.
rs/execution_environment/src/scheduler/tests/metrics.rs Remove with_replica_version(ReplicaVersion::default()) usage.
rs/execution_environment/src/scheduler/tests.rs Remove with_replica_version(ReplicaVersion::default()) usage.
rs/execution_environment/src/scheduler/test_utilities.rs Default scheduler tests to test_replica_version(); remove with_replica_version setter.
rs/execution_environment/src/canister_manager/tests.rs Set explicit replica version and assert returned value matches.
rs/engine_controller/tests/tests.rs Use test_replica_version() instead of local default helper.
rs/engine_controller/Cargo.toml Add ic-test-utilities-types as a dev-dependency for tests.
rs/engine_controller/BUILD.bazel Add Bazel dep on //rs/test_utilities/types.
rs/determinism_test/src/setup.rs Populate ReplicaConfig.replica_version in determinism tests.
rs/determinism_test/src/lib.rs Use test_replica_version() in batch contexts for determinism test.
rs/crypto/temp_crypto/src/lib.rs Replace default replica version IDs in test fixtures with explicit strings.
rs/crypto/prng/tests/tests.rs Remove global default pinning; set explicit replica version in test random beacon content.
rs/crypto/prng/src/tests.rs Set explicit replica version in test random beacon content.
rs/consensus/utils/src/lib.rs Remove is_current_protocol_version helper relying on ReplicaVersion::default().
rs/consensus/tests/payload.rs Build ReplicaConfig with explicit replica version and pass into consensus components.
rs/consensus/tests/integration.rs Ensure test ReplicaConfig includes explicit replica version.
rs/consensus/tests/framework/types.rs Pass replica version into consensus pool creation.
rs/consensus/tests/framework/runner.rs Pass replica version into DKG creation.
rs/consensus/src/consensus/validator.rs Compare artifact versions against replica_config.replica_version (no default).
rs/consensus/src/consensus/status.rs Make halting logic compare against injected “my replica version” instead of default.
rs/consensus/src/consensus/random_tape_maker.rs Create random tape content with explicit replica version.
rs/consensus/src/consensus/random_beacon_maker.rs Create random beacon content with explicit replica version.
rs/consensus/src/consensus/priority.rs Build notarizations/finalizations with explicit replica version in tests.
rs/consensus/src/consensus/notary.rs Build notarization content with explicit replica version; thread version into delay logic.
rs/consensus/src/consensus/malicious_consensus.rs Build finalization content with explicit replica version.
rs/consensus/src/consensus/finalizer.rs Thread replica version into batch delivery and finalization content creation.
rs/consensus/src/consensus/catchup_package_maker.rs Thread replica version into status checks.
rs/consensus/src/consensus/block_maker.rs Create blocks with explicit replica version; update halting tests accordingly.
rs/consensus/src/consensus/batch_delivery.rs Thread replica version into delivery/status checks; log version from block.
rs/consensus/src/consensus.rs Remove protocol-version check helper that depended on ReplicaVersion::default().
rs/consensus/mocks/src/lib.rs Initialize replica config with replica version derived from subnet records.
rs/consensus/idkg/src/utils.rs Thread explicit replica version into test blocks.
rs/consensus/idkg/src/payload_builder.rs Thread explicit replica version into test blocks.
rs/consensus/dkg/src/utils.rs Preserve parent block replica version in test utilities.
rs/consensus/dkg/src/test_utils.rs Create dealing content with explicit test replica version.
rs/consensus/dkg/src/payload_validator.rs Thread explicit test replica version into DKG configs/messages.
rs/consensus/dkg/src/lib.rs Store replica version in DkgImpl and validate messages against it (no default).
rs/consensus/cup_utils/src/lib.rs Switch tests to from_str for replica versions.
rs/consensus/benches/validate_payload.rs Pass explicit replica version into consensus pool for benchmark setup.
rs/boundary_node/ic_boundary/src/test_utils.rs Use test_replica_version() for subnet record fixtures.
rs/boundary_node/ic_boundary/Cargo.toml Add dev-dep on ic-test-utilities-types for tests.
rs/boundary_node/ic_boundary/BUILD.bazel Add Bazel dep on //rs/test_utilities/types.
rs/backup/src/backup_helper.rs Use test_replica_version() in backup helper tests.
rs/backup/Cargo.toml Add dev-dep on ic-test-utilities-types for tests.
rs/backup/BUILD.bazel Add Bazel dep on //rs/test_utilities/types.
rs/artifact_pool/src/test_utils.rs Update artifact test utilities to use explicit replica versions.
rs/artifact_pool/src/lib.rs Make persistent pool compatibility check accept explicit replica version.
rs/artifact_pool/src/dkg_pool.rs Create dealing content with explicit test replica version.
rs/artifact_pool/src/consensus_pool.rs Make consensus pool accept replica version (affects spool path layout).
rs/artifact_pool/src/consensus_pool_cache.rs Use explicit replica version in test consensus pool construction.
rs/artifact_pool/src/canister_http_pool.rs Use explicit test replica version in canister HTTP pool tests.
rs/artifact_pool/src/backup.rs Update backup artifact conversion tests to include explicit replica versions.
rs/artifact_pool/benches/load_blocks.rs Pass explicit replica version into consensus pool for benches.
packages/pocket-ic/tests/unix.rs Use test_replica_version() for registry create subnet payloads.
packages/pocket-ic/Cargo.toml Add ic-test-utilities-types to non-windows dev-deps for tests.
packages/pocket-ic/BUILD.bazel Add Bazel dep on //rs/test_utilities/types.
Cargo.lock Lockfile updates for new/removed crate deps.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 59 to 63
fn try_from(version_str: &str) -> Result<Self, Self::Error> {
if !version_str.chars().all(is_valid_version_symbol) {
Err(ReplicaVersionParseError(version_str.to_string()))
} else {
Ok(ReplicaVersion {
Comment on lines 409 to 412
unit_delay_millis: None,
initial_notary_delay_millis: None,
replica_version_id: None,
replica_version_id: ReplicaVersion::from_str("").unwrap(),
dkg_interval_length: None,
Comment on lines +185 to +187
const UNKNOWN_REPLICA_VERSION: &str = "unknown_replica_version";
let replica_version = replica_args.as_ref().map_or_else(
|_| ReplicaVersion::try_from(UNKNOWN_REPLICA_VERSION).unwrap(),

@eichhorl eichhorl Aug 19, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? I.e. why not panic?

Comment on lines 80 to +82
node_id: NodeId,
subnet_id: SubnetId,
replica_version: ReplicaVersion,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this could also take the ReplicaConfig instead

}

static DEFAULT_VERSION_ID: OnceCell<String> = OnceCell::new();
pub static REPLICA_BINARY_HASH: OnceCell<String> = OnceCell::new();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed?

Comment on lines +275 to +276
impl FakeContentSigner<RandomTapeContent> for RandomTapeShare {
fn fake(content: RandomTapeContent, signer: NodeId) -> RandomTapeShare {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not keep it as FakeContentSigner<Height> and set the test replica version here?

);
break;
};
let replica_version = block.version().clone();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree they should be the same, but it introduces a dependency on the validator to continue ensuring that. No strong preference though

Comment thread rs/replay/src/player.rs
Comment on lines +226 to +232
// Without a consensus pool there is nothing to replay.
if !cfg.artifact_pool.consensus_pool_path.exists() {
panic!(
"No consensus pool found at {:?}",
cfg.artifact_pool.consensus_pool_path
);
Some(consensus_pool)
} else {
None
};
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there could be a scenario where we might want to make multiple changes to a recovery state over multiple calls to ic-replay. In that case, only the first call replays the pool, every subsequent call only applies extra batches on top of the checkpoint that the previous call created.

There are also some sub-commands that don't need a pool.

If we have a pool, then we could probably also use ic_artifact_pool::get_replica_version. But if there is no pool, and a replica version is needed, then it could be a new CLI argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants