This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Decouple & move default ports to CliConfiguration #6250
Closed
Closed
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6384bc4
Initial commit
cecton 1ef6fa8
Move default ports to CliConfiguration
cecton e48ccf8
replace options by value directly
cecton c7f9851
Remove &self and Result for default_ methods
cecton c3028d5
move all the things to SubstrateCli
cecton 5acaa63
Update client/cli/src/commands/mod.rs
cecton b401b8d
Update client/cli/src/commands/mod.rs
cecton be8de48
Merge commit feb334d87773331c23ef6560a55f43fcb5ef62a8 (no conflict)
cecton df58587
Revert "move all the things to SubstrateCli"
cecton e07b9a4
Revert "Remove &self and Result for default_ methods"
cecton 1b325b8
Merge commit f06d5f0ff1b94c0e66b7bda871274e9cba2fc5d6 (no conflict)
cecton e77365a
Added changelog
cecton 90b4f44
Update CHANGELOG.md
cecton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
move all the things to SubstrateCli
- Loading branch information
commit c3028d58780a6d0e40b047eaad89396241b0aed9
There are no files selected for viewing
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
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
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.
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 really understand why he have these ports in this trait here?
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 explained in detail here: #6250 (comment)
TL;DR: This is to make sure the default value is the same everywhere (on all subcommands). SubstrateCli has kind of "static"/"constant"-like stuff while ConfigurationCli know how to transform things for a subcommand.
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 entirely sold on this solution. This distinction between these traits seems rather random. And what is with other default values? Why are they not override-able?
Uh oh!
There was an error while loading. Please reload this page.
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.
Me neither 😅 initially when I did the refactoring I wanted to have only one trait but it wasn't possible.
Some things work using the parameters provided by the user (CliConfiguration) like: getting the database parameters.
Some other things work using kinda global values (SubstrateCli) like: impl name, impl version.
Some are a bit of both like: getting the chain spec value from user input but process the input the same way for the entire Cli.
In CliConfiguration there are no function that return what should be the default value of something. They are all kinda getter to the user input. Here what we override is the default port of something.
Well, either way I'm out of argument so I will let you decide what is best among those options and I will adapt the code accordingly:
(Note: there is no option for using CliConfiguration without Result and without &self because &self is required to dispatch to the right subcommand if used in CliConfiguration. This is not the case for SubstrateCli because the trait is kinda global to the entire Cli app.)
🔝 ☝️ cc @seunlanlege (because related to encapsulation OCD)
I have been asked to avoid proc macros in the API as much as possible, so this won't even be an option for me.