Skip to content

Commit cdefe3d

Browse files
Merge branch 'take-snapshot-proposal' into test-take-canister-snapshot-proposal
2 parents 190d075 + 029cd14 commit cdefe3d

File tree

1 file changed

+5
-27
lines changed

1 file changed

+5
-27
lines changed

rs/nns/governance/src/governance.rs

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ use ic_nns_governance_api::{
116116
},
117117
subnet_rental::SubnetRentalRequest,
118118
};
119-
use ic_nns_handler_root_interface::TakeCanisterSnapshotRequest;
120119
use ic_node_rewards_canister_api::monthly_rewards::{
121120
GetNodeProvidersMonthlyXdrRewardsRequest, GetNodeProvidersMonthlyXdrRewardsResponse,
122121
};
@@ -4810,8 +4809,11 @@ impl Governance {
48104809
.map_err(invalid_proposal_error)?;
48114810
}
48124811
ValidNnsFunction::TakeCanisterSnapshot => {
4813-
Self::validate_take_canister_snapshot_payload(&update.payload)
4814-
.map_err(invalid_proposal_error)?;
4812+
if !are_canister_snapshot_proposals_enabled() {
4813+
return Err(invalid_proposal_error(
4814+
"TakeCanisterSnapshot proposals are not yet enabled.".to_string(),
4815+
));
4816+
}
48154817
}
48164818
_ => {}
48174819
};
@@ -4885,30 +4887,6 @@ impl Governance {
48854887
.map_err(|e| format!("The given AddOrRemoveDataCentersProposalPayload is invalid: {e}"))
48864888
}
48874889

4888-
fn validate_take_canister_snapshot_payload(payload: &[u8]) -> Result<(), String> {
4889-
if !are_canister_snapshot_proposals_enabled() {
4890-
return Err("TakeCanisterSnapshot proposals are not yet enabled.".to_string());
4891-
}
4892-
4893-
let _request = Decode!([decoder_config()]; payload, TakeCanisterSnapshotRequest)
4894-
.map_err(|err| format!("Invalid TakeCanisterSnapshotRequest: {err}"))?;
4895-
4896-
// Ideally, we would verify that the Root canister (or maybe the
4897-
// Governance canister?) is a controller of _request.canister_id, but
4898-
// that would require async (or we have to hard-code a list of known
4899-
// controllees); whereas, currently, proposal validation is sync, and
4900-
// changing it to async is fraught with peril...
4901-
//
4902-
// Ditto for _request.replace_snapshot. It can be None, but if it is
4903-
// Some, it must be some snapshot belonging to _request.canister_id.
4904-
//
4905-
// Not performaing these checks is not catastrophic; it just means that
4906-
// when the proposal is executed, no snapshot will be generated. In that
4907-
// case, all they need to do is make a another proposal.
4908-
4909-
Ok(())
4910-
}
4911-
49124890
fn validate_create_service_nervous_system(
49134891
&self,
49144892
create_service_nervous_system: &CreateServiceNervousSystem,

0 commit comments

Comments
 (0)