-
Notifications
You must be signed in to change notification settings - Fork 135
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: add cli flags for storage capacity per subnetwork #1558
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@morph-dev over all the PR looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love all the tests!
nit I just did a quick grep, and didn't see any tests that the --mb
alias still works. I'd be in favor of a single simple one to make sure we don't accidentally disable it in the future.
if storage_flag.is_some() && !config.portal_subnetworks.contains(&subnetwork) { | ||
return Err(Error::raw( | ||
ErrorKind::ArgumentConflict, | ||
format!( | ||
"--storage.{} is set but {subnetwork} subnetwork is not enabled", | ||
subnetwork.to_cli_arg(), | ||
), | ||
)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we have to error out in this case. I do like the impulse to be strict to avoid accidents.
But I can also imagine a scenario where I'm flipping between enabling and disabling a network, and having to do that in two places in the command being a little annoying.
I'm slightly in favor of dropping this if you're neutral.
@@ -256,7 +301,7 @@ impl TrinConfig { | |||
|
|||
pub fn new_from<I, T>(args: I) -> Result<Self, clap::Error> | |||
where | |||
I: Iterator<Item = T>, | |||
I: IntoIterator<Item = T>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do really like this change. It also added noise to a big PR. I think it belongs in its own commit/PR.
ethportal-api/src/types/cli.rs
Outdated
assert_eq!( | ||
config.storage_capacity_config(), | ||
StorageCapacityConfig::Specific { | ||
beacon_mb: Some(0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there are any actual bugs here, but as a practice the test for setting a specific value should probably pick one that isn't the value you would arrive at by default.
Rebased, fixed default capacity tests, added Let me know if you have other comments and I will address them in the followup PR. |
What was wrong?
Based on #1548 and discussion in the last meeting, we agreed that we want following cli flags regarding storage capacity:
storage.total
flag that specifies total storage capacity (in MB)mb
should be set as alias (until we migrate in other places)storage.beacon
,storage.history
andstorage.state
that specifies storage capacity (in MB) per subnetwork explicitlySome restrictions:
storage.total
can't be combined with other flagsstorage.{subnetwork}
is specified for one enabled subnetwork, it should be specified for all enabled networksFor future work:
How was it fixed?
TrinConfig
is createdPortalStorageConfig
To-Do