Skip to content

Commit

Permalink
Merge branch 'sat-subnet-create-with-min-nakamoto' into 'main'
Browse files Browse the repository at this point in the history
feat: Accept min Nakamoto Coefficient for subnet create

See merge request dfinity-lab/core/release!477
  • Loading branch information
sasa-tomic committed Nov 29, 2022
2 parents 51eb5e5 + 73d17d0 commit 138dc73
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion rs/decentralization/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,14 @@ pub trait TopologyManager: SubnetQuerier + AvailableNodesQuerier {
.remove(nodes)
}

async fn create_subnet(&self, size: usize) -> Result<SubnetChange, NetworkError> {
async fn create_subnet(
&self,
size: usize,
min_nakamoto_coefficients: Option<MinNakamotoCoefficients>,
) -> Result<SubnetChange, NetworkError> {
SubnetChangeRequest {
available_nodes: self.available_nodes().await?,
min_nakamoto_coefficients,
..Default::default()
}
.extend(size)
Expand Down
4 changes: 2 additions & 2 deletions rs/ic-management-backend/src/endpoints/subnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ async fn create_subnet(
request: web::Json<SubnetCreateRequest>,
) -> Result<HttpResponse, Error> {
let registry = registry.read().await;
println!("Received a request to create a subnet {:?}", request.size);
println!("Received a request to create a subnet of size {:?} and MinNakamotoCoefficients {}", request.size, serde_json::to_string(&request.min_nakamoto_coefficients).unwrap());
Ok(HttpResponse::Ok().json(decentralization::SubnetChangeResponse::from(
&registry.create_subnet(request.size).await?,
&registry.create_subnet(request.size, request.min_nakamoto_coefficients.clone()).await?,
)))
}

Expand Down
1 change: 1 addition & 0 deletions rs/ic-management-types/src/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub enum ReplaceTarget {
#[derive(Serialize, Deserialize)]
pub struct SubnetCreateRequest {
pub size: usize,
pub min_nakamoto_coefficients: Option<MinNakamotoCoefficients>,
}

#[derive(Serialize, Deserialize)]
Expand Down

0 comments on commit 138dc73

Please sign in to comment.