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

Hardfork2 #3136

Merged
merged 4 commits into from Nov 27, 2019
Merged

Hardfork2 #3136

merged 4 commits into from Nov 27, 2019

Conversation

@tromp
Copy link
Contributor

tromp commented Nov 25, 2019


name: HardFork2
about: This hard-fork allows blocks with YEAR_HEIGHT/FLOONET_SECOND_HARD_FORK <= height < YEAR_HEIGHT*3/2 with header version 3 and Cuckaroom29 as secondary PoW.
title: HardFork2
labels: consensus breaking
assignees: @antiochp @yeastplume @quentinlesceller


Currently, consensus::valid_header_version(height, version) returns false for all height >= YEAR_HEIGHT.
This PR changes that to return true for version 3 at either FLOONET_SECOND_HARD_FORK <= height < YEAR_HEIGHT*3/2 on floonet or YEAR_HEIGHT <= height < YEAR_HEIGHT*3/2 on mainnet.

This PR also changes global::create_pow_context to return new_cuckaroom_ctx(edge_bits, proof_size) when consensus::valid_header_version(height, version) holds for version 3, which means that Cuckaroom29 [1] is the only valid secondary PoW after the hard fork.

Successfully tested on a mainnet fast sync.

[1] https://www.grin-forum.org/t/next-pow-cuckaroom-unveiled-at-grincon1

@antiochp antiochp added this to the 3.0.0 milestone Nov 25, 2019
@tromp tromp changed the title [WIP] Hardfork2 Hardfork2 Nov 26, 2019
Copy link
Member

quentinlesceller left a comment

Looks good to me.

@@ -130,6 +130,9 @@ pub const HARD_FORK_INTERVAL: u64 = YEAR_HEIGHT / 2;
/// Floonet first hard fork height, set to happen around 2019-06-20
pub const FLOONET_FIRST_HARD_FORK: u64 = 185_040;

/// Floonet second hard fork height, set to happen around 2019-12-19
pub const FLOONET_SECOND_HARD_FORK: u64 = 298_080;

/// Check whether the block version is valid at a given height, implements
/// 6 months interval scheduled hard forks for the first 2 years.
pub fn valid_header_version(height: u64, version: HeaderVersion) -> bool {

This comment has been minimized.

Copy link
@antiochp

antiochp Nov 26, 2019

Member

Not directly related to this PR but it would be awesome if we had a function that took a block height and returned the valid header version (if there was one, maybe Option<HeaderVersion> to maintain the "hard cutoff" like we have now). We could then refactor valid_header_version() to use this internally. We would also be able to leverage it for block height specific logic elsewhere.

This comment has been minimized.

Copy link
@tromp

tromp Nov 26, 2019

Author Contributor

Yes; I've also been thinking about adding that, just to simplify the logic in valid_header_version.
The latter does have the advantage in making certain heights invalid regardless of version, which is a nice way to stop obsolete clients in their track.

This comment has been minimized.

Copy link
@tromp

tromp Nov 27, 2019

Author Contributor

see latest commit...

Copy link
Member

antiochp left a comment

I can't speak to the actual cuckaroo* changes but the hard fork cutoff and the logic around valid header versions looks good to me.

@antiochp

This comment has been minimized.

Copy link
Member

antiochp commented Nov 27, 2019

@tromp Is this good to go now?

@yeastplume Want to take a look before we merge this?

Copy link
Member

yeastplume left a comment

LGTM

@tromp

This comment has been minimized.

Copy link
Contributor Author

tromp commented Nov 27, 2019

should be good to go...

@antiochp antiochp merged commit 82b1ff9 into mimblewimble:master Nov 27, 2019
10 checks passed
10 checks passed
mimblewimble.grin #20191127.2 succeeded
Details
mimblewimble.grin (linux api/util/store) linux api/util/store succeeded
Details
mimblewimble.grin (linux chain/core/keychain) linux chain/core/keychain succeeded
Details
mimblewimble.grin (linux pool/p2p/src) linux pool/p2p/src succeeded
Details
mimblewimble.grin (linux release) linux release succeeded
Details
mimblewimble.grin (linux servers) linux servers succeeded
Details
mimblewimble.grin (macos release) macos release succeeded
Details
mimblewimble.grin (macos test) macos test succeeded
Details
mimblewimble.grin (windows release) windows release succeeded
Details
mimblewimble.grin (windows test) windows test succeeded
Details
@antiochp antiochp mentioned this pull request Dec 11, 2019
garyyu added a commit to garyyu/grin that referenced this pull request Jan 14, 2020
* add 2nd HF and cuckaroom

* add cuckaroom and hardfork tests

* remove all traces of later phaseouts

* refactor header_version from valid_header_version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.