Skip to content

Commit 2f5d582

Browse files
authored
feat: CON-1716 Allow specifying initial DKG subnet for subnet splitting and rental (#10027)
Creating, recovering or splitting a subnet requires new key material for the nodes comprising the subnet. This key material needs to be generated by a different subnet. Until recently, this key generation was exclusively done by the NNS. Since #9782 however, it may be done by any subnet (and specifically, _not_ the NNS). The linked PR already updated proposals for creating and recovering subnets to optionally specify which subnet should be responsible for generating the initial key material. This PR similarly updates the remaining two proposal types that also cause new key material to be generated, namely subnet splitting and subnet rental (which is a subnet creation).
1 parent 936346a commit 2f5d582

15 files changed

Lines changed: 119 additions & 6 deletions

File tree

rs/nns/governance/api/src/types.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2826,6 +2826,9 @@ pub struct FulfillSubnetRentalRequest {
28262826
pub user: Option<PrincipalId>,
28272827
pub node_ids: Option<Vec<PrincipalId>>,
28282828
pub replica_version_id: Option<String>,
2829+
/// Optional subnet that should handle `setup_initial_dkg` for subnet creation.
2830+
/// If not set, handling defaults to the NNS subnet.
2831+
pub initial_dkg_subnet_id: Option<PrincipalId>,
28292832
}
28302833

28312834
#[derive(

rs/nns/governance/canister/governance.did

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,10 @@ type FulfillSubnetRentalRequest = record {
11151115
//
11161116
// https://github.com/dfinity/ic/releases/latest
11171117
replica_version_id : opt text;
1118+
1119+
// Optional subnet that should handle `setup_initial_dkg` for subnet creation.
1120+
// If not set, handling defaults to the NNS subnet.
1121+
initial_dkg_subnet_id : opt principal;
11181122
};
11191123

11201124
// Declares an approved set of alternative replica virtual machine software for

rs/nns/governance/proto/ic_nns_governance/pb/v1/governance.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,6 +1992,9 @@ message FulfillSubnetRentalRequest {
19921992
ic_base_types.pb.v1.PrincipalId user = 1;
19931993
repeated ic_base_types.pb.v1.PrincipalId node_ids = 3;
19941994
string replica_version_id = 2;
1995+
// Optional subnet that should handle `setup_initial_dkg` for subnet creation.
1996+
// If not set, handling defaults to the NNS subnet.
1997+
optional ic_base_types.pb.v1.PrincipalId initial_dkg_subnet_id = 4;
19951998
}
19961999

19972000
message BlessAlternativeGuestOsVersion {

rs/nns/governance/src/gen/ic_nns_governance.pb.v1.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2995,6 +2995,10 @@ pub struct FulfillSubnetRentalRequest {
29952995
pub node_ids: ::prost::alloc::vec::Vec<::ic_base_types::PrincipalId>,
29962996
#[prost(string, tag = "2")]
29972997
pub replica_version_id: ::prost::alloc::string::String,
2998+
/// Optional subnet that should handle `setup_initial_dkg` for subnet creation.
2999+
/// If not set, handling defaults to the NNS subnet.
3000+
#[prost(message, optional, tag = "4")]
3001+
pub initial_dkg_subnet_id: ::core::option::Option<::ic_base_types::PrincipalId>,
29983002
}
29993003
#[derive(
30003004
candid::CandidType,

rs/nns/governance/src/pb/conversions/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2790,6 +2790,7 @@ impl From<pb::FulfillSubnetRentalRequest> for api::FulfillSubnetRentalRequest {
27902790
user: item.user,
27912791
node_ids: Some(item.node_ids),
27922792
replica_version_id: Some(item.replica_version_id),
2793+
initial_dkg_subnet_id: item.initial_dkg_subnet_id,
27932794
}
27942795
}
27952796
}
@@ -2800,6 +2801,7 @@ impl From<api::FulfillSubnetRentalRequest> for pb::FulfillSubnetRentalRequest {
28002801
user: item.user,
28012802
node_ids: item.node_ids.unwrap_or_default(),
28022803
replica_version_id: item.replica_version_id.unwrap_or_default(),
2804+
initial_dkg_subnet_id: item.initial_dkg_subnet_id,
28032805
}
28042806
}
28052807
}

