Skip to content
Merged
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
373 changes: 191 additions & 182 deletions Cargo.lock

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ license = "Apache-2.0"
# ./scripts/point-to-ic-repo-commit-id.sh be used. That also updates the files
# in the candid directory. (This core would be unnecessary if this code also
# lived in the ic repo.)
ic-base-types = { git = "https://github.com/dfinity/ic", rev = "007c473c9c7fc820c49eea5c823cdd4b9404119d" }
ic-ckbtc-minter = { git = "https://github.com/dfinity/ic", rev = "007c473c9c7fc820c49eea5c823cdd4b9404119d" }
ic-nervous-system-common = { git = "https://github.com/dfinity/ic", rev = "007c473c9c7fc820c49eea5c823cdd4b9404119d" }
ic-nns-common = { git = "https://github.com/dfinity/ic", rev = "007c473c9c7fc820c49eea5c823cdd4b9404119d" }
ic-nns-constants = { git = "https://github.com/dfinity/ic", rev = "007c473c9c7fc820c49eea5c823cdd4b9404119d" }
ic-nns-governance = { git = "https://github.com/dfinity/ic", rev = "007c473c9c7fc820c49eea5c823cdd4b9404119d" }
ic-nns-governance-api = { git = "https://github.com/dfinity/ic", rev = "007c473c9c7fc820c49eea5c823cdd4b9404119d" }
ic-sns-governance = { git = "https://github.com/dfinity/ic", rev = "007c473c9c7fc820c49eea5c823cdd4b9404119d" }
ic-sns-root = { git = "https://github.com/dfinity/ic", rev = "007c473c9c7fc820c49eea5c823cdd4b9404119d" }
ic-sns-swap = { git = "https://github.com/dfinity/ic", rev = "007c473c9c7fc820c49eea5c823cdd4b9404119d" }
ic-sns-wasm = { git = "https://github.com/dfinity/ic", rev = "007c473c9c7fc820c49eea5c823cdd4b9404119d" }
icp-ledger = { git = "https://github.com/dfinity/ic", rev = "007c473c9c7fc820c49eea5c823cdd4b9404119d" }
icrc-ledger-types = { git = "https://github.com/dfinity/ic", rev = "007c473c9c7fc820c49eea5c823cdd4b9404119d" }
ledger-canister = { git = "https://github.com/dfinity/ic", rev = "007c473c9c7fc820c49eea5c823cdd4b9404119d" }
ic-base-types = { git = "https://github.com/dfinity/ic", rev = "b4b0230aa1ed1c94d3674a9a27d60b724edb5cd4" }
ic-ckbtc-minter = { git = "https://github.com/dfinity/ic", rev = "b4b0230aa1ed1c94d3674a9a27d60b724edb5cd4" }
ic-nervous-system-common = { git = "https://github.com/dfinity/ic", rev = "b4b0230aa1ed1c94d3674a9a27d60b724edb5cd4" }
ic-nns-common = { git = "https://github.com/dfinity/ic", rev = "b4b0230aa1ed1c94d3674a9a27d60b724edb5cd4" }
ic-nns-constants = { git = "https://github.com/dfinity/ic", rev = "b4b0230aa1ed1c94d3674a9a27d60b724edb5cd4" }
ic-nns-governance = { git = "https://github.com/dfinity/ic", rev = "b4b0230aa1ed1c94d3674a9a27d60b724edb5cd4" }
ic-nns-governance-api = { git = "https://github.com/dfinity/ic", rev = "b4b0230aa1ed1c94d3674a9a27d60b724edb5cd4" }
ic-sns-governance = { git = "https://github.com/dfinity/ic", rev = "b4b0230aa1ed1c94d3674a9a27d60b724edb5cd4" }
ic-sns-root = { git = "https://github.com/dfinity/ic", rev = "b4b0230aa1ed1c94d3674a9a27d60b724edb5cd4" }
ic-sns-swap = { git = "https://github.com/dfinity/ic", rev = "b4b0230aa1ed1c94d3674a9a27d60b724edb5cd4" }
ic-sns-wasm = { git = "https://github.com/dfinity/ic", rev = "b4b0230aa1ed1c94d3674a9a27d60b724edb5cd4" }
icp-ledger = { git = "https://github.com/dfinity/ic", rev = "b4b0230aa1ed1c94d3674a9a27d60b724edb5cd4" }
icrc-ledger-types = { git = "https://github.com/dfinity/ic", rev = "b4b0230aa1ed1c94d3674a9a27d60b724edb5cd4" }
ledger-canister = { git = "https://github.com/dfinity/ic", rev = "b4b0230aa1ed1c94d3674a9a27d60b724edb5cd4" }

