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

Implement block header #757

Merged
merged 7 commits into from
Jan 15, 2020
Merged

Conversation

limebell
Copy link
Member

@limebell limebell commented Jan 13, 2020

Previously RawBlock can be in two different states which are:

  • Contains all transactions that block has.
  • Contains only transaction id of that block has.

To be clear, separated BlockDigest which contains only transaction ids from RawBlock. Additionally added a structure named BlockHeader which summarizes block information except transactions.
To sum it up, there are now 4 block related objects:

  • Block : A class represents block. This contains all block parameters and transactions.
  • RawBlock : A serialization used in network transportation. This contains serialized transactions BlockHeader.
  • BlockDigest : A serialization used in storage. This contains transaction ids and BlockHeader.
  • BlockHeader : A serialization describes block information. This does not neither transactions nor transaction ids.

Caution: This patch is based on #751
This closes #749.

@codecov
Copy link

codecov bot commented Jan 13, 2020

Codecov Report

Merging #757 into master will decrease coverage by 0.04%.
The diff coverage is 92.75%.

@@            Coverage Diff             @@
##           master     #757      +/-   ##
==========================================
- Coverage    86.4%   86.36%   -0.05%     
==========================================
  Files         222      223       +1     
  Lines       19218    19179      -39     
==========================================
- Hits        16605    16563      -42     
+ Misses       1419     1410       -9     
- Partials     1194     1206      +12
Impacted Files Coverage Δ
Libplanet/Net/Swarm.cs 85.86% <100%> (ø) ⬆️
Libplanet/Store/DefaultStore.cs 82.83% <100%> (ø) ⬆️
Libplanet/Blocks/RawBlock.cs 100% <100%> (+6.12%) ⬆️
Libplanet/Tx/Transaction.cs 91.73% <100%> (ø) ⬆️
Libplanet/Store/BaseStore.cs 80.64% <100%> (ø) ⬆️
Libplanet.Tests/Blocks/BlockTest.cs 98.26% <100%> (+0.06%) ⬆️
Libplanet/Blocks/BlockDigest.cs 68.96% <68.96%> (ø)
Libplanet/Blocks/Block.cs 83.83% <69.84%> (+0.68%) ⬆️
Libplanet/Tx/RawTransaction.cs 79.74% <81.81%> (-2.15%) ⬇️
Libplanet/Blocks/BlockHeader.cs 89.47% <89.47%> (ø)
... and 5 more

@limebell limebell force-pushed the feature/block-header branch from 7ceff9d to 7718c04 Compare January 14, 2020 02:12
@limebell limebell marked this pull request as ready for review January 14, 2020 02:12
@limebell limebell force-pushed the feature/block-header branch from 7718c04 to aa41eb6 Compare January 14, 2020 03:02
@limebell limebell requested a review from longfin January 14, 2020 03:03
longfin
longfin previously approved these changes Jan 14, 2020
earlbread
earlbread previously approved these changes Jan 14, 2020
@limebell limebell dismissed stale reviews from earlbread and longfin via 79f75af January 14, 2020 07:14
earlbread
earlbread previously approved these changes Jan 14, 2020
@limebell
Copy link
Member Author

I made BlockHeader and BlockDigest structs readonly.

@limebell limebell requested a review from earlbread January 14, 2020 09:19
earlbread
earlbread previously approved these changes Jan 14, 2020
@limebell limebell requested a review from earlbread January 14, 2020 09:54
earlbread
earlbread previously approved these changes Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Seperate header from block
5 participants