rs/nns/governance/src/proposals/fulfill_subnet_rental_request.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ pub(crate) struct ValidFulfillSubnetRentalRequest {
4242
user: PrincipalId,
4343
node_ids: Vec<PrincipalId>,
4444
replica_version_id: String,
45+
/// Optional subnet that should handle `setup_initial_dkg` for subnet creation.
46+
/// If not set, handling defaults to the NNS subnet.
47+
initial_dkg_subnet_id: Option<PrincipalId>,
4548
}
4649

4750
impl TryFrom<FulfillSubnetRentalRequest> for ValidFulfillSubnetRentalRequest {
@@ -52,6 +55,7 @@ impl TryFrom<FulfillSubnetRentalRequest> for ValidFulfillSubnetRentalRequest {
5255
user,
5356
node_ids,
5457
replica_version_id,
58+
initial_dkg_subnet_id,
5559
} = value;
5660

5761
let mut defects = vec![];
@@ -93,6 +97,7 @@ impl TryFrom<FulfillSubnetRentalRequest> for ValidFulfillSubnetRentalRequest {
9397
user,
9498
node_ids,
9599
replica_version_id,
100+
initial_dkg_subnet_id,
96101
})
97102
}
98103
}
@@ -239,7 +244,7 @@ impl ValidFulfillSubnetRentalRequest {
239244

240245
subnet_type: SubnetType::Application,
241246
subnet_id_override: None,
242-
initial_dkg_subnet_id: None,
247+
initial_dkg_subnet_id: self.initial_dkg_subnet_id.map(SubnetId::from),
243248
start_as_nns: false,
244249
is_halted: false,
245250
chain_key_config: None,

rs/nns/governance/src/proposals/fulfill_subnet_rental_request/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ fn test_validate_fulfill_subnet_rental_request() {
2222
.map(|_| new_subnet_id())
2323
.collect(),
2424
replica_version_id: "60fb469c46e44e6071193a3314cc442044fcf17a".to_string(),
25+
initial_dkg_subnet_id: None,
2526
};
2627

2728
// Sad cases.

rs/registry/admin/bin/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,11 @@ struct ProposeToFulfillSubnetRentalRequestCmd {
16061606
/// Replica version ID (40 character hexadecimal git commit ID)
16071607
#[clap(long)]
16081608
replica_version_id: String,
1609+
1610+
/// Optional subnet that should handle `setup_initial_dkg` for subnet creation.
1611+
/// If not set, handling defaults to the NNS subnet.
1612+
#[clap(long)]
1613+
initial_dkg_subnet_id: Option<PrincipalId>,
16091614
}
16101615

16111616
impl ProposalTitle for ProposeToFulfillSubnetRentalRequestCmd {
@@ -1628,6 +1633,7 @@ impl ProposalAction for ProposeToFulfillSubnetRentalRequestCmd {
16281633
user: Some(self.user),
16291634
node_ids: Some(self.node_ids.clone()),
16301635
replica_version_id: Some(self.replica_version_id.clone()),
1636+
initial_dkg_subnet_id: self.initial_dkg_subnet_id,
16311637
},
16321638
)
16331639
}

rs/registry/canister/canister/registry.did

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ type SplitSubnetPayload = record {
548548
source_subnet_id: principal;
549549
destination_canister_ranges: vec CanisterIdRange;
550550
destination_node_ids: vec principal;
551+
initial_dkg_subnet_id: opt principal;
551552
};
552553

553554
type OperationType = variant {

rs/registry/canister/canister/registry_test.did

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ type SplitSubnetPayload = record {
548548
source_subnet_id: principal;
549549
destination_canister_ranges: vec CanisterIdRange;
550550
destination_node_ids: vec principal;
551+
initial_dkg_subnet_id: opt principal;
551552
};
552553

553554
type OperationType = variant {

0 commit comments

Comments
 (0)