-
Notifications
You must be signed in to change notification settings - Fork 35
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: move some flags into configs for provider and deploy #635
Conversation
collateralPerWorker: Number(flags["collateral-per-worker"]), | ||
minWorkers: flags["min-workers"], | ||
targetWorkers: flags["target-workers"], | ||
maxWorkersPerProvider: flags["max-workers-per-provider"], | ||
pricePerWorkerEpoch: flags["price-per-worker-epoch"], | ||
pricePerWorkerEpoch: Number(flags["price-per-worker-epoch"]), |
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.
Do you validate Number conversion somehow? What if string contains float value for example?
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.
this command is hidden from users and only for development purposes, so I don't validate anything here
src/commands/deal/deploy.ts
Outdated
assert( | ||
deal !== undefined, | ||
"Unreachable. All worker names are checked above", | ||
); |
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 like this assert. If you made validation already, probably your validating function should return refined fluenceConfig.deals
like a proof of validation? Probably every validation should either throw or return refined value e. g. without union with undefined
or null
.
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 can't do that easilly because as you can see the value I am itterating on comes from aqua, so the only way to avoid the assert is to pass all this to aqua just so aqua will return all of this back as a result (without actually using any of it)
src/lib/configs/project/provider.ts
Outdated
return getConfigInitFunction(getInitConfigOptions())(); | ||
} | ||
|
||
export function initReadonlyProviderConfig() { | ||
export function initReadonlyProviderConfig(name?: string | undefined) { |
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.
export function initReadonlyProviderConfig(name?: string | undefined) { | |
export function initReadonlyProviderConfig(name?: string) { |
Looks like in js omitting argument is the same as passing undefined
directly
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.
Yeah for function params this seems to be true, will apply this imporvement. This is not true for objects though, cause for objects a new key might be created with undefined inside, which would a different runtime behaviour
Looks nice! |
* feat: move some flags into configs for provider and deploy * Apply automatic changes * set correct default, forbid unknown properties * fix? * fix? * Apply automatic changes * fix? * fix * fixes * Apply automatic changes * fixes * Apply automatic changes * fixes --------- Co-authored-by: shamsartem <[email protected]>
No description provided.