Skip to content

Conversation

@lima-limon-inc
Copy link
Collaborator

@lima-limon-inc lima-limon-inc commented Nov 3, 2025

Closes: #121

This PR adds artifact support, both for executables and libraries. With this, midenup should first try to download an artifact if it exists. If it doesn't or the fetching fails, then it proceeds to install from source.

Implementation notes:

  • The Artifact struct holds a URI which is used to fetch the artifact, either from a URL (prefixed by https://) or from a file (prefixed by file://). Each artifact only holds a specific triplet (for more information, see LLVM's triplet implementation), which is displayed in the URI itself, for example:
    • https://github.com/0xMiden/miden-client/releases/download/0.0/client-aarch64-apple-darwin: Holds the miden-client's binary for aarch64-apple-darwin
    • https://github.com/0xMiden/miden-vm/releases/download/0.0/std.masp: Holds the Package for the std library. (Do note that masp packages are used by the MidenVM and so therefore these URIs do not have a platform dependent triplet).
  • The src/external.rs file holds functions that are imported into the install script by the include_str macro. These were added in a separate file to enhance readability.
  • As a final note, now if a component fails to get installed, midenup will simply skip said component if it's in release mode. In debug mode, it panics.

@lima-limon-inc lima-limon-inc self-assigned this Nov 3, 2025
@lima-limon-inc lima-limon-inc added command:midenup An issue or task related to the `midenup` command check:install PRs only: runs workflows that perform additional end-to-end integration testing labels Nov 3, 2025
@lima-limon-inc lima-limon-inc changed the base branch from main to fabrizioorsi/i113-remove-hardcoded-components November 3, 2025 20:59
@lima-limon-inc lima-limon-inc force-pushed the fabrizioorsi/i121-artifact-support branch 4 times, most recently from 77a15c8 to 2fb1bef Compare November 6, 2025 14:47
@lima-limon-inc
Copy link
Collaborator Author

Hi there @bitwalker. Status update: This PR is almost ready for review, I'm doing some final polishing.

Before merging this, I think it would be worthwhile to add an artifact field to at least one component, so that we can check that it works properly. So far, I've been testing this with a simple hello world binary.

Maybe we could try adding the debugger, since that's where the release github action currently resides. Is the next branch ready for merging? Did you have something else in mind?
Do let me know if I can help with anything!

Comment on lines +40 to +64
// bin/ directory which holds binaries.
let bin_dir = toolchain_dir.join("bin");
if !bin_dir.exists() {
std::fs::create_dir_all(&bin_dir).with_context(|| {
format!("failed to create toolchain directory: '{}'", bin_dir.display())
})?;
}

// lib/ directory which holds MASP libraries.
let lib_dir = toolchain_dir.join("lib");
if !lib_dir.exists() {
std::fs::create_dir_all(&lib_dir).with_context(|| {
format!("failed to create toolchain directory: '{}'", lib_dir.display())
})?;
}

// opt/ directory which holds symlinks to binaries in bin/.
// These are used in order to preserve a "midenup" compatible
// interface. This relies on the fact that clap uses argv[0] in order to
// display executable names names. These symlinks have the following format:
// `miden <component name>`
// Then, when `miden` is invoked, it uses these symlinks to execute the
// underlying binary. With this setup, `clap` displays the name as: `miden
// <component name>` instead of just `binary_name` when displaying help
// messages.
Copy link
Collaborator Author

@lima-limon-inc lima-limon-inc Nov 6, 2025

Choose a reason for hiding this comment

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

opt/, bin/ and lib/ did not change in this PR. I simply added these lines and comments to elaborate on their functionality.

@lima-limon-inc lima-limon-inc force-pushed the fabrizioorsi/i121-artifact-support branch from 2fb1bef to f24bcb3 Compare November 6, 2025 15:21
@lima-limon-inc lima-limon-inc force-pushed the fabrizioorsi/i121-artifact-support branch from f24bcb3 to 0a4ba74 Compare November 6, 2025 17:33
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 November 6, 2025 20:47
@lima-limon-inc lima-limon-inc force-pushed the fabrizioorsi/i121-artifact-support branch from d184473 to c82f722 Compare November 6, 2025 20:47
{%- else if dep.path %}, path = "{{ dep.path }}"
{%- endif %} }
{%- endfor %}
curl = "{{ curl_version }}"
Copy link
Collaborator Author

@lima-limon-inc lima-limon-inc Nov 6, 2025

Choose a reason for hiding this comment

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

This will use the same version of CURL as the midenup itself. This is obtained in the build.rs file.

"artifacts": [
{
"target": "zkvm-miden-unknown",
"uri": "https://github.com/lima-limon-inc/fabriz.io/releases/download/0.0/std.masp"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These URLS are not intended to be merged and are only here to test this PR. They should be removed before merging.

Base automatically changed from fabrizioorsi/i113-remove-hardcoded-components to main November 10, 2025 12:46
@lima-limon-inc lima-limon-inc force-pushed the fabrizioorsi/i121-artifact-support branch from 30d37dd to d0d2f32 Compare November 13, 2025 17:52
@lima-limon-inc
Copy link
Collaborator Author

Sidenote: I'll give the implementation a rework. I'll replace the triplet to url table with a list of urls instead to simplify things.

@lima-limon-inc lima-limon-inc marked this pull request as draft November 14, 2025 14:50
@lima-limon-inc lima-limon-inc marked this pull request as ready for review November 25, 2025 15:52
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
@bitwalker
Copy link
Collaborator

@lima-limon-inc I finally got the the release workflow for miden-debug sorted with artifact (with attestation) support working, with the v0.4.4 release.

v0.4.4 can be used with the v0.19 toolchain, upcoming releases will work with v0.20+. In the meantime, hopefully that provides all that is needed to validate a real component works with this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

check:install PRs only: runs workflows that perform additional end-to-end integration testing command:midenup An issue or task related to the `midenup` command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add artifact support

3 participants