Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(node): add node_reward_type to config tool #2641

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

andrewbattat
Copy link
Member

@andrewbattat andrewbattat commented Nov 15, 2024

NODE-1474
node_reward_type was just added to config.ini. This PR adds it to the new config tool.

@andrewbattat andrewbattat self-assigned this Nov 15, 2024
@github-actions github-actions bot added the feat label Nov 15, 2024
Comment on lines 64 to 65
/// The node reward type determines node rewards
pub node_reward_type: String,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node_reward_type exists as an enum in the registry protobuf:

enum NodeRewardType {

Rather than maintain the enum in two locations, we can leave it as a string here and just do a basic formatting check in the CreateSetuposConfig command

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be a slippery slope, but why can't we rely on these types directly?

We will need to do this mapping at some point when nodes use this config value to communicate with the registry - why not now? If the enum is in flux, it might be another good story to think about for config compatibility.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I actually looked at the enum this time 🤦‍♀️.

We will still need some parsing to map the "human" names to these enum values, and at that point it would be good to use the types directly.

Until that mapping exists, though, this basic check in SetupOS looks fine. We just need to be wary that every variant that makes it past parsing needs to eventually be handled. (The same applies to the check from #1787.)

@@ -61,6 +61,8 @@ pub struct GuestOSConfig {

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
pub struct ICOSSettings {
/// The node reward type determines node rewards
pub node_reward_type: Option<String>,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node_reward_type is Optional in config, even though it's required for SetupOS installation, because nodes on mainnet currently don't have the field, so this way, the update-config.service can leave the value as optional

@andrewbattat andrewbattat marked this pull request as ready for review November 15, 2024 22:28
@andrewbattat andrewbattat requested a review from a team as a code owner November 15, 2024 22:28
@github-actions github-actions bot added the @node label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants