Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
max-dfinity committed Jan 29, 2025
1 parent 8083f45 commit 504cc42
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
5 changes: 2 additions & 3 deletions rs/nns/governance/api/src/ic_nns_governance.pb.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3484,7 +3484,7 @@ pub struct ListProposalInfoResponse {
/// will be returned in the current page.
#[derive(candid::CandidType, candid::Deserialize, serde::Serialize, comparable::Comparable)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq)]
#[derive(Clone, Debug, PartialEq)]
pub struct ListNeurons {
/// The neurons to get information about. The "requested list"
/// contains all of these neuron IDs.
Expand Down Expand Up @@ -3524,9 +3524,8 @@ pub mod list_neurons {
/// A type for the request to list neurons.
#[derive(candid::CandidType, candid::Deserialize, serde::Serialize, comparable::Comparable)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Debug, PartialEq)]
pub struct NeuronSubaccount {
#[prost(bytes = "vec", tag = "1")]
#[serde(with = "serde_bytes")]
pub subaccount: Vec<u8>,
}
Expand Down
21 changes: 13 additions & 8 deletions rs/nns/governance/src/governance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ use ic_nns_constants::{
LIFELINE_CANISTER_ID, REGISTRY_CANISTER_ID, ROOT_CANISTER_ID, SNS_WASM_CANISTER_ID,
SUBNET_RENTAL_CANISTER_ID,
};
use ic_nns_governance_api::pb::v1::list_neurons::NeuronSubaccount;
use ic_nns_governance_api::{
pb::v1::{
self as api,
Expand Down Expand Up @@ -2278,16 +2279,20 @@ impl Governance {
};

let mut neurons_by_subaccount: BTreeSet<NeuronId> = neuron_subaccounts
.unwrap_or_default()
.iter()
.flat_map(|neuron_subaccount| {
Self::bytes_to_subaccount(&neuron_subaccount.subaccount)
.ok()
.and_then(|subaccount| {
self.neuron_store.get_neuron_id_for_subaccount(subaccount)
.as_ref()
.map(|subaccounts| {
subaccounts
.iter()
.flat_map(|neuron_subaccount| {
Self::bytes_to_subaccount(&neuron_subaccount.subaccount)
.ok()
.and_then(|subaccount| {
self.neuron_store.get_neuron_id_for_subaccount(subaccount)
})
})
.collect()
})
.collect();
.unwrap_or_default();

// Concatenate (explicit and implicit)-ly included neurons.
let mut requested_neuron_ids: BTreeSet<NeuronId> =
Expand Down

0 comments on commit 504cc42

Please sign in to comment.