Skip to content

Commit

Permalink
Rename Topic and NnsFunction values (#695)
Browse files Browse the repository at this point in the history
# Motivation

Some topics and proposal types were renamed in backend enums to better
reflect reality.
To avoid confusion, we make the names here consistent with what is used
in the backend code.

# Changes

1. Copied the values for the `Topic` and `NnsFunction` enums from
https://github.com/dfinity/ic/blob/master/rs/nns/governance/proto/ic_nns_governance/pb/v1/governance.proto
2. Removed the prefixes and converted to camelcase.
3. Fix a typo on the reference to the original proto file.

# Tests

Prepared changes in nns-dapp to make the tests there pass.

# Todos

- [x] Add entry to changelog (if necessary).
  • Loading branch information
dskloetd authored Aug 12, 2024
1 parent e980532 commit b015643
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Next

## Breaking changes

- Rename values of enum Topic and NnsFunction to match the backend values.

## Features

- Support conversion of `InstallCode`, `StopOrStartCanister` and `UpdateCanisterSettings` actions, `SetVisibility` neuron operation, and `Neuron::visibility` attribute.
Expand Down
19 changes: 12 additions & 7 deletions packages/nns/src/enums/governance.enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// These enums are used to map back numbers provided by the backend through the Candid declaration.
// We use Pascal case for consistency reason.
//
// Proto source: https://github.com/dfinity/ic/blob/master/rs/nns/governance/proto/icNns_governance/pb/v1/governance.proto
// Proto source: https://github.com/dfinity/ic/blob/master/rs/nns/governance/proto/ic_nns_governance/pb/v1/governance.proto

export enum NeuronState {
Unspecified = 0,
Expand All @@ -14,7 +14,7 @@ export enum NeuronState {

export enum Topic {
Unspecified = 0,
ManageNeuron = 1,
NeuronManagement = 1,
ExchangeRate = 2,
NetworkEconomics = 3,
Governance = 4,
Expand All @@ -28,8 +28,8 @@ export enum Topic {
* @deprecated
*/
SnsDecentralizationSale = 11,
SubnetReplicaVersionManagement = 12,
ReplicaVersionManagement = 13,
IcOsVersionDeployment = 12,
IcOsVersionElection = 13,
SnsAndCommunityFund = 14,
ApiBoundaryNodeManagement = 15,
SubnetRental = 16,
Expand Down Expand Up @@ -97,7 +97,7 @@ export enum NnsFunction {
AssignNoid = 8,
NnsRootUpgrade = 9,
IcpXdrConversionRate = 10,
UpdateSubnetReplicaVersion = 11,
DeployGuestosToAllSubnetNodes = 11,
ClearProvisionalWhitelist = 12,
RemoveNodesFromSubnet = 13,
SetAuthorizedSubnetworks = 14,
Expand All @@ -124,12 +124,17 @@ export enum NnsFunction {
UpdateAllowedPrincipals = 35,
RetireReplicaVersion = 36,
InsertSnsWasmUpgradePathEntries = 37,
UpdateElectedReplicaVersions = 38,
ReviseElectedGuestosVersions = 38,
BitcoinSetConfig = 39,
UpdateElectedHostosVersions = 40,
UpdateNodesHostosVersion = 41,
AddApiBoundaryNode = 43,
HardResetNnsRootToVersion = 42,
AddApiBoundaryNodes = 43,
RemoveApiBoundaryNodes = 44,
/**
* @deprecated
*/
UpdateApiBoundaryNodeDomain = 45,
UpdateApiBoundaryNodesVersion = 46,
DeployGuestosToSomeApiBoundaryNodes = 47,
DeployGuestosToAllUnassignedNodes = 48,
Expand Down

0 comments on commit b015643

Please sign in to comment.