Miden-wallet accounts should be callable from the note script written in Rust
- Linguagem predominante
- Rust
- Estrelas
- 115
- Forks
- 84
- Merge médio
- 1d 8h
- PRs com merge (30d)
- 15
Descrição
### 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.
Guia de contribuição
Direção de pesquisa
A issue envolve a transformação ABI do frontend do compilador e o tratamento de componentes Wasm. Examine o caminho do código para componentes Wasm, especificamente como as chamadas de função entre componentes são traduzidas usando a operação `call`. Analise os wrappers de função para exportações/importações e a lógica de lifting/lowering no SDK. O objetivo é permitir que scripts de nota em Rust chamem os procedimentos padrão de carteira básica do MASM. Comece entendendo a abordagem atual de vinculação do kernel de transações e as vinculações de interface WIT geradas pelo `wit-bindgen`.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- rust, wasm
- Domínio
- backend-api-design, compilers
- Tipo de issue
- Funcionalidade
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100