Refuse a node that advertises an unknown protocol_version

Abierto
#200 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
Medio día
Aptitud para principiantes
74/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
rust
Área
cli

Línea de trabajo

Start in resolve_transport in src/cli.rs, at the match arm that logs the unknown protocol_version and falls back to gift wrap. Then read fetch_protocol_version_with to see where a missing tag and an unparseable tag both become None. Done when an unknown version returns a clear error unless --transport was passed, a "1" maps to gift wrap, a "2" maps to NIP-44 direct, and an unparseable tag is treated as unknown rather than v1, with tests for each case.

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

Descripción

Problem

resolve_transport (src/cli.rs) falls back to gift wrap when the node advertises a protocol_version the CLI does not know:

Some(other) => {
    log::warn!("Node advertised unknown protocol_version={other}; defaulting to gift-wrap")
}

Protocols v1 and v2 are incompatible, and a node gives no error for a message in the wrong format. A node that advertises a future "3" would receive gift wraps it never reads, and the command would just time out.

Expected

The client rule is now in the protocol docs (MostroP2P/protocol#70, "Future protocol versions") and the daemon spec (MostroP2P/mostro#1003, §8):

  • Unknown protocol_version → fail with a clear error ("this node speaks protocol vN, which this mostro-cli version does not support"), unless the user passed --transport explicitly.
  • 1 → gift wrap, while the CLI still supports v1.
  • 2 → NIP-44 direct.
  • No tag, or no info event → a daemon older than v0.18.0 speaking v1 (current behavior, correct).

fetch_protocol_version_with currently folds "tag present but unparseable" into None together with "no tag". An unparseable value should count as unknown, not as v1.

Why now

mostrod v0.19.0 removes protocol v1 (MostroP2P/mostro#786) and keeps the versioning mechanism for a future v3. The CLI needs this rule before it drops its v1 code.

Lenguaje dominante
Rust
Estrellas
39
Forks
16
Merge medio
4 h 6 min
PR fusionados (30 d)
3

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de MostroP2P/mostro-cli

Todos los issues de MostroP2P/mostro-cli

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.