Skip to content

Commit

Permalink
feature: load LinkLibrary from a Miden package
Browse files Browse the repository at this point in the history
  • Loading branch information
greenhat committed Oct 30, 2024
1 parent 2d72836 commit 6cd29e1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ derive_more = "0.99"
indexmap = "2.2"
# miden-assembly = { version = "0.10.3" }
# miden-core = { version = "0.10.3" }
miden-assembly = { version = "0.10.5", git = "https://github.com/0xPolygonMiden/miden-vm", rev = "e84368bb5b0629e367e615973fa7dd4823a872b7" }
miden-core = { version = "0.10.5", git = "https://github.com/0xPolygonMiden/miden-vm", rev = "e84368bb5b0629e367e615973fa7dd4823a872b7" }
miden-assembly = { version = "0.10.5", git = "https://github.com/0xPolygonMiden/miden-vm", rev = "3fb46fae44adfb525dc8665a65b07611ed100806" }
miden-core = { version = "0.10.5", git = "https://github.com/0xPolygonMiden/miden-vm", rev = "3fb46fae44adfb525dc8665a65b07611ed100806" }
miden-parsing = "0.1"
# miden-processor = { version = "0.10.3" }
# miden-stdlib = { version = "0.10.3", features = ["with-debug-info"] }
miden-processor = { version = "0.10.5", git = "https://github.com/0xPolygonMiden/miden-vm", rev = "e84368bb5b0629e367e615973fa7dd4823a872b7" }
miden-stdlib = { version = "0.10.5", git = "https://github.com/0xPolygonMiden/miden-vm", rev = "e84368bb5b0629e367e615973fa7dd4823a872b7", features = ["with-debug-info"] }
miden-package = { version = "0.10.5", git = "https://github.com/0xPolygonMiden/miden-vm", rev = "e84368bb5b0629e367e615973fa7dd4823a872b7" }
miden-processor = { version = "0.10.5", git = "https://github.com/0xPolygonMiden/miden-vm", rev = "3fb46fae44adfb525dc8665a65b07611ed100806" }
miden-stdlib = { version = "0.10.5", git = "https://github.com/0xPolygonMiden/miden-vm", rev = "3fb46fae44adfb525dc8665a65b07611ed100806", features = ["with-debug-info"] }
miden-package = { version = "0.10.5", git = "https://github.com/0xPolygonMiden/miden-vm", rev = "3fb46fae44adfb525dc8665a65b07611ed100806" }
#miden-assembly = { git = "https://github.com/0xPolygonMiden/miden-vm", rev = "828557c28ca1d159bfe42195e7ea73256ce4aa06" }
#miden-core = { git = "https://github.com/0xPolygonMiden/miden-vm", rev = "828557c28ca1d159bfe42195e7ea73256ce4aa06" }
#miden-processor = { git = "https://github.com/0xPolygonMiden/miden-vm", rev = "828557c28ca1d159bfe42195e7ea73256ce4aa06" }
Expand Down
12 changes: 10 additions & 2 deletions midenc-session/src/libs.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use alloc::{borrow::Cow, boxed::Box, format, str::FromStr, string::ToString};
use core::fmt;
use core::{fmt, panic};
use std::{
ffi::OsStr,
path::{Path, PathBuf},
Expand Down Expand Up @@ -133,7 +133,15 @@ impl LinkLibrary {
))
}),
LibraryKind::Masp => {
todo!("Should be implemented as part of the https://github.com/0xPolygonMiden/compiler/issues/346")
let bytes = std::fs::read(path).into_diagnostic()?;
let package = miden_package::Package::read_from_bytes(bytes)?;
let lib = match package.mast {
miden_package::MastArtifact::Executable(_) => {
panic!("expected library for Miden package, not program")
}
miden_package::MastArtifact::Library(lib) => lib.clone(),
};
Ok((*lib).clone())
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/src/rust_masm_tests/rust_sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ fn rust_sdk_p2id_note_script() {
"../rust-apps-wasm/rust-sdk/p2id-note",
config,
[
// "--link-library".into(),
// masl_path.into_os_string().into_string().unwrap().into(),
"--link-library".into(),
masp_path.into_os_string().into_string().unwrap().into(),
],
);
let artifact_name = test.artifact_name().to_string();
Expand Down

0 comments on commit 6cd29e1

Please sign in to comment.