Call faucet `mint_and_send` from a tx script
- Linguagem predominante
- Rust
- Estrelas
- 115
- Forks
- 84
- Merge médio
- 1d 8h
- PRs com merge (30d)
- 15
Descrição
In the context of https://github.com/0xMiden/faucet/pull/204, I need to compile a tx script that executes the `mint_and_send` procedure of the `BasicFungibleFaucet` component. The Rust code follows this structure:
```rust
use crate::bindings::Account;
#[tx_script]
fn run(arg: Word, account: Account) {
...
account.mint_and_send(amount, tag, note_type, recipient);
}
```
The problem is that this requires the bindings of the component defined in miden-standards. Since the procedure is written in MASM, there's no Rust source to get the WIT from. Is it possible to manually reconstruct that WIT bindings? Is this approach correct, or should I do it differently?
Alternatives I already tried:
1. Avoid going through an account procedure, and instead call the `faucet::mint` kernel syscall directly from the script. This fails with `account procedure with procedure root … is not in the account procedure index map`. I think this is because the kernel restricts `faucet::mint` to invocations whose caller is an account procedure.
2. Using a thin wrapper account component that internally calls `faucet::mint`. This avoids the error above and works, but it would require that the node implemented this account component so that the faucet on the genesis is built with it.
Guia de contribuição
Direção de pesquisa
A issue envolve chamar um procedimento MASM a partir de um script de transação Rust, exigindo vinculações WIT para o componente `BasicFungibleFaucet`. Comece examinando o módulo `crate::bindings::Account` e a assinatura do procedimento `mint_and_send`. Consulte o repositório miden-standards para entender a interface do componente. Determine se a reconstrução manual do WIT é possível ou se uma abordagem diferente, como modificar as restrições de syscall do kernel, é necessária. Verifique o PR do faucet #204 vinculado para obter contexto.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- rust
- Domínio
- compilers
- Tipo de issue
- Funcionalidade
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 45/100