Skip to content
Open
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
12 changes: 12 additions & 0 deletions rs/nns/governance/api/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4292,6 +4292,12 @@ pub enum NnsFunction {
/// `SetupInitialDKG` requests without an explicit subnet id are routed to the
/// calling subnet (NNS).
SetDefaultInitialDkgSubnet = 58,
/// Deploy a GuestOS version to an explicit list of subnets at once. The
/// proposal changes the GuestOS version used on every subnet in the provided
/// list. The version must be contained in the list of elected GuestOS
/// versions. The upgrade is completed when each subnet creates the next
/// regular CUP.
UpdateGuestosVersionForSubnets = 59,
}
impl NnsFunction {
/// String value of the enum field names used in the ProtoBuf definition.
Expand Down Expand Up @@ -4380,6 +4386,9 @@ impl NnsFunction {
NnsFunction::SetDefaultInitialDkgSubnet => {
"NNS_FUNCTION_SET_DEFAULT_INITIAL_DKG_SUBNET"
}
NnsFunction::UpdateGuestosVersionForSubnets => {
"NNS_FUNCTION_UPDATE_GUESTOS_VERSION_FOR_SUBNETS"
}
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand Down Expand Up @@ -4463,6 +4472,9 @@ impl NnsFunction {
"NNS_FUNCTION_SPLIT_SUBNET" => Some(Self::SplitSubnet),
"NNS_FUNCTION_DELETE_SUBNET" => Some(Self::DeleteSubnet),
"NNS_FUNCTION_SET_DEFAULT_INITIAL_DKG_SUBNET" => Some(Self::SetDefaultInitialDkgSubnet),
"NNS_FUNCTION_UPDATE_GUESTOS_VERSION_FOR_SUBNETS" => {
Some(Self::UpdateGuestosVersionForSubnets)
}
_ => None,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,13 @@ enum NnsFunction {
// `SetupInitialDKG` requests without an explicit subnet id are routed to the
// calling subnet (NNS).
NNS_FUNCTION_SET_DEFAULT_INITIAL_DKG_SUBNET = 58;

// Deploy a GuestOS version to an explicit list of subnets at once. The
// proposal changes the GuestOS version used on every subnet in the provided
// list. The version must be contained in the list of elected GuestOS
// versions. The upgrade is completed when each subnet creates the next
// regular CUP.
NNS_FUNCTION_UPDATE_GUESTOS_VERSION_FOR_SUBNETS = 59;
}

// Payload of a proposal that calls a function on another NNS
Expand Down
12 changes: 12 additions & 0 deletions rs/nns/governance/src/gen/ic_nns_governance.pb.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5286,6 +5286,12 @@ pub enum NnsFunction {
/// `SetupInitialDKG` requests without an explicit subnet id are routed to the
/// calling subnet (NNS).
SetDefaultInitialDkgSubnet = 58,
/// Deploy a GuestOS version to an explicit list of subnets at once. The
/// proposal changes the GuestOS version used on every subnet in the provided
/// list. The version must be contained in the list of elected GuestOS
/// versions. The upgrade is completed when each subnet creates the next
/// regular CUP.
UpdateGuestosVersionForSubnets = 59,
}
impl NnsFunction {
/// String value of the enum field names used in the ProtoBuf definition.
Expand Down Expand Up @@ -5362,6 +5368,9 @@ impl NnsFunction {
Self::SplitSubnet => "NNS_FUNCTION_SPLIT_SUBNET",
Self::DeleteSubnet => "NNS_FUNCTION_DELETE_SUBNET",
Self::SetDefaultInitialDkgSubnet => "NNS_FUNCTION_SET_DEFAULT_INITIAL_DKG_SUBNET",
Self::UpdateGuestosVersionForSubnets => {
"NNS_FUNCTION_UPDATE_GUESTOS_VERSION_FOR_SUBNETS"
}
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand Down Expand Up @@ -5445,6 +5454,9 @@ impl NnsFunction {
"NNS_FUNCTION_SPLIT_SUBNET" => Some(Self::SplitSubnet),
"NNS_FUNCTION_DELETE_SUBNET" => Some(Self::DeleteSubnet),
"NNS_FUNCTION_SET_DEFAULT_INITIAL_DKG_SUBNET" => Some(Self::SetDefaultInitialDkgSubnet),
"NNS_FUNCTION_UPDATE_GUESTOS_VERSION_FOR_SUBNETS" => {
Some(Self::UpdateGuestosVersionForSubnets)
}
_ => None,
}
}
Expand Down
6 changes: 6 additions & 0 deletions rs/nns/governance/src/pb/conversions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3885,6 +3885,9 @@ impl From<pb::NnsFunction> for api::NnsFunction {
pb::NnsFunction::SetDefaultInitialDkgSubnet => {
api::NnsFunction::SetDefaultInitialDkgSubnet
}
pb::NnsFunction::UpdateGuestosVersionForSubnets => {
api::NnsFunction::UpdateGuestosVersionForSubnets
}
}
}
}
Expand Down Expand Up @@ -3985,6 +3988,9 @@ impl From<api::NnsFunction> for pb::NnsFunction {
api::NnsFunction::SetDefaultInitialDkgSubnet => {
pb::NnsFunction::SetDefaultInitialDkgSubnet
}
api::NnsFunction::UpdateGuestosVersionForSubnets => {
pb::NnsFunction::UpdateGuestosVersionForSubnets
}
}
}
}
Expand Down
18 changes: 18 additions & 0 deletions rs/nns/governance/src/proposals/execute_nns_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ pub enum ValidNnsFunction {
SplitSubnet,
DeleteSubnet,
SetDefaultInitialDkgSubnet,
UpdateGuestosVersionForSubnets,
}

