Tests: no test covers a payment of 0 or the genesis block meeting the difficulty
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- java
- Ambito
- blockchain, testing
Direzione di ricerca
Le due regole si trovano nella sezione "How it's supposed to work" del README, e il codice che descrivono è in Blockchain.java. Inizia eseguendo mvn -B test e leggi BlockchainTest, dove si trovano blocksAreMinedAndLinked e startsWithGenesisBlock. Il lavoro è completo quando esiste un nuovo file di test con un test che verifica che un pagamento di importo zero venga rifiutato e un test che verifica che l'hash del blocco genesis inizi con gli zeri della difficoltà, e quando entrambi falliscono applicando localmente le mutazioni della tabella nell'issue.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Two sentences in the README's "How it's supposed to work" section have no test that would fail if the code stopped following them.
Missing coverage
-
The amount has to be more than 0.
BlockchainTest.cannotMakeNegativePaymentonly tries-10. The boundary value0is never tried. The menu does reject it today ("Payment amount must be greater than zero."), but nothing would notice if it stopped. -
Every block's hash starts with as many zeros as the difficulty.
blocksAreMinedAndLinkedchecks the zeros in a loop that starts ati = 1, andstartsWithGenesisBlockonly checksgetPreviousHash(). The genesis block (block 0) is never checked.
Evidence
Checked on main @ 0e92205, JDK 17.0.12, Maven 3.9.16, by changing the code locally and running mvn -B test:
Local change to Blockchain.java |
Result |
|---|---|
tx.amount() <= 0 changed to tx.amount() < 0 (a 0 payment is accepted) |
all 18 tests still pass |
genesis.mine(difficulty); removed from the constructor (genesis is not mined) |
all 18 tests still pass |
Planned change
Add one new test file with one test for each rule. Tests only, no production code changes.
I'd like to work on this.
- Lingua principale
- Java
- Stelle
- 0
- Fork
- 3
- Merge medio
- 16h 38m
- PR unite (30g)
- 7
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna 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 techcsispit/mini-chain
-
Enhancement: Modernize Cryptographic & Data Architecture (Merkle Trees, Ed25519, Deterministic Hashing & Address Derivation)Forse già presa @sohanjadyal l’ha presa oggi. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
techcsispit/mini-chain#27 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
README says changing Block or Transaction makes chain.dat stop loading, but adding a field or method still loads itForse già presa @tanujb03 l’ha presa 3 giorni fa. Apertadocumentation good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 25/100
techcsispit/mini-chain#21 ·
I maintainer di solito rispondono entro 1 giorno
-
BlockchainTest: signature tampering tests pass on the hash check; Block.mine() is a no-op so signature verification is not testedForse già presa @tanujb03 l’ha presa 3 giorni fa. Apertagood first issue tests
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
techcsispit/mini-chain#19 ·
I maintainer di solito rispondono entro 1 giorno
-
Blockchain: a payment that was already mined can be submitted again, and it is accepted and mined a second timeForse già presa @tanujb03 l’ha presa 3 giorni fa. Apertabug good first issue
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
techcsispit/mini-chain#16 ·
I maintainer di solito rispondono entro 1 giorno
-
A signed payment can be altered (payee and amount) and still pass signature verificationForse già presa @tanujb03 l’ha presa 3 giorni fa. Apertaadvanced bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
techcsispit/mini-chain#15 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di techcsispit/mini-chain
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
objectionary/lints#1556 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
wildfly/wildfly-launcher#99 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
apache/rocketmq#11427 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno