Decide and test what entering a second time does
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 55/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- blockchain
Direzione di ricerca
Start in enter in src/lib.rs, which writes DataKey::Member(subject) and publishes Entered without checking for an existing member, then read src/test.rs to see what is covered. Choose one repeat-entry behaviour, either keeping it or making it a no-op, and decide whether the stored ledger sequence is exposed through a getter or removed. Done means tests for the double entry and the first Entered event (topics, subject, policy_version) pass under cargo test --locked, the README states the behaviour in one sentence, and the WASM size from stellar contract build --locked is reported.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Written against commit a23a8df; later commits may have moved things, so check the code first.
Size: Trivial
Description
Nothing says what happens when an address that is already a member enters again, and no test checks it. Today the second entry
is accepted, overwrites the stored record, and publishes a second Entered event. The value it overwrites is never read.
Current state
enter in src/lib.rs always runs persistent().set(&DataKey::Member(subject), &env.ledger().sequence()), extends the
lifetimes, and publishes Entered { subject, policy_version }. It never looks to see whether the address is already a member.
is_member only calls has, and no function returns the stored ledger sequence, so the value written is dead data.
src/test.rs has no test that enters twice, and none that looks at the events (env.events()), so the event's topics and
policy_version field are unchecked too.
What to build
Pick one behaviour for a repeat entry and make it explicit:
- keep it (a repeat entry succeeds, refreshes the record and emits another event) and say so in the README and a doc comment, or
- make it a no-op for an existing member, with no second event.
Either way, decide what the stored value is for: expose it (for example a member_since getter) or store something that does not
pretend to carry information. Then test the behaviour, and test the event once: its topics (gate, entered), the subject and
the policy_version taken from the decision.
Acceptance criteria
- A test for entering twice that asserts the chosen behaviour, including how many events were published.
- A test that the first entry publishes
Enteredwith the right topics, subject and policy version. - The stored value is either readable through the contract's interface or removed.
- The README says what a repeat entry does, in one sentence.
- The gate's WASM stays small; say what size it is now.
Out of scope
Revoking membership. Counting entries.
Verification
cargo test --locked, and stellar contract build --locked for the size.
- Lingua principale
- Rust
- Stelle
- 2
- Fork
- 2
- Merge medio
- 2h 30m
- PR unite (30g)
- 2
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un 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 Sorogate/example-consumer
-
documentation good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
Sorogate/example-consumer#17 ·
-
documentation good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Sorogate/example-consumer#15 ·
-
enhancement good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Sorogate/example-consumer#14 ·
-
Cache the Rust build in CIApertaenhancement good first issue help wanted
Difficoltà 2/5 Mezza giornata Idoneità per principianti 80/100
Sorogate/example-consumer#12 ·
-
enhancement good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Sorogate/example-consumer#11 ·
Tutte le issue di Sorogate/example-consumer
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
libnativeapi/nativeapi#21 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
longbridge/nsh#804 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno