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
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ async fn test_create_canister_and_install_code() {
.build_async()
.await;

// Step 1.2: Install NNS canisters with the test governance canister
// (which has the CreateCanisterAndInstallCode feature flag enabled).
// Step 1.2: Install NNS canisters.
{
let mut nns_installer = NnsInstaller::default();
nns_installer.with_current_nns_canister_versions();
nns_installer.with_test_governance_canister();
nns_installer.install(&pocket_ic).await;
}

Expand Down
17 changes: 0 additions & 17 deletions rs/nns/governance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,6 @@ thread_local! {
static ENABLE_NEURON_FOLLOW_RESTRICTIONS: Cell<bool>
= const { Cell::new(true) };

static ENABLE_CREATE_CANISTER_AND_INSTALL_CODE_PROPOSALS: Cell<bool>
= const { Cell::new(true) };

static ENABLE_SUBNET_SPLITTING_PROPOSALS: Cell<bool>
= const { Cell::new(false) };

Expand Down Expand Up @@ -285,20 +282,6 @@ pub fn temporarily_disable_neuron_follow_restrictions() -> Temporary {
Temporary::new(&ENABLE_NEURON_FOLLOW_RESTRICTIONS, false)
}

pub fn are_create_canister_and_install_code_proposals_enabled() -> bool {
ENABLE_CREATE_CANISTER_AND_INSTALL_CODE_PROPOSALS.get()
}

#[cfg(any(test, feature = "canbench-rs", feature = "test"))]
pub fn temporarily_enable_create_canister_and_install_code_proposals() -> Temporary {
Temporary::new(&ENABLE_CREATE_CANISTER_AND_INSTALL_CODE_PROPOSALS, true)
}

#[cfg(any(test, feature = "canbench-rs", feature = "test"))]
pub fn temporarily_disable_create_canister_and_install_code_proposals() -> Temporary {
Temporary::new(&ENABLE_CREATE_CANISTER_AND_INSTALL_CODE_PROPOSALS, false)
}

#[cfg(any(test, feature = "canbench-rs", feature = "test"))]
pub fn temporarily_enable_subnet_splitting_proposals() -> Temporary {
Temporary::new(&ENABLE_SUBNET_SPLITTING_PROPOSALS, true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::{
are_create_canister_and_install_code_proposals_enabled,
pb::v1::{
CreateCanisterAndInstallCode, GovernanceError, SelfDescribingValue, Topic,
canister_settings::{LogVisibility, SnapshotVisibility},
Expand All @@ -23,13 +22,6 @@ use ic_nns_handler_root_interface as root;

impl CreateCanisterAndInstallCode {
pub fn validate(&self) -> Result<(), GovernanceError> {
if !are_create_canister_and_install_code_proposals_enabled() {
return Err(GovernanceError::new_with_message(
ErrorType::InvalidProposal,
"CreateCanisterAndInstallCode proposals are not enabled yet.",
));
}

let Self {
host_subnet_id,
canister_settings,
Expand Down Expand Up @@ -226,24 +218,10 @@ impl CallCanister for CreateCanisterAndInstallCode {
type Reply = root::CreateCanisterAndInstallCodeOk;

fn canister_and_function(&self) -> Result<(CanisterId, &str), GovernanceError> {
if !are_create_canister_and_install_code_proposals_enabled() {
return Err(GovernanceError::new_with_message(
ErrorType::InvalidProposal,
"CreateCanisterAndInstallCode proposals are not enabled yet.",
));
}

Ok((ROOT_CANISTER_ID, "create_canister_and_install_code"))
}

fn payload(&self) -> Result<Vec<u8>, GovernanceError> {
if !are_create_canister_and_install_code_proposals_enabled() {
return Err(GovernanceError::new_with_message(
ErrorType::InvalidProposal,
"CreateCanisterAndInstallCode proposals are not enabled yet.",
));
}

let request = root::CreateCanisterAndInstallCodeRequest::try_from(self.clone())?;

Encode!(&request).map_err(|e| {
Expand Down
Loading