Skip to content

Commit

Permalink
Merge branch 'jason/NNS1-2393-1' into 'master'
Browse files Browse the repository at this point in the history
chore(sns-w): Clean up logic related to allowed principals

< [Previous MR in this series](https://gitlab.com/dfinity-lab/public/ic/-/merge_requests/17508) |

Closes NNS1-2393 

Closes NNS1-2393

See merge request dfinity-lab/public/ic!17693
  • Loading branch information
aterga committed Feb 16, 2024
2 parents 36712fa + 0aeebbc commit e7ce95b
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 490 deletions.
3 changes: 0 additions & 3 deletions rs/nns/integration_tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ mod list_node_providers;
#[cfg(test)]
mod network_economics;

#[cfg(test)]
mod sns_wasm_allowed_principals;

#[cfg(test)]
mod neuron_following;

Expand Down
169 changes: 0 additions & 169 deletions rs/nns/integration_tests/src/sns_wasm_allowed_principals.rs

This file was deleted.

35 changes: 21 additions & 14 deletions rs/nns/sns-wasm/canister/canister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ use ic_sns_wasm::{
canister_stable_memory::CanisterStableMemory,
init::SnsWasmCanisterInitPayload,
pb::v1::{
AddWasmRequest, AddWasmResponse, DeployNewSnsRequest, DeployNewSnsResponse,
GetAllowedPrincipalsRequest, GetAllowedPrincipalsResponse,
GetDeployedSnsByProposalIdRequest, GetDeployedSnsByProposalIdResponse,
GetNextSnsVersionRequest, GetNextSnsVersionResponse, GetSnsSubnetIdsRequest,
GetSnsSubnetIdsResponse, GetWasmRequest, GetWasmResponse, InsertUpgradePathEntriesRequest,
InsertUpgradePathEntriesResponse, ListDeployedSnsesRequest, ListDeployedSnsesResponse,
ListUpgradeStepsRequest, ListUpgradeStepsResponse, UpdateAllowedPrincipalsRequest,
update_allowed_principals_response::UpdateAllowedPrincipalsResult, AddWasmRequest,
AddWasmResponse, DeployNewSnsRequest, DeployNewSnsResponse, GetAllowedPrincipalsRequest,
GetAllowedPrincipalsResponse, GetDeployedSnsByProposalIdRequest,
GetDeployedSnsByProposalIdResponse, GetNextSnsVersionRequest, GetNextSnsVersionResponse,
GetSnsSubnetIdsRequest, GetSnsSubnetIdsResponse, GetWasmRequest, GetWasmResponse,
InsertUpgradePathEntriesRequest, InsertUpgradePathEntriesResponse,
ListDeployedSnsesRequest, ListDeployedSnsesResponse, ListUpgradeStepsRequest,
ListUpgradeStepsResponse, SnsWasmError, UpdateAllowedPrincipalsRequest,
UpdateAllowedPrincipalsResponse, UpdateSnsSubnetListRequest, UpdateSnsSubnetListResponse,
},
sns_wasm::SnsWasmCanister,
Expand Down Expand Up @@ -436,13 +437,17 @@ fn update_allowed_principals() {

#[candid_method(update, rename = "update_allowed_principals")]
fn update_allowed_principals_(
request: UpdateAllowedPrincipalsRequest,
_: UpdateAllowedPrincipalsRequest,
) -> UpdateAllowedPrincipalsResponse {
SNS_WASM.with(|sns_wasm| {
sns_wasm
.borrow_mut()
.update_allowed_principals(request, caller())
})
UpdateAllowedPrincipalsResponse {
update_allowed_principals_result: Some(UpdateAllowedPrincipalsResult::Error(
SnsWasmError {
message: "update_allowed_principals is obsolete. For launching an SNS, please \
submit a CreateServiceNervousSystem proposal."
.to_string(),
},
)),
}
}

#[export_name = "canister_query get_allowed_principals"]
Expand All @@ -452,7 +457,9 @@ fn get_allowed_principals() {

#[candid_method(query, rename = "get_allowed_principals")]
fn get_allowed_principals_(_request: GetAllowedPrincipalsRequest) -> GetAllowedPrincipalsResponse {
SNS_WASM.with(|sns_wasm| sns_wasm.borrow().get_allowed_principals())
GetAllowedPrincipalsResponse {
allowed_principals: vec![],
}
}

/// Add or remove SNS subnet IDs from the list of subnet IDs that SNS instances will be deployed to
Expand Down
19 changes: 3 additions & 16 deletions rs/nns/sns-wasm/src/pb/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use crate::{
pb::v1::{
add_wasm_response, get_deployed_sns_by_proposal_id_response,
update_allowed_principals_response, AddWasmResponse, DeployedSns,
add_wasm_response, get_deployed_sns_by_proposal_id_response, AddWasmResponse, DeployedSns,
GetDeployedSnsByProposalIdResponse, GetNextSnsVersionResponse,
InsertUpgradePathEntriesResponse, ListUpgradeStep, PrettySnsVersion, SnsCanisterIds,
SnsCanisterType, SnsSpecificSnsUpgrade, SnsUpgrade, SnsVersion, SnsWasm, SnsWasmError,
SnsWasmStableIndex, StableCanisterState, UpdateAllowedPrincipalsResponse,
UpdateSnsSubnetListResponse, UpgradePath as StableUpgradePath,
SnsWasmStableIndex, StableCanisterState, UpdateSnsSubnetListResponse,
UpgradePath as StableUpgradePath,
},
sns_wasm::{vec_to_hash, SnsWasmCanister, UpgradePath},
stable_memory::SnsWasmStableMemory,
Expand Down Expand Up @@ -50,18 +49,6 @@ impl InsertUpgradePathEntriesResponse {
}
}

impl UpdateAllowedPrincipalsResponse {
pub fn error(message: String) -> Self {
Self {
update_allowed_principals_result: Some(
update_allowed_principals_response::UpdateAllowedPrincipalsResult::Error(
SnsWasmError { message },
),
),
}
}
}

impl UpdateSnsSubnetListResponse {
pub fn error(message: &str) -> Self {
Self {
Expand Down

0 comments on commit e7ce95b

Please sign in to comment.