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

Adjust difficulty gradually #213

Merged
merged 12 commits into from Apr 25, 2019

Conversation

Projects
None yet
3 participants
@earlbread
Copy link
Member

commented Apr 20, 2019

  • Changed the difficulty calculation algorithm to gradually adjust the difficulty.
  • Removed HashDigest.HasLeadingZeroBits() method and added HashDigest.LessThanTarget() mtehod.
  • Changed difficulty type to long from int.
  • Changed BlockPolicy interface to receive the minimum difficulty and difficulty bound divisor.

@earlbread earlbread self-assigned this Apr 20, 2019

@earlbread earlbread force-pushed the earlbread:difficulty-adjustment branch 4 times, most recently from 74b1e71 to 8250168 Apr 23, 2019

@earlbread earlbread marked this pull request as ready for review Apr 23, 2019

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

@earlbread earlbread changed the title [WIP] Adjust difficulty gradually Adjust difficulty gradually Apr 23, 2019

@codecov

This comment has been minimized.

Copy link

commented Apr 23, 2019

Codecov Report

Merging #213 into master will increase coverage by 0.29%.
The diff coverage is 92.85%.

@@            Coverage Diff             @@
##           master     #213      +/-   ##
==========================================
+ Coverage   83.52%   83.82%   +0.29%     
==========================================
  Files          74       74              
  Lines        3394     3407      +13     
==========================================
+ Hits         2835     2856      +21     
+ Misses        559      551       -8
Impacted Files Coverage Δ
Libplanet/Blockchain/BlockChain.cs 97.73% <100%> (ø) ⬆️
Libplanet/Blocks/RawBlock.cs 100% <100%> (ø) ⬆️
Libplanet/Blocks/Block.cs 97.95% <100%> (ø) ⬆️
Libplanet/Hashcash.cs 100% <100%> (ø) ⬆️
Libplanet/HashDigest.cs 100% <100%> (+2.56%) ⬆️
Libplanet/Blockchain/Policies/BlockPolicy.cs 93.75% <89.28%> (-6.25%) ⬇️
Libplanet/Net/Swarm.cs 80.58% <0%> (+1.11%) ⬆️
Show resolved Hide resolved CHANGES.md Outdated
Show resolved Hide resolved Libplanet/Blockchain/Policies/BlockPolicy.cs
Show resolved Hide resolved Libplanet/HashDigest.cs Outdated
Show resolved Hide resolved Libplanet/HashDigest.cs Outdated
Show resolved Hide resolved Libplanet/HashDigest.cs Outdated

@earlbread earlbread force-pushed the earlbread:difficulty-adjustment branch from 8250168 to 01dcf64 Apr 25, 2019

@earlbread earlbread requested a review from longfin Apr 25, 2019

@longfin

This comment has been minimized.

Copy link
Member

commented Apr 25, 2019

It seems to need rebase. @earlbread

@earlbread earlbread force-pushed the earlbread:difficulty-adjustment branch from 01dcf64 to a6d05c7 Apr 25, 2019

@earlbread

This comment has been minimized.

Copy link
Member Author

commented Apr 25, 2019

I rebased this on the master branch. @longfin

Show resolved Hide resolved Libplanet/HashDigest.cs Outdated
Show resolved Hide resolved CHANGES.md Outdated
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
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
Show resolved Hide resolved Libplanet/Hashcash.cs

@earlbread earlbread force-pushed the earlbread:difficulty-adjustment branch from a6d05c7 to a8c4b44 Apr 25, 2019

@earlbread

This comment has been minimized.

Copy link
Member Author

commented Apr 25, 2019

I applied review comments and rebased on the master branch. Please take a look.

Show resolved Hide resolved CHANGES.md Outdated
Show resolved Hide resolved CHANGES.md Outdated

@earlbread earlbread force-pushed the earlbread:difficulty-adjustment branch from a8c4b44 to 7ee3b57 Apr 25, 2019

@earlbread

This comment has been minimized.

Copy link
Member Author

commented Apr 25, 2019

I applied what you mentioned. @dahlia

Show resolved Hide resolved CHANGES.md Outdated

@earlbread earlbread force-pushed the earlbread:difficulty-adjustment branch from 7ee3b57 to ae5ebfb Apr 25, 2019

@dahlia

dahlia approved these changes Apr 25, 2019

@earlbread earlbread merged commit 78748ef into planetarium:master Apr 25, 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 92.85% of diff hit (target 83.52%)
Details
codecov/project 83.82% (+0.29%) compared to 7f4a3fd
Details

@earlbread earlbread deleted the earlbread:difficulty-adjustment branch Apr 25, 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.