From 86f8f708d88cf19979676a1f77f8ca0be9511448 Mon Sep 17 00:00:00 2001 From: Tomas Fabrizio Orsi Date: Thu, 30 Apr 2026 15:19:39 -0300 Subject: [PATCH 1/5] feat: add the ProtocolLib's masp Package as artifact --- .github/workflows/workspace-publish.yml | 40 +++++++++++++++++++++ CHANGELOG.md | 4 +++ Cargo.lock | 1 + Makefile | 4 +++ crates/miden-protocol/src/protocol.rs | 22 ++++++++++++ crates/miden-standards/Cargo.toml | 5 +-- crates/miden-standards/src/standards_lib.rs | 21 +++++++++++ scripts/generate-package.rs | 24 +++++++++++++ 8 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 scripts/generate-package.rs diff --git a/.github/workflows/workspace-publish.yml b/.github/workflows/workspace-publish.yml index 7903e80927..0490c72f4b 100644 --- a/.github/workflows/workspace-publish.yml +++ b/.github/workflows/workspace-publish.yml @@ -34,3 +34,43 @@ jobs: release-branch: ${{ github.event.release.target_commitish }} env: CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} + + # Upload the pre-compiled artifacts (miden-protocol.masp) on the + # GitHub release page. + # Used by midenup to speed up installs. + upload-artifacts: + name: upload pre-built miden-protocol library artifacts + if: ${{ github.repository_owner == '0xMiden' }} + permissions: + contents: write + id-token: write + attestations: write + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + ref: ${{ github.event.release.tag_name }} + persist-credentials: false + - uses: ./.github/actions/cleanup-runner + - name: Install Rust + run: | + rustup update --no-self-update + rustc --version + - name: Build miden-core.masp + run: | + make packages + - name: Prepare artifact + run: | + mv target/packages/miden-protocol.masp miden-protocol.masp + - name: Attest miden-core.masp + uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0 + with: + subject-path: miden-core.masp + - name: Upload miden-core.masp + env: + RELEASE_TAG: ${{ github.event.release.tag_name }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -e + gh release upload ${RELEASE_TAG} miden-protocol.masp diff --git a/CHANGELOG.md b/CHANGELOG.md index 84af7b48dd..7786717315 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ - Added `tx::get_tx_script_root` kernel procedure returning the root of the executed transaction script (empty word if no script was executed) ([#2816](https://github.com/0xMiden/protocol/pull/2816)). - Added `TransactionScript::from_package()` method to create `TransactionScript` from `miden-mast-package::Package` ([#2779](https://github.com/0xMiden/protocol/pull/2779)). - Re-exported `MIN_STACK_DEPTH` from `miden-processor` ([#2856](https://github.com/0xMiden/protocol/pull/2856)). +- Added `into_package()` method for `ProtocolLib` & `StandardsLib` ([#2859](https://github.com/0xMiden/protocol/pull/2859)). ### Fixes @@ -35,6 +36,9 @@ - Fixed `output_note::add_asset` and `output_note::set_attachment` to no longer accept invalid note indices ([#2824](https://github.com/0xMiden/protocol/pull/2824)). - Fixed auth components to use initial storage state for authentication ([#2677](https://github.com/0xMiden/protocol/issues/2677)). +### Enhancements +- Added binary artifact compilation to the CI to aid `midenup`'s installation speed ([#2859](https://github.com/0xMiden/protocol/pull/2859)). + ## 0.14.5 (2026-04-23) - Fixed note script compilation: all note scripts are now compiled as libraries ([#2822](https://github.com/0xMiden/protocol/pull/2822)). diff --git a/Cargo.lock b/Cargo.lock index 86f4fada84..09cc50f741 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1925,6 +1925,7 @@ dependencies = [ "fs-err", "miden-assembly", "miden-core-lib", + "miden-mast-package", "miden-processor", "miden-protocol", "miden-standards", diff --git a/Makefile b/Makefile index f2ecc7ac48..6e170265a6 100644 --- a/Makefile +++ b/Makefile @@ -146,6 +146,10 @@ build-no-std: ## Build without the standard library build-no-std-testing: ## Build without the standard library. Includes the `testing` feature $(BUILD_GENERATED_FILES_IN_SRC) cargo build --no-default-features --target wasm32-unknown-unknown --workspace --exclude bench-transaction --features testing +.PHONY: packages +packages: ## Builds .masp packages and store them in target/packages + cargo +nightly -Zscript scripts/generate-package.rs + # --- test vectors -------------------------------------------------------------------------------- .PHONY: generate-solidity-test-vectors diff --git a/crates/miden-protocol/src/protocol.rs b/crates/miden-protocol/src/protocol.rs index 8ba96c9392..8c13cbf688 100644 --- a/crates/miden-protocol/src/protocol.rs +++ b/crates/miden-protocol/src/protocol.rs @@ -1,5 +1,8 @@ +use alloc::boxed::Box; use alloc::sync::Arc; +use miden_mast_package::{Package, TargetType, Version}; + use crate::assembly::Library; use crate::assembly::mast::MastForest; use crate::utils::serde::Deserializable; @@ -10,6 +13,8 @@ use crate::utils::sync::LazyLock; const PROTOCOL_LIB_BYTES: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/assets/protocol.masl")); +const PROTOCOL_PACKAGE_NAME: &str = "miden-protocol"; + // PROTOCOL LIBRARY // ================================================================================================ @@ -21,6 +26,23 @@ impl ProtocolLib { pub fn mast_forest(&self) -> &Arc { self.0.mast_forest() } + + /// Wraps this library into a [`Package`] named `PROTOCOL_PACKAGE_NAME`, + /// versioned with the `miden-protocol` crate's version. + pub fn into_package(self) -> Box { + // The ProtocolLib's version is the same as the crate's as per the miden-protocol's + // Cargo.toml. + let version = Version::parse(env!("CARGO_PKG_VERSION")) + .expect("CARGO_PKG_VERSION must be valid semver"); + + Package::from_library( + PROTOCOL_PACKAGE_NAME.into(), + version, + TargetType::Library, + Arc::new(self.0), + [], + ) + } } impl AsRef for ProtocolLib { diff --git a/crates/miden-standards/Cargo.toml b/crates/miden-standards/Cargo.toml index 29e75e8cbc..17f0896be7 100644 --- a/crates/miden-standards/Cargo.toml +++ b/crates/miden-standards/Cargo.toml @@ -21,8 +21,9 @@ testing = ["dep:rand", "miden-assembly/testing", "miden-protocol/testing"] [dependencies] # Miden dependencies -miden-processor = { workspace = true } -miden-protocol = { workspace = true } +miden-mast-package = { workspace = true } +miden-processor = { workspace = true } +miden-protocol = { workspace = true } # External dependencies bon = { workspace = true } diff --git a/crates/miden-standards/src/standards_lib.rs b/crates/miden-standards/src/standards_lib.rs index effda29a16..92f80e8f78 100644 --- a/crates/miden-standards/src/standards_lib.rs +++ b/crates/miden-standards/src/standards_lib.rs @@ -1,5 +1,7 @@ +use alloc::boxed::Box; use alloc::sync::Arc; +use miden_mast_package::{Package, TargetType, Version}; use miden_protocol::assembly::Library; use miden_protocol::assembly::mast::MastForest; use miden_protocol::utils::serde::Deserializable; @@ -11,6 +13,8 @@ use miden_protocol::utils::sync::LazyLock; const STANDARDS_LIB_BYTES: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/assets/standards.masl")); +const STANDARDS_LIB_NAME: &str = "miden-standards"; + // MIDEN STANDARDS LIBRARY // ================================================================================================ @@ -22,6 +26,23 @@ impl StandardsLib { pub fn mast_forest(&self) -> &Arc { self.0.mast_forest() } + + /// Wraps this library into a [`Package`] named `PROTOCOL_PACKAGE_NAME`, + /// versioned with the `miden-protocol` crate's version. + pub fn into_package(self) -> Box { + // The ProtocolLib's version is the same as the crate's as per the miden-standards's + // Cargo.toml. + let version = Version::parse(env!("CARGO_PKG_VERSION")) + .expect("CARGO_PKG_VERSION must be valid semver"); + + Package::from_library( + STANDARDS_LIB_NAME.into(), + version, + TargetType::Library, + Arc::new(self.0), + [], + ) + } } impl AsRef for StandardsLib { diff --git a/scripts/generate-package.rs b/scripts/generate-package.rs new file mode 100644 index 0000000000..7cf8e6b281 --- /dev/null +++ b/scripts/generate-package.rs @@ -0,0 +1,24 @@ +#!/usr/bin/env cargo + +--- +[dependencies] +miden-protocol = { path = "../crates/miden-protocol" } +semver = "1" +--- + +use std::env; + +use miden_protocol::ProtocolLib; + +fn main() -> std::io::Result<()> { + // Must be run from the workspace root (CARGO_TARGET_DIR is not set for cargo scripts). + let workspace_root = env::current_dir().expect("could not read PWD"); + let packages_dir = workspace_root.join("target").join("packages"); + std::fs::create_dir_all(&packages_dir)?; + + let package = ProtocolLib::default().into_package(); + package.write_masp_file(&packages_dir)?; + + println!("wrote {}.masp to {}", package.name, packages_dir.display()); + Ok(()) +} From 1163cebc386abc75227c071d0cbeb1cce771d30d Mon Sep 17 00:00:00 2001 From: Tomas Fabrizio Orsi Date: Tue, 5 May 2026 12:36:16 -0300 Subject: [PATCH 2/5] review: remove miden- prefix from package artifacts --- .github/workflows/workspace-publish.yml | 4 ++-- crates/miden-protocol/src/protocol.rs | 2 +- crates/miden-standards/src/standards_lib.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/workspace-publish.yml b/.github/workflows/workspace-publish.yml index 0490c72f4b..bc04bc07b6 100644 --- a/.github/workflows/workspace-publish.yml +++ b/.github/workflows/workspace-publish.yml @@ -62,7 +62,7 @@ jobs: make packages - name: Prepare artifact run: | - mv target/packages/miden-protocol.masp miden-protocol.masp + mv target/packages/protocol.masp protocol.masp - name: Attest miden-core.masp uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0 with: @@ -73,4 +73,4 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | set -e - gh release upload ${RELEASE_TAG} miden-protocol.masp + gh release upload ${RELEASE_TAG} protocol.masp diff --git a/crates/miden-protocol/src/protocol.rs b/crates/miden-protocol/src/protocol.rs index 8c13cbf688..fa912d570d 100644 --- a/crates/miden-protocol/src/protocol.rs +++ b/crates/miden-protocol/src/protocol.rs @@ -13,7 +13,7 @@ use crate::utils::sync::LazyLock; const PROTOCOL_LIB_BYTES: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/assets/protocol.masl")); -const PROTOCOL_PACKAGE_NAME: &str = "miden-protocol"; +const PROTOCOL_PACKAGE_NAME: &str = "protocol"; // PROTOCOL LIBRARY // ================================================================================================ diff --git a/crates/miden-standards/src/standards_lib.rs b/crates/miden-standards/src/standards_lib.rs index 92f80e8f78..11cc46ea75 100644 --- a/crates/miden-standards/src/standards_lib.rs +++ b/crates/miden-standards/src/standards_lib.rs @@ -13,7 +13,7 @@ use miden_protocol::utils::sync::LazyLock; const STANDARDS_LIB_BYTES: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/assets/standards.masl")); -const STANDARDS_LIB_NAME: &str = "miden-standards"; +const STANDARDS_LIB_NAME: &str = "standards"; // MIDEN STANDARDS LIBRARY // ================================================================================================ From 3f0e2149964ab32c4bd79f74e1c5e369b9fff62d Mon Sep 17 00:00:00 2001 From: Tomas Fabrizio Orsi Date: Tue, 5 May 2026 12:41:20 -0300 Subject: [PATCH 3/5] review: rename STANDARDS_LIB_NAME -> STANDARDS_PACKAGE_NAME --- crates/miden-standards/src/standards_lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/miden-standards/src/standards_lib.rs b/crates/miden-standards/src/standards_lib.rs index 11cc46ea75..7253082258 100644 --- a/crates/miden-standards/src/standards_lib.rs +++ b/crates/miden-standards/src/standards_lib.rs @@ -13,7 +13,7 @@ use miden_protocol::utils::sync::LazyLock; const STANDARDS_LIB_BYTES: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/assets/standards.masl")); -const STANDARDS_LIB_NAME: &str = "standards"; +const STANDARDS_PACKAGE_NAME: &str = "standards"; // MIDEN STANDARDS LIBRARY // ================================================================================================ @@ -27,7 +27,7 @@ impl StandardsLib { self.0.mast_forest() } - /// Wraps this library into a [`Package`] named `PROTOCOL_PACKAGE_NAME`, + /// Wraps this library into a [`Package`] named `STANDARDS_PACKAGE_NAME`, /// versioned with the `miden-protocol` crate's version. pub fn into_package(self) -> Box { // The ProtocolLib's version is the same as the crate's as per the miden-standards's @@ -36,7 +36,7 @@ impl StandardsLib { .expect("CARGO_PKG_VERSION must be valid semver"); Package::from_library( - STANDARDS_LIB_NAME.into(), + STANDARDS_PACKAGE_NAME.into(), version, TargetType::Library, Arc::new(self.0), From c06648a6b569f57e1f0cbd42e7b706eab20afe95 Mon Sep 17 00:00:00 2001 From: Tomas Fabrizio Orsi Date: Tue, 5 May 2026 12:53:10 -0300 Subject: [PATCH 4/5] feat: add StandardsLib library to generate_package.rs --- scripts/generate-package.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/generate-package.rs b/scripts/generate-package.rs index 7cf8e6b281..48cb8d74ef 100644 --- a/scripts/generate-package.rs +++ b/scripts/generate-package.rs @@ -3,12 +3,14 @@ --- [dependencies] miden-protocol = { path = "../crates/miden-protocol" } +miden-standards = { path = "../crates/miden-standards" } semver = "1" --- use std::env; use miden_protocol::ProtocolLib; +use miden_standards::StandardsLib; fn main() -> std::io::Result<()> { // Must be run from the workspace root (CARGO_TARGET_DIR is not set for cargo scripts). @@ -16,9 +18,13 @@ fn main() -> std::io::Result<()> { let packages_dir = workspace_root.join("target").join("packages"); std::fs::create_dir_all(&packages_dir)?; - let package = ProtocolLib::default().into_package(); - package.write_masp_file(&packages_dir)?; + let protocol_pkg = ProtocolLib::default().into_package(); + protocol_pkg.write_masp_file(&packages_dir)?; + println!("wrote {}.masp to {}", protocol_pkg.name, packages_dir.display()); + + let standards_pkg = StandardsLib::default().into_package(); + standards_pkg.write_masp_file(&packages_dir)?; + println!("wrote {}.masp to {}", standards_pkg.name, packages_dir.display()); - println!("wrote {}.masp to {}", package.name, packages_dir.display()); Ok(()) } From 0498c292ed547b28004f1edc66aea94f1e8f4cc7 Mon Sep 17 00:00:00 2001 From: Tomas Fabrizio Orsi Date: Tue, 5 May 2026 12:59:10 -0300 Subject: [PATCH 5/5] feat: add multiple files to the workspace_publish.yml --- .github/workflows/workspace-publish.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/workspace-publish.yml b/.github/workflows/workspace-publish.yml index bc04bc07b6..20550f8629 100644 --- a/.github/workflows/workspace-publish.yml +++ b/.github/workflows/workspace-publish.yml @@ -57,20 +57,23 @@ jobs: run: | rustup update --no-self-update rustc --version - - name: Build miden-core.masp + - name: Build packages run: | make packages - - name: Prepare artifact + - name: Prepare artifacts run: | - mv target/packages/protocol.masp protocol.masp - - name: Attest miden-core.masp + mv target/packages/miden-protocol.masp miden-protocol.masp + mv target/packages/standards.masp standards.masp + - name: Attest packages uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0 with: - subject-path: miden-core.masp - - name: Upload miden-core.masp + subject-path: | + protocol.masp + standards.masp + - name: Upload packages env: RELEASE_TAG: ${{ github.event.release.tag_name }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | set -e - gh release upload ${RELEASE_TAG} protocol.masp + gh release upload ${RELEASE_TAG} protocol.masp standards.masp