impl ValidNnsFunction {
Expand All @@ -468,6 +469,7 @@ impl ValidNnsFunction {
ValidNnsFunction::HardResetNnsRootToVersion
| ValidNnsFunction::ReviseElectedGuestosVersions
| ValidNnsFunction::DeployGuestosToAllSubnetNodes
| ValidNnsFunction::UpdateGuestosVersionForSubnets
)
}

Expand Down Expand Up @@ -506,6 +508,9 @@ impl ValidNnsFunction {
ValidNnsFunction::DeployGuestosToAllSubnetNodes => {
(REGISTRY_CANISTER_ID, "deploy_guestos_to_all_subnet_nodes")
}
ValidNnsFunction::UpdateGuestosVersionForSubnets => {
(REGISTRY_CANISTER_ID, "update_guestos_version_for_subnets")
}
ValidNnsFunction::ReviseElectedHostosVersions => {
(REGISTRY_CANISTER_ID, "revise_elected_hostos_versions")
}
Expand Down Expand Up @@ -630,6 +635,7 @@ impl ValidNnsFunction {

ValidNnsFunction::DeployHostosToSomeNodes
| ValidNnsFunction::DeployGuestosToAllSubnetNodes
| ValidNnsFunction::UpdateGuestosVersionForSubnets
| ValidNnsFunction::DeployGuestosToSomeApiBoundaryNodes
| ValidNnsFunction::DeployGuestosToAllUnassignedNodes => Topic::IcOsVersionDeployment,

Expand Down Expand Up @@ -667,6 +673,9 @@ impl ValidNnsFunction {
ValidNnsFunction::UpdateConfigOfSubnet => "Update Subnet Config",
ValidNnsFunction::AssignNoid => "Assign Node Operator ID (NOID)",
ValidNnsFunction::DeployGuestosToAllSubnetNodes => "Deploy GuestOS To All Subnet Nodes",
ValidNnsFunction::UpdateGuestosVersionForSubnets => {
"Update GuestOS Version For Subnets"
}
ValidNnsFunction::ClearProvisionalWhitelist => "Clear Provisional Whitelist",
ValidNnsFunction::RemoveNodesFromSubnet => "Remove Node from Subnet",
ValidNnsFunction::SetAuthorizedSubnetworks => "Set Authorized Subnets",
Expand Down Expand Up @@ -767,6 +776,12 @@ impl ValidNnsFunction {
The version must be contained in the list of elected GuestOS versions.\n\n\
The upgrade is completed when the subnet creates the next regular CUP."
}
ValidNnsFunction::UpdateGuestosVersionForSubnets => {
"Deploy a GuestOS version to an explicit list of subnets at once. The proposal \
changes the GuestOS version used on every subnet in the provided list.\n\n\
The version must be contained in the list of elected GuestOS versions.\n\n\
The upgrade is completed when each subnet creates the next regular CUP."
}
ValidNnsFunction::ClearProvisionalWhitelist => {
"Clear the provisional whitelist, which allows the listed principals to create \
Canisters with cycles. The mechanism is only needed for bootstrap and testing and \
Expand Down Expand Up @@ -1036,6 +1051,9 @@ impl TryFrom<NnsFunction> for ValidNnsFunction {
NnsFunction::SetDefaultInitialDkgSubnet => {
Ok(ValidNnsFunction::SetDefaultInitialDkgSubnet)
}
NnsFunction::UpdateGuestosVersionForSubnets => {
Ok(ValidNnsFunction::UpdateGuestosVersionForSubnets)
}

// Obsolete functions - based on check_obsolete
NnsFunction::BlessReplicaVersion | NnsFunction::RetireReplicaVersion => {
Expand Down
20 changes: 20 additions & 0 deletions rs/nns/governance/src/proposals/execute_nns_function_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,26 @@ fn test_execute_nns_function_try_from_errors() {
}
}

#[test]
fn test_update_guestos_version_for_subnets_routing() {
use ic_nns_constants::REGISTRY_CANISTER_ID;

let valid = ValidExecuteNnsFunction::try_from(ExecuteNnsFunction {
nns_function: NnsFunction::UpdateGuestosVersionForSubnets as i32,
payload: vec![],
})
.expect("UpdateGuestosVersionForSubnets should be a valid NNS function");

assert_eq!(
valid.nns_function,
ValidNnsFunction::UpdateGuestosVersionForSubnets
);
assert_eq!(
valid.nns_function.canister_and_function(),
(REGISTRY_CANISTER_ID, "update_guestos_version_for_subnets"),
);
}

// This tests a "normal" NNS function where the payload is translated through a candid file fetched
// by the `canister_metadata` method on the management canister.
#[tokio::test]
Expand Down
3 changes: 3 additions & 0 deletions rs/nns/governance/unreleased_changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on the process that this file is part of, see
proposes to set or unset the default subnet to which `SetupInitialDKG`
management canister calls are routed when no subnet is specified explicitly
in the request.
* Added a new `NnsFunction` variant `UpdateGuestosVersionForSubnets`, which
proposes to deploy a given (elected) GuestOS version to an explicit list of
subnets at once.

## Changed

Expand Down
13 changes: 13 additions & 0 deletions rs/registry/canister/canister/canister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ use registry_canister::{
do_update_elected_hostos_versions::{
ReviseElectedHostosVersionsPayload, UpdateElectedHostosVersionsPayload,
},
do_update_guestos_version_for_subnets::UpdateGuestosVersionForSubnetsPayload,
do_update_node_operator_config::UpdateNodeOperatorConfigPayload,
do_update_node_operator_config_directly::UpdateNodeOperatorConfigDirectlyPayload,
do_update_nodes_hostos_version::{
Expand Down Expand Up @@ -563,6 +564,18 @@ fn deploy_guestos_to_all_subnet_nodes_(payload: DeployGuestosToAllSubnetNodesPay
recertify_registry();
}

#[unsafe(export_name = "canister_update update_guestos_version_for_subnets")]
fn update_guestos_version_for_subnets() {
check_caller_is_governance_and_log("update_guestos_version_for_subnets");
over(candid_one, update_guestos_version_for_subnets_);
}

#[candid_method(update, rename = "update_guestos_version_for_subnets")]
fn update_guestos_version_for_subnets_(payload: UpdateGuestosVersionForSubnetsPayload) {
registry_mut().do_update_guestos_version_for_subnets(payload);
recertify_registry();
}

// TODO[NNS1-3000]: Remove this endpoint once mainnet NNS Governance starts calling the new
// TODO[NNS1-3000]: `revise_elected_hostos_versions` endpoint.
#[unsafe(export_name = "canister_update update_elected_hostos_versions")]
Expand Down
6 changes: 6 additions & 0 deletions rs/registry/canister/canister/registry.did
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,11 @@ type UpdateFirewallRulesPayload = record {
rules : vec FirewallRule;
};

type UpdateGuestosVersionForSubnetsPayload = record {
subnet_ids : vec principal;
replica_version_id : text;
};

type UpdateNodeDirectlyPayload = record {
idkg_dealing_encryption_pk : opt blob;
};
Expand Down Expand Up @@ -655,6 +660,7 @@ service : {
update_elected_hostos_versions : (UpdateElectedHostosVersionsPayload) -> ();
revise_elected_hostos_versions : (ReviseElectedHostosVersionsPayload) -> ();
update_firewall_rules : (UpdateFirewallRulesPayload) -> ();
update_guestos_version_for_subnets : (UpdateGuestosVersionForSubnetsPayload) -> ();
update_node_directly : (UpdateNodeDirectlyPayload) -> ();
update_node_domain_directly : (UpdateNodeDomainDirectlyPayload) -> (UpdateNodeDomainDirectlyResponse);
update_node_ipv4_config_directly : (UpdateNodeIPv4ConfigDirectlyPayload) -> (
Expand Down
6 changes: 6 additions & 0 deletions rs/registry/canister/canister/registry_test.did
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,11 @@ type UpdateFirewallRulesPayload = record {
rules : vec FirewallRule;
};

type UpdateGuestosVersionForSubnetsPayload = record {
subnet_ids : vec principal;
replica_version_id : text;
};

type UpdateNodeDirectlyPayload = record {
idkg_dealing_encryption_pk : opt blob;
};
Expand Down Expand Up @@ -655,6 +660,7 @@ service : {
update_elected_hostos_versions : (UpdateElectedHostosVersionsPayload) -> ();
revise_elected_hostos_versions : (ReviseElectedHostosVersionsPayload) -> ();
update_firewall_rules : (UpdateFirewallRulesPayload) -> ();
update_guestos_version_for_subnets : (UpdateGuestosVersionForSubnetsPayload) -> ();
update_node_directly : (UpdateNodeDirectlyPayload) -> ();
update_node_domain_directly : (UpdateNodeDomainDirectlyPayload) -> (UpdateNodeDomainDirectlyResponse);
update_node_ipv4_config_directly : (UpdateNodeIPv4ConfigDirectlyPayload) -> (
Expand Down
Loading
Loading