isValid() does not verify mining reward amount or enforce a single reward transaction per block
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- java
- 領域
- blockchain
調査の方向性
Transaction 内の Blockchain.isValid() と Transaction.NETWORK を読みます。issue には不足しているチェックが示され、README には 50 coin の報酬が定義されています。ブロックがトランザクションをどのように公開するかを追い、その後、各ブロックにネットワークトランザクションが最大 1 つだけ含まれ、その金額が MINING_REWARD と等しくなるように検証を更新します。金額が変更された場合と報酬が重複した場合に isValid() が false を返し、有効にマイニングされたブロックは引き続き検証を通過すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
In mini-chain, mining rewards are issued with Transaction.NETWORK ("network") as the sender.
Under Transaction.hasValidSignature():
public boolean hasValidSignature() {
if (NETWORK.equals(from)) return true;
...
Transactions from "network" bypass digital signature checks by design because there is no private key for the network.
However, in Blockchain.isValid(), there is no validation verifying the mining reward amount or the count of reward transactions:
- A block's mining reward can be altered from
MINING_REWARD(50) to an arbitrary amount (e.g.1,000,000coins). - A block can contain multiple
"network"reward transactions.
When a block's reward transaction is tampered with, the Merkle root recalculated, and the block re-mined to meet the difficulty target (as demonstrated in Menu Option 7), isValid() still returns true because:
- The recalculated Merkle root matches
block.getMerkleRoot(). - The re-mined block hash meets the difficulty target.
tx.hasValidSignature()returnstruefor"network"without validating that the amount equalsMINING_REWARD.
Expected Behavior
According to the README:
- "Mining: A mined block holds all waiting payments plus a 50 coin reward for the miner."
- "Validation:
isValid()returns false if anything in any mined block was changed..."
isValid() should verify that in each mined block:
- There is at most one transaction from
Transaction.NETWORK. - Any transaction from
Transaction.NETWORKhastx.amount() == MINING_REWARD.
If either invariant is violated, isValid() should return false.
- 主要言語
- Java
- スター
- 0
- フォーク
- 3
- 平均マージ
- 1日 22時間
- マージ済み PR(30日)
- 12
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
techcsispit/mini-chain のほかの issue
-
README says changing Block or Transaction makes chain.dat stop loading, but adding a field or method still loads it対応中かも @tanujb03 が 11 日前に担当しました。 オープンdocumentation good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 25/100
techcsispit/mini-chain#21 ·
メンテナーはふだん 2 日以内に返信
-
Blockchain: a payment that was already mined can be submitted again, and it is accepted and mined a second time対応中かも @aadiitya2007 が 1 日前に担当しました。 オープンbug good first issue
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
techcsispit/mini-chain#16 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
A signed payment can be altered (payee and amount) and still pass signature verification対応中かも @aadiitya2007 が 1 日前に担当しました。 オープンadvanced bug
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
techcsispit/mini-chain#15 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
techcsispit/mini-chain の issue をすべて見る
似ている issue
-
ChaosEngine: backup-remote doctor row passes while consumer mode hides bot memory from git対応中かも @MohabMohie が今日担当しました。 オープンagentic
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ShaftHQ/SHAFT_ENGINE#7263 ·
メンテナーはふだん 1 日以内に返信
-
bug/错误
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
FCL-Team/FoldCraftLauncher#1951 ·
メンテナーはふだん 4 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
quarkusio/quarkus-agent-mcp#296 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
commons-app/apps-android-commons#7072 ·
メンテナーはふだん 1 日以内に返信
-
Type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
hypherionmc/sdlink#240 ·