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

Validate only the next block to be appended when append a block #210

Merged
merged 14 commits into from Apr 20, 2019

Conversation

Projects
None yet
3 participants
@earlbread
Copy link
Member

commented Apr 18, 2019

  • Added ValidateNextBlock(IReadOnlyList<Block<T>>, Block<T>) to IBlockPolicy.
  • Changed BlockChain<T>.Append() to validate only the next block to be appended.
  • Removed ExpectDifficulties().
  • Changed IndexOutOfRangeException in BlockChain<T> to ArgumentOutOfRangeException.
  • Moved IBlockPolicy<T>.ValidateBlocks() to IBlockPolicyExtension.ValidateBlocks<T>().

@earlbread earlbread requested review from dahlia and longfin Apr 18, 2019

@earlbread earlbread self-assigned this Apr 18, 2019

@earlbread earlbread changed the title Validate block to add Validate only the next block to be appended when append a block Apr 18, 2019

@earlbread earlbread force-pushed the earlbread:validate-block-to-add branch from e04dc97 to cd24020 Apr 18, 2019

@codecov

This comment has been minimized.

Copy link

commented Apr 18, 2019

Codecov Report

Merging #210 into master will decrease coverage by 3.34%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #210      +/-   ##
==========================================
- Coverage   87.47%   84.12%   -3.35%     
==========================================
  Files          73       74       +1     
  Lines        3376     3364      -12     
==========================================
- Hits         2953     2830     -123     
- Misses        423      534     +111
Impacted Files Coverage Δ
Libplanet/Blockchain/Policies/BlockPolicy.cs 100% <100%> (ø) ⬆️
...lanet/Blockchain/Policies/IBlockPolicyExtension.cs 100% <100%> (ø)
Libplanet/Blockchain/BlockChain.cs 99.24% <100%> (+0.38%) ⬆️
Libplanet/Net/IceServer.cs 0% <0%> (-100%) ⬇️
Libplanet/Net/IceServerException.cs 0% <0%> (-100%) ⬇️
Libplanet/Net/NetworkStreamProxy.cs 0% <0%> (-77.78%) ⬇️
Libplanet/Net/Swarm.cs 81.46% <0%> (-6.41%) ⬇️
Show resolved Hide resolved Libplanet/Blockchain/Policies/BlockPolicy.cs Outdated
Show resolved Hide resolved Libplanet/Blockchain/Policies/BlockPolicy.cs Outdated
Show resolved Hide resolved Libplanet/Blockchain/Policies/BlockPolicy.cs Outdated
@longfin

This comment has been minimized.

Copy link
Member

commented Apr 18, 2019

@earlbread it seems to have conflicts. could you rebase it?

Show resolved Hide resolved CHANGES.md Outdated

@earlbread earlbread force-pushed the earlbread:validate-block-to-add branch 2 times, most recently from 590ac1c to 9723ae0 Apr 19, 2019

@earlbread earlbread force-pushed the earlbread:validate-block-to-add branch from 9723ae0 to 249b6ad Apr 19, 2019

Show resolved Hide resolved CHANGES.md Outdated
Show resolved Hide resolved CHANGES.md Outdated
Show resolved Hide resolved CHANGES.md Outdated
Show resolved Hide resolved CHANGES.md Outdated
Show resolved Hide resolved CHANGES.md Outdated
Show resolved Hide resolved Libplanet.Tests/Blockchain/Policies/BlockPolicyTest.cs Outdated
Show resolved Hide resolved Libplanet/Blockchain/BlockChain.cs

@earlbread earlbread force-pushed the earlbread:validate-block-to-add branch from 00f898d to e9932a7 Apr 19, 2019

@earlbread

This comment has been minimized.

Copy link
Member Author

commented Apr 19, 2019

I applied suggestions and added commits. Please take a look. @dahlia @longfin

earlbread added some commits Apr 19, 2019

@earlbread

This comment has been minimized.

Copy link
Member Author

commented Apr 20, 2019

I added a test to make sure the Append function does a block validation. @dahlia @longfin

@dahlia

dahlia approved these changes Apr 20, 2019

@earlbread earlbread merged commit fed5858 into planetarium:master Apr 20, 2019

5 checks passed

Travis CI - Pull Request Build Passed
Details
WIP Ready for review
Details
changelog This contains self-describing changelog.
Details
codecov/patch 100% of diff hit (target 87.47%)
Details
codecov/project Absolute coverage decreased by -3.34% but relative coverage increased by +12.52% compared to 8b4f1fe
Details

@earlbread earlbread deleted the earlbread:validate-block-to-add branch Apr 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.