Releases: 0xMiden/compiler
Releases · 0xMiden/compiler
v0.1.5
New
struct
type support in function arguments and results in the account API (total size limited to 16 felts);
Fixes
- Delayed registration of
scf
dialect causes canonicalizations to be skipped (affectedis_prime
example); - Load account's data segments and global variables on cross-context calls;
- Various memory intrinsics fixes for small integer types;
v0.1.0
New
- Declare local Miden dependencies via
path
(either a cargo-miden project or a Miden package); - Bundle Miden SDK WIT files with relevant SDK crates and deploy them on
cargo miden new
; - Add a new project template in the
cargo-miden
for note script and enable an account project template(default); - High-level account storage API (see
examples/storage-example
); - Add
examples/counter-contract
example;
Fixes
- Incorrect folding of continuation region blocks #522
v0.0.8
This release of the compiler contains a large number of internal improvements as well as new capabilities:
- The compiler supports compilation of arbitrary pure-Rust programs, the only limitation being that libstd is not supported, i.e. your crate must be marked
#![no_std]
. However, you are allowed to use the liballoc crate for access to types that require heap allocation, e.g.Vec
,Box
, etc. See any of the example projects for reference. - The
cargo-miden
Cargo extension is available, and currently oriented towards pure-Rust projects. You can usecargo miden new
to create a new crate ready for compilation to Miden, andcargo miden build
to compile a Miden package. See the docs for more information on the use ofcargo-miden
. - The internal IR of the compiler was rewritten from the ground up to provide a more sound foundation for analysis and rewriting. This new IR uses an MLIR-like architecture/design, and supports virtually all of the same capabilities. As part of this refactoring, a number of outstanding compilation bugs were addressed. Please notify us/open an issue if you encounter any compilation bugs with pure-Rust programs!
- Initial support for defining Miden accounts and note scripts in Rust has been implemented, but is not yet complete in this release. It is possible to start experimenting with account compilation with this release, but we would recommend waiting for v0.0.9 when the tooling is in a more finished state. There are example projects that do demonstrate how the new SDK is used however, so feel free to take a look and provide any feedback you may have!
With this release, we expect to switch to a more regular monthly release cadence.
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!