spec: rule 3 assumes one enum per contract, which shared error types break
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Documentazione
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- javascript
- Ambito
- documentation
Direzione di ricerca
Start by reading SPEC.md rule 3, rule 4, and the reference allocation table. Decide whether shared #[contracterror] enums should be permitted or discouraged, and check prior art from Soroban workspaces as the issue suggests. Update the spec so its rules and allocation table agree; done means it explains the chosen policy and, if relevant, how existing shared enums should migrate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Which rule
SPEC.md rule 3, "Each contract MUST own exactly one block", and by extension the whole framing that an enum corresponds to a contract.
The layout it does not fit
A workspace with a shared error crate:
contracts/
shared/src/error.rs // pub enum CommonError
token/src/error.rs // pub enum TokenError
router/src/error.rs // pub enum RouterError
CommonError is re-exported and returned by three contracts. Under the current spec it needs a block, but it is not a contract, and a caller receiving one of its codes genuinely cannot tell which contract produced it — which rule 4 exists to prevent.
The reference allocation gestures at this with a 900-999 row labelled "shared / library errors", but the rules never actually say how a shared type is meant to work, so the table and the rules disagree.
The real question
Is a shared error enum acceptable at all?
There is a coherent argument that it is not: if the caller cannot identify the origin, the error is less useful, and the fix is per-contract enums that wrap or duplicate the shared variants. There is an equally coherent argument that duplicating "unauthorized" across six contracts is worse, and that the origin belongs in the transaction data rather than the code.
The spec should pick one and say why. Right now it silently assumes the problem does not exist.
Suggested resolution
Either:
- (a) Explicitly permit shared enums, require them to sit in a designated shared block, and add a note that codes in that block do not identify a contract; or
- (b) Recommend against them, with a short migration sketch for workspaces that already have one.
Whichever is chosen, rule 3 needs rewording from "contract" to "#[contracterror] enum", since that is what the tooling actually keys on.
Good first issue because
This is a documentation and reasoning change, not code. Prior art from a real Soroban workspace that has solved it either way would be the most valuable thing anyone could add here.
- Lingua principale
- JavaScript
- Stelle
- 0
- Fork
- 1
- Merge medio
- 14h 38m
- PR unite (30g)
- 9
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi 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 codepacct/codepact-conventions
-
enhancement good first issue wave
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
codepacct/codepact-conventions#55 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement wave
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
codepacct/codepact-conventions#54 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue wave
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
codepacct/codepact-conventions#53 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue tests wave
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
codepacct/codepact-conventions#52 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue tests wave
Difficoltà 1/5 1-3 ore Idoneità per principianti 86/100
codepacct/codepact-conventions#51 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di codepacct/codepact-conventions
Issue simili
-
bug security
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
IbrahimHafez1/loadwise#251 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 87/100
erkamyaman/unslop-anything#421 ·
I maintainer di solito rispondono entro 1 giorno