0xPolygonMiden / compiler

Compiler from MidenIR to Miden Assembly

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test suite for Miden stdlib ABI transformation

greenhat opened this issue · comments

Goal

The goal is to test both the ABI transformation strategies implemented in the frontend and the Rust bindings written for every Miden stdlib function in the miden-prelude crate (see mem for example).

Implementation details

Since the Miden stdlib doesn't have dependencies, we can link it and call the Miden stdlib functions using their Rust bindings providing the inputs and assessing the outputs in the property-based tests running the compiled code in the Miden VM.
Alternatively, we can generate the Miden stdlib function stubs in the IR (like for tx_kernel API in Miden SDK in #160 ) that will assert certain facts about the inputs and return mocked data and then run the compiled code in the Miden VM. This approach has a drawback that it would not be able to use property-based testing, since the inputs and outputs are hard-coded in the stubs.

Temporarily, instead of relying on digests, use MASM module names for stdlib function imports so they would end up with correct module names in use statements in the compiled MASM.