[BUG]: Blocks on a different parent are classified INVALID and get the sender banned
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- blockchain
Direzione di ricerca
Start at minichain/chain.py:184, where _apply_block chooses between INVALID and FAILED based on whether "hash" appears in the exception text, and read the previous-hash, index and timestamp checks around it to see how each raises. Reproduce by building two Blockchain() instances from the same genesis, mining block 1 on each, and passing one chain's block to the other to confirm ValidationStatus.INVALID. Note that PR #186 already proposes a one-line change plus a test, so read it before starting rather than duplicating it; done means a parent mismatch returns FAILED and the existing reject/bann path no longer bans an honest peer.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug Description
Blockchain._apply_block picks the rejection status with INVALID if "hash" in str(exc) else FAILED (minichain/chain.py:184). The previous-hash check raises "invalid previous hash ...", which contains "hash", so a block built on a different parent is classified INVALID. With INVALID_THRESHOLD = 1 the sending peer is banned on the first such block, and the ban is persisted.
So two miners that find a block at the same height ban each other, and a node that is 2+ blocks behind bans the peer that gossips the tip (then main.py asks that same peer for a sync).
Proposed fix: only "invalid hash" and "invalid Proof of Work" stay INVALID; a parent mismatch becomes FAILED, like the index and timestamp checks. I have a one-line patch with a test.
Steps to Reproduce
- Create two
Blockchain()instances from the same genesis. - Mine block 1 on each.
chain_b.add_block(block1_from_a)returnsValidationStatus.INVALID.
Same result when a fresh node receives the tip of a peer that is 2 blocks ahead.
Logs and Screenshots
[WARNING] [minichain.chain] Block 1 rejected: invalid previous hash 8325...addc != 0000...b6f1
same-height fork block from honest peer: ValidationStatus.INVALID
honest peer 2 blocks ahead, we receive its tip: ValidationStatus.INVALID
Environment Details
main @ e16ae98, Python 3.13
Impact
High - Major feature is broken
Code of Conduct
- I have joined the Discord server and will post updates there
- I have searched existing issues to avoid duplicates
- Lingua principale
- Python
- Stelle
- 12
- Fork
- 27
- Merge medio
- 2m
- PR unite (30g)
- 1
Preparare l'ambiente
- Include un Dockerfile o un 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 StabilityNexus/MiniChain
-
[BUG]: Handle JSON-RPC notifications and empty batches correctlyForse già presa @Muneerali199 l’ha presa 10 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
StabilityNexus/MiniChain#177 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
automatic-copyright-year: keep README copyright currentForse già presa @anshulchikhale30-p l’ha presa 7 giorni fa. Apertadocumentation enhancement
Difficoltà 3/5 Mezza giornata Idoneità per principianti 35/100
StabilityNexus/MiniChain#189 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficulty: bound per-block EMA moves, add a difficulty floor, and preserve state across restartsForse già presa @anshulchikhale30-p l’ha presa 7 giorni fa. Apertabug documentation enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
StabilityNexus/MiniChain#187 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG]: P2P sync downloads full 500-block chunks without headers-first validationForse già presa @anshulchikhale30-p l’ha presa 14 giorni fa. Apertabug documentation enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
StabilityNexus/MiniChain#178 ·
I maintainer di solito rispondono entro 1 giorno
-
[FEATURE]: Add transaction and receipt lookup RPC methodsForse già presa @Thushara3005 l’ha presa 10 giorni fa. Apertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
StabilityNexus/MiniChain#176 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di StabilityNexus/MiniChain
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
huggingface/datasets#9128 ·
I maintainer di solito rispondono entro 1 giorno
-
priority:low ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
OpenHands/extensions#975 ·
I maintainer di solito rispondono entro 1 giorno
-
Function/dict state handlers can't supply provider-state injected values (`generate.provider_state`)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
pact-foundation/pact-python#1789 ·
I maintainer di solito rispondono entro 9 giorni
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
juandresrodca/AdminForge#66 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno