0xMiden / 0xMiden/web-sdk

NoteAssets new and push panic instead of returning errors for invalid asset lists

Abierto Apto para principiantes
#289 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
1
Forks
21
Merge medio
12 h 14 min
PR fusionados (30 d)
41

Descripción

`NoteAssets` validates asset lists through `miden_client::note::NoteAssets`, but the wasm wrapper currently unwraps those fallible operations.

File evidence:

- `crates/web-client/src/models/note_assets.rs` calls `NativeNoteAssets::new(native_assets).unwrap()` in `NoteAssets::new`.
- The same file rebuilds the asset list in `push()` and unwraps `NativeNoteAssets::new(assets)` again.

This means normal validation failures such as duplicate assets or too many assets are exposed to JavaScript as a wasm panic rather than a catchable `JsErr`. Other fallible bindings in the same crate, such as asset constructors, return `Result<_, JsErr>` instead.

Expected behavior: invalid `NoteAssets` inputs should return a JavaScript error without panicking the wasm module.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

The issue is in `crates/web-client/src/models/note_assets.rs`. Look at the `NoteAssets::new` and `push` methods where `unwrap()` is called on `NativeNoteAssets::new`. Compare with other asset constructors in the same crate that return `Result<_, JsErr>`. The goal is to change these calls to return a `Result` instead of panicking, so invalid inputs produce a catchable JavaScript error. Test by building the wasm and verifying error handling from JavaScript.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
rust, typescript, wasm
Área
devtools, web-dev
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Tranquilo
Claridad
Bien especificado
Aptitud para principiantes
70/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.