-
Notifications
You must be signed in to change notification settings - Fork 2
feat: support multiple commands and multiple binaries in aliases #130
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
base: fabrizioorsi/i123-active-toolchain-bug
Are you sure you want to change the base?
feat: support multiple commands and multiple binaries in aliases #130
Conversation
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
c46ff37 to
04d1168
Compare
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
b387f86 to
c168571
Compare
9fef9e2 to
f760d9c
Compare
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
…ble to execute Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
c3cf98c to
46bfd7c
Compare
59ade72 to
aa6c489
Compare
| /// Resolve the command to a [[Component]]'s corresponding executable. This | ||
| /// requires the following CliCommand in the manifest to be a | ||
| /// [[CliCommand::Verbatim]] with the name of the executable to execute. | ||
| /// For example: | ||
| /// | ||
| /// "aliases": { | ||
| /// "account": [["executable", "client", "new-account"]], | ||
| /// } |
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 too fond of Executable and VarPath depending implicitly on the following CliCommand on the manifest.
I believe these two could be refactored so that all the required arguments are on the same enum variant.
Like so:
pub enum CliCommand {
(...)
Executable { component_name: String },
(...)This would change the way CliCommand is serialized, but I think encapsulating all the required component into a single variant would a win in the long run.
aa6c489 to
b8507c1
Compare
|
Sidenote: Since this changes the way the Manifest is serialized, it is expected for this test to fail; since it uses the published manifest. |
| #[test] | ||
| /// Validates that the *published* channel manifest is parseable. | ||
| /// NOTE: This test is mainly intended for backwards compatibilty reasons. | ||
| fn validate_published_channel_manifest() { | ||
| let manifest = Manifest::load_from(Manifest::PUBLISHED_MANIFEST_URI) | ||
| .expect("Failed to parse upstream manifest."); | ||
|
|
||
| let stable = manifest | ||
| .get_channel(&UserChannel::Stable) | ||
| .expect("Could not convert UserChannel to internal channel representation"); | ||
|
|
||
| assert!(stable.get_component("std").is_some()); | ||
| } | ||
|
|
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 removed this test since installing the stable toolchain is already done in .github/workflows/integration.yml.
Additionally, the integration tests are only run if the unit tests pass. So currently, this test is only blocking the integration test suite; without providing additional functionality.
|
Hey @lima-limon-inc , thanks for working on this! I was actually also working on implementing a solution to #129 in this PR: #132 FYI, I think it might make sense to compare the two approaches. On PR #132 , I moved the aliases outside of the individual components struct, to a "aliases" struct that sits at the top-level of each channel (which caused significantly more code changes). The future Furthermore, I think we need better coordination on who is working on what for |
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
1a3358c to
b72b0d6
Compare
|
Hi there @Keinberger !
Agreed! I looked at your PR and I believe our approaches are more similar than they are dissimilar.
I also added this channel-wide aliases in my PR. I believe having aliases which encompass multiple binaries makes these "channel wide aliases" a necessity. I think the main difference in approach between both PRs is that #132 removes component specific aliases, whilst this PR keeps them.
I believe keeping the concept of "component specific aliases" is worthwhile. Were the CLI of a component to change, it would only be that component's responsibility to update the corresponding manifest entries. On the other, aliases that correspond to multiple binaries, like
Totally, I apologize for any inconvenience this might have caused. Having said this, I'll be working on a slight refactor of I'm not too certain of going with this table-like approach, since that might limit Edit: The PR in question, editing |
|
@lima-limon-inc @Keinberger I would like to better understand why this feature is necessary in the first place. It isn't clear to me why
If there is a compelling reason why |
In this case I was expecting @lima-limon-inc to work on this because he self-assigned the related issue as soon as it was created AFAIK, but more generally I agree! The fact that it's still not clear where the feature should be implemented is also related.
I think some of the rationale can be found in the closed client PR (cc @mmagician). |
Based on my reading of that comment, it would seem that the inverse could be done instead then, implement In general though, a key design constraint is that If we determine that we really want Either way, I don't think the direction in this PR or in #132 are the way forward. It strikes me that if the need for this kind of capability is more pervasive than just the |
Thanks for explaining, I agree that it is worthwhile to keep the component-centric aliases. Nevertheless, one suggestion that I'd like to make would be to rename the "key" for channel-wide aliases in the manifest file. Otherwise I fear it's confusing as to why aliases are defined channel-wide, and component-specific.
Sounds good, no worries. I think we can utilize our internal Slack channel for better communication. Also, I missed that you self-assigned this issue, so that one is on me. |
As Ignacio already pointed out, this was discussed on the original PR on I would also like to link this comment by Santiago, in which he explained that the inclusion of the
Here my comment on your thought: Per se, I do agree that we can do that. Nevertheless, I think it's important to point out that this would break the Right now, If we were to integrate the full logic of the mint command there (i.e. integrating and depending on the client CLI), the faucet itself would become sort of an extension of the "client", which I'm not sure we want. Two reasons for that:
On the other hand, if we consider that the I'm open to either direction, but wanted to surface these trade-offs. Would be great to hear other people's perspective on this too! |
Not with the CLI, but Currently, the I think we're conflating two concepts in the faucet discussions: The latter can be refactored to remove its dependency on |
Yes, I agree this is probably a pattern that would repeat in the future, and that splitting features out into a different tool could work out here (I couldn't find it just now but I think I suggested a similar approach when the implementation was going to live on the client repo).
Do you mean doing something like // Request note from the faucet as it's currently done in https://github.com/0xMiden/miden-faucet/pull/196
// This does not currently exist but essentially it would load a config in the same way as the CLI does and
// init a client
let client = Client::from_system_user_config();
let req = TransactionRequest::builder().consume_notes(/* recently_minted_note */).build()?;
client.submit_new_transaction(req, target_account_id)?;If so, I think this would also work. As you mentioned, the faucet user binary becomes a specialized client which just implements functionality for a specific subset of transactions (consuming notes from the faucet with a specific account). I may have misunderstood @Keinberger's reservations but I'm not sure they apply here; as @mmagician mentioned, the backend already relies on the client and additionally I don't think there would be a need to config the client instance necessarily (not in a way that it wasn't necessary before if you wanted to get assets into an account managed by yourself). |
|
Sorry it has taken me so long to follow up here, I've been pretty swamped as of late 😅.
Yes, exactly. Since the faucet already depends on the client, it would seem natural then to have the
Agreed, and in particular, the client would have already been configured via
Fair. I think I'd like to wait and see another example of that pattern before we attempt to solve for it in
I'm more concerned about breaking changes to Consider As I noted though, |
|
Okay, thanks everyone for sharing your thoughts! I want to summarize everything here so we can align on an approach moving forward: 👉 From what it seems, we want to move the note consumption functionality to the miden-faucet repository (i.e., the I'm fine with that. For the record, I'm also fine with the other approach that was discussed, i.e., separating There is one thing I would like to mention regarding moving the note consumption to the faucet repository: This is important to ensure that the faucet uses the same configuration as the client CLI would (which is the intended user behavior). Since the client specifies how to determine the correct Please let me know if everyone is fine with moving the functionality to the faucet repo and implementing this helper function in the client repository! |
That's my understanding as well.
It'd be great to be able to extract enough of the configuration details defined via 100% agree though that the
I think we have consensus on the overall approach here, and all that remains are some minor technical details related to client configuration that I don't see derailing things even if there is some objection there (and I doubt there is, but I'll defer to @igamigo on that). I'd say you have a green light to start building this out, and we can tackle any debate around technical details in the resulting PRs. |
Sounds good, I already started building out the feature in the miden-client repository which can be found here: 0xMiden/miden-client#1642 |
Closes #129
This PR makes adds the following functionalities:
Channels can also haveAliasesBoth of these features were added in order to support the
miden mintcommand (described in more detail here: 0xMiden/miden-faucet#192) which requires a succession of command from different binaries to be executed.To achieve this, the following changes were made:
MidenArgument::Aliasnow contains aVec<CLICommand>instead of a singleCLICommand. Additionally, theComponentfield was removed, in order to support multi-binary aliases.CliCommand::Executablenow requires the following argument to be of typeCliCommand::Verbatimwith the name of the component that needs to be executed.CliCommand::PositionalArgument, which can be used to pass specific positional argument used in the CLI to the underlying binaries. This mainly intended for multi-command aliases, like so:This means that when a user calls the
miden mintalias, the first argument they pass tomiden mintwill be passed tofaucet-clientandclientexecutables.