diff --git a/Cargo.lock b/Cargo.lock index 1b5e78e243..7063a5c27a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4110,7 +4110,6 @@ version = "0.1.0" dependencies = [ "candid", "canister_time", - "ic-ledger-types", "serde", "serde_json", "types", diff --git a/backend/canisters/neuron_controller/CHANGELOG.md b/backend/canisters/neuron_controller/CHANGELOG.md index d8dda22beb..18d38d819e 100644 --- a/backend/canisters/neuron_controller/CHANGELOG.md +++ b/backend/canisters/neuron_controller/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] +### Changed + +- Only disburse 1 ICP rather than full amount until we've seen it working ([#5103](https://github.com/open-chat-labs/open-chat/pull/5103)) + ## [[2.0.993](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.993-neuron_controller)] - 2024-01-03 ### Added diff --git a/backend/canisters/neuron_controller/api/can.did b/backend/canisters/neuron_controller/api/can.did index 7ae4b584df..39c63a67d7 100644 --- a/backend/canisters/neuron_controller/api/can.did +++ b/backend/canisters/neuron_controller/api/can.did @@ -1,4 +1,4 @@ -type AccountIdentifier = vec nat8; +type AccountIdentifier = record { hash : vec nat8 }; type AddHotKey = record { new_hot_key : opt principal }; type Amount = record { e8s : nat64 }; type By = variant { diff --git a/backend/canisters/neuron_controller/impl/src/jobs/process_neurons.rs b/backend/canisters/neuron_controller/impl/src/jobs/process_neurons.rs index a13ce1a223..b775145148 100644 --- a/backend/canisters/neuron_controller/impl/src/jobs/process_neurons.rs +++ b/backend/canisters/neuron_controller/impl/src/jobs/process_neurons.rs @@ -1,6 +1,7 @@ use crate::updates::manage_nns_neuron::manage_nns_neuron_impl; use crate::{mutate_state, read_state}; use ic_ledger_types::{AccountIdentifier, DEFAULT_SUBACCOUNT}; +use nns_governance_canister::types::manage_neuron::disburse::Amount; use nns_governance_canister::types::manage_neuron::{Command, Disburse, Spawn}; use nns_governance_canister::types::ListNeurons; use std::time::Duration; @@ -79,13 +80,19 @@ async fn spawn_neurons(neuron_ids: Vec) { } async fn disburse_neurons(neuron_ids: Vec) { + let account = nns_governance_canister::types::AccountIdentifier { + hash: AccountIdentifier::new(&SNS_GOVERNANCE_CANISTER_ID, &DEFAULT_SUBACCOUNT) + .as_ref() + .to_vec(), + }; + for neuron_id in neuron_ids { info!(neuron_id, "Disbursing neuron"); manage_nns_neuron_impl( neuron_id, Command::Disburse(Disburse { - to_account: Some(AccountIdentifier::new(&SNS_GOVERNANCE_CANISTER_ID, &DEFAULT_SUBACCOUNT)), - amount: None, + to_account: Some(account.clone()), + amount: Some(Amount { e8s: E8S_PER_ICP }), }), ) .await; diff --git a/backend/external_canisters/nns_governance/api/Cargo.toml b/backend/external_canisters/nns_governance/api/Cargo.toml index 7a4cece428..4078156ffb 100644 --- a/backend/external_canisters/nns_governance/api/Cargo.toml +++ b/backend/external_canisters/nns_governance/api/Cargo.toml @@ -8,7 +8,6 @@ edition = "2021" [dependencies] candid = { workspace = true } canister_time = { path = "../../../libraries/canister_time" } -ic-ledger-types = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } types = { path = "../../../libraries/types" } diff --git a/backend/external_canisters/nns_governance/api/src/types.rs b/backend/external_canisters/nns_governance/api/src/types.rs index 40b3bb2fe1..a7ba674e30 100644 --- a/backend/external_canisters/nns_governance/api/src/types.rs +++ b/backend/external_canisters/nns_governance/api/src/types.rs @@ -1,5 +1,4 @@ use candid::{CandidType, Principal}; -use ic_ledger_types::AccountIdentifier; use serde::{Deserialize, Deserializer, Serialize}; use std::collections::HashMap; use types::TimestampMillis; @@ -663,6 +662,11 @@ pub struct Countries { pub iso_codes: Vec, } +#[derive(CandidType, Serialize, Deserialize, Clone, Debug)] +pub struct AccountIdentifier { + pub hash: Vec, +} + impl TryFrom for types::Proposal { type Error = String;