Rename enum utilities for clarity and refactor#4992
Merged
pwojcikdev merged 3 commits intonanocurrency:developfrom Jan 20, 2026
Merged
Rename enum utilities for clarity and refactor#4992pwojcikdev merged 3 commits intonanocurrency:developfrom
pwojcikdev merged 3 commits intonanocurrency:developfrom
Conversation
Test Results for Commit cd20846Pull Request 4992: Results Test Case Results
Last updated: 2026-01-19 21:54:05 UTC |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the enum utility functions to improve clarity and code organization. The changes move enum utilities from a nested nano::enum_util namespace directly into the nano namespace with clearer, more descriptive function names.
Changes:
- Renamed enum utility functions with more descriptive names (
name→enum_to_string,values→enum_values,try_parse→enum_try_parse,parse→enum_parse,cast→enum_convert) - Replaced runtime validation with compile-time concept
enum_convertible_tofor type-safe enum conversions - Added
enum_bitsettype alias and improved documentation throughout
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| nano/lib/enum_util.hpp | Core refactoring: removes nested namespace, renames functions, adds compile-time concept for enum conversion validation, and adds enum_bitset type alias |
| nano/core_test/enums.cpp | Updates all test cases to use new function names |
| nano/benchmarks/stats.cpp | Updates benchmark code to use enum_values |
| nano/lib/block_type.cpp | Updates to use enum_to_string |
| nano/lib/logging_enums.cpp | Updates to use enum_to_string, enum_values, and enum_try_parse |
| nano/lib/stats_enums.cpp | Updates to use enum_to_string |
| nano/lib/thread_roles.cpp | Updates to use enum_to_string |
| nano/messages/deserialize_message.cpp | Updates to use enum_convert and enum_to_string |
| nano/messages/message_type.cpp | Updates to use enum_convert and enum_to_string |
| nano/node/active_elections.cpp | Updates to use enum_convert and enum_to_string |
| nano/node/block_source.cpp | Updates to use enum_convert and enum_to_string |
| nano/node/bootstrap/bootstrap_service.cpp | Updates to use enum_convert |
| nano/node/election.cpp | Updates to use enum_convert and enum_to_string |
| nano/node/rep_tiers.cpp | Updates to use enum_convert |
| nano/node/transport/message_deserializer.cpp | Updates to use enum_convert and enum_to_string |
| nano/node/transport/tcp_listener.cpp | Updates to use enum_to_string |
| nano/node/transport/tcp_socket.cpp | Updates to use enum_to_string |
| nano/node/transport/traffic_type.cpp | Updates to use enum_convert, enum_to_string, and enum_values |
| nano/node/vote_rebroadcaster.cpp | Updates to use enum_convert |
| nano/node/vote_router.cpp | Updates to use enum_convert and enum_to_string |
| nano/secure/common.cpp | Updates to use enum_convert and enum_to_string |
| nano/store/common.cpp | Updates to use enum_to_string |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.