Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miner is no longer nullable #1341

Merged

Conversation

greymistcube
Copy link
Contributor

Unless we want to support blockchain architecture where blocks without miners are allowed as a feature, there doesn't seem to be a real necessity for having null miner Address for Block<T>. On a side note, having a dummy Address or a special Address reserved for unforeseen future purposes might come in handy for the convenience of development. Just spitballing, but something like /dev/null Address "eating up" Transaction<T>s and/or IActions might be useful. Perhaps we should reserve 0 and/or 1?

@greymistcube greymistcube marked this pull request as ready for review June 10, 2021 09:56
@greymistcube greymistcube added invalid This doesn't seem right suggestion Suggestion or feature request labels Jun 10, 2021
@codecov
Copy link

codecov bot commented Jun 10, 2021

Codecov Report

Merging #1341 (3b22396) into main (b6b38b3) will increase coverage by 0.06%.
The diff coverage is 92.30%.

@@            Coverage Diff             @@
##             main    #1341      +/-   ##
==========================================
+ Coverage   77.08%   77.14%   +0.06%     
==========================================
  Files         256      256              
  Lines       17262    17257       -5     
==========================================
+ Hits        13306    13313       +7     
+ Misses       3390     3378      -12     
  Partials      566      566              
Impacted Files Coverage Δ
Libplanet/Blocks/Block.cs 84.14% <80.00%> (ø)
Libplanet/Action/ActionEvaluator.cs 95.63% <100.00%> (ø)
Libplanet/Blocks/BlockHeader.cs 96.69% <100.00%> (-0.07%) ⬇️
Libplanet/Net/Protocols/KademliaProtocol.cs 67.04% <0.00%> (-0.75%) ⬇️
Libplanet/Net/Swarm.cs 84.14% <0.00%> (+0.36%) ⬆️
Libplanet.RocksDBStore/MonoRocksDBStore.cs 91.03% <0.00%> (+0.40%) ⬆️
Libplanet/Net/Transports/NetMQTransport.cs 81.41% <0.00%> (+1.00%) ⬆️
Libplanet/FixedSizedQueue.cs 100.00% <0.00%> (+18.75%) ⬆️

limebell
limebell previously approved these changes Jun 14, 2021
@limebell
Copy link
Member

What happens if deserializing pre-existing blocks with null miner?

@greymistcube
Copy link
Contributor Author

greymistcube commented Jun 14, 2021

Hmm... Block<T>.Miner holds Address and BlockHeader.Miner holds ImmutableArray<byte>.
If serialized data is missing the miner key/value pair, deserialization would fail on:

Miner = dict.GetValue<Binary>(MinerKey).ToImmutableArray();

If a key/value pair is present, but the value is empty, then again, deserialization would fail on:

new Address(rb.Header.Miner),

I'm assuming creation of malformed Block<T> is handled somewhere else tho. 😶

longfin
longfin previously approved these changes Jun 21, 2021
@greymistcube greymistcube removed the invalid This doesn't seem right label Jun 21, 2021
@greymistcube greymistcube force-pushed the refactor/non-nullable-miner branch 2 times, most recently from 43fe1d5 to 2250357 Compare June 21, 2021 05:02
@greymistcube
Copy link
Contributor Author

/rebase

@libplanet libplanet force-pushed the refactor/non-nullable-miner branch from 2250357 to 6983399 Compare June 29, 2021 05:15
@greymistcube greymistcube force-pushed the refactor/non-nullable-miner branch 4 times, most recently from bd695b7 to 2b68661 Compare July 6, 2021 02:12
@limebell limebell requested review from longfin and limebell July 6, 2021 02:56
@greymistcube greymistcube force-pushed the refactor/non-nullable-miner branch from 2b68661 to 00ddc70 Compare July 7, 2021 00:41
@greymistcube greymistcube requested a review from kfangw July 7, 2021 00:47
kfangw
kfangw previously approved these changes Jul 7, 2021
Copy link
Contributor

@kfangw kfangw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

limebell
limebell previously approved these changes Jul 8, 2021
@greymistcube greymistcube dismissed stale reviews from limebell and kfangw via 526163d July 8, 2021 01:31
@greymistcube greymistcube force-pushed the refactor/non-nullable-miner branch from 526163d to 51f4e43 Compare July 11, 2021 14:10
@greymistcube greymistcube force-pushed the refactor/non-nullable-miner branch from 51f4e43 to 1cb52bf Compare July 19, 2021 00:54
@longfin
Copy link
Member

longfin commented Jul 19, 2021

/rebase

@libplanet libplanet force-pushed the refactor/non-nullable-miner branch from 1cb52bf to 3b22396 Compare July 19, 2021 10:25
@greymistcube greymistcube merged commit 57a8710 into planetarium:main Jul 20, 2021
@greymistcube greymistcube deleted the refactor/non-nullable-miner branch July 22, 2021 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggestion Suggestion or feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants