Tests: no test covers a payment of 0 or the genesis block meeting the difficulty
メンテナーはふだん 2 日以内に返信
関連するプルリクエストがすでにマージされています。
- #24 @tanujb03 による — マージ済み
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 82/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- java
- 領域
- blockchain, testing
調査の方向性
2つのルールは README の "How it's supposed to work" セクションにあり、それらが説明しているコードは Blockchain.java にあります。まず mvn -B test を実行し、blocksAreMinedAndLinked と startsWithGenesisBlock がある BlockchainTest を読んでください。完了の条件は、金額ゼロの支払いが拒否されることを確認するテストと、ジェネシスブロックのハッシュが難易度に応じたゼロで始まることを確認するテストを含む新しいテストファイルが作られ、issue の表にある変異をローカルで適用したときに両方のテストが失敗することです。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Java
- スター
- 0
- フォーク
- 3
- 平均マージ
- 2日 5時間
- マージ済み PR(30日)
- 15
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
techcsispit/mini-chain のほかの issue
-
Blockchain.isValid() does not verify sender balance, allowing blocks with negative balances to pass validation対応中かも @aadiitya2007 が 4 日前に担当しました。 オープンbug good first issue
難易度 4/5 1〜2日 初心者へのやさしさ 20/100
techcsispit/mini-chain#37 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
README says changing Block or Transaction makes chain.dat stop loading, but adding a field or method still loads it対応中かも @tanujb03 が 23 日前に担当しました。 オープンdocumentation good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 25/100
techcsispit/mini-chain#21 ·
メンテナーはふだん 2 日以内に返信
techcsispit/mini-chain の issue をすべて見る
似ている issue
-
BindingServiceProperties.bindings regressed to a non-thread-safe TreeMap in GH-3158: concurrent first use of binding names corrupts it対応中かも @AkashB23 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
spring-cloud/spring-cloud-stream#3321 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] 资源包列表 与 模组/数据包/世界 列表排列顺序不一致対応中かも @fishdry1000 が 4 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
ai-driven-fuzzing bug claude Minor
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
linagora/twake-calendar-side-service#1333 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
AtlasOfLivingAustralia/species-lists#882 ·
メンテナーはふだん 1 日以内に返信
-
Type/Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
ballerina-platform/ballerina-library#9458 ·
メンテナーはふだん 1 日以内に返信