0xMiden / 0xMiden/compiler

Miden-wallet accounts should be callable from the note script written in Rust

Đang mở
#936 7 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
115
Fork
84
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
15

Mô tả

### Why

Miden wallet creates accounts using the standard basic wallet written in MASM. It means that the majority of the wallets on-chain will be standard basic wallets. As of today we have no way of calling its methods from the Rust script note. It means that we cannot write note scripts in Rust targeting the largest wallet base.

### How

We can add Rust bindings in the SDK for the MASM standard basic wallet. However, the MASM procedures need to be `call`ed instead of `exec`ed (current ABI transformation in the frontend).

Ideally we want it to be handled in the code pathway for Wasm components where we translate cross-component function calls using the `call` op. But the current implementation uses the function wrappers on both the exported and imported sides even if no lifting/lowering is needed. This will end up with the wrong procedure digest compiled for the `call` op (the lowering wrapper in the imports).
We could rewrite lifting/lowering to not use the import/export wrapper functions if no lifting/lowering is required.

The other problem is that Wasm cross-component calls involve the WIT interface and `wit-bindgen`-generated bindings. This leads to another layer of wrapper functions in exports and imports that we would need to get rid of so that our `call` op references the "true" procedure's MAST digest.

The experimentation is needed to figure out how much time it'd take to implement it.

Alternatively, although it looks ugly, we could write the Rust bindings the same way we do for the tx kernel but hard-code to use `call` for the MASM standard basic wallet procedure names.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

The issue involves the compiler's frontend ABI transformation and Wasm component handling. Look at the code pathway for Wasm components, specifically how cross-component function calls are translated using the `call` op. Examine the function wrappers for exports/imports and the lifting/lowering logic in the SDK. The goal is to allow Rust note scripts to call MASM standard basic wallet procedures. Start by understanding the current tx kernel binding approach and the WIT interface bindings generated by `wit-bindgen`.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
rust, wasm
Lĩnh vực
backend-api-design, compilers
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.