candid = "0.10.2"
candid_parser = "0.1.2"
Expand Down
64 changes: 63 additions & 1 deletion candid/governance.did
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type Action = variant {
BlessAlternativeGuestOsVersion : BlessAlternativeGuestOsVersion;
TakeCanisterSnapshot : TakeCanisterSnapshot;
LoadCanisterSnapshot : LoadCanisterSnapshot;
CreateCanisterAndInstallCode : CreateCanisterAndInstallCode;
};

type AddHotKey = record {
Expand Down Expand Up @@ -66,6 +67,7 @@ type CanisterSettings = record {
freezing_threshold : opt nat64;
controllers : opt Controllers;
log_visibility : opt int32;
snapshot_visibility : opt int32;
wasm_memory_limit : opt nat64;
memory_allocation : opt nat64;
compute_allocation : opt nat64;
Expand Down Expand Up @@ -231,6 +233,20 @@ type Countries = record {
iso_codes : vec text;
};

type CreateCanisterAndInstallCode = record {
host_subnet_id : opt principal;
canister_settings : opt CanisterSettings;
wasm_module_hash : opt blob;
install_arg_hash : opt blob;
};

type CreateCanisterAndInstallCodeRequest = record {
host_subnet_id : opt principal;
canister_settings : opt CanisterSettings;
wasm_module : opt WasmModule;
install_arg : opt blob;
};

type CreateServiceNervousSystem = record {
url : opt text;
governance_parameters : opt GovernanceParameters;
Expand Down Expand Up @@ -380,6 +396,7 @@ type GovernanceCachedMetrics = record {
timestamp_seconds : nat64;
seed_neuron_count : nat64;
spawning_neurons_count : nat64;
total_maturity_disbursements_in_progress_e8s_equivalent : nat64;

non_self_authenticating_controller_neuron_subset_metrics : opt NeuronSubsetMetrics;
public_neuron_subset_metrics : opt NeuronSubsetMetrics;
Expand Down Expand Up @@ -434,6 +451,9 @@ type InstallCode = record {

type InstallCodeRequest = record {
arg : opt blob;
// If we add support for chunked WASMs later, the WasmModule type should
// probably be used in place of this field in order to be consistent with
// CreateCanisterAndInstallCodeRequest.
wasm_module : opt blob;
skip_stopping_before_installing : opt bool;
canister_id : opt principal;
Expand Down Expand Up @@ -775,6 +795,12 @@ type Neuron = record {
// Per NNS policy, this is opt. Nevertheless, it will never be null.
potential_voting_power : opt nat64;

// Base value (in e8s) used for the "8-year gang" dissolve delay bonus. For neurons that had the
// maximum dissolve delay of 8 years before the maximum was reduced, this is set to the total
// staked value net of fees (including staked maturity) captured at the time of migration.
// For all other neurons, this is 0.
eight_year_gang_bonus_base_e8s : opt nat64;

// The maturity disbursements in progress, i.e. the disbursements that are initiated but not
// finalized. The finalization happens 7 days after the disbursement is initiated.
maturity_disbursements_in_progress : opt vec MaturityDisbursement;
Expand Down Expand Up @@ -869,6 +895,8 @@ type NeuronInfo = record {
voting_power_refreshed_timestamp_seconds : opt nat64;
deciding_voting_power : opt nat64;
potential_voting_power : opt nat64;
// See analogous field in Neuron.
eight_year_gang_bonus_base_e8s : opt nat64;
};

type NeuronStakeTransfer = record {
Expand Down Expand Up @@ -1041,6 +1069,7 @@ type ProposalActionRequest = variant {
BlessAlternativeGuestOsVersion : BlessAlternativeGuestOsVersion;
TakeCanisterSnapshot : TakeCanisterSnapshot;
LoadCanisterSnapshot : LoadCanisterSnapshot;
CreateCanisterAndInstallCode : CreateCanisterAndInstallCodeRequest;
};

// Creates a rented subnet from a rental request (in the Subnet Rental
Expand Down Expand Up @@ -1403,6 +1432,10 @@ type CustomProposalCriticality = record {
additional_critical_native_action_ids : opt vec nat64;
};

type WasmModule = variant {
Inlined : blob;
};

type WaitForQuietState = record {
current_deadline_timestamp_seconds : nat64;
};
Expand Down Expand Up @@ -1504,7 +1537,35 @@ type SelfDescribingValue = variant {

type GetPendingProposalsRequest = record {
return_self_describing_action : opt bool;
}
};

// Request to create a new neuron using ICRC-2 transfer_from.
// The caller must have previously approved the governance canister to spend the specified amount.
type CreateNeuronRequest = record {
// Required. The amount of ICP to stake in e8s.
amount_e8s : opt nat64;
// The subaccount of the caller to transfer ICP from. Defaults to the default subaccount.
source_subaccount: opt blob;
// The controller of the new neuron. Defaults to the caller.
controller : opt principal;
// The followees to set for the new neuron. Defaults to the network's default followees.
followees : opt SetFollowing;
// The dissolve delay in seconds. Defaults to 7 days. Clamped to [0, 8 years].
dissolve_delay_seconds : opt nat64;
// Whether the neuron should start dissolving immediately. Defaults to false.
dissolving : opt bool;
// Whether to automatically stake maturity. Defaults to false.
auto_stake_maturity : opt bool;
};

type CreatedNeuron = record {
neuron_id : opt NeuronId;
};

type CreateNeuronResponse = variant {
Ok : CreatedNeuron;
Err : GovernanceError;
};

service : (Governance) -> {
claim_gtc_neurons : (principal, vec NeuronId) -> (Result);
Expand Down Expand Up @@ -1545,6 +1606,7 @@ service : (Governance) -> {
list_proposals : (ListProposalInfoRequest) -> (ListProposalInfoResponse) query;
list_neuron_votes : (ListNeuronVotesRequest) -> (ListNeuronVotesResponse) query;
manage_neuron : (ManageNeuronRequest) -> (ManageNeuronResponse);
create_neuron : (CreateNeuronRequest) -> (CreateNeuronResponse);
settle_community_fund_participation : (SettleCommunityFundParticipation) -> (
Result,
);
Expand Down
14 changes: 13 additions & 1 deletion candid/ledger.did
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,21 @@ type Value = variant {
Blob : blob
};

type ChangeArchiveOptions = record {
trigger_threshold : opt nat64;
num_blocks_to_archive : opt nat64;
node_max_memory_size_bytes : opt nat64;
max_message_size_bytes : opt nat64;
controller_id : opt principal;
more_controller_ids : opt vec principal;
cycles_for_archive_creation : opt nat64;
max_transactions_per_response : opt nat64
};

type UpgradeArgs = record {
icrc1_minting_account : opt Account;
feature_flags : opt FeatureFlags
feature_flags : opt FeatureFlags;
change_archive_options : opt ChangeArchiveOptions
};

type LedgerCanisterPayload = variant {
Expand Down
53 changes: 52 additions & 1 deletion candid/registry.did
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,16 @@ type CompleteCanisterMigrationPayload = record {
migration_trace : vec principal;
};

type ResourceLimits = record {
maximum_state_size : opt nat64;
maximum_state_delta : opt nat64;
};

type CreateSubnetPayload = record {
unit_delay_millis : nat64;
features : SubnetFeatures;
max_ingress_bytes_per_message : nat64;
max_ingress_bytes_per_block: opt nat64;
dkg_dealings_per_block : nat64;
max_block_payload_size : nat64;
start_as_nns : bool;
Expand All @@ -105,6 +111,8 @@ type CreateSubnetPayload = record {

subnet_admins: opt vec principal;

resource_limits : opt ResourceLimits;

// TODO(NNS1-2444): The fields below are deprecated and they are not read anywhere.
ingress_bytes_per_block_soft_cap : nat64;
gossip_max_artifact_streams_per_peer : nat32;
Expand All @@ -125,6 +133,15 @@ type CreateSubnetResponse = variant {
Err: text;
};

type DeleteSubnetPayload = record {
subnet_id : principal;
};

type DeleteSubnetResponse = variant {
Ok;
Err: text;
};

type CanisterCyclesCostSchedule = variant {
Normal;
Free;
Expand Down Expand Up @@ -354,7 +371,7 @@ type SubnetFeatures = record {
sev_enabled : opt bool;
};

type SubnetType = variant { application; verified_application; system };
type SubnetType = variant { application; verified_application; system; cloud_engine };

type UpdateApiBoundaryNodesVersionPayload = record {
version : text;
Expand Down Expand Up @@ -443,6 +460,7 @@ type UpdateSubnetPayload = record {
unit_delay_millis : opt nat64;
max_duplicity : opt nat32;
features : opt SubnetFeatures;
resource_limits : opt ResourceLimits;
set_gossip_config_to_default : bool;
halt_at_cup_height : opt bool;
pfn_evaluation_period_ms : opt nat32;
Expand All @@ -453,6 +471,7 @@ type UpdateSubnetPayload = record {
start_as_nns : opt bool;
is_halted : opt bool;
max_ingress_messages_per_block : opt nat64;
max_ingress_bytes_per_block: opt nat64;
max_number_of_canisters : opt nat64;
retransmission_request_ms : opt nat32;
dkg_interval_length : opt nat64;
Expand Down Expand Up @@ -482,6 +501,11 @@ type UpdateUnassignedNodesConfigPayload = record {
ssh_readonly_access : opt vec text;
};

type MigrateNodeOperatorPayload = record {
new_node_operator_id : opt principal;
old_node_operator_id : opt principal;
};

type SwapNodeInSubnetDirectlyPayload = record {
new_node_id : opt principal;
old_node_id : opt principal;
Expand All @@ -503,6 +527,11 @@ type SetSubnetOperationalLevelPayload = record {
// Similar to ssh_read_only_access, except that this targets one node at a
// time, not all the nodes in the subnet.
ssh_node_state_write_access : opt vec NodeSshAccess;

// Replica version IDs to recall for this subnet. If specified, these versions
// will replace the subnet's recalled_replica_version_ids list, preventing
// the subnet from upgrading to these versions.
recalled_replica_version_ids : opt vec text;
};

type NodeSshAccess = record {
Expand All @@ -513,6 +542,24 @@ type NodeSshAccess = record {
public_keys : opt vec text;
};

type SplitSubnetPayload = record {
source_subnet_id: principal;
destination_canister_ranges: vec CanisterIdRange;
destination_node_ids: vec principal;
};

type OperationType = variant {
Add: vec principal;
Remove: vec principal;
Clear: record {};
};

type UpdateSubnetAdminsPayload = record {
subnet_id: principal;
// opt for future compatibility when removing operation types.
operation_type: opt OperationType;
};

service : {
add_api_boundary_nodes : (AddApiBoundaryNodesPayload) -> ();
add_firewall_rules : (AddFirewallRulesPayload) -> ();
Expand All @@ -524,6 +571,7 @@ service : {
clear_provisional_whitelist : () -> ();
complete_canister_migration : (CompleteCanisterMigrationPayload) -> ();
create_subnet : (CreateSubnetPayload) -> (CreateSubnetResponse);
delete_subnet : (DeleteSubnetPayload) -> (DeleteSubnetResponse);
deploy_guestos_to_all_subnet_nodes : (
DeployGuestosToAllSubnetNodesPayload
) -> ();
Expand All @@ -539,6 +587,7 @@ service : {
get_node_providers_monthly_xdr_rewards : (opt GetNodeProvidersMonthlyXdrRewardsRequest) -> (GetNodeProvidersMonthlyXdrRewardsResponse) query;
get_subnet_for_canister : (GetSubnetForCanisterRequest) -> (GetSubnetForCanisterResponse) query;
migrate_canisters: (MigrateCanistersPayload) -> (MigrateCanistersResponse);
migrate_node_operator_directly : (MigrateNodeOperatorPayload) -> ();
prepare_canister_migration : (PrepareCanisterMigrationPayload) -> ();
recover_subnet : (RecoverSubnetPayload) -> ();
remove_api_boundary_nodes : (RemoveApiBoundaryNodesPayload) -> ();
Expand Down Expand Up @@ -571,6 +620,8 @@ service : {
UpdateSshReadOnlyAccessForAllUnassignedNodesPayload
) -> ();
update_subnet : (UpdateSubnetPayload) -> ();
update_subnet_admins : (UpdateSubnetAdminsPayload) -> ();
update_unassigned_nodes_config : (UpdateUnassignedNodesConfigPayload) -> ();
swap_node_in_subnet_directly : (SwapNodeInSubnetDirectlyPayload) -> ();
split_subnet : (SplitSubnetPayload) -> ();
};
1 change: 1 addition & 0 deletions candid/sns-governance.did
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ type ManageDappCanisterSettings = record {
canister_ids : vec principal;
reserved_cycles_limit : opt nat64;
log_visibility : opt int32;
snapshot_visibility : opt int32;
wasm_memory_limit : opt nat64;
memory_allocation : opt nat64;
compute_allocation : opt nat64;
Expand Down
1 change: 1 addition & 0 deletions candid/sns-root.did
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ type ManageDappCanisterSettingsRequest = record {
canister_ids : vec principal;
reserved_cycles_limit : opt nat64;
log_visibility : opt int32;
snapshot_visibility : opt int32;
wasm_memory_limit : opt nat64;
memory_allocation : opt nat64;
compute_allocation : opt nat64;
Expand Down
7 changes: 1 addition & 6 deletions src/commands/neuron_manage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::lib::{
AnyhowResult, AuthInfo, ParsedNnsAccount, ROLE_NNS_GOVERNANCE,
};
use anyhow::{anyhow, bail, ensure, Context};
use candid::{CandidType, Encode, Principal};
use candid::{Encode, Principal};
use clap::{Parser, ValueEnum};
use ic_base_types::PrincipalId;
use ic_nns_common::pb::v1::{NeuronId, ProposalId};
Expand All @@ -30,11 +30,6 @@ pub const ONE_DAY_SECONDS: u32 = 24 * 60 * 60;
pub const ONE_YEAR_SECONDS: u32 = (4 * 365 + 1) * ONE_DAY_SECONDS / 4;
pub const ONE_MONTH_SECONDS: u32 = ONE_YEAR_SECONDS / 12;

#[derive(CandidType)]
pub struct AccountIdentifier {
hash: Vec<u8>,
}

#[derive(Debug, Clone, Copy, ValueEnum)]
enum EnableState {
Enabled,
Expand Down
Loading
Loading