Unused error variant
- Lenguaje dominante
- Rust
- Estrellas
- 104
- Forks
- 138
- Merge medio
- 1 d 13 h
- PR fusionados (30 d)
- 56
Descripción
`GetNoteScriptByRoot` currently reports a missing script by returning `Ok(MaybeNoteScript { script: None })` ([link](https://github.com/0xMiden/node/blob/143cf7fe8511b55f28b32038b72dbf903f975663/crates/store/src/server/rpc_api.rs#L358-L376)). However, `GetNoteScriptByRootError::ScriptNotFound` is still declared with error code `2`:
https://github.com/0xMiden/node/blob/143cf7fe8511b55f28b32038b72dbf903f975663/crates/store/src/errors.rs#L460
As far as I can tell, that variant is never constructed anywhere in the codebase. This is a bit inconsistent with other lookup endpoints in the same crate. For example, `get_account` reports missing accounts via a typed `GetAccountError::AccountNotFound` error; though here it might make sense since not finding a script is not necessarily an error state.
We hit this in the client because we were parsing the error but instead we always got a response. That broke a flow that probes the registry before deciding whether to register a script.
Not sure there's much to do, but we probably want one of the following:
- keep the current `Ok(None)` / `MaybeNoteScript` behavior, and remove the unused `ScriptNotFound` variant;
- return `ScriptNotFound` when the script is missing, matching endpoints like `get_account` and removing the `Option<>` out of the response type
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.