Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
syntax = "proto3";
package registry.standard_engine_replica_version.v1;

// The default replica/guestos version that engines run, used when an engine's
// own SubnetRecord.replica_version_id is blank (i.e. the engine has not opted
// out of the standard upgrade train).
message StandardEngineReplicaVersionRecord {
// In general, these are (hex encoded) git commit IDs from the dfinity/ic
// repo, identifying the source code from which Replica was built. (Also known
// as Guest OS versions.)
string new_replica_version_id = 1;
string old_replica_version_id = 2;

// The (approximate) fraction of engines that should be on
// new_replica_version_id (the rest should be on old_replica_version_id).
//
// Ranges from 0.0 to 1.0 (inclusive).
//
// Engines with "upgrade priority" <= this should take on
// new_replica_version_id. An engine's upgrade priority is a hash whose inputs
// include its own subnet_id, and new_replica_version_id. More precisely, an
// engine's priority is determined as follows:
//
// 1. Compute SHA-256 of the concatenation of
// a. len("upgrade priority"): a single u8
// b. "upgrade priority": ASCII encoded
// c. new_replica_version_id: hex decoded
// d. the engine's subnet_id: raw bytes
//
// 2. Take the first 8 bytes of that hash, and interpret them as a
// little-endian 64 bit unsigned integer.
//
// 3. Divide that u64 by 2^64 - 1. The result is the engine's upgrade
// priority, a number in [0.0, 1.0].
double deployment_progress = 3;
}
3 changes: 3 additions & 0 deletions rs/protobuf/generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ fn build_registry_proto(def: &Path, out: &Path) {
def.join("registry/node_rewards/v2/node_rewards.proto"),
def.join("registry/dc/v1/dc.proto"),
def.join("registry/unassigned_nodes_config/v1/unassigned_nodes_config.proto"),
def.join(
"registry/standard_engine_replica_version/v1/standard_engine_replica_version.proto",
),
];

compile_protos(config, def, &registry_files);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// This file is @generated by prost-build.
/// The default replica/guestos version that engines run, used when an engine's
/// own SubnetRecord.replica_version_id is blank (i.e. the engine has not opted
/// out of the standard upgrade train).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StandardEngineReplicaVersionRecord {
/// In general, these are (hex encoded) git commit IDs from the dfinity/ic
/// repo, identifying the source code from which Replica was built. (Also known
/// as Guest OS versions.)
#[prost(string, tag = "1")]
pub new_replica_version_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub old_replica_version_id: ::prost::alloc::string::String,
/// The (approximate) fraction of engines that should be on
/// new_replica_version_id (the rest should be on old_replica_version_id).
///
/// Ranges from 0.0 to 1.0 (inclusive).
///
/// Engines with "upgrade priority" \<= this should take on
/// new_replica_version_id. An engine's upgrade priority is a hash whose inputs
/// include its own subnet_id, and new_replica_version_id. More precisely, an
/// engine's priority is determined as follows:
///
/// 1. Compute SHA-256 of the concatenation of
/// a. len("upgrade priority"): a single u8
/// b. "upgrade priority": ASCII encoded
/// c. new_replica_version_id: hex decoded
/// d. the engine's subnet_id: raw bytes
///
/// 1. Take the first 8 bytes of that hash, and interpret them as a
/// little-endian 64 bit unsigned integer.
///
/// 1. Divide that u64 by 2^64 - 1. The result is the engine's upgrade
/// priority, a number in \[0.0, 1.0\].
#[prost(double, tag = "3")]
pub deployment_progress: f64,
}
1 change: 1 addition & 0 deletions rs/protobuf/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ pub mod node_rewards;
pub mod provisional_whitelist;
pub mod replica_version;
pub mod routing_table;
pub mod standard_engine_replica_version;
pub mod subnet;
pub mod unassigned_nodes_config;
3 changes: 3 additions & 0 deletions rs/protobuf/src/registry/standard_engine_replica_version.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#[allow(clippy::all)]
#[path = "../gen/registry/registry.standard_engine_replica_version.v1.rs"]
pub mod v1;
5 changes: 5 additions & 0 deletions rs/registry/keys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub const ROOT_SUBNET_ID_KEY: &str = "nns_subnet_id";
pub const DEFAULT_INITIAL_DKG_SUBNET_ID_KEY: &str = "default_initial_dkg_subnet_id";
pub const NODE_REWARDS_TABLE_KEY: &str = "node_rewards_table";
const UNASSIGNED_NODES_CONFIG_RECORD_KEY: &str = "unassigned_nodes_config";
const STANDARD_ENGINE_REPLICA_VERSION_RECORD_KEY: &str = "standard_engine_replica_version";

pub const API_BOUNDARY_NODE_RECORD_KEY_PREFIX: &str = "api_boundary_node_";
pub const NODE_RECORD_KEY_PREFIX: &str = "node_record_";
Expand Down Expand Up @@ -92,6 +93,10 @@ pub fn make_unassigned_nodes_config_record_key() -> String {
UNASSIGNED_NODES_CONFIG_RECORD_KEY.to_string()
}

pub fn make_standard_engine_replica_version_record_key() -> String {
STANDARD_ENGINE_REPLICA_VERSION_RECORD_KEY.to_string()
}

/// Returns the key whose payload is the [`SubnetId`] of the subnet to which
/// `SetupInitialDKG` management canister calls are routed by default.
pub fn make_default_initial_dkg_subnet_id_key() -> String {
Expand Down
Loading