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

feat: difficulty adjustment rfc version #1307

Conversation

@zhangsoledad zhangsoledad requested a review from nervosnetwork/ckb-code-review as a code owner Jul 26, 2019

@nervos-bot
Copy link

left a comment

Hold as requested by @zhangsoledad.

@nervos-bot

This comment has been minimized.

Copy link

commented Jul 26, 2019

@quake is assigned as the chief reviewer

@zhangsoledad zhangsoledad force-pushed the zhangsoledad:zhangsoledad/difficulty_adjustment_rfc branch from 88d0cb5 to 31efc2c Jul 27, 2019

spec/src/consensus.rs Outdated Show resolved Hide resolved
spec/src/consensus.rs Outdated Show resolved Hide resolved
spec/src/consensus.rs Outdated Show resolved Hide resolved

@zhangsoledad zhangsoledad force-pushed the zhangsoledad:zhangsoledad/difficulty_adjustment_rfc branch 4 times, most recently from c98ca85 to 09a5b41 Jul 27, 2019

@zhangsoledad zhangsoledad changed the title [WIP] feat: difficulty adjustment rfc version feat: difficulty adjustment rfc version Jul 27, 2019

@nervos-bot nervos-bot bot dismissed their stale review Jul 27, 2019

Unhold as requested by @zhangsoledad.

@zhangsoledad zhangsoledad force-pushed the zhangsoledad:zhangsoledad/difficulty_adjustment_rfc branch 2 times, most recently from de75906 to a9a8c8d Jul 27, 2019

@quake
quake approved these changes Jul 29, 2019

@zhangsoledad zhangsoledad force-pushed the zhangsoledad:zhangsoledad/difficulty_adjustment_rfc branch from a9a8c8d to f0db194 Jul 29, 2019

spec/src/consensus.rs Outdated Show resolved Hide resolved
@janx
janx approved these changes Jul 30, 2019

@zhangsoledad zhangsoledad force-pushed the zhangsoledad:zhangsoledad/difficulty_adjustment_rfc branch from f0db194 to 1a45729 Jul 30, 2019

@u2
u2 approved these changes Jul 30, 2019
@u2

This comment has been minimized.

Copy link
Collaborator

commented Jul 30, 2019

Looks good for me, except the Determining the Next Epoch’s Difficulty part which I did not understand.

@janx

This comment has been minimized.

Copy link
Member

commented Jul 30, 2019

@u2 please don't approve unless you have no further problem about the code, otherwise code review is meaningless.

@u2 u2 self-requested a review Jul 30, 2019

@doitian
Copy link
Member

left a comment

Flag to review it today.

@zhangsoledad zhangsoledad force-pushed the zhangsoledad:zhangsoledad/difficulty_adjustment_rfc branch from 1a45729 to d139cef Jul 30, 2019

@zhangsoledad zhangsoledad force-pushed the zhangsoledad:zhangsoledad/difficulty_adjustment_rfc branch from d139cef to 177e6a8 Aug 1, 2019

@zhangsoledad zhangsoledad changed the title [HOLD] feat: difficulty adjustment rfc version feat: difficulty adjustment rfc version Aug 1, 2019

@nervos-bot nervos-bot bot dismissed their stale review Aug 1, 2019

Unhold as requested by @zhangsoledad.

@zhangsoledad zhangsoledad requested review from doitian, janx and quake Aug 1, 2019

@zhangsoledad zhangsoledad force-pushed the zhangsoledad:zhangsoledad/difficulty_adjustment_rfc branch from 177e6a8 to 673a735 Aug 2, 2019

type Output = RationalU256;
#[inline]
fn mul(self, rhs: &RationalU256) -> RationalU256 {
RationalU256::new(&self.numer * &rhs.numer, &self.denom * &rhs.denom)

This comment has been minimized.

Copy link
@doitian

doitian Aug 2, 2019

Member

What's the behavior when the U256 multiplication overflows?

This comment has been minimized.

Copy link
@zhangsoledad

zhangsoledad Aug 2, 2019

Author Member

panic whether release or debug

spec/src/consensus.rs Show resolved Hide resolved

@zhangsoledad zhangsoledad force-pushed the zhangsoledad:zhangsoledad/difficulty_adjustment_rfc branch from 673a735 to d9ffd18 Aug 4, 2019

spec/src/consensus.rs Outdated Show resolved Hide resolved
@janx
janx approved these changes Aug 5, 2019

@zhangsoledad zhangsoledad force-pushed the zhangsoledad:zhangsoledad/difficulty_adjustment_rfc branch from d9ffd18 to 085c924 Aug 5, 2019

@zhangsoledad

This comment has been minimized.

Copy link
Member Author

commented Aug 7, 2019

bors r+

bors bot added a commit that referenced this pull request Aug 7, 2019
Merge #1307
1307: feat: difficulty adjustment rfc version r=zhangsoledad a=zhangsoledad

Apply new difficulty adjustment mechanism
https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0020-ckb-consensus-protocol/0020-ckb-consensus-protocol.md#dynamic-difficulty-adjustment-mechanism

Co-authored-by: zhangsoledad <787953403@qq.com>
@bors

This comment has been minimized.

Copy link
Contributor

commented Aug 7, 2019

Build failed

  • continuous-integration/travis-ci/push
@zhangsoledad

This comment has been minimized.

Copy link
Member Author

commented Aug 7, 2019

bors r+

bors bot added a commit that referenced this pull request Aug 7, 2019
Merge #1307
1307: feat: difficulty adjustment rfc version r=zhangsoledad a=zhangsoledad

Apply new difficulty adjustment mechanism
https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0020-ckb-consensus-protocol/0020-ckb-consensus-protocol.md#dynamic-difficulty-adjustment-mechanism

Co-authored-by: zhangsoledad <787953403@qq.com>
@bors

This comment has been minimized.

Copy link
Contributor

commented Aug 7, 2019

Build succeeded

  • continuous-integration/travis-ci/push

@bors bors bot merged commit 085c924 into nervosnetwork:develop Aug 7, 2019

5 checks passed

Dummy CI CI that does nothing
Details
Travis CI - Pull Request Build Passed
Details
bors Build succeeded
Details
nervosnetwork.ckb Build #20190805.15 succeeded
Details
nervosnetwork.ckb (UnitTest) UnitTest succeeded
Details
@backporting

This comment has been minimized.

Copy link

commented Aug 7, 2019

The backport to rc/v0.17 failed:

Commits ["085c92484978e8dabe1c3812dae479de9e29f20c"] could not be cherry-picked on top of rc/v0.17

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub.
git fetch
# Create new working tree.
git worktree add .worktrees/backport rc/v0.17
# Navigate to the new directory.
cd .worktrees/backport
# Cherry-pick all the commits of this pull request and resolve the likely conflicts.
git cherry-pick 085c92484978e8dabe1c3812dae479de9e29f20c
# Create a new branch with these backported commits.
git checkout -b backport-1307-to-rc/v0.17
# Push it to GitHub.
git push --set-upstream origin backport-1307-to-rc/v0.17
# Go back to the original working tree.
cd ../..
# Delete the working tree.
git worktree remove .worktrees/backport

Then, create a pull request where the base branch is rc/v0.17 and the compare/head branch is backport-1307-to-rc/v0.17.

@zhangsoledad zhangsoledad deleted the zhangsoledad:zhangsoledad/difficulty_adjustment_rfc branch Aug 16, 2019

@doitian doitian referenced this pull request Aug 24, 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.