Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Refuse a node that advertises an unknown protocol_version

Aperta
#200 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
74/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
cli

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Rust
Stelle
39
Fork
16
Merge medio
11h 7m
PR unite (30g)
7

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MostroP2P/mostro-cli

Tutte le issue di MostroP2P/mostro-cli

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.