Skip to content

Conversation

lima-limon-inc
Copy link

@lima-limon-inc lima-limon-inc commented Sep 15, 2025

This PR adds makes it so that the CLI can now extract a component template from a passed in package, via the -p, --packages flags.
Additionally, this TODO comment was addressed, now the I/O error display more context.

Here are snippets showcasing the new error messages:

  × account component error: failed to read account component template from component.mca
  ╰─▶ component.mca has an invalid file extension: 'mca'. Expected: mct
  × account component error: failed to read account component template from ./templates/component.mct
 ╰─▶ No such file or directory (os error 2)
  × account component error: failed to read Package from ./packages/component.masp
╰─▶ No such file or directory (os error 2)
  × account component error: failed to read Package from component.masl
  ╰─▶ component.masl has an invalid file extension: 'masl'. Expected: masp

Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
@lima-limon-inc lima-limon-inc marked this pull request as ready for review September 15, 2025 19:20
/// Optional list of files specifying additional component template files to add to the
/// account.
/// List of files specifying component template files for the account. At
/// lease one component template is required.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/// lease one component template is required.
/// least one component template is required.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks! Changed here: b285982

Comment on lines 248 to 257
// If a user passes in a file with the `.masp` file extension, then we
// leave the passed in path as is; since it probably is a full path.
// This is the case with cargo-miden, which displays the full path to
// stdout after compilation finishes.
let path = if path.extension().is_none() {
let path = path.with_extension(MIDEN_PACKAGE_EXTENSION);
packages_dir.join(&path)
} else {
path.clone()
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

But we're not checking that this file's extension is actually .masp, right? Only that it exists.

Copy link
Author

Choose a reason for hiding this comment

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

Great point! I'll add a check.

Copy link
Author

Choose a reason for hiding this comment

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

Check added here: eb6884a

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]>
Comment on lines 156 to 160
/// Optional list of files specifying additional component template files to add to the
/// account.
/// List of files specifying component template files for the account. At
/// least one component template is required.
Copy link
Author

@lima-limon-inc lima-limon-inc Sep 16, 2025

Choose a reason for hiding this comment

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

Sidenote: I believe this list is not optional since at least one element has to be passed in, source: https://github.com/lambdaclass/miden-client/pull/25/files#diff-95eb60497fe9b9ad958ac1c26595181b35ee51f5e192ebe32ac9689cecb768c2L254-R360.AFAIK, this is only optional when building a wallet.

Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
@lima-limon-inc lima-limon-inc force-pushed the fabrizioorsi-account-from-package branch 2 times, most recently from 27b99dd to 90c41b3 Compare September 16, 2025 18:44
Copy link
Collaborator

@TomasArrachea TomasArrachea left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants