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

Provide genesis block API #688

Merged
merged 2 commits into from Dec 4, 2019
Merged

Conversation

@moreal
Copy link
Contributor

moreal commented Nov 20, 2019

In this pull-request, BlockChain became to have genesis-block. Also it doesn't allow to create new chain for another chain, having other genesis-block, during fork, because we can't know before append.

@moreal moreal force-pushed the moreal:provide-genesis-block-api branch from 726a313 to fef1b35 Nov 20, 2019
@moreal moreal requested review from longfin, dahlia, limebell and earlbread Nov 20, 2019
@moreal moreal self-assigned this Nov 20, 2019
@codecov

This comment has been minimized.

Copy link

codecov bot commented Nov 20, 2019

Codecov Report

Merging #688 into master will increase coverage by 1.48%.
The diff coverage is 99.36%.

@@            Coverage Diff             @@
##           master     #688      +/-   ##
==========================================
+ Coverage   86.15%   87.64%   +1.48%     
==========================================
  Files         220      219       -1     
  Lines       18037    17993      -44     
==========================================
+ Hits        15540    15770     +230     
+ Misses       1425     1164     -261     
+ Partials     1072     1059      -13
Impacted Files Coverage Δ
Libplanet/Tx/Transaction.cs 94.48% <100%> (ø) ⬆️
Libplanet/Blocks/Block.cs 90.68% <100%> (ø) ⬆️
Libplanet.Tests/Blockchain/BlockChainTest.cs 98.66% <100%> (+0.03%) ⬆️
Libplanet/Net/Swarm.cs 86.91% <100%> (+5.45%) ⬆️
Libplanet.Tests/Net/SwarmTest.cs 98.88% <100%> (+3.28%) ⬆️
Libplanet/Blockchain/GenesisConfiguration.cs 100% <100%> (ø)
Libplanet/Blockchain/BlockChain.cs 94.06% <97.82%> (+1.04%) ⬆️
Libplanet/Net/Protocols/RoutingTable.cs 77.88% <0%> (-1.12%) ⬇️
Libplanet/Store/BaseStore.cs 81.25% <0%> (ø) ⬆️
Libplanet.Tests/Store/StoreTracker.cs 56.75% <0%> (ø) ⬆️
... and 19 more
@moreal moreal changed the title Provide genesis block API [WIP] Provide genesis block API Nov 21, 2019
@moreal moreal force-pushed the moreal:provide-genesis-block-api branch 6 times, most recently from 98c8c8e to 6936aba Nov 25, 2019
@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Nov 27, 2019

Codecov Report

Merging #688 into master will decrease coverage by 0.23%.
The diff coverage is 96.18%.

@@            Coverage Diff            @@
##           master    #688      +/-   ##
=========================================
- Coverage   86.14%   85.9%   -0.24%     
=========================================
  Files         221     222       +1     
  Lines       18137   18332     +195     
=========================================
+ Hits        15625   15749     +124     
- Misses       1436    1455      +19     
- Partials     1076    1128      +52
Impacted Files Coverage Δ
Libplanet.Tests/Store/StoreTest.cs 98.24% <100%> (+0.02%) ⬆️
Libplanet.Tests/Store/StoreFixture.cs 100% <100%> (ø) ⬆️
...lanet.Tests/Blockchain/Policies/BlockPolicyTest.cs 97.33% <100%> (-0.44%) ⬇️
Libplanet/Tx/Transaction.cs 94.48% <100%> (ø) ⬆️
Libplanet/Store/DefaultStore.cs 85.68% <100%> (+0.49%) ⬆️
Libplanet/Blocks/InvalidGenesisBlockException.cs 71.42% <71.42%> (ø)
Libplanet/Blockchain/BlockChain.cs 90.88% <80.55%> (-2.14%) ⬇️
Libplanet/Net/Swarm.cs 80.37% <90.9%> (-1.26%) ⬇️
Libplanet.Tests/Net/SwarmTest.cs 95.82% <95.37%> (+0.01%) ⬆️
Libplanet.Tests/TestUtils.cs 79.83% <96.66%> (-13.72%) ⬇️
... and 10 more
@moreal moreal force-pushed the moreal:provide-genesis-block-api branch 6 times, most recently from d8159b9 to 6c9ff29 Nov 27, 2019
@moreal moreal changed the title [WIP] Provide genesis block API Provide genesis block API Nov 27, 2019
@moreal moreal force-pushed the moreal:provide-genesis-block-api branch 7 times, most recently from 3ea7b99 to ba45b39 Nov 27, 2019
Libplanet/Net/Swarm.cs Outdated Show resolved Hide resolved
Libplanet/Blockchain/BlockChain.cs Show resolved Hide resolved
Libplanet/Blockchain/BlockChain.cs Outdated Show resolved Hide resolved
Libplanet/Blockchain/BlockChain.cs Outdated Show resolved Hide resolved
@moreal moreal force-pushed the moreal:provide-genesis-block-api branch from ff95823 to 3360b2a Dec 3, 2019
@moreal moreal requested review from longfin and dahlia Dec 3, 2019
@moreal moreal force-pushed the moreal:provide-genesis-block-api branch 4 times, most recently from 9c9e6f7 to d0bd4ba Dec 3, 2019
@moreal moreal dismissed stale reviews from limebell, earlbread, and longfin via 04f402d Dec 4, 2019
@moreal moreal force-pushed the moreal:provide-genesis-block-api branch from d0bd4ba to 04f402d Dec 4, 2019
@longfin longfin requested review from earlbread and limebell Dec 4, 2019
moreal and others added 2 commits Nov 20, 2019
Co-Authored-By: Hong minhee <hong.minhee@gmail.com>
Co-Authored-By: Chanhyuck <lime_bell@naver.com>
@moreal moreal force-pushed the moreal:provide-genesis-block-api branch from 04f402d to dd73bab Dec 4, 2019
@longfin
longfin approved these changes Dec 4, 2019
@dahlia
dahlia approved these changes Dec 4, 2019
@@ -210,6 +249,34 @@ public Block<T> Tip
}
}

/// <summary>
/// Mine the genesis block of the blockchain.

This comment has been minimized.

Copy link
@dahlia

dahlia Dec 4, 2019

Member
Suggested change
/// Mine the genesis block of the blockchain.
/// Mine the genesis block of a blockchain.
/// Mine the genesis block of the blockchain.
/// </summary>
/// <param name="actions">List of actions will be included in the genesis block.
/// If it's null, it will be replaced with <see cref="ImmutableArray{T}.Empty"/>

This comment has been minimized.

Copy link
@dahlia

dahlia Dec 4, 2019

Member
Suggested change
/// If it's null, it will be replaced with <see cref="ImmutableArray{T}.Empty"/>
/// If it's <c>null</c>, it will be filled with <see cref="ImmutableArray{T}.Empty"/>
/// </summary>
/// <param name="actions">List of actions will be included in the genesis block.
/// If it's null, it will be replaced with <see cref="ImmutableArray{T}.Empty"/>
/// as default.</param>

This comment has been minimized.

Copy link
@dahlia

dahlia Dec 4, 2019

Member
Suggested change
/// as default.</param>
/// by default.</param>
/// <param name="actions">List of actions will be included in the genesis block.
/// If it's null, it will be replaced with <see cref="ImmutableArray{T}.Empty"/>
/// as default.</param>
/// <param name="privateKey">A private key to sign the transaction in the genesis block.

This comment has been minimized.

Copy link
@dahlia

dahlia Dec 4, 2019

Member

IMHO it would be better if there is a method which takes transactions instead of actions, and this method becomes a facade on that.

Suggested change
/// <param name="privateKey">A private key to sign the transaction in the genesis block.
/// <param name="privateKey">A private key to sign transactions in the genesis block.
/// as default.</param>
/// <param name="privateKey">A private key to sign the transaction in the genesis block.
/// If it's null, it will use new private key as default.</param>
/// <param name="timestamp">The timestamp of the genesis block. If it's null, it will

This comment has been minimized.

Copy link
@dahlia

dahlia Dec 4, 2019

Member
Suggested change
/// <param name="timestamp">The timestamp of the genesis block. If it's null, it will
/// <param name="timestamp">The timestamp of the genesis block. If it's <c>null</c>, it will
/// <param name="privateKey">A private key to sign the transaction in the genesis block.
/// If it's null, it will use new private key as default.</param>
/// <param name="timestamp">The timestamp of the genesis block. If it's null, it will
/// use <see cref="DateTimeOffset.UtcNow"/> as default.</param>

This comment has been minimized.

Copy link
@dahlia

dahlia Dec 4, 2019

Member
Suggested change
/// use <see cref="DateTimeOffset.UtcNow"/> as default.</param>
/// use <see cref="DateTimeOffset.UtcNow"/> by default.</param>
/// If it's null, it will use new private key as default.</param>
/// <param name="timestamp">The timestamp of the genesis block. If it's null, it will
/// use <see cref="DateTimeOffset.UtcNow"/> as default.</param>
/// <returns>The genesis block mined with parameters.</returns>

This comment has been minimized.

Copy link
@dahlia

dahlia Dec 4, 2019

Member
Suggested change
/// <returns>The genesis block mined with parameters.</returns>
/// <returns>The mined genesis block.</returns>
@moreal moreal merged commit a1be3d0 into planetarium:master Dec 4, 2019
20 checks passed
20 checks passed
benchmarks (macos-latest)
Details
dist
Details
benchmarks (ubuntu-18.04)
Details
benchmarks (windows-latest)
Details
docs
Details
WIP Ready for review
Details
changelog This contains self-describing changelog.
Details
codecov/patch 96.18% of diff hit (target 86.14%)
Details
codecov/project Absolute coverage decreased by -0.23% but relative coverage increased by +10.03% compared to 1de9fb4
Details
license/cla Contributor License Agreement is signed.
Details
planetarium.libplanet Build #20191204.6 had test failures
Details
planetarium.libplanet (Linux_Mono) Linux_Mono succeeded
Details
planetarium.libplanet (Linux_NETCore) Linux_NETCore succeeded
Details
planetarium.libplanet (Windows_Mono) Windows_Mono succeeded
Details
planetarium.libplanet (Windows_NETCore) Windows_NETCore succeeded
Details
planetarium.libplanet (Windows_NETCore_coverage) Windows_NETCore_coverage succeeded
Details
planetarium.libplanet (Windows_NETFramework) Windows_NETFramework succeeded
Details
planetarium.libplanet (macOS_Mono) macOS_Mono succeeded
Details
planetarium.libplanet (macOS_NETCore) macOS_NETCore succeeded
Details
planetarium.libplanet (macOS_Unity) macOS_Unity succeeded
Details
moreal added a commit to moreal/libplanet that referenced this pull request Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.