UPLC: handle JS boolean in the Bool constant encoder
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- typescript
- Ambito
- compilers
Direzione di ricerca
Inizia in packages/evolution/src/UPLC.ts, nell’encoder di Bool intorno a L954, poi leggi le definizioni di ConstantValue e constantTerm intorno a L194 e L1282 e il decoder intorno a L660. Aggiungi la copertura di regressione descritta nell’issue e verifica che false e true producano byte flat diversi, con false che viene decodificato nell’indice 0.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
The flat encoder for a Bool constant reads value.index, but ConstantValue also permits a plain JS boolean. A JS false has no .index, so (false).index === 0n is false and the encoder emits the True bit. con bool false and con bool true then produce identical flat bytes, so a script built from a false boolean computes that constant as true. Narrow in practice (parameter application uses con data, never con bool), but the public type invites the call that triggers it.
Affected
packages/evolution/src/UPLC.ts Bool encoder (L954)
packages/evolution/src/UPLC.ts ConstantValue type (L194), constantTerm (L1282)
decoder representation: UPLC.ts (L660)
Fix
Handle the primitive form the type advertises in the encoder, e.g.
const bit = typeof value === "boolean" ? (value ? 1 : 0) : (value.index === 0n ? 0 : 1)
Or drop boolean from ConstantValue so { index } is the only representation and the footgun cannot typecheck.
Regression test
- given: a program whose body is constantTerm("Bool", false)
- before fix: flat(con bool false) === flat(con bool true), and decoding flat(con bool false) yields index 1 (True)
- after fix: flat(con bool false) !== flat(con bool true), and decoding flat(con bool false) yields index 0 (False)
Must FAIL on main today and PASS after the fix.
Reference
Report 11
- Lingua principale
- TypeScript
- Stelle
- 22
- Fork
- 30
- Merge medio
- 13h
- PR unite (30g)
- 14
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di IntersectMBO/evolution-sdk
-
dependencies good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 93/100
IntersectMBO/evolution-sdk#541 ·
-
bug external-review
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
IntersectMBO/evolution-sdk#530 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
IntersectMBO/evolution-sdk#518 ·
-
enhancement external-review
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
IntersectMBO/evolution-sdk#456 · 1 commento ·
-
bug external-review
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
IntersectMBO/evolution-sdk#396 ·
Tutte le issue di IntersectMBO/evolution-sdk
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
[Bug]: Matrix progress drafts fail with "Matrix runtime not initialized" during tool activity Apertabug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
calcite-components needs triage refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Esri/calcite-design-system#15203 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
danielmiessler/LifeOS#2218 ·