From 263be9b0ab0e0cc7570d833baaf2e16483aeb904 Mon Sep 17 00:00:00 2001 From: "pr-automation-bot-public[bot]" <189003650+pr-automation-bot-public[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 07:29:13 +0000 Subject: [PATCH] bot: Update proposals candid bindings (#5947) # Motivation We would like to render all the latest proposal types. Even with no changes, just updating the reference is good practice. # Changes * Update the version of `IC_COMMIT_FOR_PROPOSALS` specified in `dfx.json`. * Updated the `proposals` candid files to the versions in that commit. * Updated the Rust code derived from `.did` files in the proposals payload rendering crate. # Tests - [ ] Please check the API updates for any breaking changes that affect our code. - [ ] Please check for new proposal types and add tests for them. Breaking changes are: * New mandatory fields * Removing mandatory fields * Renaming fields * Changing the type of a field * Adding new variants Co-authored-by: gix-bot --- .../nns_governance/nns_governance.did | 98 ++++++++++++++++++- .../nns_registry/nns_registry.did | 2 +- .../used_by_proposals/sns_wasm/sns_wasm.did | 2 +- dfx.json | 2 +- .../src/canisters/nns_governance/api.rs | 12 ++- .../src/canisters/nns_registry/api.rs | 2 +- rs/proposals/src/canisters/sns_wasm/api.rs | 2 +- 7 files changed, 112 insertions(+), 8 deletions(-) diff --git a/declarations/used_by_proposals/nns_governance/nns_governance.did b/declarations/used_by_proposals/nns_governance/nns_governance.did index 2052f93da07..cc8e4e736ea 100644 --- a/declarations/used_by_proposals/nns_governance/nns_governance.did +++ b/declarations/used_by_proposals/nns_governance/nns_governance.did @@ -1,4 +1,4 @@ -//! Candid for canister `nns_governance` obtained by `scripts/update_ic_commit` from: +//! Candid for canister `nns_governance` obtained by `scripts/update_ic_commit` from: type AccountIdentifier = record { hash : blob; }; @@ -570,6 +570,32 @@ type NetworkEconomics = record { minimum_icp_xdr_rate : nat64; maximum_node_provider_rewards_e8s : nat64; neurons_fund_economics : opt NeuronsFundEconomics; + + // Parameters that affect the voting power of neurons. + voting_power_economics : opt VotingPowerEconomics; +}; + +// Parameters that affect the voting power of neurons. +type VotingPowerEconomics = record { + // If a neuron has not "refreshed" its voting power after this amount of time, + // its deciding voting power starts decreasing linearly. See also + // clear_following_after_seconds. + // + // For explanation of what "refresh" means in this context, see + // https://dashboard.internetcomputer.org/proposal/132411 + // + // Initially, set to 0.5 years. (The nominal length of a year is 365.25 days). + start_reducing_voting_power_after_seconds : opt nat64; + + // After a neuron has experienced voting power reduction for this amount of + // time, a couple of things happen: + // + // 1. Deciding voting power reaches 0. + // + // 2. Its following on topics other than NeuronManagement are cleared. + // + // Initially, set to 1/12 years. + clear_following_after_seconds : opt nat64; }; type Neuron = record { @@ -596,6 +622,63 @@ type Neuron = record { known_neuron_data : opt KnownNeuronData; spawn_at_timestamp_seconds : opt nat64; voting_power_refreshed_timestamp_seconds : opt nat64; + + // The amount of "sway" this neuron has when voting on proposals. + // + // When a proposal is created, each eligible neuron gets a "blank" ballot. The + // amount of voting power in that ballot is set to the neuron's deciding + // voting power at the time of proposal creation. There are two ways that a + // proposal can become decided: + // + // 1. Early: Either more than half of the total voting power in the ballots + // votes in favor (then the proposal is approved), or at least half of the + // votal voting power in the ballots votes against (then, the proposal is + // rejected). + // + // 2. The proposal's voting deadline is reached. At that point, if there is + // more voting power in favor than against, and at least 3% of the total + // voting power voted in favor, then the proposal is approved. Otherwise, it + // is rejected. + // + // If a neuron regularly refreshes its voting power, this has the same value + // as potential_voting_power. Actions that cause a refresh are as follows: + // + // 1. voting directly (not via following) + // 2. set following + // 3. refresh voting power + // + // (All of these actions are performed via the manage_neuron method.) + // + // However, if a neuron has not refreshed in a "long" time, this will be less + // than potential voting power. See VotingPowerEconomics. As a further result + // of less deciding voting power, not only does it have less influence on the + // outcome of proposals, the neuron receives less voting rewards (when it + // votes indirectly via following). + // + // For details, see https://dashboard.internetcomputer.org/proposal/132411. + // + // Per NNS policy, this is opt. Nevertheless, it will never be null. + deciding_voting_power : opt nat64; + + // The amount of "sway" this neuron can have if it refreshes its voting power + // frequently enough. + // + // Unlike deciding_voting_power, this does NOT take refreshing into account. + // Rather, this only takes three factors into account: + // + // 1. (Net) staked amount - This is the "base" of a neuron's voting power. + // This primarily consists of the neuron's ICP balance. + // + // 2. Age - Neurons with more age have more voting power (all else being + // equal). + // + // 3. Dissolve delay - Neurons with longer dissolve delay have more voting + // power (all else being equal). Neurons with a dissolve delay of less + // than six months are not eligible to vote. Therefore, such neurons + // are considered to have 0 voting power. + // + // Per NNS policy, this is opt. Nevertheless, it will never be null. + potential_voting_power : opt nat64; }; type NeuronBasketConstructionParameters = record { @@ -634,6 +717,7 @@ type NeuronInFlightCommand = record { timestamp : nat64; }; +// In general, this is a subset of Neuron. type NeuronInfo = record { dissolve_delay_seconds : nat64; recent_ballots : vec BallotInfo; @@ -645,9 +729,19 @@ type NeuronInfo = record { retrieved_at_timestamp_seconds : nat64; visibility : opt int32; known_neuron_data : opt KnownNeuronData; - voting_power : nat64; age_seconds : nat64; + + // Deprecated. Use either deciding_voting_power or potential_voting_power + // instead. Has the same value as deciding_voting_power. + // + // Previously, if a neuron had < 6 months dissolve delay (making it ineligible + // to vote), this would not get set to 0 (zero). That was pretty confusing. + // Now that this is set to deciding_voting_power, this actually does get + // zeroed out. + voting_power : nat64; voting_power_refreshed_timestamp_seconds : opt nat64; + deciding_voting_power : opt nat64; + potential_voting_power : opt nat64; }; type NeuronStakeTransfer = record { diff --git a/declarations/used_by_proposals/nns_registry/nns_registry.did b/declarations/used_by_proposals/nns_registry/nns_registry.did index d4c40b9f1ed..5eba19b037d 100644 --- a/declarations/used_by_proposals/nns_registry/nns_registry.did +++ b/declarations/used_by_proposals/nns_registry/nns_registry.did @@ -1,4 +1,4 @@ -//! Candid for canister `nns_registry` obtained by `scripts/update_ic_commit` from: +//! Candid for canister `nns_registry` obtained by `scripts/update_ic_commit` from: // A brief note about the history of this file: This file used to be // automatically generated, but now, it is hand-crafted, because the // auto-generator has some some pretty degenerate behaviors. The worst of those diff --git a/declarations/used_by_proposals/sns_wasm/sns_wasm.did b/declarations/used_by_proposals/sns_wasm/sns_wasm.did index a73c918ee58..d736a3129d7 100644 --- a/declarations/used_by_proposals/sns_wasm/sns_wasm.did +++ b/declarations/used_by_proposals/sns_wasm/sns_wasm.did @@ -1,4 +1,4 @@ -//! Candid for canister `sns_wasm` obtained by `scripts/update_ic_commit` from: +//! Candid for canister `sns_wasm` obtained by `scripts/update_ic_commit` from: type AddWasmRequest = record { hash : blob; wasm : opt SnsWasm; diff --git a/dfx.json b/dfx.json index 193619ab9e9..d5047b4485a 100644 --- a/dfx.json +++ b/dfx.json @@ -441,7 +441,7 @@ "POCKETIC_VERSION": "3.0.1", "CARGO_SORT_VERSION": "1.0.9", "SNSDEMO_RELEASE": "release-2024-12-04", - "IC_COMMIT_FOR_PROPOSALS": "release-2024-11-28_03-15-revert-hashes-in-blocks", + "IC_COMMIT_FOR_PROPOSALS": "release-2024-12-06_03-16-base", "IC_COMMIT_FOR_SNS_AGGREGATOR": "release-2024-11-28_03-15-revert-hashes-in-blocks" }, "packtool": "" diff --git a/rs/proposals/src/canisters/nns_governance/api.rs b/rs/proposals/src/canisters/nns_governance/api.rs index 998ea1d0469..884d7663f9b 100644 --- a/rs/proposals/src/canisters/nns_governance/api.rs +++ b/rs/proposals/src/canisters/nns_governance/api.rs @@ -1,5 +1,5 @@ //! Rust code created from candid by: `scripts/did2rs.sh --canister nns_governance --out api.rs --header did2rs.header --traits Serialize` -//! Candid for canister `nns_governance` obtained by `scripts/update_ic_commit` from: +//! Candid for canister `nns_governance` obtained by `scripts/update_ic_commit` from: #![allow(clippy::all)] #![allow(missing_docs)] #![allow(clippy::missing_docs_in_private_items)] @@ -397,6 +397,11 @@ pub struct RewardNodeProviders { pub rewards: Vec, } #[derive(Serialize, CandidType, Deserialize)] +pub struct VotingPowerEconomics { + pub start_reducing_voting_power_after_seconds: Option, + pub clear_following_after_seconds: Option, +} +#[derive(Serialize, CandidType, Deserialize)] pub struct Decimal { pub human_readable: Option, } @@ -416,6 +421,7 @@ pub struct NeuronsFundEconomics { #[derive(Serialize, CandidType, Deserialize)] pub struct NetworkEconomics { pub neuron_minimum_stake_e8s: u64, + pub voting_power_economics: Option, pub max_proposals_to_keep_per_topic: u32, pub neuron_management_fee_per_proposal_e8s: u64, pub reject_cost_e8s: u64, @@ -747,9 +753,11 @@ pub struct Neuron { pub recent_ballots: Vec, pub voting_power_refreshed_timestamp_seconds: Option, pub kyc_verified: bool, + pub potential_voting_power: Option, pub neuron_type: Option, pub not_for_profit: bool, pub maturity_e8s_equivalent: u64, + pub deciding_voting_power: Option, pub cached_neuron_stake_e8s: u64, pub created_timestamp_seconds: u64, pub auto_stake_maturity: Option, @@ -824,7 +832,9 @@ pub struct NeuronInfo { pub dissolve_delay_seconds: u64, pub recent_ballots: Vec, pub voting_power_refreshed_timestamp_seconds: Option, + pub potential_voting_power: Option, pub neuron_type: Option, + pub deciding_voting_power: Option, pub created_timestamp_seconds: u64, pub state: i32, pub stake_e8s: u64, diff --git a/rs/proposals/src/canisters/nns_registry/api.rs b/rs/proposals/src/canisters/nns_registry/api.rs index 21c4da7d73d..1fc04f13830 100644 --- a/rs/proposals/src/canisters/nns_registry/api.rs +++ b/rs/proposals/src/canisters/nns_registry/api.rs @@ -1,5 +1,5 @@ //! Rust code created from candid by: `scripts/did2rs.sh --canister nns_registry --out api.rs --header did2rs.header --traits Serialize` -//! Candid for canister `nns_registry` obtained by `scripts/update_ic_commit` from: +//! Candid for canister `nns_registry` obtained by `scripts/update_ic_commit` from: #![allow(clippy::all)] #![allow(missing_docs)] #![allow(clippy::missing_docs_in_private_items)] diff --git a/rs/proposals/src/canisters/sns_wasm/api.rs b/rs/proposals/src/canisters/sns_wasm/api.rs index 488540dfa8b..546014eb20e 100644 --- a/rs/proposals/src/canisters/sns_wasm/api.rs +++ b/rs/proposals/src/canisters/sns_wasm/api.rs @@ -1,5 +1,5 @@ //! Rust code created from candid by: `scripts/did2rs.sh --canister sns_wasm --out api.rs --header did2rs.header --traits Serialize` -//! Candid for canister `sns_wasm` obtained by `scripts/update_ic_commit` from: +//! Candid for canister `sns_wasm` obtained by `scripts/update_ic_commit` from: #![allow(clippy::all)] #![allow(missing_docs)] #![allow(clippy::missing_docs_in_private_items)]