diff --git a/scripts/canisters/governance.did b/scripts/canisters/governance.did index 90e13abb..9b64c41c 100644 --- a/scripts/canisters/governance.did +++ b/scripts/canisters/governance.did @@ -1,7 +1,13 @@ -type AccountIdentifier = record { hash : vec nat8 }; +type AccountIdentifier = record { + hash : blob; +}; + type Action = variant { RegisterKnownNeuron : KnownNeuron; ManageNeuron : ManageNeuron; + UpdateCanisterSettings : UpdateCanisterSettings; + InstallCode : InstallCode; + StopOrStartCanister : StopOrStartCanister; CreateServiceNervousSystem : CreateServiceNervousSystem; ExecuteNnsFunction : ExecuteNnsFunction; RewardNodeProvider : RewardNodeProvider; @@ -10,22 +16,57 @@ type Action = variant { SetDefaultFollowees : SetDefaultFollowees; RewardNodeProviders : RewardNodeProviders; ManageNetworkEconomics : NetworkEconomics; - ApproveGenesisKyc : ApproveGenesisKyc; + ApproveGenesisKyc : Principals; AddOrRemoveNodeProvider : AddOrRemoveNodeProvider; Motion : Motion; }; -type AddHotKey = record { new_hot_key : opt principal }; -type AddOrRemoveNodeProvider = record { change : opt Change }; -type Amount = record { e8s : nat64 }; -type ApproveGenesisKyc = record { principals : vec principal }; -type Ballot = record { vote : int32; voting_power : nat64 }; -type BallotInfo = record { vote : int32; proposal_id : opt NeuronId }; + +type AddHotKey = record { + new_hot_key : opt principal; +}; + +type AddOrRemoveNodeProvider = record { + change : opt Change; +}; + +type Amount = record { + e8s : nat64; +}; + +type ApproveGenesisKyc = record { + principals : vec principal; +}; + +type Ballot = record { + vote : int32; + voting_power : nat64; +}; + +type BallotInfo = record { + vote : int32; + proposal_id : opt ProposalId; +}; + type By = variant { NeuronIdOrSubaccount : record {}; MemoAndController : ClaimOrRefreshNeuronFromAccount; Memo : nat64; }; -type Canister = record { id : opt principal }; + +type Canister = record { + id : opt principal; +}; + +type CanisterSettings = record { + freezing_threshold : opt nat64; + controllers : opt Controllers; + log_visibility : opt int32; + wasm_memory_limit : opt nat64; + memory_allocation : opt nat64; + compute_allocation : opt nat64; + wasm_memory_threshold : opt nat64; +}; + type CanisterStatusResultV2 = record { status : opt int32; freezing_threshold : opt nat64; @@ -33,32 +74,56 @@ type CanisterStatusResultV2 = record { memory_size : opt nat64; cycles : opt nat64; idle_cycles_burned_per_day : opt nat64; - module_hash : vec nat8; + module_hash : blob; }; + type CanisterSummary = record { status : opt CanisterStatusResultV2; canister_id : opt principal; }; -type CfNeuron = record { - has_created_neuron_recipes : opt bool; - nns_neuron_id : nat64; - amount_icp_e8s : nat64; -}; -type CfParticipant = record { - hotkey_principal : text; - cf_neurons : vec CfNeuron; + +type Change = variant { + ToRemove : NodeProvider; + ToAdd : NodeProvider; }; -type Change = variant { ToRemove : NodeProvider; ToAdd : NodeProvider }; + type ChangeAutoStakeMaturity = record { requested_setting_for_auto_stake_maturity : bool; }; -type ClaimOrRefresh = record { by : opt By }; + +type ClaimOrRefresh = record { + by : opt By; +}; + type ClaimOrRefreshNeuronFromAccount = record { controller : opt principal; memo : nat64; }; -type ClaimOrRefreshNeuronFromAccountResponse = record { result : opt Result_1 }; -type ClaimOrRefreshResponse = record { refreshed_neuron_id : opt NeuronId }; + +type ClaimOrRefreshNeuronFromAccountResponse = record { + result : opt Result_1; +}; + +type ClaimOrRefreshResponse = record { + refreshed_neuron_id : opt NeuronId; +}; + +// This is one way for a neuron to make sure that its deciding_voting_power is +// not less than its potential_voting_power. See the description of those fields +// in Neuron. +type RefreshVotingPower = record { + // Intentionally left blank. +}; + +type RefreshVotingPowerResponse = record { + // Intentionally left blank. + // + // We could add information such as the value in the neuron's + // voting_power_refreshed_timestamp_second's field, but let's keep things + // minimal until we discover there is a "real need". YAGNI. +}; + +// KEEP THIS IN SYNC WITH ManageNeuronCommandRequest! type Command = variant { Spawn : Spawn; Split : Split; @@ -72,7 +137,11 @@ type Command = variant { StakeMaturity : StakeMaturity; MergeMaturity : MergeMaturity; Disburse : Disburse; + RefreshVotingPower : RefreshVotingPower; + + // KEEP THIS IN SYNC WITH ManageNeuronCommandRequest! }; + type Command_1 = variant { Error : GovernanceError; Spawn : SpawnResponse; @@ -87,7 +156,9 @@ type Command_1 = variant { StakeMaturity : StakeMaturityResponse; MergeMaturity : MergeMaturityResponse; Disburse : DisburseResponse; + RefreshVotingPower : RefreshVotingPowerResponse; }; + type Command_2 = variant { Spawn : NeuronId; Split : Split; @@ -99,18 +170,31 @@ type Command_2 = variant { MergeMaturity : MergeMaturity; Disburse : Disburse; }; + type Committed = record { total_direct_contribution_icp_e8s : opt nat64; total_neurons_fund_contribution_icp_e8s : opt nat64; sns_governance_canister_id : opt principal; }; + type Committed_1 = record { total_direct_participation_icp_e8s : opt nat64; total_neurons_fund_participation_icp_e8s : opt nat64; sns_governance_canister_id : opt principal; }; -type Configure = record { operation : opt Operation }; -type Countries = record { iso_codes : vec text }; + +type Configure = record { + operation : opt Operation; +}; + +type Controllers = record { + controllers : vec principal; +}; + +type Countries = record { + iso_codes : vec text; +}; + type CreateServiceNervousSystem = record { url : opt text; governance_parameters : opt GovernanceParameters; @@ -123,17 +207,33 @@ type CreateServiceNervousSystem = record { swap_parameters : opt SwapParameters; initial_token_distribution : opt InitialTokenDistribution; }; + +type DateRangeFilter = record { + start_timestamp_seconds : opt nat64; + end_timestamp_seconds : opt nat64; +}; + +type Decimal = record { + human_readable : opt text; +}; + type DerivedProposalInformation = record { swap_background_information : opt SwapBackgroundInformation; }; + type DeveloperDistribution = record { developer_neurons : vec NeuronDistribution; }; + type Disburse = record { to_account : opt AccountIdentifier; amount : opt Amount; }; -type DisburseResponse = record { transfer_block_height : nat64 }; + +type DisburseResponse = record { + transfer_block_height : nat64; +}; + type DisburseToNeuron = record { dissolve_delay_seconds : nat64; kyc_verified : bool; @@ -141,23 +241,54 @@ type DisburseToNeuron = record { new_controller : opt principal; nonce : nat64; }; + type DissolveState = variant { DissolveDelaySeconds : nat64; WhenDissolvedTimestampSeconds : nat64; }; -type Duration = record { seconds : opt nat64 }; -type ExecuteNnsFunction = record { nns_function : int32; payload : vec nat8 }; -type Follow = record { topic : int32; followees : vec NeuronId }; -type Followees = record { followees : vec NeuronId }; -type Followers = record { followers : vec NeuronId }; -type FollowersMap = record { followers_map : vec record { nat64; Followers } }; -type GetNeuronsFundAuditInfoRequest = record { nns_proposal_id : opt NeuronId }; -type GetNeuronsFundAuditInfoResponse = record { result : opt Result_6 }; -type GlobalTimeOfDay = record { seconds_after_utc_midnight : opt nat64 }; + +type Duration = record { + seconds : opt nat64; +}; + +type ExecuteNnsFunction = record { + nns_function : int32; + payload : blob; +}; + +type Follow = record { + topic : int32; + followees : vec NeuronId; +}; + +type Followees = record { + followees : vec NeuronId; +}; + +type Followers = record { + followers : vec NeuronId; +}; + +type FollowersMap = record { + followers_map : vec record { nat64; Followers }; +}; + +type GetNeuronsFundAuditInfoRequest = record { + nns_proposal_id : opt ProposalId; +}; + +type GetNeuronsFundAuditInfoResponse = record { + result : opt Result_6; +}; + +type GlobalTimeOfDay = record { + seconds_after_utc_midnight : opt nat64; +}; + type Governance = record { default_followees : vec record { int32; Followees }; making_sns_proposal : opt MakingSnsProposal; - most_recent_monthly_node_provider_rewards : opt MostRecentMonthlyNodeProviderRewards; + most_recent_monthly_node_provider_rewards : opt MonthlyNodeProviderRewards; maturity_modulation_last_updated_at_timestamp_seconds : opt nat64; wait_for_quiet_threshold_seconds : nat64; metrics : opt GovernanceCachedMetrics; @@ -165,6 +296,7 @@ type Governance = record { node_providers : vec NodeProvider; cached_daily_maturity_modulation_basis_points : opt int32; economics : opt NetworkEconomics; + restore_aging_summary : opt RestoreAgingSummary; spawning_neurons : opt bool; latest_reward_event : opt RewardEvent; to_claim_transfers : vec NeuronStakeTransfer; @@ -172,10 +304,12 @@ type Governance = record { topic_followee_index : vec record { int32; FollowersMap }; migrations : opt Migrations; proposals : vec record { nat64; ProposalData }; + xdr_conversion_rate : opt XdrConversionRate; in_flight_commands : vec record { nat64; NeuronInFlightCommand }; neurons : vec record { nat64; Neuron }; genesis_timestamp_seconds : nat64; }; + type GovernanceCachedMetrics = record { total_maturity_e8s_equivalent : nat64; not_dissolving_neurons_e8s_buckets : vec record { nat64; float64 }; @@ -198,11 +332,13 @@ type GovernanceCachedMetrics = record { not_dissolving_neurons_count : nat64; total_locked_e8s : nat64; neurons_fund_total_active_neurons : nat64; + total_voting_power_non_self_authenticating_controller : opt nat64; total_staked_maturity_e8s_equivalent : nat64; not_dissolving_neurons_e8s_buckets_ect : vec record { nat64; float64 }; total_staked_e8s_ect : nat64; not_dissolving_neurons_staked_maturity_e8s_equivalent_sum : nat64; dissolved_neurons_e8s : nat64; + total_staked_e8s_non_self_authenticating_controller : opt nat64; dissolving_neurons_e8s_buckets_seed : vec record { nat64; float64 }; neurons_with_less_than_6_months_dissolve_delay_e8s : nat64; not_dissolving_neurons_staked_maturity_e8s_equivalent_buckets : vec record { @@ -218,8 +354,18 @@ type GovernanceCachedMetrics = record { not_dissolving_neurons_e8s_buckets_seed : vec record { nat64; float64 }; timestamp_seconds : nat64; seed_neuron_count : nat64; -}; -type GovernanceError = record { error_message : text; error_type : int32 }; + + 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 { + error_message : text; + error_type : int32; +}; + type GovernanceParameters = record { neuron_maximum_dissolve_delay_bonus : opt Percentage; neuron_maximum_age_for_age_bonus : opt Duration; @@ -232,90 +378,198 @@ type GovernanceParameters = record { proposal_rejection_fee : opt Tokens; voting_reward_parameters : opt VotingRewardParameters; }; + type IdealMatchedParticipationFunction = record { serialized_representation : opt text; }; -type Image = record { base64_encoding : opt text }; + +type Image = record { + base64_encoding : opt text; +}; + type IncreaseDissolveDelay = record { additional_dissolve_delay_seconds : nat32; }; + type InitialTokenDistribution = record { treasury_distribution : opt SwapDistribution; developer_distribution : opt DeveloperDistribution; swap_distribution : opt SwapDistribution; }; + +type InstallCode = record { + skip_stopping_before_installing : opt bool; + wasm_module_hash : opt blob; + canister_id : opt principal; + arg_hash : opt blob; + install_mode : opt int32; +}; + +type InstallCodeRequest = record { + arg : opt blob; + wasm_module : opt blob; + skip_stopping_before_installing : opt bool; + canister_id : opt principal; + install_mode : opt int32; +}; + type KnownNeuron = record { id : opt NeuronId; known_neuron_data : opt KnownNeuronData; }; -type KnownNeuronData = record { name : text; description : opt text }; + +type KnownNeuronData = record { + name : text; + description : opt text; +}; + type LedgerParameters = record { transaction_fee : opt Tokens; token_symbol : opt text; token_logo : opt Image; token_name : opt text; }; -type ListKnownNeuronsResponse = record { known_neurons : vec KnownNeuron }; + +type ListKnownNeuronsResponse = record { + known_neurons : vec KnownNeuron; +}; + type ListNeurons = record { + include_public_neurons_in_full_neurons : opt bool; neuron_ids : vec nat64; + include_empty_neurons_readable_by_caller : opt bool; include_neurons_readable_by_caller : bool; }; + type ListNeuronsResponse = record { neuron_infos : vec record { nat64; NeuronInfo }; full_neurons : vec Neuron; }; -type ListNodeProvidersResponse = record { node_providers : vec NodeProvider }; + +type ListNodeProviderRewardsRequest = record { + date_filter : opt DateRangeFilter; +}; + +type ListNodeProviderRewardsResponse = record { + rewards : vec MonthlyNodeProviderRewards; +}; + +type ListNodeProvidersResponse = record { + node_providers : vec NodeProvider; +}; + type ListProposalInfo = record { include_reward_status : vec int32; omit_large_fields : opt bool; - before_proposal : opt NeuronId; + before_proposal : opt ProposalId; limit : nat32; exclude_topic : vec int32; include_all_manage_neuron_proposals : opt bool; include_status : vec int32; }; -type ListProposalInfoResponse = record { proposal_info : vec ProposalInfo }; + +type ListProposalInfoResponse = record { + proposal_info : vec ProposalInfo; +}; + +type MakeProposalRequest = record { + url : text; + title : opt text; + action : opt ProposalActionRequest; + summary : text; +}; + type MakeProposalResponse = record { message : opt text; - proposal_id : opt NeuronId; + proposal_id : opt ProposalId; }; + type MakingSnsProposal = record { proposal : opt Proposal; caller : opt principal; proposer_id : opt NeuronId; }; + type ManageNeuron = record { id : opt NeuronId; command : opt Command; neuron_id_or_subaccount : opt NeuronIdOrSubaccount; }; -type ManageNeuronResponse = record { command : opt Command_1 }; -type Merge = record { source_neuron_id : opt NeuronId }; -type MergeMaturity = record { percentage_to_merge : nat32 }; + +// KEEP THIS IN SYNC WITH COMMAND! +type ManageNeuronCommandRequest = variant { + Spawn : Spawn; + Split : Split; + Follow : Follow; + ClaimOrRefresh : ClaimOrRefresh; + Configure : Configure; + RegisterVote : RegisterVote; + Merge : Merge; + DisburseToNeuron : DisburseToNeuron; + MakeProposal : MakeProposalRequest; + StakeMaturity : StakeMaturity; + MergeMaturity : MergeMaturity; + Disburse : Disburse; + RefreshVotingPower : RefreshVotingPower; + + // KEEP THIS IN SYNC WITH COMMAND! +}; + +type ManageNeuronRequest = record { + id : opt NeuronId; + command : opt ManageNeuronCommandRequest; + neuron_id_or_subaccount : opt NeuronIdOrSubaccount; +}; + +type ManageNeuronResponse = record { + command : opt Command_1; +}; + +type Merge = record { + source_neuron_id : opt NeuronId; +}; + +type MergeMaturity = record { + percentage_to_merge : nat32; +}; + type MergeMaturityResponse = record { merged_maturity_e8s : nat64; new_stake_e8s : nat64; }; + type MergeResponse = record { target_neuron : opt Neuron; source_neuron : opt Neuron; target_neuron_info : opt NeuronInfo; source_neuron_info : opt NeuronInfo; }; + type Migration = record { status : opt int32; failure_reason : opt text; progress : opt Progress; }; + type Migrations = record { neuron_indexes_migration : opt Migration; copy_inactive_neurons_to_stable_memory_migration : opt Migration; }; -type MostRecentMonthlyNodeProviderRewards = record { + +type MonthlyNodeProviderRewards = record { + minimum_xdr_permyriad_per_icp : opt nat64; + registry_version : opt nat64; + node_providers : vec NodeProvider; timestamp : nat64; rewards : vec RewardNodeProvider; + xdr_conversion_rate : opt XdrConversionRate; + maximum_node_provider_rewards_e8s : opt nat64; }; -type Motion = record { motion_text : text }; + +type Motion = record { + motion_text : text; +}; + type NetworkEconomics = record { neuron_minimum_stake_e8s : nat64; max_proposals_to_keep_per_topic : nat32; @@ -325,7 +579,35 @@ type NetworkEconomics = record { neuron_spawn_dissolve_delay_seconds : nat64; 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 { id : opt NeuronId; staked_maturity_e8s_equivalent : opt nat64; @@ -340,23 +622,85 @@ type Neuron = record { auto_stake_maturity : opt bool; aging_since_timestamp_seconds : nat64; hot_keys : vec principal; - account : vec nat8; + account : blob; joined_community_fund_timestamp_seconds : opt nat64; dissolve_state : opt DissolveState; followees : vec record { int32; Followees }; neuron_fees_e8s : nat64; + visibility : opt int32; transfer : opt NeuronStakeTransfer; 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 { dissolve_delay_interval : opt Duration; count : opt nat64; }; + type NeuronBasketConstructionParameters_1 = record { dissolve_delay_interval_seconds : nat64; count : nat64; }; + type NeuronDistribution = record { controller : opt principal; dissolve_delay : opt Duration; @@ -364,15 +708,26 @@ type NeuronDistribution = record { vesting_period : opt Duration; stake : opt Tokens; }; -type NeuronId = record { id : nat64 }; + +type NeuronId = record { + id : nat64; +}; + +type ProposalId = record { + id : nat64; +}; + type NeuronIdOrSubaccount = variant { - Subaccount : vec nat8; + Subaccount : blob; NeuronId : NeuronId; }; + type NeuronInFlightCommand = record { command : opt Command_2; timestamp : nat64; }; + +// In general, this is a subset of Neuron. type NeuronInfo = record { dissolve_delay_seconds : nat64; recent_ballots : vec BallotInfo; @@ -382,42 +737,97 @@ type NeuronInfo = record { stake_e8s : nat64; joined_community_fund_timestamp_seconds : opt nat64; 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 { - to_subaccount : vec nat8; + to_subaccount : blob; neuron_stake_e8s : nat64; from : opt principal; memo : nat64; - from_subaccount : vec nat8; + from_subaccount : blob; transfer_timestamp : nat64; block_height : nat64; }; + +type NeuronSubsetMetrics = record { + count : opt nat64; + + total_staked_e8s : opt nat64; + total_maturity_e8s_equivalent : opt nat64; + total_staked_maturity_e8s_equivalent : opt 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 { final_neurons_fund_participation : opt NeuronsFundParticipation; initial_neurons_fund_participation : opt NeuronsFundParticipation; neurons_fund_refunds : opt NeuronsFundSnapshot; }; + type NeuronsFundData = record { final_neurons_fund_participation : opt NeuronsFundParticipation; initial_neurons_fund_participation : opt NeuronsFundParticipation; neurons_fund_refunds : opt NeuronsFundSnapshot; }; + +type NeuronsFundEconomics = record { + maximum_icp_xdr_rate : opt Percentage; + neurons_fund_matched_funding_curve_coefficients : opt NeuronsFundMatchedFundingCurveCoefficients; + max_theoretical_neurons_fund_participation_amount_xdr : opt Decimal; + minimum_icp_xdr_rate : opt Percentage; +}; + +type NeuronsFundMatchedFundingCurveCoefficients = record { + contribution_threshold_xdr : opt Decimal; + one_third_participation_milestone_xdr : opt Decimal; + full_participation_milestone_xdr : opt Decimal; +}; + type NeuronsFundNeuron = record { - hotkey_principal : opt text; + controller : opt principal; + hotkeys : opt Principals; is_capped : opt bool; nns_neuron_id : opt nat64; amount_icp_e8s : opt nat64; }; + type NeuronsFundNeuronPortion = record { - hotkey_principal : opt principal; + controller : opt principal; + hotkeys : vec principal; is_capped : opt bool; maturity_equivalent_icp_e8s : opt nat64; nns_neuron_id : opt NeuronId; amount_icp_e8s : opt nat64; }; + type NeuronsFundParticipation = record { total_maturity_equivalent_icp_e8s : opt nat64; intended_neurons_fund_participation_icp_e8s : opt nat64; @@ -428,20 +838,30 @@ type NeuronsFundParticipation = record { ideal_matched_participation_function : opt IdealMatchedParticipationFunction; allocated_neurons_fund_participation_icp_e8s : opt nat64; }; + type NeuronsFundSnapshot = record { neurons_fund_neuron_portions : vec NeuronsFundNeuronPortion; }; + type NodeProvider = record { id : opt principal; reward_account : opt AccountIdentifier; }; -type Ok = record { neurons_fund_audit_info : opt NeuronsFundAuditInfo }; -type Ok_1 = record { neurons_fund_neuron_portions : vec NeuronsFundNeuron }; + +type Ok = record { + neurons_fund_audit_info : opt NeuronsFundAuditInfo; +}; + +type Ok_1 = record { + neurons_fund_neuron_portions : vec NeuronsFundNeuron; +}; + type OpenSnsTokenSwap = record { community_fund_investment_e8s : opt nat64; target_swap_canister_id : opt principal; params : opt Params; }; + type Operation = variant { RemoveHotKey : RemoveHotKey; AddHotKey : AddHotKey; @@ -449,10 +869,12 @@ type Operation = variant { StopDissolving : record {}; StartDissolving : record {}; IncreaseDissolveDelay : IncreaseDissolveDelay; + SetVisibility : SetVisibility; JoinCommunityFund : record {}; LeaveCommunityFund : record {}; SetDissolveTimestamp : SetDissolveTimestamp; }; + type Params = record { min_participant_icp_e8s : nat64; neuron_basket_construction_parameters : opt NeuronBasketConstructionParameters_1; @@ -466,18 +888,45 @@ type Params = record { min_icp_e8s : nat64; max_direct_participation_icp_e8s : opt nat64; }; -type Percentage = record { basis_points : opt nat64 }; -type Progress = variant { LastNeuronId : NeuronId }; + +type Percentage = record { + basis_points : opt nat64; +}; + +type Principals = record { + principals : vec principal; +}; + +type Progress = variant { + LastNeuronId : NeuronId; +}; + type Proposal = record { url : text; title : opt text; action : opt Action; summary : text; }; + +type ProposalActionRequest = variant { + RegisterKnownNeuron : KnownNeuron; + ManageNeuron : ManageNeuronRequest; + UpdateCanisterSettings : UpdateCanisterSettings; + InstallCode : InstallCodeRequest; + StopOrStartCanister : StopOrStartCanister; + CreateServiceNervousSystem : CreateServiceNervousSystem; + ExecuteNnsFunction : ExecuteNnsFunction; + RewardNodeProvider : RewardNodeProvider; + RewardNodeProviders : RewardNodeProviders; + ManageNetworkEconomics : NetworkEconomics; + ApproveGenesisKyc : Principals; + AddOrRemoveNodeProvider : AddOrRemoveNodeProvider; + Motion : Motion; +}; + type ProposalData = record { - id : opt NeuronId; + id : opt ProposalId; failure_reason : opt GovernanceError; - cf_participants : vec CfParticipant; ballots : vec record { nat64; Ballot }; proposal_timestamp_seconds : nat64; reward_event_round : nat64; @@ -493,9 +942,11 @@ type ProposalData = record { wait_for_quiet_state : opt WaitForQuietState; executed_timestamp_seconds : nat64; original_total_community_fund_maturity_e8s_equivalent : opt nat64; + total_potential_voting_power : opt nat64; }; + type ProposalInfo = record { - id : opt NeuronId; + id : opt ProposalId; status : int32; topic : int32; failure_reason : opt GovernanceError; @@ -512,20 +963,85 @@ type ProposalInfo = record { proposal : opt Proposal; proposer : opt NeuronId; executed_timestamp_seconds : nat64; + total_potential_voting_power : opt nat64; +}; + +type RegisterVote = record { + vote : int32; + proposal : opt ProposalId; +}; + +type RemoveHotKey = record { + hot_key_to_remove : opt principal; +}; + +type RestoreAgingNeuronGroup = record { + count : opt nat64; + previous_total_stake_e8s : opt nat64; + current_total_stake_e8s : opt nat64; + group_type : int32; +}; + +type RestoreAgingSummary = record { + groups : vec RestoreAgingNeuronGroup; + timestamp_seconds : opt nat64; +}; + +type Result = variant { + Ok; + Err : GovernanceError; +}; + +type Result_1 = variant { + Error : GovernanceError; + NeuronId : NeuronId; }; -type RegisterVote = record { vote : int32; proposal : opt NeuronId }; -type RemoveHotKey = record { hot_key_to_remove : opt principal }; -type Result = variant { Ok; Err : GovernanceError }; -type Result_1 = variant { Error : GovernanceError; NeuronId : NeuronId }; -type Result_10 = variant { Ok : Ok_1; Err : GovernanceError }; -type Result_2 = variant { Ok : Neuron; Err : GovernanceError }; -type Result_3 = variant { Ok : GovernanceCachedMetrics; Err : GovernanceError }; -type Result_4 = variant { Ok : RewardNodeProviders; Err : GovernanceError }; -type Result_5 = variant { Ok : NeuronInfo; Err : GovernanceError }; -type Result_6 = variant { Ok : Ok; Err : GovernanceError }; -type Result_7 = variant { Ok : NodeProvider; Err : GovernanceError }; -type Result_8 = variant { Committed : Committed; Aborted : record {} }; -type Result_9 = variant { Committed : Committed_1; Aborted : record {} }; + +type Result_10 = variant { + Ok : Ok_1; + Err : GovernanceError; +}; + +type Result_2 = variant { + Ok : Neuron; + Err : GovernanceError; +}; + +type Result_3 = variant { + Ok : GovernanceCachedMetrics; + Err : GovernanceError; +}; + +type Result_4 = variant { + Ok : MonthlyNodeProviderRewards; + Err : GovernanceError; +}; + +type Result_5 = variant { + Ok : NeuronInfo; + Err : GovernanceError; +}; + +type Result_6 = variant { + Ok : Ok; + Err : GovernanceError; +}; + +type Result_7 = variant { + Ok : NodeProvider; + Err : GovernanceError; +}; + +type Result_8 = variant { + Committed : Committed; + Aborted : record {}; +}; + +type Result_9 = variant { + Committed : Committed_1; + Aborted : record {}; +}; + type RewardEvent = record { rounds_since_last_distribution : opt nat64; day_after_genesis : nat64; @@ -533,53 +1049,96 @@ type RewardEvent = record { total_available_e8s_equivalent : nat64; latest_round_available_e8s_equivalent : opt nat64; distributed_e8s_equivalent : nat64; - settled_proposals : vec NeuronId; + settled_proposals : vec ProposalId; }; + type RewardMode = variant { RewardToNeuron : RewardToNeuron; RewardToAccount : RewardToAccount; }; + type RewardNodeProvider = record { node_provider : opt NodeProvider; reward_mode : opt RewardMode; amount_e8s : nat64; }; + type RewardNodeProviders = record { use_registry_derived_rewards : opt bool; rewards : vec RewardNodeProvider; }; -type RewardToAccount = record { to_account : opt AccountIdentifier }; -type RewardToNeuron = record { dissolve_delay_seconds : nat64 }; + +type RewardToAccount = record { + to_account : opt AccountIdentifier; +}; + +type RewardToNeuron = record { + dissolve_delay_seconds : nat64; +}; + type SetDefaultFollowees = record { default_followees : vec record { int32; Followees }; }; -type SetDissolveTimestamp = record { dissolve_timestamp_seconds : nat64 }; -type SetOpenTimeWindowRequest = record { open_time_window : opt TimeWindow }; + +type SetDissolveTimestamp = record { + dissolve_timestamp_seconds : nat64; +}; + +type SetOpenTimeWindowRequest = record { + open_time_window : opt TimeWindow; +}; + type SetSnsTokenSwapOpenTimeWindow = record { request : opt SetOpenTimeWindowRequest; swap_canister_id : opt principal; }; + +type SetVisibility = record { + visibility : opt int32; +}; + type SettleCommunityFundParticipation = record { result : opt Result_8; open_sns_token_swap_proposal_id : opt nat64; }; + type SettleNeuronsFundParticipationRequest = record { result : opt Result_9; nns_proposal_id : opt nat64; }; -type SettleNeuronsFundParticipationResponse = record { result : opt Result_10 }; + +type SettleNeuronsFundParticipationResponse = record { + result : opt Result_10; +}; + type Spawn = record { percentage_to_spawn : opt nat32; new_controller : opt principal; nonce : opt nat64; }; -type SpawnResponse = record { created_neuron_id : opt NeuronId }; -type Split = record { amount_e8s : nat64 }; -type StakeMaturity = record { percentage_to_stake : opt nat32 }; + +type SpawnResponse = record { + created_neuron_id : opt NeuronId; +}; + +type Split = record { + amount_e8s : nat64; +}; + +type StakeMaturity = record { + percentage_to_stake : opt nat32; +}; + type StakeMaturityResponse = record { maturity_e8s : nat64; staked_maturity_e8s : nat64; }; + +type StopOrStartCanister = record { + action : opt int32; + canister_id : opt principal; +}; + type SwapBackgroundInformation = record { ledger_index_canister_summary : opt CanisterSummary; fallback_controller_principal_ids : vec principal; @@ -590,7 +1149,11 @@ type SwapBackgroundInformation = record { root_canister_summary : opt CanisterSummary; dapp_canister_summaries : vec CanisterSummary; }; -type SwapDistribution = record { total : opt Tokens }; + +type SwapDistribution = record { + total : opt Tokens; +}; + type SwapParameters = record { minimum_participants : opt nat64; neurons_fund_participation : opt bool; @@ -607,70 +1170,98 @@ type SwapParameters = record { neurons_fund_investment_icp : opt Tokens; restricted_countries : opt Countries; }; + type SwapParticipationLimits = record { min_participant_icp_e8s : opt nat64; max_participant_icp_e8s : opt nat64; min_direct_participation_icp_e8s : opt nat64; max_direct_participation_icp_e8s : opt nat64; }; + type Tally = record { no : nat64; yes : nat64; total : nat64; timestamp_seconds : nat64; }; + type TimeWindow = record { start_timestamp_seconds : nat64; end_timestamp_seconds : nat64; }; -type Tokens = record { e8s : opt nat64 }; -type UpdateNodeProvider = record { reward_account : opt AccountIdentifier }; + +type Tokens = record { + e8s : opt nat64; +}; + +type UpdateCanisterSettings = record { + canister_id : opt principal; + settings : opt CanisterSettings; +}; + +type UpdateNodeProvider = record { + reward_account : opt AccountIdentifier; +}; + type VotingRewardParameters = record { reward_rate_transition_duration : opt Duration; initial_reward_rate : opt Percentage; final_reward_rate : opt Percentage; }; -type WaitForQuietState = record { current_deadline_timestamp_seconds : nat64 }; + +type WaitForQuietState = record { + current_deadline_timestamp_seconds : nat64; +}; + +type XdrConversionRate = record { + xdr_permyriad_per_icp : opt nat64; + timestamp_seconds : opt nat64; +}; + service : (Governance) -> { claim_gtc_neurons : (principal, vec NeuronId) -> (Result); claim_or_refresh_neuron_from_account : (ClaimOrRefreshNeuronFromAccount) -> ( - ClaimOrRefreshNeuronFromAccountResponse, - ); + ClaimOrRefreshNeuronFromAccountResponse + ); get_build_metadata : () -> (text) query; get_full_neuron : (nat64) -> (Result_2) query; get_full_neuron_by_id_or_subaccount : (NeuronIdOrSubaccount) -> ( - Result_2, - ) query; + Result_2 + ) query; get_latest_reward_event : () -> (RewardEvent) query; get_metrics : () -> (Result_3) query; get_monthly_node_provider_rewards : () -> (Result_4); get_most_recent_monthly_node_provider_rewards : () -> ( - opt MostRecentMonthlyNodeProviderRewards, - ) query; + opt MonthlyNodeProviderRewards + ) query; get_network_economics_parameters : () -> (NetworkEconomics) query; get_neuron_ids : () -> (vec nat64) query; get_neuron_info : (nat64) -> (Result_5) query; get_neuron_info_by_id_or_subaccount : (NeuronIdOrSubaccount) -> ( - Result_5, - ) query; + Result_5 + ) query; get_neurons_fund_audit_info : (GetNeuronsFundAuditInfoRequest) -> ( - GetNeuronsFundAuditInfoResponse, - ) query; + GetNeuronsFundAuditInfoResponse + ) query; get_node_provider_by_caller : (null) -> (Result_7) query; get_pending_proposals : () -> (vec ProposalInfo) query; get_proposal_info : (nat64) -> (opt ProposalInfo) query; + get_restore_aging_summary : () -> (RestoreAgingSummary) query; list_known_neurons : () -> (ListKnownNeuronsResponse) query; list_neurons : (ListNeurons) -> (ListNeuronsResponse) query; + list_node_provider_rewards : (ListNodeProviderRewardsRequest) -> ( + ListNodeProviderRewardsResponse + ) query; list_node_providers : () -> (ListNodeProvidersResponse) query; list_proposals : (ListProposalInfo) -> (ListProposalInfoResponse) query; - manage_neuron : (ManageNeuron) -> (ManageNeuronResponse); + manage_neuron : (ManageNeuronRequest) -> (ManageNeuronResponse); settle_community_fund_participation : (SettleCommunityFundParticipation) -> ( - Result, - ); + Result + ); settle_neurons_fund_participation : ( - SettleNeuronsFundParticipationRequest, - ) -> (SettleNeuronsFundParticipationResponse); - simulate_manage_neuron : (ManageNeuron) -> (ManageNeuronResponse); + SettleNeuronsFundParticipationRequest + ) -> (SettleNeuronsFundParticipationResponse); + simulate_manage_neuron : (ManageNeuronRequest) -> (ManageNeuronResponse); transfer_gtc_neuron : (NeuronId, NeuronId) -> (Result); update_node_provider : (UpdateNodeProvider) -> (Result); -} \ No newline at end of file +}; diff --git a/src/backend/integration/src/tests/user_profile.spec.ts b/src/backend/integration/src/tests/user_profile.spec.ts index 8779ab19..eac7b2c9 100644 --- a/src/backend/integration/src/tests/user_profile.spec.ts +++ b/src/backend/integration/src/tests/user_profile.spec.ts @@ -41,9 +41,9 @@ describe('User Profile', () => { const res = await driver.actor.list_reviewer_profiles(); const resOk = extractOkResponse(res); - expect(resOk).toEqual({ - profiles: [alice, bob], - }); + expect(resOk.profiles).toBeArrayOfSize(2); + expect(resOk.profiles).toContainEqual(alice); + expect(resOk.profiles).toContainEqual(bob); }); }); diff --git a/src/frontend/src/.ic-assets.json b/src/frontend/src/.ic-assets.json index 2f47a488..82c6fc62 100644 --- a/src/frontend/src/.ic-assets.json +++ b/src/frontend/src/.ic-assets.json @@ -2,7 +2,7 @@ { "match": "**/*", "headers": { - "Content-Security-Policy": "default-src 'self'; connect-src 'self' https://icp-api.io; img-src 'self' https://icp0.io http://localhost; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; form-action 'self'; object-src 'none'; frame-ancestors 'none'; upgrade-insecure-requests; block-all-mixed-content", + "Content-Security-Policy": "default-src 'self'; connect-src 'self' https://icp-api.io; img-src 'self' https://icp0.io http://localhost blob:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; form-action 'self'; object-src 'none'; frame-ancestors 'none'; upgrade-insecure-requests; block-all-mixed-content", "Permissions-Policy": "accelerometer=(), ambient-light-sensor=(), autoplay=(), battery=(), camera=(), cross-origin-isolated=(), display-capture=(), document-domain=(), encrypted-media=(), execution-while-not-rendered=(), execution-while-out-of-viewport=(), fullscreen=(), geolocation=(), gyroscope=(), keyboard-map=(), magnetometer=(), microphone=(), midi=(), navigation-override=(), payment=(), picture-in-picture=(), publickey-credentials-get=(), screen-wake-lock=(), sync-xhr=(), usb=(), web-share=(), xr-spatial-tracking=(), clipboard-read=(), clipboard-write=(), gamepad=(), speaker-selection=(), conversion-measurement=(), focus-without-user-activation=(), hid=(), idle-detection=(), interest-cohort=(), serial=(), sync-script=(), trust-token-redemption=(), window-placement=(), vertical-scroll=()", "X-Frame-Options": "DENY", "Referrer-Policy": "same-origin", diff --git a/src/frontend/src/app/app.config.ts b/src/frontend/src/app/app.config.ts index 823687ad..28387789 100644 --- a/src/frontend/src/app/app.config.ts +++ b/src/frontend/src/app/app.config.ts @@ -29,7 +29,6 @@ export const APP_CONFIG: ApplicationConfig = { }), provideIcAuth({ identityProvider: ENV.IDENTITY_PROVIDER, - derivationOrigin: ENV.DERIVATION_ORIGIN, }), ], }; diff --git a/src/frontend/src/environments/environment.common.ts b/src/frontend/src/environments/environment.common.ts index a7cc07d1..de2b9543 100644 --- a/src/frontend/src/environments/environment.common.ts +++ b/src/frontend/src/environments/environment.common.ts @@ -9,18 +9,9 @@ export const BACKEND_ORIGIN = IS_MAINNET ? `https://${CANISTER_ID_BACKEND}.icp0.io` : `http://${CANISTER_ID_BACKEND}.localhost:8080`; -export const CANISTER_ID_MARKETING = import.meta.CANISTER_ID_MARKETING ?? ''; - export const CANISTER_ID_INTERNET_IDENTITY = import.meta.CANISTER_ID_INTERNET_IDENTITY ?? ''; export const IDENTITY_PROVIDER = IS_MAINNET ? 'https://identity.ic0.app' : `http://${CANISTER_ID_INTERNET_IDENTITY}.localhost:8080`; - -// don't use derivation origins locally because II rejects them as invalid -// this can be enabled locally once II supports it -// Use this value for local support: `http://${CANISTER_ID_MARKETING}.localhost:8000`; -export const DERIVATION_ORIGIN = IS_MAINNET - ? `https://${CANISTER_ID_MARKETING}.icp0.io` - : undefined; diff --git a/src/frontend/src/environments/environment.development.ts b/src/frontend/src/environments/environment.development.ts index c0666338..ff326840 100644 --- a/src/frontend/src/environments/environment.development.ts +++ b/src/frontend/src/environments/environment.development.ts @@ -2,7 +2,6 @@ import { API_GATEWAY, BACKEND_ORIGIN, CANISTER_ID_BACKEND, - DERIVATION_ORIGIN, DFX_NETWORK, IDENTITY_PROVIDER, IS_MAINNET, @@ -15,5 +14,4 @@ export const ENV = { DFX_NETWORK, IDENTITY_PROVIDER, IS_MAINNET, - DERIVATION_ORIGIN, }; diff --git a/src/frontend/src/environments/environment.ts b/src/frontend/src/environments/environment.ts index c0666338..ff326840 100644 --- a/src/frontend/src/environments/environment.ts +++ b/src/frontend/src/environments/environment.ts @@ -2,7 +2,6 @@ import { API_GATEWAY, BACKEND_ORIGIN, CANISTER_ID_BACKEND, - DERIVATION_ORIGIN, DFX_NETWORK, IDENTITY_PROVIDER, IS_MAINNET, @@ -15,5 +14,4 @@ export const ENV = { DFX_NETWORK, IDENTITY_PROVIDER, IS_MAINNET, - DERIVATION_ORIGIN, }; diff --git a/src/frontend/src/typings.d.ts b/src/frontend/src/typings.d.ts index 23ab4f5d..6384e017 100644 --- a/src/frontend/src/typings.d.ts +++ b/src/frontend/src/typings.d.ts @@ -1,6 +1,5 @@ interface ImportMeta { CANISTER_ID_BACKEND?: string; - CANISTER_ID_MARKETING?: string; CANISTER_ID_INTERNET_IDENTITY?: string; DFX_NETWORK?: string; } diff --git a/src/marketing/generate-alt-origins.mjs b/src/marketing/generate-alt-origins.mjs deleted file mode 100644 index f78f80a1..00000000 --- a/src/marketing/generate-alt-origins.mjs +++ /dev/null @@ -1,24 +0,0 @@ -import 'dotenv/config'; -import { writeFile, mkdir } from 'node:fs/promises'; -import { dirname, resolve } from 'node:path'; -import { fileURLToPath } from 'node:url'; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); - -const dfxNetwork = process.env.DFX_NETWORK ?? 'local'; -const isMainnet = dfxNetwork === 'ic'; - -const frontendCanisterId = process.env.CANISTER_ID_FRONTEND ?? ''; -const frontedUrl = isMainnet - ? `https://${frontendCanisterId}.icp0.io` - : `http://${frontendCanisterId}.localhost:8080`; - -const fileContent = { - alternativeOrigins: [frontedUrl], -}; -const targetDir = resolve(__dirname, 'dist', '.well-known'); -const filePath = resolve(targetDir, 'ii-alternative-origins'); - -await mkdir(targetDir, { recursive: true }); -await writeFile(filePath, JSON.stringify(fileContent)); diff --git a/src/marketing/package.json b/src/marketing/package.json index 93f0674a..ba186537 100644 --- a/src/marketing/package.json +++ b/src/marketing/package.json @@ -5,7 +5,7 @@ "version": "0.0.1", "scripts": { "start": "astro dev", - "build": "astro check && astro build && node ./generate-alt-origins.mjs" + "build": "astro check && astro build" }, "dependencies": { "@astrojs/netlify": "^5.2.0", diff --git a/src/marketing/public/.ic-assets.json b/src/marketing/public/.ic-assets.json index 5f0980f8..9060e237 100644 --- a/src/marketing/public/.ic-assets.json +++ b/src/marketing/public/.ic-assets.json @@ -11,17 +11,5 @@ "X-XSS-Protection": "1; mode=block" }, "allow_raw_access": false - }, - { - "match": ".well-known", - "ignore": false - }, - { - "match": ".well-known/ii-alternative-origins", - "headers": { - "Access-Control-Allow-Origin": "*", - "Content-Type": "application/json" - }, - "ignore": false } ]