Releases: 0xPolygonMiden/compiler
Releases · 0xPolygonMiden/compiler
v0.0.5 (Alpha)
This is the alpha release of the Miden compiler toolchain, and all crates are published to crates.io with version 0.0.5
.
NOTE: This release is an alpha, it is not production-ready, and should be used for experimentation, and development on/feedback for the compiler itself.
This release includes the following features:
- A compiler executable and command, i.e.
midenc compile
for compiling programs manually - A Cargo extension for creating new Miden-based Rust projects, and compiling them for Miden (see
cargo-miden
, and thecargo miden build
command) - Support for compiling a WebAssembly (Wasm) module to Miden Assembly. A Wasm module can be obtained for a Rust program by compiling for the
wasm32-wasip1
target (or alternatively, thewasm32-unknown-unknown
target, but due to some ABI incompatibilities in Rust itself, the former target is recommended). For now, it is expected that these programs are compiled with#![no_std]
(however, depending on thealloc
crate is supported). In theory, any language that compiles to WebAssembly could be supported, but we have not tested languages other than Rust ourselves. - Support for source-level debug information propagated through to compiled MAST, which can then be used to render diagnostics about program failures. Currently, this is only really leveraged by the interactive debugger.
- Support for requesting outputs in various forms: IR textual format, Miden Assembly textual format, MAST text and binary formats, and our experimental package format
- An experimental package format with the
.masp
extension. This combines MAST with metadata needed for dependency management, as well as data required to seed the advice provider so that the program can initialize its read-only memory segments on startup. - An experimental SDK for parts of the Miden stdlib, and some low-level transaction kernel APIs. This is in its initial stages of development, but has been used to experiment with defining things like a basic wallet for the Miden rollup.
- An interactive debugger for compiled programs, via
midenc debug
This release also has the following issues/limitations:
- There are known issues with one of the transformation passes used during the lowering to MASM, which crops up when certain control flow patterns occur in the Wasm input. If you get an assertion during compilation that references the
treeify
pass, this is affecting you, and you should report the issue to us so that we can keep track of it while we address the issue. - There is limited support for the Miden standard library and transaction kernel APIs. We have only started defining the bindings for these, so if one is missing that you require, please let us know! We will be expanding on these quickly, but this is a known limitation.
- Support for cross-context Miden procedure calls (i.e. those done with
call
, notexec
) are not yet supported. This is coming in the beta release, but for now you are limited to expressing programs that are all in the same logical context. This is sufficient to express Miden account code, but makes it impossible for the moment to prototype note scripts and their interactions with accounts. - Support for dynamic/indirect calls (e.g.
dynexec
/dyncall
). This is coming soon as well, but did not make it into this release. If you are compiling a Rust program that happens to rely on indirect calls, you will get a compilation error. Please let us know if you run into this, so we can determine how critical this is for the types of programs being written. It is a high priority for us, but so are various other features, so we're going to be addressing the biggest blockers first. - The experimental package format is not understood by the Miden VM directly, but you can use
midenc debug
to do so for you. Otherwise, you will need to expressly request the compiler to emit MAST instead, using--emit=mast
, and then look for it in thetarget/midenc
directory. - The
cargo-miden
extension does not allow you to link against hand-written Miden Assembly yet. To link against Miden Assembly code that you have hand-written, you must compile the program by hand, it must first be in a standard Miden Assembly library directory structure, then you can link against it using the-l
and-L
flags. For example, assuming you have a library namedfoo
, in a subdirectory namedfoo
of the current working directory, you would domidenc compile -l foo -L . target/wasm32-wasip1/release/my_app.wasm
.
Please report all issues via the issue tracker!