README says changing Block or Transaction makes chain.dat stop loading, but adding a field or method still loads it
メンテナーはふだん 2 日以内に返信
評価
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 初心者へのやさしさ
- 25/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- java
調査の方向性
The sentence to change is in the README's "Saving" section, which says changing Block or Transaction stops chain.dat from loading. Compare it with the version-comment in Block.java and Transaction.java and with the fallback in Storage.load, which together show that only incompatible serialization changes stop loading. Done means the README says added fields or methods still load and gives one example that does stop loading. A linked pull request (#22) already exists, so check it before starting.
索引モデルが issue の本文から書いたものです。
説明
What I did
- Fresh checkout of
main(0e92205), JDK 17, Maven 3.9. mvn compile exec:java, then in the menu:2(mine a block, nameasha),1(asha pays ravi 10),8(quit). This writeschain.dat.- Followed the README sentence literally and changed
Block: addedprivate String note = "added";underprivate String hash;inBlock.java. Thenmvn compile exec:javaagain. - Repeated from a fresh
chain.datwith other changes:- added a method
public String memo() { return "changed"; }toTransaction - changed
private static final long serialVersionUID = 2L;to3LinBlock - changed the same line to
3LinTransaction - changed
private int noncetoprivate long nonceinBlock
- added a method
What I expected
The README, "Saving" section, says:
It is tied to the
BlockandTransactionclasses. Change either one and the file stops loading, and the program starts a new chain instead.
So after any change to Block or Transaction, the program should start a new chain.
What happened instead
| Change | What the program printed |
|---|---|
add a field to Block |
Loaded chain.dat. (old chain, queued payment and balances intact) |
add a method to Transaction |
Loaded chain.dat. |
serialVersionUID 2L to 3L in Block |
Couldn't read chain.dat (InvalidClassException), so a new chain was started. |
serialVersionUID 2L to 3L in Transaction |
Loaded chain.dat. |
nonce int to long in Block |
Couldn't read chain.dat (InvalidClassException), so a new chain was started. |
So the file stops loading only for changes Java serialization treats as incompatible. This looks intended: Block.java and Transaction.java carry the comment // bump version only for incompatible changes, adding a field is safe, and Storage.load falls back to a new chain when it can't read the file. The README sentence is the part that is too broad.
I'd like to fix the README wording only (no code change), so that it says adding a field or method still loads, and gives an example of a change that does make the file stop loading.
Environment
main @ 0e92205, JDK 17.0.12, Maven 3.9.16, Windows 11.
- 主要言語
- Java
- スター
- 0
- フォーク
- 3
- 平均マージ
- 1日 22時間
- マージ済み PR(30日)
- 10
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
techcsispit/mini-chain のほかの issue
-
Enhancement: Deterministic transaction hashing across all record fields対応中かも @sohanjadyal が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
techcsispit/mini-chain#29 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
Enhancement: Migrate to native Ed25519 signatures and public-key address derivation対応中かも @sohanjadyal が今日担当しました。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
techcsispit/mini-chain#31 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Blockchain: a payment that was already mined can be submitted again, and it is accepted and mined a second time対応中かも @tanujb03 が 7 日前に担当しました。 オープンbug good first issue
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
techcsispit/mini-chain#16 ·
メンテナーはふだん 2 日以内に返信
-
A signed payment can be altered (payee and amount) and still pass signature verification対応中かも @tanujb03 が 7 日前に担当しました。 オープンadvanced bug
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
techcsispit/mini-chain#15 ·
メンテナーはふだん 2 日以内に返信
techcsispit/mini-chain の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
apache/rocketmq-dashboard#6896 ·
メンテナーはふだん 3 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
OpenIntegrationEngine/engine#496 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
SasanLabs/VulnerableApp#836 ·
メンテナーはふだん 1 日以内に返信
-
enhancement frontend
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
Albertinesilva/backend-engineering-journey-java-springboot#46 ·