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

descriptors.ts selectors ignore their `env` arg — silent wrong-descriptor risk if a second env is wired

Aperta Adatta ai principianti
#469 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
typescript
Ambito
cli

Direzione di ricerca

Inizia in src/utils/descriptors.ts leggendo i tre selettori e i relativi import dei descrittori paseo, quindi segui la env passata da src/utils/connection.ts. Assicurati che gli ambienti imprevisti falliscano in modo esplicito, mentre l’ambiente paseo cablato rimanga valido, ed esegui tsc insieme al controllo di divergenza di config.test.ts per verificare la modifica.

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

Descrizione

task

Summary

Since #465, the three descriptor selectors in src/utils/descriptors.ts
(getAssetHubDescriptor / getBulletinDescriptor / getIndividualityDescriptor)
ignore their env parameter and unconditionally return the paseo-* descriptor.
This is safe today, but it is a latent footgun: the correctness of the selectors
depends on an implicit invariant enforced in a different file.

Background

@parity/[email protected] dropped the summit-* descriptor
subpaths (and summit was retired), so the selectors no longer branch per env —
they return the fixed paseo constants and discard the env arg:

export function getAssetHubDescriptor(_env: Env | undefined): AssetHubDescriptor {
    return paseo_asset_hub;
}
export function getBulletinDescriptor(_env: Env | undefined): BulletinDescriptor { … }
export function getIndividualityDescriptor(_env: Env | undefined): IndividualityDescriptor { … }

The risk

getConnection() (src/utils/connection.ts) builds the direct PAPI clients from
getAssetHubDescriptor(getChainConfig().env) (and the bulletin/individuality
equivalents). Because the env arg is discarded, "always return paseo" is only
correct while paseo-next-v2 is the sole env wired in CONFIGS.

If someone later wires a second env into CONFIGS (e.g. polkadot, which is
already present in ENV_IDS) without also editing descriptors.ts, direct
reads would decode that chain's state with the paseo descriptor — silently
wrong metadata, with no error raised. The only thing preventing this today is
getChainConfig() throwing for any env not in CONFIGS — an implicit safety net
one file away from the code that relies on it.

Proposed fix

Make the selectors fail loud instead of silently returning paseo for an
unexpected env: assert the requested env resolves to a paseo-family descriptor
(or that it is the wired default) and throw otherwise. ~3 lines; converts the
latent footgun into an immediate, obvious error the moment a second env is wired.
Restore real per-env selection here if/when another env ships dedicated
descriptors upstream.

Context

Surfaced by the #465 code review (altitude / latent-correctness finding).
Not a live bug — only paseo-next-v2 is wired today, and tsc + the
config.test.ts divergence guard both hold. Filed as hardening / tech-debt.

Lingua principale
TypeScript
Stelle
5
Fork
12
Merge medio
7g 6h
PR unite (30g)
3

Preparare l'ambiente

Non abbiamo ancora controllato i file di configurazione di questo progetto. 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 paritytech/playground-cli

Tutte le issue di paritytech/playground-cli

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.