[BUG]: Blocks on a different parent are classified INVALID and get the sender banned
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
- 領域
- blockchain
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Python
- スター
- 12
- フォーク
- 27
- 平均マージ
- 2分
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
StabilityNexus/MiniChain のほかの issue
-
[BUG]: Handle JSON-RPC notifications and empty batches correctly対応中かも @Muneerali199 が 10 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
StabilityNexus/MiniChain#177 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
automatic-copyright-year: keep README copyright current対応中かも @anshulchikhale30-p が 7 日前に担当しました。 オープンdocumentation enhancement
難易度 3/5 半日 初心者へのやさしさ 35/100
StabilityNexus/MiniChain#189 ·
メンテナーはふだん 1 日以内に返信
-
Difficulty: bound per-block EMA moves, add a difficulty floor, and preserve state across restarts対応中かも @anshulchikhale30-p が 7 日前に担当しました。 オープンbug documentation enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
StabilityNexus/MiniChain#187 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: P2P sync downloads full 500-block chunks without headers-first validation対応中かも @anshulchikhale30-p が 14 日前に担当しました。 オープンbug documentation enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
StabilityNexus/MiniChain#178 ·
メンテナーはふだん 1 日以内に返信
-
[FEATURE]: Add transaction and receipt lookup RPC methods対応中かも @Thushara3005 が 10 日前に担当しました。 オープンenhancement
難易度 4/5 3〜5日 初心者へのやさしさ 58/100
StabilityNexus/MiniChain#176 ·
メンテナーはふだん 1 日以内に返信
StabilityNexus/MiniChain の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
huggingface/datasets#9128 ·
メンテナーはふだん 1 日以内に返信
-
priority:low ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
OpenHands/extensions#975 ·
メンテナーはふだん 1 日以内に返信
-
Function/dict state handlers can't supply provider-state injected values (`generate.provider_state`)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
pact-foundation/pact-python#1789 ·
メンテナーはふだん 9 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
juandresrodca/AdminForge#66 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信