Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
- [BREAKING] Added cycle counts to notes returned by `NoteConsumptionInfo` and removed public fields from related types ([#2772](https://github.com/0xMiden/miden-base/issues/2772)).
- [BREAKING] Removed unused `payback_attachment` from `SwapNoteStorage` and `attachment` from `MintNoteStorage` ([#2789](https://github.com/0xMiden/protocol/pull/2789)).
- Automatically enable `concurrent` feature in `miden-tx` for `std` context ([#2791](https://github.com/0xMiden/protocol/pull/2791)).
- Added `TransactionScript::from_package()` method to create `TransactionScript` from `miden-mast-package::Package` ([#2779](https://github.com/0xMiden/protocol/pull/2779)).

### Fixes

- Made deserialization of `AccountCode` more robust ([#2788](https://github.com/0xMiden/protocol/pull/2788)).


## 0.14.3 (2026-04-07)

- [BREAKING] Updated for compatibility with miden-vm v0.22.1 (`Arc<Library>` return types, `MastArtifact`/`PackageKind` removal) ([#2742](https://github.com/0xMiden/protocol/pull/2742)).
Expand Down
2 changes: 2 additions & 0 deletions crates/miden-protocol/src/errors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,8 @@ impl PartialBlockchainError {
pub enum TransactionScriptError {
#[error("failed to assemble transaction script:\n{}", PrintDiagnostic::new(.0))]
AssemblyError(Report),
#[error("failed to convert package to transaction script:\n{}", PrintDiagnostic::new(.0))]
PackageNotProgram(Report),
}

// TRANSACTION INPUT ERROR
Expand Down
16 changes: 16 additions & 0 deletions crates/miden-protocol/src/transaction/tx_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ use alloc::vec::Vec;

use miden_core::mast::MastNodeExt;
use miden_crypto::merkle::InnerNodeInfo;
use miden_mast_package::Package;

use super::{Felt, Hasher, Word};
use crate::account::auth::{PublicKeyCommitment, Signature};
use crate::errors::TransactionScriptError;
use crate::note::{NoteId, NoteRecipient};
use crate::utils::serde::{
ByteReader,
Expand Down Expand Up @@ -308,6 +310,20 @@ impl TransactionScript {
Self { mast, entrypoint }
}

/// Creates a [TransactionScript] from a [`Package`].
///
/// The package must be an executable (i.e., its target type must be
/// [`TargetType::Executable`](miden_mast_package::TargetType::Executable)).
///
/// # Errors
/// Returns an error if the package cannot be converted to an executable program.
pub fn from_package(package: &Package) -> Result<Self, TransactionScriptError> {
Comment thread
bobbinth marked this conversation as resolved.
let program =
package.try_into_program().map_err(TransactionScriptError::PackageNotProgram)?;

Ok(TransactionScript::new(program))
}

// PUBLIC ACCESSORS
// --------------------------------------------------------------------------------------------

Expand Down
Loading