Skip to content

Commit

Permalink
Update candid for nns package (#821)
Browse files Browse the repository at this point in the history
# Motivation

The automatic candid update PR from last week broke some tests because
of a new field `wasm_memory_threshold` in `CanisterSettings`.

# Changes

1. Checked out `release-2025-01-09_03-19-base` in IC repo.
2. Ran `scripts/import-candid ../../ic`.
3. Ran `scripts/compile-idl-js`.
4. Reverted files outside `packages/nns`.
5. Updated types and tests to take into account the new field.

# Tests

Unit tests updated.

# Todos

- [x] Add entry to changelog (if necessary).
  • Loading branch information
dskloetd authored Jan 20, 2025
1 parent 2256f53 commit 96915e8
Show file tree
Hide file tree
Showing 16 changed files with 168 additions and 26 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# YYYY.MM.DD-HHMMZ

# Features

- Support `CanisterSettings.wasm_memory_threshold` in `@dfinity/nns`.

# 2025.01.20-1030Z

## Overview
Expand Down
2 changes: 1 addition & 1 deletion packages/nns/candid/genesis_token.did
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from IC repo commit 0f35ac817b (2024-12-06) 'rs/nns/gtc/canister/gtc.did' by import-candid
// Generated from IC repo commit aa705aaa62 (2025-01-08 tags: release-2025-01-09_03-19-base) 'rs/nns/gtc/canister/gtc.did' by import-candid
type AccountState = record {
authenticated_principal_id : opt principal;
successfully_transferred_neurons : vec TransferredNeuron;
Expand Down
22 changes: 22 additions & 0 deletions packages/nns/candid/governance.certified.idl.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export const idlFactory = ({ IDL }) => {
const Controllers = IDL.Record({ 'controllers' : IDL.Vec(IDL.Principal) });
const CanisterSettings = IDL.Record({
'freezing_threshold' : IDL.Opt(IDL.Nat64),
'wasm_memory_threshold' : IDL.Opt(IDL.Nat64),
'controllers' : IDL.Opt(Controllers),
'log_visibility' : IDL.Opt(IDL.Int32),
'wasm_memory_limit' : IDL.Opt(IDL.Nat64),
Expand Down Expand Up @@ -365,12 +366,16 @@ export const idlFactory = ({ IDL }) => {
'voting_power_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
'total_staked_e8s' : IDL.Opt(IDL.Nat64),
'count' : IDL.Opt(IDL.Nat64),
'deciding_voting_power_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
'total_staked_maturity_e8s_equivalent' : IDL.Opt(IDL.Nat64),
'total_potential_voting_power' : IDL.Opt(IDL.Nat64),
'total_deciding_voting_power' : IDL.Opt(IDL.Nat64),
'staked_maturity_e8s_equivalent_buckets' : IDL.Vec(
IDL.Tuple(IDL.Nat64, IDL.Nat64)
),
'staked_e8s_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
'total_voting_power' : IDL.Opt(IDL.Nat64),
'potential_voting_power_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
'count_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
});
const GovernanceCachedMetrics = IDL.Record({
Expand All @@ -395,6 +400,9 @@ export const idlFactory = ({ IDL }) => {
'total_staked_e8s_seed' : IDL.Nat64,
'total_staked_maturity_e8s_equivalent_ect' : IDL.Nat64,
'total_staked_e8s' : IDL.Nat64,
'fully_lost_voting_power_neuron_subset_metrics' : IDL.Opt(
NeuronSubsetMetrics
),
'not_dissolving_neurons_count' : IDL.Nat64,
'total_locked_e8s' : IDL.Nat64,
'neurons_fund_total_active_neurons' : IDL.Nat64,
Expand All @@ -405,6 +413,9 @@ export const idlFactory = ({ IDL }) => {
'not_dissolving_neurons_e8s_buckets_ect' : IDL.Vec(
IDL.Tuple(IDL.Nat64, IDL.Float64)
),
'declining_voting_power_neuron_subset_metrics' : IDL.Opt(
NeuronSubsetMetrics
),
'total_staked_e8s_ect' : IDL.Nat64,
'not_dissolving_neurons_staked_maturity_e8s_equivalent_sum' : IDL.Nat64,
'dissolved_neurons_e8s' : IDL.Nat64,
Expand Down Expand Up @@ -1093,6 +1104,7 @@ export const init = ({ IDL }) => {
const Controllers = IDL.Record({ 'controllers' : IDL.Vec(IDL.Principal) });
const CanisterSettings = IDL.Record({
'freezing_threshold' : IDL.Opt(IDL.Nat64),
'wasm_memory_threshold' : IDL.Opt(IDL.Nat64),
'controllers' : IDL.Opt(Controllers),
'log_visibility' : IDL.Opt(IDL.Int32),
'wasm_memory_limit' : IDL.Opt(IDL.Nat64),
Expand Down Expand Up @@ -1348,12 +1360,16 @@ export const init = ({ IDL }) => {
'voting_power_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
'total_staked_e8s' : IDL.Opt(IDL.Nat64),
'count' : IDL.Opt(IDL.Nat64),
'deciding_voting_power_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
'total_staked_maturity_e8s_equivalent' : IDL.Opt(IDL.Nat64),
'total_potential_voting_power' : IDL.Opt(IDL.Nat64),
'total_deciding_voting_power' : IDL.Opt(IDL.Nat64),
'staked_maturity_e8s_equivalent_buckets' : IDL.Vec(
IDL.Tuple(IDL.Nat64, IDL.Nat64)
),
'staked_e8s_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
'total_voting_power' : IDL.Opt(IDL.Nat64),
'potential_voting_power_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
'count_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
});
const GovernanceCachedMetrics = IDL.Record({
Expand All @@ -1378,6 +1394,9 @@ export const init = ({ IDL }) => {
'total_staked_e8s_seed' : IDL.Nat64,
'total_staked_maturity_e8s_equivalent_ect' : IDL.Nat64,
'total_staked_e8s' : IDL.Nat64,
'fully_lost_voting_power_neuron_subset_metrics' : IDL.Opt(
NeuronSubsetMetrics
),
'not_dissolving_neurons_count' : IDL.Nat64,
'total_locked_e8s' : IDL.Nat64,
'neurons_fund_total_active_neurons' : IDL.Nat64,
Expand All @@ -1388,6 +1407,9 @@ export const init = ({ IDL }) => {
'not_dissolving_neurons_e8s_buckets_ect' : IDL.Vec(
IDL.Tuple(IDL.Nat64, IDL.Float64)
),
'declining_voting_power_neuron_subset_metrics' : IDL.Opt(
NeuronSubsetMetrics
),
'total_staked_e8s_ect' : IDL.Nat64,
'not_dissolving_neurons_staked_maturity_e8s_equivalent_sum' : IDL.Nat64,
'dissolved_neurons_e8s' : IDL.Nat64,
Expand Down
7 changes: 7 additions & 0 deletions packages/nns/candid/governance.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export interface Canister {
}
export interface CanisterSettings {
freezing_threshold: [] | [bigint];
wasm_memory_threshold: [] | [bigint];
controllers: [] | [Controllers];
log_visibility: [] | [number];
wasm_memory_limit: [] | [bigint];
Expand Down Expand Up @@ -258,12 +259,14 @@ export interface GovernanceCachedMetrics {
total_staked_e8s_seed: bigint;
total_staked_maturity_e8s_equivalent_ect: bigint;
total_staked_e8s: bigint;
fully_lost_voting_power_neuron_subset_metrics: [] | [NeuronSubsetMetrics];
not_dissolving_neurons_count: bigint;
total_locked_e8s: bigint;
neurons_fund_total_active_neurons: bigint;
total_voting_power_non_self_authenticating_controller: [] | [bigint];
total_staked_maturity_e8s_equivalent: bigint;
not_dissolving_neurons_e8s_buckets_ect: Array<[bigint, number]>;
declining_voting_power_neuron_subset_metrics: [] | [NeuronSubsetMetrics];
total_staked_e8s_ect: bigint;
not_dissolving_neurons_staked_maturity_e8s_equivalent_sum: bigint;
dissolved_neurons_e8s: bigint;
Expand Down Expand Up @@ -554,10 +557,14 @@ export interface NeuronSubsetMetrics {
voting_power_buckets: Array<[bigint, bigint]>;
total_staked_e8s: [] | [bigint];
count: [] | [bigint];
deciding_voting_power_buckets: Array<[bigint, bigint]>;
total_staked_maturity_e8s_equivalent: [] | [bigint];
total_potential_voting_power: [] | [bigint];
total_deciding_voting_power: [] | [bigint];
staked_maturity_e8s_equivalent_buckets: Array<[bigint, bigint]>;
staked_e8s_buckets: Array<[bigint, bigint]>;
total_voting_power: [] | [bigint];
potential_voting_power_buckets: Array<[bigint, bigint]>;
count_buckets: Array<[bigint, bigint]>;
}
export interface NeuronsFundAuditInfo {
Expand Down
37 changes: 22 additions & 15 deletions packages/nns/candid/governance.did
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated from IC repo commit 0f35ac817b (2024-12-06) 'rs/nns/governance/canister/governance.did' by import-candid
// Generated from IC repo commit aa705aaa62 (2025-01-08 tags: release-2025-01-09_03-19-base) 'rs/nns/governance/canister/governance.did' by import-candid
type AccountIdentifier = record {
hash : blob;
};
Expand Down Expand Up @@ -65,6 +65,7 @@ type CanisterSettings = record {
wasm_memory_limit : opt nat64;
memory_allocation : opt nat64;
compute_allocation : opt nat64;
wasm_memory_threshold : opt nat64;
};

type CanisterStatusResultV2 = record {
Expand Down Expand Up @@ -124,8 +125,6 @@ type RefreshVotingPowerResponse = record {
};

// KEEP THIS IN SYNC WITH ManageNeuronCommandRequest!
//
// Deprecated. Use ManageNeuronCommandRequest instead. It is equivalent.
type Command = variant {
Spawn : Spawn;
Split : Split;
Expand Down Expand Up @@ -349,15 +348,18 @@ type GovernanceCachedMetrics = record {
};
dissolving_neurons_count_buckets : vec record { nat64; nat64 };
dissolving_neurons_e8s_buckets_ect : vec record { nat64; float64 };
non_self_authenticating_controller_neuron_subset_metrics : opt NeuronSubsetMetrics;
dissolving_neurons_count : nat64;
dissolving_neurons_e8s_buckets : vec record { nat64; float64 };
total_staked_maturity_e8s_equivalent_seed : nat64;
community_fund_total_staked_e8s : nat64;
not_dissolving_neurons_e8s_buckets_seed : vec record { nat64; float64 };
public_neuron_subset_metrics : opt NeuronSubsetMetrics;
timestamp_seconds : nat64;
seed_neuron_count : nat64;

non_self_authenticating_controller_neuron_subset_metrics : opt NeuronSubsetMetrics;
public_neuron_subset_metrics : opt NeuronSubsetMetrics;
declining_voting_power_neuron_subset_metrics : opt NeuronSubsetMetrics;
fully_lost_voting_power_neuron_subset_metrics : opt NeuronSubsetMetrics;
};

type GovernanceError = record {
Expand Down Expand Up @@ -496,10 +498,6 @@ type ManageNeuron = record {
};

// KEEP THIS IN SYNC WITH COMMAND!
//
// Command is deprecated, but people need time to migrate to this. Therefore, we
// have not deleted Command yet. In the meantime, ManageNeuronCommandRequest
// must be kept in sync with Command.
type ManageNeuronCommandRequest = variant {
Spawn : Spawn;
Split : Split;
Expand Down Expand Up @@ -768,16 +766,25 @@ type NeuronStakeTransfer = record {
};

type NeuronSubsetMetrics = record {
total_maturity_e8s_equivalent : opt nat64;
maturity_e8s_equivalent_buckets : vec record { nat64; nat64 };
voting_power_buckets : vec record { nat64; nat64 };
total_staked_e8s : opt nat64;
count : opt nat64;

total_staked_e8s : opt nat64;
total_maturity_e8s_equivalent : opt nat64;
total_staked_maturity_e8s_equivalent : opt nat64;
staked_maturity_e8s_equivalent_buckets : vec record { nat64; nat64 };
staked_e8s_buckets : vec record { nat64; nat64 };

total_voting_power : opt nat64;
total_deciding_voting_power : opt nat64;
total_potential_voting_power : opt nat64;

count_buckets : vec record { nat64; nat64 };

staked_e8s_buckets : vec record { nat64; nat64 };
maturity_e8s_equivalent_buckets : vec record { nat64; nat64 };
staked_maturity_e8s_equivalent_buckets : vec record { nat64; nat64 };

voting_power_buckets : vec record { nat64; nat64 };
deciding_voting_power_buckets : vec record { nat64; nat64 };
potential_voting_power_buckets : vec record { nat64; nat64 };
};

type NeuronsFundAuditInfo = record {
Expand Down
22 changes: 22 additions & 0 deletions packages/nns/candid/governance.idl.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export const idlFactory = ({ IDL }) => {
const Controllers = IDL.Record({ 'controllers' : IDL.Vec(IDL.Principal) });
const CanisterSettings = IDL.Record({
'freezing_threshold' : IDL.Opt(IDL.Nat64),
'wasm_memory_threshold' : IDL.Opt(IDL.Nat64),
'controllers' : IDL.Opt(Controllers),
'log_visibility' : IDL.Opt(IDL.Int32),
'wasm_memory_limit' : IDL.Opt(IDL.Nat64),
Expand Down Expand Up @@ -365,12 +366,16 @@ export const idlFactory = ({ IDL }) => {
'voting_power_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
'total_staked_e8s' : IDL.Opt(IDL.Nat64),
'count' : IDL.Opt(IDL.Nat64),
'deciding_voting_power_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
'total_staked_maturity_e8s_equivalent' : IDL.Opt(IDL.Nat64),
'total_potential_voting_power' : IDL.Opt(IDL.Nat64),
'total_deciding_voting_power' : IDL.Opt(IDL.Nat64),
'staked_maturity_e8s_equivalent_buckets' : IDL.Vec(
IDL.Tuple(IDL.Nat64, IDL.Nat64)
),
'staked_e8s_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
'total_voting_power' : IDL.Opt(IDL.Nat64),
'potential_voting_power_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
'count_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
});
const GovernanceCachedMetrics = IDL.Record({
Expand All @@ -395,6 +400,9 @@ export const idlFactory = ({ IDL }) => {
'total_staked_e8s_seed' : IDL.Nat64,
'total_staked_maturity_e8s_equivalent_ect' : IDL.Nat64,
'total_staked_e8s' : IDL.Nat64,
'fully_lost_voting_power_neuron_subset_metrics' : IDL.Opt(
NeuronSubsetMetrics
),
'not_dissolving_neurons_count' : IDL.Nat64,
'total_locked_e8s' : IDL.Nat64,
'neurons_fund_total_active_neurons' : IDL.Nat64,
Expand All @@ -405,6 +413,9 @@ export const idlFactory = ({ IDL }) => {
'not_dissolving_neurons_e8s_buckets_ect' : IDL.Vec(
IDL.Tuple(IDL.Nat64, IDL.Float64)
),
'declining_voting_power_neuron_subset_metrics' : IDL.Opt(
NeuronSubsetMetrics
),
'total_staked_e8s_ect' : IDL.Nat64,
'not_dissolving_neurons_staked_maturity_e8s_equivalent_sum' : IDL.Nat64,
'dissolved_neurons_e8s' : IDL.Nat64,
Expand Down Expand Up @@ -1109,6 +1120,7 @@ export const init = ({ IDL }) => {
const Controllers = IDL.Record({ 'controllers' : IDL.Vec(IDL.Principal) });
const CanisterSettings = IDL.Record({
'freezing_threshold' : IDL.Opt(IDL.Nat64),
'wasm_memory_threshold' : IDL.Opt(IDL.Nat64),
'controllers' : IDL.Opt(Controllers),
'log_visibility' : IDL.Opt(IDL.Int32),
'wasm_memory_limit' : IDL.Opt(IDL.Nat64),
Expand Down Expand Up @@ -1364,12 +1376,16 @@ export const init = ({ IDL }) => {
'voting_power_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
'total_staked_e8s' : IDL.Opt(IDL.Nat64),
'count' : IDL.Opt(IDL.Nat64),
'deciding_voting_power_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
'total_staked_maturity_e8s_equivalent' : IDL.Opt(IDL.Nat64),
'total_potential_voting_power' : IDL.Opt(IDL.Nat64),
'total_deciding_voting_power' : IDL.Opt(IDL.Nat64),
'staked_maturity_e8s_equivalent_buckets' : IDL.Vec(
IDL.Tuple(IDL.Nat64, IDL.Nat64)
),
'staked_e8s_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
'total_voting_power' : IDL.Opt(IDL.Nat64),
'potential_voting_power_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
'count_buckets' : IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
});
const GovernanceCachedMetrics = IDL.Record({
Expand All @@ -1394,6 +1410,9 @@ export const init = ({ IDL }) => {
'total_staked_e8s_seed' : IDL.Nat64,
'total_staked_maturity_e8s_equivalent_ect' : IDL.Nat64,
'total_staked_e8s' : IDL.Nat64,
'fully_lost_voting_power_neuron_subset_metrics' : IDL.Opt(
NeuronSubsetMetrics
),
'not_dissolving_neurons_count' : IDL.Nat64,
'total_locked_e8s' : IDL.Nat64,
'neurons_fund_total_active_neurons' : IDL.Nat64,
Expand All @@ -1404,6 +1423,9 @@ export const init = ({ IDL }) => {
'not_dissolving_neurons_e8s_buckets_ect' : IDL.Vec(
IDL.Tuple(IDL.Nat64, IDL.Float64)
),
'declining_voting_power_neuron_subset_metrics' : IDL.Opt(
NeuronSubsetMetrics
),
'total_staked_e8s_ect' : IDL.Nat64,
'not_dissolving_neurons_staked_maturity_e8s_equivalent_sum' : IDL.Nat64,
'dissolved_neurons_e8s' : IDL.Nat64,
Expand Down
Loading

0 comments on commit 96915e8

Please sign in to comment.