Skip to content

Commit

Permalink
Deleted ARE_SET_VISIBILITY_PROPOSALS_ENABLED, now that the feature ha…
Browse files Browse the repository at this point in the history
…s gone through a probation period.
  • Loading branch information
daniel-wong-dfinity-org committed Jan 30, 2025
1 parent e5500d6 commit 2a53ea7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 46 deletions.
29 changes: 1 addition & 28 deletions rs/nns/governance/src/governance.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
are_set_visibility_proposals_enabled, decoder_config,
decoder_config,
governance::{
merge_neurons::{
build_merge_neurons_response, calculate_merge_neurons_effect,
Expand Down Expand Up @@ -527,18 +527,6 @@ impl ManageNeuron {
(Some(nid), None) => Ok(Some(NeuronIdOrSubaccount::NeuronId(*nid))),
}
}

// TODO(NNS1-3228): Delete this.
fn is_set_visibility(&self) -> bool {
let Some(Command::Configure(ref configure)) = self.command else {
return false;
};

matches!(
configure.operation,
Some(manage_neuron::configure::Operation::SetVisibility(_)),
)
}
}

impl Command {
Expand Down Expand Up @@ -4978,21 +4966,6 @@ impl Governance {
&self,
manage_neuron: &ManageNeuron,
) -> Result<(), GovernanceError> {
// TODO(NNS1-3228): Delete this.
if manage_neuron.is_set_visibility() &&
// But SetVisibility proposals are disabled
!are_set_visibility_proposals_enabled()
{
return Err(GovernanceError::new_with_message(
ErrorType::Unavailable,
"Setting neuron visibility via proposal is not allowed yet, \
but it will be in the not too distant future. If you need \
this sooner, please, start a new thread at forum.dfinity.org \
and describe your use case."
.to_string(),
));
}

let managed_id = manage_neuron
.get_neuron_id_or_subaccount()?
.ok_or_else(|| {
Expand Down
18 changes: 0 additions & 18 deletions rs/nns/governance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,6 @@ thread_local! {

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

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

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

static USE_STABLE_MEMORY_FOLLOWING_INDEX: Cell<bool> = const { Cell::new(true) };
Expand Down Expand Up @@ -248,22 +246,6 @@ pub fn temporarily_disable_prune_following() -> Temporary {
Temporary::new(&IS_PRUNE_FOLLOWING_ENABLED, false)
}

pub fn are_set_visibility_proposals_enabled() -> bool {
ARE_SET_VISIBILITY_PROPOSALS_ENABLED.with(|ok| ok.get())
}

/// Only integration tests should use this.
#[cfg(any(test, feature = "canbench-rs", feature = "test"))]
pub fn temporarily_enable_set_visibility_proposals() -> Temporary {
Temporary::new(&ARE_SET_VISIBILITY_PROPOSALS_ENABLED, true)
}

/// Only integration tests should use this.
#[cfg(any(test, feature = "canbench-rs", feature = "test"))]
pub fn temporarily_disable_set_visibility_proposals() -> Temporary {
Temporary::new(&ARE_SET_VISIBILITY_PROPOSALS_ENABLED, false)
}

pub fn allow_active_neurons_in_stable_memory() -> bool {
ALLOW_ACTIVE_NEURONS_IN_STABLE_MEMORY.with(|ok| ok.get())
}
Expand Down

0 comments on commit 2a53ea7

Please sign in to comment.